Browse Source

neon: HomePage don't try opening the drawer in the loading state when navigating back

pull/362/head
Nikolas Rimikis 1 year ago
parent
commit
b57527f515
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 42
      packages/neon/neon/lib/src/pages/home.dart

42
packages/neon/neon/lib/src/pages/home.dart

@ -183,18 +183,7 @@ class _HomePageState extends State<HomePage> {
) =>
OptionBuilder<NavigationMode>(
option: _globalOptions.navigationMode,
builder: (final context, final navigationMode) => WillPopScope(
onWillPop: () async {
if (_scaffoldKey.currentState!.isDrawerOpen) {
Navigator.pop(context);
return true;
}
_scaffoldKey.currentState!.openDrawer();
return false;
},
child: Builder(
builder: (final context) {
builder: (final context, final navigationMode) {
if (accountsSnapshot.hasData) {
final accounts = accountsSnapshot.data!;
final account = accounts.find(_account.id);
@ -263,18 +252,15 @@ class _HomePageState extends State<HomePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (capabilities.data != null) ...[
if (capabilities.data!.capabilities.theming?.name !=
null) ...[
if (capabilities.data!.capabilities.theming?.name != null) ...[
Text(
capabilities.data!.capabilities.theming!.name!,
style: DefaultTextStyle.of(context).style.copyWith(
color:
Theme.of(context).appBarTheme.foregroundColor,
color: Theme.of(context).appBarTheme.foregroundColor,
),
),
],
if (capabilities.data!.capabilities.theming?.logo !=
null) ...[
if (capabilities.data!.capabilities.theming?.logo != null) ...[
Flexible(
child: NeonCachedUrlImage(
url: capabilities.data!.capabilities.theming!.logo!,
@ -305,9 +291,8 @@ class _HomePageState extends State<HomePage> {
child: NeonAccountTile(
account: account,
dense: true,
textColor: Theme.of(context)
.appBarTheme
.foregroundColor,
textColor:
Theme.of(context).appBarTheme.foregroundColor,
),
),
)
@ -554,7 +539,17 @@ class _HomePageState extends State<HomePage> {
),
);
return Row(
return WillPopScope(
onWillPop: () async {
if (_scaffoldKey.currentState!.isDrawerOpen) {
Navigator.pop(context);
return true;
}
_scaffoldKey.currentState!.openDrawer();
return false;
},
child: Row(
children: [
if (navigationMode == NavigationMode.drawerAlwaysVisible) ...[
drawer,
@ -569,6 +564,7 @@ class _HomePageState extends State<HomePage> {
),
),
],
),
);
}
}
@ -579,7 +575,5 @@ class _HomePageState extends State<HomePage> {
),
),
),
),
),
);
}

Loading…
Cancel
Save