improve android navigation bar

This commit is contained in:
nyne
2024-10-31 11:42:17 +08:00
parent a09fb0e81c
commit a508d85ce6
3 changed files with 18 additions and 5 deletions

View File

@@ -16,7 +16,14 @@ class SmoothCustomScrollView extends StatelessWidget {
return CustomScrollView( return CustomScrollView(
controller: controller, controller: controller,
physics: physics, physics: physics,
slivers: slivers, slivers: [
...slivers,
SliverPadding(
padding: EdgeInsets.only(
bottom: context.padding.bottom,
),
),
],
); );
}, },
); );
@@ -87,7 +94,7 @@ class _SmoothScrollProviderState extends State<SmoothScrollProvider> {
_controller.position.minScrollExtent, _controller.position.minScrollExtent,
_controller.position.maxScrollExtent, _controller.position.maxScrollExtent,
); );
if(_futurePosition == old) return; if (_futurePosition == old) return;
_controller.animateTo(_futurePosition!, _controller.animateTo(_futurePosition!,
duration: _fastAnimationDuration, curve: Curves.linear); duration: _fastAnimationDuration, curve: Curves.linear);
} }

View File

@@ -178,11 +178,13 @@ class _SystemUiProvider extends StatelessWidget {
systemUiStyle = SystemUiOverlayStyle.dark.copyWith( systemUiStyle = SystemUiOverlayStyle.dark.copyWith(
statusBarColor: Colors.transparent, statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.transparent, systemNavigationBarColor: Colors.transparent,
systemNavigationBarIconBrightness: Brightness.dark,
); );
} else { } else {
systemUiStyle = SystemUiOverlayStyle.light.copyWith( systemUiStyle = SystemUiOverlayStyle.light.copyWith(
statusBarColor: Colors.transparent, statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.transparent, systemNavigationBarColor: Colors.transparent,
systemNavigationBarIconBrightness: Brightness.light,
); );
} }
return AnnotatedRegion<SystemUiOverlayStyle>( return AnnotatedRegion<SystemUiOverlayStyle>(

View File

@@ -107,6 +107,11 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
} }
void openOrClose() { void openOrClose() {
if(!_isOpen) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
} else {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
}
setState(() { setState(() {
_isOpen = !_isOpen; _isOpen = !_isOpen;
}); });
@@ -142,10 +147,9 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
), ),
AnimatedPositioned( AnimatedPositioned(
duration: const Duration(milliseconds: 180), duration: const Duration(milliseconds: 180),
bottom: _isOpen ? 0 : -(kBottomBarHeight + context.padding.bottom), bottom: _isOpen ? 0 : -kBottomBarHeight,
left: 0, left: 0,
right: 0, right: 0,
height: kBottomBarHeight + context.padding.bottom,
child: buildBottom(), child: buildBottom(),
), ),
], ],
@@ -200,7 +204,7 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
} }
Widget child = SizedBox( Widget child = SizedBox(
height: kBottomBarHeight + MediaQuery.of(context).padding.bottom, height: kBottomBarHeight,
child: Column( child: Column(
children: [ children: [
const SizedBox( const SizedBox(