- Changed window size to mobile phone format (400x800) - Removed width condition for ActiveProxyFooter - now always visible - Added run-umbrix.sh launch script with icon copying - Stats cards now display on all screen sizes
62 lines
2.0 KiB
Dart
62 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:umbrix/core/router/router.dart';
|
|
import 'package:umbrix/features/common/adaptive_root_scaffold.dart';
|
|
import 'package:umbrix/utils/utils.dart';
|
|
|
|
bool showDrawerButton(BuildContext context) {
|
|
if (!useMobileRouter) return true;
|
|
final String location = GoRouterState.of(context).uri.path;
|
|
if (location == const HomeRoute().location || location == const ProfilesOverviewRoute().location) return true;
|
|
if (location.startsWith(const ProxiesRoute().location)) return true;
|
|
if (location.startsWith(const PerAppProxyRoute().location)) return true;
|
|
return false;
|
|
}
|
|
|
|
class NestedAppBar extends StatelessWidget {
|
|
const NestedAppBar({
|
|
super.key,
|
|
this.title,
|
|
this.actions,
|
|
this.pinned = true,
|
|
this.forceElevated = false,
|
|
this.bottom,
|
|
});
|
|
|
|
final Widget? title;
|
|
final List<Widget>? actions;
|
|
final bool pinned;
|
|
final bool forceElevated;
|
|
final PreferredSizeWidget? bottom;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final hasDrawer = RootScaffold.stateKey.currentState?.hasDrawer ?? false;
|
|
final shouldShowDrawer = showDrawerButton(context);
|
|
|
|
return SliverAppBar(
|
|
leading: hasDrawer && shouldShowDrawer
|
|
? IconButton(
|
|
icon: const Icon(Icons.menu),
|
|
onPressed: () {
|
|
RootScaffold.stateKey.currentState?.openDrawer();
|
|
},
|
|
)
|
|
: (Navigator.of(context).canPop()
|
|
? IconButton(
|
|
icon: Icon(context.isRtl ? Icons.arrow_forward : Icons.arrow_back),
|
|
padding: EdgeInsets.only(right: context.isRtl ? 50 : 0),
|
|
onPressed: () {
|
|
Navigator.of(context).pop(); // Pops the current route off the navigator stack
|
|
},
|
|
)
|
|
: null),
|
|
title: title,
|
|
actions: actions,
|
|
pinned: pinned,
|
|
forceElevated: forceElevated,
|
|
bottom: bottom,
|
|
);
|
|
}
|
|
}
|