mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-12 09:32:33 +00:00
Fix wallet create in settings
This commit is contained in:
parent
5a77aa2017
commit
3dcf5b05a5
5 changed files with 24 additions and 10 deletions
|
@ -1,4 +1,5 @@
|
|||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/entities/load_current_wallet.dart';
|
||||
|
@ -23,8 +24,11 @@ void startAuthenticationStateChange(AuthenticationStore authenticationStore,
|
|||
}
|
||||
|
||||
if (state == AuthenticationState.allowed) {
|
||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
return;
|
||||
// Temporary workaround for the issue with desktopKey dispose
|
||||
Future.delayed(Duration(milliseconds: 2), () async {
|
||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
return;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import 'package:flutter_mobx/flutter_mobx.dart';
|
|||
import 'package:mobx/mobx.dart';
|
||||
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
||||
import 'package:cake_wallet/main.dart';
|
||||
import 'package:cake_wallet/router.dart' as Router;
|
||||
|
||||
class DashboardPage extends StatelessWidget {
|
||||
DashboardPage({
|
||||
|
|
|
@ -33,7 +33,16 @@ class DesktopDashboardPage extends BasePage {
|
|||
@override
|
||||
bool get resizeToAvoidBottomInset => false;
|
||||
|
||||
|
||||
@override
|
||||
Widget Function(BuildContext, Widget) get rootWrapper =>
|
||||
(BuildContext context, Widget scaffold) => Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).accentColor,
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
Theme.of(context).primaryColor,
|
||||
], begin: Alignment.topRight, end: Alignment.bottomLeft)),
|
||||
child: scaffold);
|
||||
|
||||
|
||||
final BalancePage balancePage;
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:cake_wallet/typography.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/router.dart' as Router;
|
||||
|
||||
final _settingsNavigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
class DesktopSettingsPage extends StatefulWidget {
|
||||
const DesktopSettingsPage({super.key});
|
||||
|
@ -16,6 +15,8 @@ class DesktopSettingsPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _DesktopSettingsPageState extends State<DesktopSettingsPage> {
|
||||
GlobalKey<NavigatorState> _settingsNavigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
final int itemCount = SettingActions.all.length;
|
||||
int? currentPage;
|
||||
|
||||
|
@ -58,7 +59,7 @@ class _DesktopSettingsPageState extends State<DesktopSettingsPage> {
|
|||
onTap: () {
|
||||
if (currentPage != index) {
|
||||
final settingContext =
|
||||
_settingsNavigatorKey.currentState?.context ?? context;
|
||||
_settingsNavigatorKey.currentState!.context;
|
||||
item.onTap.call(settingContext);
|
||||
_onItemChange(index);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:cake_wallet/main.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
|
@ -100,9 +101,9 @@ class WalletListBodyState extends State<WalletListBody> {
|
|||
leftButtonText: S.of(context).cancel,
|
||||
rightButtonText: S.of(context).change,
|
||||
actionLeftButton: () =>
|
||||
Navigator.of(context).pop(false),
|
||||
Navigator.of(dialogContext).pop(false),
|
||||
actionRightButton: () =>
|
||||
Navigator.of(context).pop(true));
|
||||
Navigator.of(dialogContext).pop(true));
|
||||
}) ??
|
||||
false;
|
||||
|
||||
|
@ -233,7 +234,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
|||
auth.hideProgressText();
|
||||
auth.close();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
Navigator.of(context).pop();
|
||||
navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
});
|
||||
} catch (e) {
|
||||
auth.changeProcessText(
|
||||
|
@ -245,7 +246,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
|||
changeProcessText(S.of(context).wallet_list_loading_wallet(wallet.name));
|
||||
await widget.walletListViewModel.loadWallet(wallet);
|
||||
hideProgressText();
|
||||
Navigator.of(context).pop();
|
||||
navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||
} catch (e) {
|
||||
changeProcessText(S.of(context).wallet_list_failed_to_load(wallet.name, e.toString()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue