Browse Source

neon: HomePage improve code readability of the loading state

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

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

@ -184,10 +184,12 @@ class _HomePageState extends State<HomePage> {
OptionBuilder<NavigationMode>( OptionBuilder<NavigationMode>(
option: _globalOptions.navigationMode, option: _globalOptions.navigationMode,
builder: (final context, final navigationMode) { builder: (final context, final navigationMode) {
if (accountsSnapshot.hasData) { final accounts = accountsSnapshot.data;
final accounts = accountsSnapshot.data!; final account = accounts?.find(_account.id);
final account = accounts.find(_account.id); if (accounts == null || account == null) {
if (account != null) { return const Scaffold();
}
final isQuickBar = navigationMode == NavigationMode.quickBar; final isQuickBar = navigationMode == NavigationMode.quickBar;
final drawer = Builder( final drawer = Builder(
builder: (final context) => Drawer( builder: (final context) => Drawer(
@ -281,8 +283,7 @@ class _HomePageState extends State<HomePage> {
child: DropdownButton<String>( child: DropdownButton<String>(
isExpanded: true, isExpanded: true,
dropdownColor: Theme.of(context).colorScheme.primary, dropdownColor: Theme.of(context).colorScheme.primary,
iconEnabledColor: iconEnabledColor: Theme.of(context).colorScheme.onBackground,
Theme.of(context).colorScheme.onBackground,
value: _account.id, value: _account.id,
items: accounts items: accounts
.map<DropdownMenuItem<String>>( .map<DropdownMenuItem<String>>(
@ -566,9 +567,6 @@ class _HomePageState extends State<HomePage> {
], ],
), ),
); );
}
}
return const Scaffold();
}, },
), ),
), ),

Loading…
Cancel
Save