💄 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(); rootScaffoldKey.currentState!.closeDrawer();
} }
Widget _buildSettingButton() {
return IconButton(
icon: const Icon(Icons.settings),
onPressed: () {
AppRouter.instance.pushNamed('settings');
_closeDrawer();
});
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -72,7 +63,6 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
leading: const Icon(Icons.account_circle), leading: const Icon(Icons.account_circle),
title: Text('guest'.tr), title: Text('guest'.tr),
subtitle: Text('unsignedIn'.tr), subtitle: Text('unsignedIn'.tr),
trailing: _buildSettingButton(),
onTap: () { onTap: () {
AppRouter.instance.goNamed('account'); AppRouter.instance.goNamed('account');
_closeDrawer(); _closeDrawer();
@ -137,7 +127,6 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
), ),
); );
}), }),
trailing: _buildSettingButton(),
onTap: () { onTap: () {
AppRouter.instance.goNamed('account'); AppRouter.instance.goNamed('account');
_closeDrawer(); _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) { .map((element) {
return ExpansionTile( return ExpansionTile(
minTileHeight: 0, minTileHeight: 0,
initiallyExpanded: true,
tilePadding: const EdgeInsets.only(left: 20, right: 24), tilePadding: const EdgeInsets.only(left: 20, right: 24),
backgroundColor: Theme.of(context).colorScheme.surfaceContainer, backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
collapsedBackgroundColor: collapsedBackgroundColor:
@ -80,6 +81,7 @@ class AppNavigationRegions extends StatelessWidget {
); );
}).toList(), }).toList(),
), ),
const SliverPadding(padding: EdgeInsets.only(bottom: 8)),
], ],
); );
}); });