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>
This commit is contained in:
Godwin Asuquo 2023-07-11 19:07:46 +03:00 committed by GitHub
parent bf0c2c8f35
commit b974458f1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 112 additions and 131 deletions

View file

@ -14,7 +14,9 @@ class DesktopDashboardActions extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Observer( return Container(
color: Theme.of(context).colorScheme.background,
child: Observer(
builder: (_) { builder: (_) {
return Column( return Column(
children: [ children: [
@ -80,6 +82,7 @@ class DesktopDashboardActions extends StatelessWidget {
], ],
); );
} }
),
); );
} }
} }

View file

@ -77,27 +77,21 @@ class DesktopSidebarWrapper extends BasePage {
SideMenuItem( SideMenuItem(
imagePath: 'assets/images/wallet_outline.png', imagePath: 'assets/images/wallet_outline.png',
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.dashboard, isSelected: desktopSidebarViewModel.currentPage == SidebarItem.dashboard,
onTap: () => desktopSidebarViewModel.onPageChange(SidebarItem.dashboard), onTap: () {
desktopSidebarViewModel.onPageChange(SidebarItem.dashboard);
desktopNavigatorKey.currentState
?.pushNamedAndRemoveUntil(Routes.desktop_actions, (route) => false);
},
), ),
SideMenuItem( SideMenuItem(
onTap: () { onTap: () {
String? currentPath; if (desktopSidebarViewModel.currentPage == SidebarItem.transactions) {
desktopNavigatorKey.currentState
desktopNavigatorKey.currentState?.popUntil((route) { ?.pushNamedAndRemoveUntil(Routes.desktop_actions, (route) => false);
currentPath = route.settings.name;
return true;
});
switch (currentPath) {
case Routes.transactionsPage:
desktopSidebarViewModel.resetSidebar(); desktopSidebarViewModel.resetSidebar();
break; } else {
default:
desktopSidebarViewModel.resetSidebar();
Future.delayed(Duration(milliseconds: 10), () {
desktopSidebarViewModel.onPageChange(SidebarItem.transactions); desktopSidebarViewModel.onPageChange(SidebarItem.transactions);
desktopNavigatorKey.currentState?.pushNamed(Routes.transactionsPage); desktopNavigatorKey.currentState?.pushNamed(Routes.transactionsPage);
});
} }
}, },
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.transactions, isSelected: desktopSidebarViewModel.currentPage == SidebarItem.transactions,
@ -156,20 +150,11 @@ class DesktopSidebarWrapper extends BasePage {
void _setEffects() async { void _setEffects() async {
reaction<SidebarItem>((_) => desktopSidebarViewModel.currentPage, (page) { reaction<SidebarItem>((_) => desktopSidebarViewModel.currentPage, (page) {
String? currentPath; if (page == SidebarItem.dashboard) {
pageController.jumpToPage(0);
desktopNavigatorKey.currentState?.popUntil((route) {
currentPath = route.settings.name;
return true;
});
if (page == SidebarItem.transactions) {
return; return;
} }
pageController.jumpToPage(page.index - 1);
if (currentPath == Routes.transactionsPage) {
Navigator.of(desktopNavigatorKey.currentContext!).pop();
}
pageController.jumpToPage(page.index);
}); });
} }
} }

View file

@ -16,9 +16,6 @@ class BalancePage extends StatelessWidget {
final DashboardViewModel dashboardViewModel; final DashboardViewModel dashboardViewModel;
final SettingsStore settingsStore; final SettingsStore settingsStore;
Color get backgroundLightColor =>
settingsStore.currentTheme.type == ThemeType.bright ? Colors.transparent : Colors.white;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(

View file

@ -118,8 +118,9 @@ class _AdvancedPrivacySettingsBodyState extends State<AdvancedPrivacySettingsBod
textColor: Colors.white, textColor: Colors.white,
), ),
const SizedBox(height: 25), const SizedBox(height: 25),
Padding( LayoutBuilder(
padding: EdgeInsets.symmetric(horizontal: MediaQuery.of(context).size.width * 0.15), builder: (_, constraints) => SizedBox(
width: constraints.maxWidth * 0.8,
child: Text( child: Text(
S.of(context).settings_can_be_changed_later, S.of(context).settings_can_be_changed_later,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -131,6 +132,7 @@ class _AdvancedPrivacySettingsBodyState extends State<AdvancedPrivacySettingsBod
), ),
), ),
), ),
)
], ],
), ),
), ),

View file

