Skip to content

Commit

Permalink
Completely migrate to Material You + Dynamic Colors
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrintt committed Oct 2, 2023
1 parent a7874ef commit ef1ba87
Show file tree
Hide file tree
Showing 22 changed files with 318 additions and 752 deletions.
39 changes: 33 additions & 6 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '../widgets/bottom_navigation.dart';
extension BottomSpacer on BuildContext {
Widget get bottomSpacer => Padding(
padding: EdgeInsets.only(
bottom: theme.navigationBarTheme.height!,
bottom: theme.navigationBarTheme.height ?? kToolbarHeight * 2,
),
);

Expand Down Expand Up @@ -44,6 +44,31 @@ class _HomePageState extends State<HomePage> with BottomNavigationStoreMixin {
);
}

late PageController _pageController;

@override
void initState() {
super.initState();

_pageController = PageController();

bottomNavigationStore.addListener(() {
if (_pageController.hasClients) {
if (_pageController.page!.toInt() !=
bottomNavigationStore.currentIndex) {
_pageController.jumpToPage(bottomNavigationStore.currentIndex);
}
}
});
}

@override
void dispose() {
_pageController.dispose();

super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -57,11 +82,13 @@ class _HomePageState extends State<HomePage> with BottomNavigationStoreMixin {
},
),
extendBody: true,
body: Stack(
children: <Widget>[
_buildTab(const AppListScreen(), 0),
_buildTab(const BackgroundTaskListScreen(), 1),
_buildTab(const FileListScreen(), 2),
body: PageView(
controller: _pageController,
physics: const NeverScrollableScrollPhysics(),
children: const <Widget>[
AppListScreen(),
BackgroundTaskListScreen(),
FileListScreen(),
],
),
);
Expand Down
Loading

0 comments on commit ef1ba87

Please sign in to comment.