From 88e245e480ed4d82d36eea52c0b857899deb3483 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Tue, 21 Feb 2023 12:22:32 +0200 Subject: [PATCH] Fix issues from code review --- .../screens/dashboard/desktop_dashboard_page.dart | 1 - .../desktop_settings/dashboard_settings_page.dart | 15 ++++----------- lib/src/widgets/setting_actions.dart | 10 ++++++++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/src/screens/dashboard/desktop_dashboard_page.dart b/lib/src/screens/dashboard/desktop_dashboard_page.dart index c2b7285b7..f79d2f9e2 100644 --- a/lib/src/screens/dashboard/desktop_dashboard_page.dart +++ b/lib/src/screens/dashboard/desktop_dashboard_page.dart @@ -24,7 +24,6 @@ class DesktopDashboardPage extends StatelessWidget { final WalletAddressListViewModel addressListViewModel; static final GlobalKey desktopKey = GlobalKey(); - static final GlobalKey kex = GlobalKey(); bool _isEffectsInstalled = false; StreamSubscription? _onInactiveSub; diff --git a/lib/src/screens/settings/desktop_settings/dashboard_settings_page.dart b/lib/src/screens/settings/desktop_settings/dashboard_settings_page.dart index f4312aba4..8028e6057 100644 --- a/lib/src/screens/settings/desktop_settings/dashboard_settings_page.dart +++ b/lib/src/screens/settings/desktop_settings/dashboard_settings_page.dart @@ -16,7 +16,7 @@ class DesktopSettingsPage extends StatefulWidget { } class _DesktopSettingsPageState extends State { - final List _allItems = []; + final int itemCount = SettingActions.desktopSettings.length; int? currentPage; @@ -26,13 +26,6 @@ class _DesktopSettingsPageState extends State { }); } - @override - void initState() { - final allActions = List.from(SettingActions.all); - allActions.remove(SettingActions.walletSettingAction); - _allItems.addAll(allActions); super.initState(); - } - @override Widget build(BuildContext context) { return Scaffold( @@ -56,8 +49,8 @@ class _DesktopSettingsPageState extends State { child: ListView.separated( padding: EdgeInsets.only(top: 0), itemBuilder: (_, index) { - final item = _allItems[index]; - final isLastTile = index == _allItems.length - 1; + final item = SettingActions.desktopSettings[index]; + final isLastTile = index == itemCount - 1; return SettingActionButton( isLastTile: isLastTile, selectionActive: currentPage != null, @@ -79,7 +72,7 @@ class _DesktopSettingsPageState extends State { height: 1, color: Theme.of(context).primaryTextTheme.caption!.decorationColor!, ), - itemCount: _allItems.length, + itemCount: itemCount, ), ), ], diff --git a/lib/src/widgets/setting_actions.dart b/lib/src/widgets/setting_actions.dart index 76e5d2c76..043c8bd0e 100644 --- a/lib/src/widgets/setting_actions.dart +++ b/lib/src/widgets/setting_actions.dart @@ -24,6 +24,16 @@ class SettingActions { supportSettingAction, ]; + static List desktopSettings = [ + connectionSettingAction, + addressBookSettingAction, + securityBackupSettingAction, + privacySettingAction, + displaySettingAction, + otherSettingAction, + supportSettingAction, + ]; + static SettingActions connectionSettingAction = SettingActions._( name: S.current.connection_sync, image: 'assets/images/nodes_menu.png',