Fix Desktop dashboard actions background color

This commit is contained in:
OmarHatem 2023-02-14 18:01:24 +02:00
parent 8f76232937
commit fb5efc0429
5 changed files with 33 additions and 49 deletions

View file

@ -520,8 +520,10 @@ Route<dynamic> createRoute(RouteSettings settings) {
));
case Routes.desktop_actions:
return CupertinoPageRoute<void>(
builder: (_) => DesktopDashboardActions(getIt<DashboardViewModel>()));
return PageRouteBuilder(
opaque: false,
pageBuilder: (_, __, ___) => DesktopDashboardActions(getIt<DashboardViewModel>()),
);
case Routes.desktop_settings_page:
return CupertinoPageRoute<void>(

View file

@ -1,7 +1,6 @@
import 'dart:async';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart';
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/yat_emoji_id.dart';
@ -18,6 +17,7 @@ import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_v
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/main.dart';
import 'package:cake_wallet/router.dart' as Router;
class DesktopDashboardPage extends BasePage {
DesktopDashboardPage({
@ -27,6 +27,8 @@ class DesktopDashboardPage extends BasePage {
required this.desktopSidebarViewModel,
});
static final GlobalKey<NavigatorState> desktopKey = GlobalKey<NavigatorState>();
@override
Color get backgroundLightColor =>
currentTheme.type == ThemeType.bright ? Colors.transparent : Colors.white;
@ -73,13 +75,12 @@ class DesktopDashboardPage extends BasePage {
});
if (currentPath == Routes.transactionsPage) {
desktopSidebarViewModel.resetSidebar();
return;
}
desktopSidebarViewModel.resetSidebar();
return;
}
desktopSidebarViewModel.onPageChange(SidebarItem.transactions);
desktopKey.currentState!.pushNamed(Routes.transactionsPage);
},
child: Observer(
builder: (_) {
@ -105,7 +106,26 @@ class DesktopDashboardPage extends BasePage {
Widget body(BuildContext context) {
_setEffects(context);
return DesktopDashboardView(balancePage);
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 3,
child: balancePage,
),
Expanded(
flex: 5,
child: Navigator(
key: desktopKey,
initialRoute: Routes.desktop_actions,
onGenerateRoute: (settings) => Router.createRoute(settings),
onGenerateInitialRoutes: (NavigatorState navigator, String initialRouteName) {
return [navigator.widget.onGenerateRoute!(RouteSettings(name: initialRouteName))!];
},
),
),
],
);
}
void _setEffects(BuildContext context) async {

View file

@ -1,35 +0,0 @@
import 'package:cake_wallet/routes.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/router.dart' as Router;
GlobalKey<NavigatorState> desktopKey = GlobalKey<NavigatorState>();
class DesktopDashboardView extends StatelessWidget {
final Widget balancePage;
const DesktopDashboardView(this.balancePage, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 3,
child: balancePage,
),
Expanded(
flex: 5,
child: Navigator(
key: desktopKey,
initialRoute: Routes.desktop_actions,
onGenerateRoute: (settings) => Router.createRoute(settings),
onGenerateInitialRoutes: (NavigatorState navigator, String initialRouteName) {
return [navigator.widget.onGenerateRoute!(RouteSettings(name: initialRouteName))!];
},
),
),
],
);
}
}

View file

@ -1,5 +1,5 @@
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart';
import 'package:cake_wallet/src/screens/dashboard/desktop_dashboard_page.dart';
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar/side_menu.dart';
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar/side_menu_item.dart';
import 'package:cake_wallet/view_model/dashboard/desktop_sidebar_view_model.dart';
@ -21,7 +21,7 @@ class DesktopSidebarWrapper extends StatelessWidget {
reaction<SidebarItem>((_) => desktopSidebarViewModel.currentPage, (page) {
String? currentPath;
desktopKey.currentState?.popUntil((route) {
DesktopDashboardPage.desktopKey.currentState?.popUntil((route) {
currentPath = route.settings.name;
return true;
});
@ -30,7 +30,7 @@ class DesktopSidebarWrapper extends StatelessWidget {
}
if (currentPath == Routes.transactionsPage) {
Navigator.of(desktopKey.currentContext!).pop();
Navigator.of(DesktopDashboardPage.desktopKey.currentContext!).pop();
}
pageController.jumpToPage(page.index);

View file

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