Skip to content

Commit

Permalink
drawer highlight bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
BHznJNs committed Feb 26, 2025
1 parent f0f95dc commit 1a68c36
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
6 changes: 5 additions & 1 deletion lib/components/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ class ScaffoldDrawer extends StatelessWidget {
_DrawerItemData(l10n.drawer_galleryPage, '/gallery' , Icons.collections_bookmark_outlined, Icons.collections_bookmark),
_DrawerItemData(l10n.drawer_settingPage, '/settings', Icons.settings_outlined , Icons.settings ),
];
final currentRoute = ModalRoute.of(context)?.settings.name ?? '/create';
final currentRoute = (() {
final routeName = ModalRoute.of(context)?.settings.name;
if (routeName == null || routeName == '/') return '/create';
return routeName;
})();
return Drawer(
child: SafeArea(
child: Column(
Expand Down
12 changes: 2 additions & 10 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class MyAppState extends State<MyApp> {
seedColor: colorTheme,
brightness: Brightness.dark,
);
final routes = {
final routes = <String, Widget Function(BuildContext)>{
'/create': (context) => ScaffoldWithDrawer(
title: S.of(context)?.drawer_createPage ?? 'Create a Link',
body: CreatePage(),
Expand Down Expand Up @@ -186,15 +186,7 @@ class MyAppState extends State<MyApp> {
),
),
themeMode: themeProvider.theme.toThemeMode(),
home: Builder(
builder: (context) {
return ScaffoldWithDrawer(
title: S.of(context)?.drawer_createPage ?? 'Create a Link',
body: CreatePage(),
drawer: sharedDrawer,
);
},
),
home: Builder(builder: routes['/create']!),
routes: routes,
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.2
version: 1.1.3

environment:
sdk: ^3.6.1
Expand Down

0 comments on commit 1a68c36

Please sign in to comment.