@ -115,6 +115,7 @@ class NodeCreateOrEditPage extends BasePage {
bottomSectionPadding: EdgeInsets.only(bottom: 24), bottomSectionPadding: EdgeInsets.only(bottom: 24),
bottomSection: Observer( bottomSection: Observer(
builder: (_) => Row( builder: (_) => Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Container( child: Container(

View file

@ -145,15 +145,13 @@ abstract class SettingsStoreBase with Store {
}); });
} }
reaction( reaction((_) => disableBuy,
(_) => disableBuy, (bool disableBuy) => sharedPreferences.setBool(PreferencesKey.disableBuyKey, disableBuy));
(bool disableBuy) => sharedPreferences.setBool(
PreferencesKey.disableBuyKey, disableBuy));
reaction( reaction(
(_) => disableSell, (_) => disableSell,
(bool disableSell) => sharedPreferences.setBool( (bool disableSell) =>
PreferencesKey.disableSellKey, disableSell)); sharedPreferences.setBool(PreferencesKey.disableSellKey, disableSell));
reaction( reaction(
(_) => fiatApiMode, (_) => fiatApiMode,
@ -350,12 +348,9 @@ abstract class SettingsStoreBase with Store {
// FIX-ME: Check for which default value we should have here // FIX-ME: Check for which default value we should have here
final shouldSaveRecipientAddress = final shouldSaveRecipientAddress =
sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey) ?? false; sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey) ?? false;
final isAppSecure = final isAppSecure = sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? false;
sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? false; final disableBuy = sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? false;
final disableBuy = final disableSell = sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? false;
sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? false;
final disableSell =
sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? false;
final currentFiatApiMode = FiatApiMode.deserialize( final currentFiatApiMode = FiatApiMode.deserialize(
raw: sharedPreferences.getInt(PreferencesKey.currentFiatApiModeKey) ?? raw: sharedPreferences.getInt(PreferencesKey.currentFiatApiModeKey) ??
FiatApiMode.enabled.raw); FiatApiMode.enabled.raw);
@ -487,15 +482,13 @@ abstract class SettingsStoreBase with Store {
useTOTP2FA = sharedPreferences.getBool(PreferencesKey.useTOTP2FA) ?? useTOTP2FA; useTOTP2FA = sharedPreferences.getBool(PreferencesKey.useTOTP2FA) ?? useTOTP2FA;
numberOfFailedTokenTrials = numberOfFailedTokenTrials =
sharedPreferences.getInt(PreferencesKey.failedTotpTokenTrials) ?? numberOfFailedTokenTrials; sharedPreferences.getInt(PreferencesKey.failedTotpTokenTrials) ?? numberOfFailedTokenTrials;
sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey) ?? shouldSaveRecipientAddress; sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey) ??
isAppSecure = shouldSaveRecipientAddress;
sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? isAppSecure; isAppSecure = sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? isAppSecure;
disableBuy = disableBuy = sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? disableBuy;
sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? disableBuy; disableSell = sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? disableSell;
disableSell = allowBiometricalAuthentication =
sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? disableSell; sharedPreferences.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
allowBiometricalAuthentication = sharedPreferences
.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
allowBiometricalAuthentication; allowBiometricalAuthentication;
shouldShowMarketPlaceInDashboard = shouldShowMarketPlaceInDashboard =
sharedPreferences.getBool(PreferencesKey.shouldShowMarketPlaceInDashboard) ?? sharedPreferences.getBool(PreferencesKey.shouldShowMarketPlaceInDashboard) ??

View file

@ -4,9 +4,9 @@ part 'desktop_sidebar_view_model.g.dart';
enum SidebarItem { enum SidebarItem {
dashboard, dashboard,
transactions,
support, support,
settings, settings,
transactions;
} }
class DesktopSidebarViewModel = DesktopSidebarViewModelBase with _$DesktopSidebarViewModel; class DesktopSidebarViewModel = DesktopSidebarViewModelBase with _$DesktopSidebarViewModel;

View file

@ -115,10 +115,10 @@ SPEC CHECKSUMS:
platform_device_id_macos: f763bb55f088be804d61b96eb4710b8ab6598e94 platform_device_id_macos: f763bb55f088be804d61b96eb4710b8ab6598e94
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4 share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4
shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451 url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451
wakelock_macos: bc3f2a9bd8d2e6c89fee1e1822e7ddac3bd004a9 wakelock_macos: bc3f2a9bd8d2e6c89fee1e1822e7ddac3bd004a9
PODFILE CHECKSUM: 5107934592df7813b33d744aebc8ddc6b5a5445f PODFILE CHECKSUM: 5107934592df7813b33d744aebc8ddc6b5a5445f
COCOAPODS: 1.11.3 COCOAPODS: 1.12.1