Tint appbar and system navigation bar
This commit is contained in:
@@ -2,6 +2,8 @@ import 'package:animations/animations.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
|
import 'package:my_linkding/widgets/system_overlay_style.dart';
|
||||||
|
|
||||||
class Layout extends StatelessWidget {
|
class Layout extends StatelessWidget {
|
||||||
final StatefulNavigationShell navigationShell;
|
final StatefulNavigationShell navigationShell;
|
||||||
|
|
||||||
@@ -19,33 +21,35 @@ class Layout extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return OverlayStyle(
|
||||||
body: PageTransitionSwitcher(
|
child: Scaffold(
|
||||||
duration: const Duration(milliseconds: 200),
|
body: PageTransitionSwitcher(
|
||||||
transitionBuilder: (child, primaryAnimation, secondaryAnimation) => FadeThroughTransition(
|
duration: const Duration(milliseconds: 200),
|
||||||
animation: primaryAnimation,
|
transitionBuilder: (child, primaryAnimation, secondaryAnimation) => FadeThroughTransition(
|
||||||
secondaryAnimation: secondaryAnimation,
|
animation: primaryAnimation,
|
||||||
child: child,
|
secondaryAnimation: secondaryAnimation,
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: navigationShell,
|
||||||
|
),
|
||||||
|
bottomNavigationBar: NavigationBar(
|
||||||
|
onDestinationSelected: (s) => goBranch(s),
|
||||||
|
selectedIndex: navigationShell.currentIndex,
|
||||||
|
destinations: const [
|
||||||
|
NavigationDestination(
|
||||||
|
icon: Icon(Icons.link_rounded),
|
||||||
|
label: "Links",
|
||||||
|
),
|
||||||
|
NavigationDestination(
|
||||||
|
icon: Icon(Icons.search_rounded),
|
||||||
|
label: "Search",
|
||||||
|
),
|
||||||
|
NavigationDestination(
|
||||||
|
icon: Icon(Icons.settings_rounded),
|
||||||
|
label: "Settings",
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: navigationShell,
|
|
||||||
),
|
|
||||||
bottomNavigationBar: NavigationBar(
|
|
||||||
onDestinationSelected: (s) => goBranch(s),
|
|
||||||
selectedIndex: navigationShell.currentIndex,
|
|
||||||
destinations: const [
|
|
||||||
NavigationDestination(
|
|
||||||
icon: Icon(Icons.link_rounded),
|
|
||||||
label: "Links",
|
|
||||||
),
|
|
||||||
NavigationDestination(
|
|
||||||
icon: Icon(Icons.search_rounded),
|
|
||||||
label: "Search",
|
|
||||||
),
|
|
||||||
NavigationDestination(
|
|
||||||
icon: Icon(Icons.settings_rounded),
|
|
||||||
label: "Settings",
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
34
lib/widgets/system_overlay_style.dart
Normal file
34
lib/widgets/system_overlay_style.dart
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
class OverlayStyle extends StatelessWidget {
|
||||||
|
final Widget child;
|
||||||
|
|
||||||
|
const OverlayStyle({
|
||||||
|
super.key,
|
||||||
|
required this.child,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final systemGestureInsets = MediaQuery.of(context).systemGestureInsets;
|
||||||
|
|
||||||
|
return AnnotatedRegion<SystemUiOverlayStyle>(
|
||||||
|
value: SystemUiOverlayStyle(
|
||||||
|
statusBarColor: Colors.transparent,
|
||||||
|
statusBarBrightness: Theme.of(context).brightness == Brightness.light ? Brightness.light : Brightness.dark,
|
||||||
|
statusBarIconBrightness: Theme.of(context).brightness == Brightness.light ? Brightness.dark : Brightness.light,
|
||||||
|
systemNavigationBarColor: systemGestureInsets.left > 0 // If true gestures navigation
|
||||||
|
? Colors.transparent
|
||||||
|
: ElevationOverlay.applySurfaceTint(
|
||||||
|
Theme.of(context).colorScheme.surface,
|
||||||
|
Theme.of(context).colorScheme.surfaceTint,
|
||||||
|
3,
|
||||||
|
),
|
||||||
|
systemNavigationBarIconBrightness:
|
||||||
|
Theme.of(context).brightness == Brightness.light ? Brightness.dark : Brightness.light,
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user