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

Loading…
Cancel
Save