Fix drawer going into unsafe areas

codemagic-setup
Hank Grabowski 2023-03-15 11:48:29 -04:00
rodzic 8df12954e4
commit bdf30ccecd
1 zmienionych plików z 58 dodań i 56 usunięć

Wyświetl plik

@ -9,64 +9,66 @@ import '../services/auth_service.dart';
class StandardAppDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
...getIt<AccountsService>().loggedInProfiles.map(
(p) => ListTile(
onTap: () async {
await getIt<AccountsService>().setActiveProfile(p);
if (context.mounted) {
context.pop();
}
},
leading: CircleAvatar(
child: CachedNetworkImage(imageUrl: p.avatar)),
title: Text(
p.username,
style: p == getIt<AccountsService>().currentProfile
? TextStyle(fontWeight: FontWeight.bold)
: null,
),
subtitle: Text(
p.serverName,
style: p == getIt<AccountsService>().currentProfile
? TextStyle(fontWeight: FontWeight.bold)
: null,
return SafeArea(
child: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
...getIt<AccountsService>().loggedInProfiles.map(
(p) => ListTile(
onTap: () async {
await getIt<AccountsService>().setActiveProfile(p);
if (context.mounted && context.canPop()) {
//context.pop();
}
},
leading: CircleAvatar(
child: CachedNetworkImage(imageUrl: p.avatar)),
title: Text(
p.username,
style: p == getIt<AccountsService>().currentProfile
? TextStyle(fontWeight: FontWeight.bold)
: null,
),
subtitle: Text(
p.serverName,
style: p == getIt<AccountsService>().currentProfile
? TextStyle(fontWeight: FontWeight.bold)
: null,
),
),
),
),
buildMenuButton(
context,
'Manage Profiles',
() => context.pushNamed(ScreenPaths.manageProfiles),
),
const Divider(),
buildMenuButton(
context,
'Gallery',
() => context.pushNamed(ScreenPaths.gallery),
),
buildMenuButton(
context,
'Direct Messages',
() => context.pushNamed(ScreenPaths.messages),
),
buildMenuButton(
context,
'Settings',
() => context.pushNamed(ScreenPaths.settings),
),
// TODO Add back in clearing ability but has to do disk caches too
// buildMenuButton(context, 'Clear Caches', () async {
// final confirm = await showYesNoDialog(
// context, 'You want to clear all memory and disk cache data?');
// if (confirm == true) {
// clearCaches();
// }
// }),
],
buildMenuButton(
context,
'Manage Profiles',
() => context.pushNamed(ScreenPaths.manageProfiles),
),
const Divider(),
buildMenuButton(
context,
'Gallery',
() => context.pushNamed(ScreenPaths.gallery),
),
buildMenuButton(
context,
'Direct Messages',
() => context.pushNamed(ScreenPaths.messages),
),
buildMenuButton(
context,
'Settings',
() => context.pushNamed(ScreenPaths.settings),
),
// TODO Add back in clearing ability but has to do disk caches too
// buildMenuButton(context, 'Clear Caches', () async {
// final confirm = await showYesNoDialog(
// context, 'You want to clear all memory and disk cache data?');
// if (confirm == true) {
// clearCaches();
// }
// }),
],
),
),
);
}