CW-349 MacOS UI issue when navigating to Transaction details screen (#921)
* Fix macos ui issues when navigatng to transaction detail screen * [skip ci] remove print and indent * Refactor previous approach based on PR review * Code Enhancements * Fix transaction page navigation * Fix disable secure app request for macos * Update background color * Update background color * Update background color * Remove unrelated format * Fix navigation UI glitch --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Godwin Asuquo committed
Jul 11, 2023 at 19:07 UTC
b974458f1ba99e5ac8501ecc7234657c33b97aef
8 files changed
+107
-126
lib/src/screens/dashboard/desktop_widgets/desktop_dashboard_actions.dart
+63
-60
@@ -14,72 +14,75 @@ class DesktopDashboardActions extends StatelessWidget {
14
15
@override
16
Widget build(BuildContext context) {
17
- return Observer(
18
- builder: (_) {
19
- return Column(
20
- children: [
21
- const SizedBox(height: 16),
22
- DesktopActionButton(
23
- title: MainActions.exchangeAction.name(context),
24
- image: MainActions.exchangeAction.image,
25
- canShow: MainActions.exchangeAction.canShow?.call(dashboardViewModel),
26
- isEnabled: MainActions.exchangeAction.isEnabled?.call(dashboardViewModel),
27
- onTap: () async => await MainActions.exchangeAction.onTap(context, dashboardViewModel),
28
- ),
29
- Row(
30
- children: [
31
- Expanded(
32
- child: DesktopActionButton(
33
- title: MainActions.receiveAction.name(context),
34
- image: MainActions.receiveAction.image,
35
- canShow: MainActions.receiveAction.canShow?.call(dashboardViewModel),
36
- isEnabled: MainActions.receiveAction.isEnabled?.call(dashboardViewModel),
37
- onTap: () async =>
38
- await MainActions.receiveAction.onTap(context, dashboardViewModel),
17
+ return Container(
18
+ color: Theme.of(context).colorScheme.background,
19
+ child: Observer(
20
+ builder: (_) {
21
+ return Column(
22
+ children: [
23
+ const SizedBox(height: 16),
24
+ DesktopActionButton(
25
+ title: MainActions.exchangeAction.name(context),
26
+ image: MainActions.exchangeAction.image,
27
+ canShow: MainActions.exchangeAction.canShow?.call(dashboardViewModel),
28
+ isEnabled: MainActions.exchangeAction.isEnabled?.call(dashboardViewModel),
29
+ onTap: () async => await MainActions.exchangeAction.onTap(context, dashboardViewModel),
30
+ ),
31
+ Row(
32
+ children: [
33
+ Expanded(
34
+ child: DesktopActionButton(
35
+ title: MainActions.receiveAction.name(context),
36
+ image: MainActions.receiveAction.image,
37
+ canShow: MainActions.receiveAction.canShow?.call(dashboardViewModel),
38
+ isEnabled: MainActions.receiveAction.isEnabled?.call(dashboardViewModel),
39
+ onTap: () async =>
40
+ await MainActions.receiveAction.onTap(context, dashboardViewModel),
41
+ ),
42
),
40
- ),
41
- Expanded(
42
- child: DesktopActionButton(
43
- title: MainActions.sendAction.name(context),
44
- image: MainActions.sendAction.image,
45
- canShow: MainActions.sendAction.canShow?.call(dashboardViewModel),
46
- isEnabled: MainActions.sendAction.isEnabled?.call(dashboardViewModel),
47
- onTap: () async => await MainActions.sendAction.onTap(context, dashboardViewModel),
43
+ Expanded(
44
+ child: DesktopActionButton(
45
+ title: MainActions.sendAction.name(context),
46
+ image: MainActions.sendAction.image,
47
+ canShow: MainActions.sendAction.canShow?.call(dashboardViewModel),
48
+ isEnabled: MainActions.sendAction.isEnabled?.call(dashboardViewModel),
49
+ onTap: () async => await MainActions.sendAction.onTap(context, dashboardViewModel),
50
+ ),
51
),
49
- ),
50
- ],
51
- ),
52
- Row(
53
- children: [
54
- Expanded(
55
- child: DesktopActionButton(
56
- title: MainActions.buyAction.name(context),
57
- image: MainActions.buyAction.image,
58
- canShow: MainActions.buyAction.canShow?.call(dashboardViewModel),
59
- isEnabled: MainActions.buyAction.isEnabled?.call(dashboardViewModel),
60
- onTap: () async => await MainActions.buyAction.onTap(context, dashboardViewModel),
52
+ ],
53
+ ),
54
+ Row(
55
+ children: [
56
+ Expanded(
57
+ child: DesktopActionButton(
58
+ title: MainActions.buyAction.name(context),
59
+ image: MainActions.buyAction.image,
60
+ canShow: MainActions.buyAction.canShow?.call(dashboardViewModel),
61
+ isEnabled: MainActions.buyAction.isEnabled?.call(dashboardViewModel),
62
+ onTap: () async => await MainActions.buyAction.onTap(context, dashboardViewModel),
63
+ ),
64
),
62
- ),
63
- Expanded(
64
- child: DesktopActionButton(
65
- title: MainActions.sellAction.name(context),
66
- image: MainActions.sellAction.image,
67
- canShow: MainActions.sellAction.canShow?.call(dashboardViewModel),
68
- isEnabled: MainActions.sellAction.isEnabled?.call(dashboardViewModel),
69
- onTap: () async => await MainActions.sellAction.onTap(context, dashboardViewModel),
65
+ Expanded(
66
+ child: DesktopActionButton(
67
+ title: MainActions.sellAction.name(context),
68
+ image: MainActions.sellAction.image,
69
+ canShow: MainActions.sellAction.canShow?.call(dashboardViewModel),
70
+ isEnabled: MainActions.sellAction.isEnabled?.call(dashboardViewModel),
71
+ onTap: () async => await MainActions.sellAction.onTap(context, dashboardViewModel),
72
+ ),
73
),
74
+ ],
75
+ ),
76
+ Expanded(
77
+ child: MarketPlacePage(
78
+ dashboardViewModel: dashboardViewModel,
79
+ marketPlaceViewModel: getIt.get<MarketPlaceViewModel>(),
80
),
72
- ],
73
- ),
74
- Expanded(
75
- child: MarketPlacePage(
76
- dashboardViewModel: dashboardViewModel,
77
- marketPlaceViewModel: getIt.get<MarketPlaceViewModel>(),
81
),
79
- ),
80
- ],
81
- );
82
- }
82
+ ],
83
+ );
84
+ }
85
+ ),
86
);
87
}
88
}
lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart
+15
-30
@@ -77,27 +77,21 @@ class DesktopSidebarWrapper extends BasePage {
77
SideMenuItem(
78
imagePath: 'assets/images/wallet_outline.png',
79
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.dashboard,
80
- onTap: () => desktopSidebarViewModel.onPageChange(SidebarItem.dashboard),
80
+ onTap: () {
81
+ desktopSidebarViewModel.onPageChange(SidebarItem.dashboard);
82
+ desktopNavigatorKey.currentState
83
+ ?.pushNamedAndRemoveUntil(Routes.desktop_actions, (route) => false);
84
+ },
85
),
86
SideMenuItem(
87
onTap: () {
84
- String? currentPath;
85
-
86
- desktopNavigatorKey.currentState?.popUntil((route) {
87
- currentPath = route.settings.name;
88
- return true;
89
- });
90
-
91
- switch (currentPath) {
92
- case Routes.transactionsPage:
93
- desktopSidebarViewModel.resetSidebar();
94
- break;
95
- default:
96
- desktopSidebarViewModel.resetSidebar();
97
- Future.delayed(Duration(milliseconds: 10), () {
98
- desktopSidebarViewModel.onPageChange(SidebarItem.transactions);
99
- desktopNavigatorKey.currentState?.pushNamed(Routes.transactionsPage);
100
- });
88
+ if (desktopSidebarViewModel.currentPage == SidebarItem.transactions) {
89
+ desktopNavigatorKey.currentState
90
+ ?.pushNamedAndRemoveUntil(Routes.desktop_actions, (route) => false);
91
+ desktopSidebarViewModel.resetSidebar();
92
+ } else {
93
+ desktopSidebarViewModel.onPageChange(SidebarItem.transactions);
94
+ desktopNavigatorKey.currentState?.pushNamed(Routes.transactionsPage);
95
}
96
},
97
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.transactions,
@@ -156,20 +150,11 @@ class DesktopSidebarWrapper extends BasePage {
150
151
void _setEffects() async {
152
reaction<SidebarItem>((_) => desktopSidebarViewModel.currentPage, (page) {
159
- String? currentPath;
160
-
161
- desktopNavigatorKey.currentState?.popUntil((route) {
162
- currentPath = route.settings.name;
163
- return true;
164
- });
165
- if (page == SidebarItem.transactions) {
153
+ if (page == SidebarItem.dashboard) {
154
+ pageController.jumpToPage(0);
155
return;
156
}
168
-
169
- if (currentPath == Routes.transactionsPage) {
170
- Navigator.of(desktopNavigatorKey.currentContext!).pop();
171
- }
172
- pageController.jumpToPage(page.index);
157
+ pageController.jumpToPage(page.index - 1);
158
});
159
}
160
}
lib/src/screens/dashboard/widgets/balance_page.dart
-3
@@ -16,9 +16,6 @@ class BalancePage extends StatelessWidget {
16
final DashboardViewModel dashboardViewModel;
17
final SettingsStore settingsStore;
18
19
- Color get backgroundLightColor =>
20
- settingsStore.currentTheme.type == ThemeType.bright ? Colors.transparent : Colors.white;
21
-
19
@override
20
Widget build(BuildContext context) {
21
return GestureDetector(
lib/src/screens/new_wallet/advanced_privacy_settings_page.dart
+10
-8
@@ -118,19 +118,21 @@ class _AdvancedPrivacySettingsBodyState extends State<AdvancedPrivacySettingsBod
118
textColor: Colors.white,
119
),
120
const SizedBox(height: 25),
121
- Padding(
122
- padding: EdgeInsets.symmetric(horizontal: MediaQuery.of(context).size.width * 0.15),
123
- child: Text(
124
- S.of(context).settings_can_be_changed_later,
125
- textAlign: TextAlign.center,
126
- style: TextStyle(
127
- color: Theme.of(context)
121
+ LayoutBuilder(
122
+ builder: (_, constraints) => SizedBox(
123
+ width: constraints.maxWidth * 0.8,
124
+ child: Text(
125
+ S.of(context).settings_can_be_changed_later,
126
+ textAlign: TextAlign.center,
127
+ style: TextStyle(
128
+ color: Theme.of(context)
129
.accentTextTheme!
130
.displayMedium!
131
.color,
132
+ ),
133
),
134
),
133
- ),
135
+ )
136
],
137
),
138
),
lib/src/screens/nodes/node_create_or_edit_page.dart
+1
@@ -115,6 +115,7 @@ class NodeCreateOrEditPage extends BasePage {
115
bottomSectionPadding: EdgeInsets.only(bottom: 24),
116
bottomSection: Observer(
117
builder: (_) => Row(
118
+ mainAxisAlignment: MainAxisAlignment.center,
119
children: <Widget>[
120
Flexible(
121
child: Container(
lib/store/settings_store.dart
+15
-22
@@ -145,15 +145,13 @@ abstract class SettingsStoreBase with Store {
145
});
146
}
147
148
- reaction(
149
- (_) => disableBuy,
150
- (bool disableBuy) => sharedPreferences.setBool(
151
- PreferencesKey.disableBuyKey, disableBuy));
148
+ reaction((_) => disableBuy,
149
+ (bool disableBuy) => sharedPreferences.setBool(PreferencesKey.disableBuyKey, disableBuy));
150
151
reaction(
152
(_) => disableSell,
155
- (bool disableSell) => sharedPreferences.setBool(
156
- PreferencesKey.disableSellKey, disableSell));
153
+ (bool disableSell) =>
154
+ sharedPreferences.setBool(PreferencesKey.disableSellKey, disableSell));
155
156
reaction(
157
(_) => fiatApiMode,
@@ -350,12 +348,9 @@ abstract class SettingsStoreBase with Store {
348
// FIX-ME: Check for which default value we should have here
349
final shouldSaveRecipientAddress =
350
sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey) ?? false;
353
- final isAppSecure =
354
- sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? false;
355
- final disableBuy =
356
- sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? false;
357
- final disableSell =
358
- sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? false;
351
+ final isAppSecure = sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? false;
352
+ final disableBuy = sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? false;
353
+ final disableSell = sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? false;
354
final currentFiatApiMode = FiatApiMode.deserialize(
355
raw: sharedPreferences.getInt(PreferencesKey.currentFiatApiModeKey) ??
356
FiatApiMode.enabled.raw);
@@ -487,16 +482,14 @@ abstract class SettingsStoreBase with Store {
482
useTOTP2FA = sharedPreferences.getBool(PreferencesKey.useTOTP2FA) ?? useTOTP2FA;
483
numberOfFailedTokenTrials =
484
sharedPreferences.getInt(PreferencesKey.failedTotpTokenTrials) ?? numberOfFailedTokenTrials;
490
- sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey) ?? shouldSaveRecipientAddress;
491
- isAppSecure =
492
- sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? isAppSecure;
493
- disableBuy =
494
- sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? disableBuy;
495
- disableSell =
496
- sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? disableSell;
497
- allowBiometricalAuthentication = sharedPreferences
498
- .getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
499
- allowBiometricalAuthentication;
485
+ sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey) ??
486
+ shouldSaveRecipientAddress;
487
+ isAppSecure = sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? isAppSecure;
488
+ disableBuy = sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? disableBuy;
489
+ disableSell = sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? disableSell;
490
+ allowBiometricalAuthentication =
491
+ sharedPreferences.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
492
+ allowBiometricalAuthentication;
493
shouldShowMarketPlaceInDashboard =
494
sharedPreferences.getBool(PreferencesKey.shouldShowMarketPlaceInDashboard) ??
495
shouldShowMarketPlaceInDashboard;
lib/view_model/dashboard/desktop_sidebar_view_model.dart
+1
-1
@@ -4,9 +4,9 @@ part 'desktop_sidebar_view_model.g.dart';
4
5
enum SidebarItem {
6
dashboard,
7
+ transactions,
8
support,
9
settings,
9
- transactions;
10
}
11
12
class DesktopSidebarViewModel = DesktopSidebarViewModelBase with _$DesktopSidebarViewModel;
macos/Podfile.lock
+2
-2
@@ -115,10 +115,10 @@ SPEC CHECKSUMS:
115
platform_device_id_macos: f763bb55f088be804d61b96eb4710b8ab6598e94
116
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
117
share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4
118
- shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c
118
+ shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
119
url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451
120
wakelock_macos: bc3f2a9bd8d2e6c89fee1e1822e7ddac3bd004a9
121
122
PODFILE CHECKSUM: 5107934592df7813b33d744aebc8ddc6b5a5445f
123
124
-COCOAPODS: 1.11.3
124
+COCOAPODS: 1.12.1