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(
controller: controller,
physics: physics,
slivers: slivers,
slivers: [
...slivers,
SliverPadding(
padding: EdgeInsets.only(
bottom: context.padding.bottom,
),
),
],
);
},
);

View File

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

View File

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