💄 Better sidebar navigation

This commit is contained in:
LittleSheep 2024-08-10 00:51:54 +08:00
parent bc5dbab9c5
commit 7f63fe7f0e
2 changed files with 19 additions and 11 deletions

View File

@ -40,15 +40,6 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
rootScaffoldKey.currentState!.closeDrawer();
}
Widget _buildSettingButton() {
return IconButton(
icon: const Icon(Icons.settings),
onPressed: () {
AppRouter.instance.pushNamed('settings');
_closeDrawer();
});
}
@override
void initState() {
super.initState();
@ -72,7 +63,6 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
leading: const Icon(Icons.account_circle),
title: Text('guest'.tr),
subtitle: Text('unsignedIn'.tr),
trailing: _buildSettingButton(),
onTap: () {
AppRouter.instance.goNamed('account');
_closeDrawer();
@ -137,7 +127,6 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
),
);
}),
trailing: _buildSettingButton(),
onTap: () {
AppRouter.instance.goNamed('account');
_closeDrawer();
@ -182,6 +171,23 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
},
),
),
const Divider(thickness: 0.3, height: 1),
Column(
children: [
ListTile(
minTileHeight: 0,
contentPadding: const EdgeInsets.symmetric(
horizontal: 20,
),
leading: const Icon(Icons.settings, size: 20).paddingAll(2),
title: Text('settings'.tr),
onTap: () {
AppRouter.instance.pushNamed('settings');
_closeDrawer();
},
),
],
).paddingOnly(top: 8)
],
),
),

View File

@ -68,6 +68,7 @@ class AppNavigationRegions extends StatelessWidget {
.map((element) {
return ExpansionTile(
minTileHeight: 0,
initiallyExpanded: true,
tilePadding: const EdgeInsets.only(left: 20, right: 24),
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
collapsedBackgroundColor:
@ -80,6 +81,7 @@ class AppNavigationRegions extends StatelessWidget {
);
}).toList(),
),
const SliverPadding(padding: EdgeInsets.only(bottom: 8)),
],
);
});