desktop rescanning navigation fix

This commit is contained in:
julian 2023-01-27 14:10:23 -06:00
parent c8783bb032
commit 6094a767d7
2 changed files with 48 additions and 31 deletions

View file

@ -2,6 +2,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
class RescanningDialog extends StatefulWidget {
@ -21,9 +24,12 @@ class _RescanningDialogState extends State<RescanningDialog>
late AnimationController? _spinController;
late Animation<double> _spinAnimation;
late final bool isDesktop;
// late final VoidCallback onCancel;
@override
void initState() {
isDesktop = Util.isDesktop;
// onCancel = widget.onCancel;
_spinController = AnimationController(
@ -53,6 +59,13 @@ class _RescanningDialogState extends State<RescanningDialog>
onWillPop: () async {
return false;
},
child: ConditionalParent(
condition: isDesktop,
builder: (child) => DesktopDialog(
maxHeight: 200,
maxWidth: 500,
child: child,
),
child: StackDialog(
title: "Rescanning blockchain",
message: "This may take a while. Please do not exit this screen.",
@ -62,7 +75,8 @@ class _RescanningDialogState extends State<RescanningDialog>
Assets.svg.arrowRotate3,
width: 24,
height: 24,
color: Theme.of(context).extension<StackColors>()!.accentColorDark,
color:
Theme.of(context).extension<StackColors>()!.accentColorDark,
),
),
// rightButton: TextButton(
@ -81,6 +95,7 @@ class _RescanningDialogState extends State<RescanningDialog>
// },
// ),
),
),
);
}
}

View file

@ -76,6 +76,8 @@ class _WalletNetworkSettingsViewState
StreamSubscription<dynamic>? _blocksRemainingSubscription;
// late StreamSubscription _nodeStatusSubscription;
late final bool isDesktop;
late double _percent;
late int _blocksRemaining;
bool _advancedIsExpanded = false;
@ -114,7 +116,7 @@ class _WalletNetworkSettingsViewState
if (mounted) {
// pop rescanning dialog
Navigator.pop(context);
Navigator.of(context, rootNavigator: isDesktop).pop();
// show success
await showDialog<dynamic>(
@ -132,7 +134,7 @@ class _WalletNetworkSettingsViewState
style: STextStyles.itemSubtitle12(context),
),
onPressed: () {
Navigator.of(context).pop();
Navigator.of(context, rootNavigator: isDesktop).pop();
},
),
),
@ -143,7 +145,7 @@ class _WalletNetworkSettingsViewState
if (mounted) {
// pop rescanning dialog
Navigator.pop(context);
Navigator.of(context, rootNavigator: isDesktop).pop();
// show error
await showDialog<dynamic>(
@ -162,7 +164,7 @@ class _WalletNetworkSettingsViewState
style: STextStyles.itemSubtitle12(context),
),
onPressed: () {
Navigator.of(context).pop();
Navigator.of(context, rootNavigator: isDesktop).pop();
},
),
),
@ -183,6 +185,7 @@ class _WalletNetworkSettingsViewState
@override
void initState() {
isDesktop = Util.isDesktop;
_currentSyncStatus = widget.initialSyncStatus;
// _currentNodeStatus = widget.initialNodeStatus;
if (_currentSyncStatus == WalletSyncStatus.synced) {
@ -270,7 +273,6 @@ class _WalletNetworkSettingsViewState
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final bool isDesktop = Util.isDesktop;
final progressLength = isDesktop
? 430.0