mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-09 20:29:57 +00:00
WIP: desktop dialog transitions
This commit is contained in:
parent
75d9ca6912
commit
9186be7fb6
5 changed files with 248 additions and 71 deletions
|
@ -10,6 +10,7 @@ import 'package:stackwallet/pages/settings_views/sub_widgets/nodes_list.dart';
|
|||
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/confirm_full_rescan.dart';
|
||||
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/rescanning_dialog.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/route_generator.dart';
|
||||
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/monero/monero_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart';
|
||||
|
@ -875,14 +876,22 @@ class _WalletNetworkSettingsViewState
|
|||
child: BlueTextButton(
|
||||
text: "Rescan",
|
||||
onTap: () async {
|
||||
await showDialog<dynamic>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return ConfirmFullRescanDialog(
|
||||
await Navigator.of(context).push(
|
||||
FadePageRoute<void>(
|
||||
ConfirmFullRescanDialog(
|
||||
onConfirm: _attemptRescan,
|
||||
);
|
||||
},
|
||||
),
|
||||
const RouteSettings(),
|
||||
),
|
||||
);
|
||||
// await showDialog<dynamic>(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return ConfirmFullRescanDialog(
|
||||
// onConfirm: _attemptRescan,
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/route_generator.dart';
|
||||
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
|
||||
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
|
||||
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
|
||||
|
@ -154,44 +155,103 @@ class _NetworkInfoButtonState extends ConsumerState<NetworkInfoButton> {
|
|||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (Util.isDesktop) {
|
||||
// showDialog<void>(
|
||||
// context: context,
|
||||
// builder: (context) => DesktopDialog(
|
||||
// maxHeight: MediaQuery.of(context).size.height - 64,
|
||||
// maxWidth: 580,
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// left: 32,
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// "Network",
|
||||
// style: STextStyles.desktopH3(context),
|
||||
// ),
|
||||
// const DesktopDialogCloseButton(),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 16,
|
||||
// left: 32,
|
||||
// right: 32,
|
||||
// bottom: 32,
|
||||
// ),
|
||||
// child: WalletNetworkSettingsView(
|
||||
// walletId: walletId,
|
||||
// initialSyncStatus: _currentSyncStatus,
|
||||
// initialNodeStatus: _currentNodeStatus,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => DesktopDialog(
|
||||
maxHeight: MediaQuery.of(context).size.height - 64,
|
||||
maxWidth: 580,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 32,
|
||||
builder: (context) => Navigator(
|
||||
initialRoute: WalletNetworkSettingsView.routeName,
|
||||
onGenerateRoute: RouteGenerator.generateRoute,
|
||||
onGenerateInitialRoutes: (_, __) {
|
||||
return [
|
||||
FadePageRoute(
|
||||
DesktopDialog(
|
||||
maxHeight: MediaQuery.of(context).size.height - 64,
|
||||
maxWidth: 580,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 32,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Network",
|
||||
style: STextStyles.desktopH3(context),
|
||||
),
|
||||
DesktopDialogCloseButton(
|
||||
onPressedOverride: Navigator.of(
|
||||
context,
|
||||
rootNavigator: true,
|
||||
).pop,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 16,
|
||||
left: 32,
|
||||
right: 32,
|
||||
bottom: 32,
|
||||
),
|
||||
child: WalletNetworkSettingsView(
|
||||
walletId: walletId,
|
||||
initialSyncStatus: _currentSyncStatus,
|
||||
initialNodeStatus: _currentNodeStatus,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Network",
|
||||
style: STextStyles.desktopH3(context),
|
||||
),
|
||||
const DesktopDialogCloseButton(),
|
||||
],
|
||||
const RouteSettings(
|
||||
name: WalletNetworkSettingsView.routeName,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 16,
|
||||
left: 32,
|
||||
right: 32,
|
||||
bottom: 32,
|
||||
),
|
||||
child: WalletNetworkSettingsView(
|
||||
walletId: walletId,
|
||||
initialSyncStatus: _currentSyncStatus,
|
||||
initialNodeStatus: _currentNodeStatus,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/route_generator.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
|
@ -22,6 +21,8 @@ class UnlockWalletKeysDesktop extends ConsumerStatefulWidget {
|
|||
|
||||
final String walletId;
|
||||
|
||||
static const String routeName = "/desktopUnlockWalletKeys";
|
||||
|
||||
@override
|
||||
ConsumerState<UnlockWalletKeysDesktop> createState() =>
|
||||
_UnlockWalletKeysDesktopState();
|
||||
|
@ -59,8 +60,13 @@ class _UnlockWalletKeysDesktopState
|
|||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: const [
|
||||
DesktopDialogCloseButton(),
|
||||
children: [
|
||||
DesktopDialogCloseButton(
|
||||
onPressedOverride: Navigator.of(
|
||||
context,
|
||||
rootNavigator: true,
|
||||
).pop,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
|
@ -175,7 +181,10 @@ class _UnlockWalletKeysDesktopState
|
|||
Expanded(
|
||||
child: SecondaryButton(
|
||||
label: "Cancel",
|
||||
onPressed: Navigator.of(context).pop,
|
||||
onPressed: Navigator.of(
|
||||
context,
|
||||
rootNavigator: true,
|
||||
).pop,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
|
@ -188,29 +197,35 @@ class _UnlockWalletKeysDesktopState
|
|||
onPressed: continueEnabled
|
||||
? () async {
|
||||
// todo: check password
|
||||
Navigator.of(context).pop();
|
||||
// Navigator.of(context).pop();
|
||||
final words = await ref
|
||||
.read(walletsChangeNotifierProvider)
|
||||
.getManager(widget.walletId)
|
||||
.mnemonic;
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => Navigator(
|
||||
initialRoute: WalletKeysDesktopPopup.routeName,
|
||||
onGenerateRoute: RouteGenerator.generateRoute,
|
||||
onGenerateInitialRoutes: (_, __) {
|
||||
return [
|
||||
RouteGenerator.generateRoute(
|
||||
RouteSettings(
|
||||
name: WalletKeysDesktopPopup.routeName,
|
||||
arguments: words,
|
||||
),
|
||||
)
|
||||
];
|
||||
},
|
||||
),
|
||||
|
||||
await Navigator.of(context).pushReplacementNamed(
|
||||
WalletKeysDesktopPopup.routeName,
|
||||
arguments: words,
|
||||
);
|
||||
//
|
||||
// await showDialog<void>(
|
||||
// context: context,
|
||||
// barrierDismissible: false,
|
||||
// builder: (context) => Navigator(
|
||||
// initialRoute: WalletKeysDesktopPopup.routeName,
|
||||
// onGenerateRoute: RouteGenerator.generateRoute,
|
||||
// onGenerateInitialRoutes: (_, __) {
|
||||
// return [
|
||||
// RouteGenerator.generateRoute(
|
||||
// RouteSettings(
|
||||
// name: WalletKeysDesktopPopup.routeName,
|
||||
// arguments: words,
|
||||
// ),
|
||||
// )
|
||||
// ];
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
: null,
|
||||
),
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart';
|
||||
import 'package:stackwallet/route_generator.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
|
@ -20,10 +21,29 @@ class WalletKeysButton extends StatelessWidget {
|
|||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => UnlockWalletKeysDesktop(
|
||||
walletId: walletId,
|
||||
builder: (context) => Navigator(
|
||||
initialRoute: UnlockWalletKeysDesktop.routeName,
|
||||
onGenerateRoute: RouteGenerator.generateRoute,
|
||||
onGenerateInitialRoutes: (_, __) {
|
||||
return [
|
||||
RouteGenerator.generateRoute(
|
||||
RouteSettings(
|
||||
name: UnlockWalletKeysDesktop.routeName,
|
||||
arguments: walletId,
|
||||
),
|
||||
)
|
||||
];
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
// showDialog<void>(
|
||||
// context: context,
|
||||
// barrierDismissible: false,
|
||||
// builder: (context) => UnlockWalletKeysDesktop(
|
||||
// walletId: walletId,
|
||||
// ),
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
|
|
|
@ -106,6 +106,7 @@ import 'package:stackwallet/utilities/enums/add_wallet_type_enum.dart';
|
|||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import 'pages_desktop_specific/home/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart';
|
||||
import 'pages_desktop_specific/home/settings_menu/language_settings/language_settings.dart';
|
||||
|
||||
class RouteGenerator {
|
||||
|
@ -1085,29 +1086,67 @@ class RouteGenerator {
|
|||
|
||||
case WalletKeysDesktopPopup.routeName:
|
||||
if (args is List<String>) {
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => WalletKeysDesktopPopup(
|
||||
return FadePageRoute(
|
||||
WalletKeysDesktopPopup(
|
||||
words: args,
|
||||
),
|
||||
settings: RouteSettings(
|
||||
RouteSettings(
|
||||
name: settings.name,
|
||||
),
|
||||
);
|
||||
// return getRoute(
|
||||
// shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
// builder: (_) => WalletKeysDesktopPopup(
|
||||
// words: args,
|
||||
// ),
|
||||
// settings: RouteSettings(
|
||||
// name: settings.name,
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
case UnlockWalletKeysDesktop.routeName:
|
||||
if (args is String) {
|
||||
return FadePageRoute(
|
||||
UnlockWalletKeysDesktop(
|
||||
walletId: args,
|
||||
),
|
||||
RouteSettings(
|
||||
name: settings.name,
|
||||
),
|
||||
);
|
||||
// return getRoute(
|
||||
// shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
// builder: (_) => WalletKeysDesktopPopup(
|
||||
// words: args,
|
||||
// ),
|
||||
// settings: RouteSettings(
|
||||
// name: settings.name,
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
case QRCodeDesktopPopupContent.routeName:
|
||||
if (args is String) {
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => QRCodeDesktopPopupContent(
|
||||
return FadePageRoute(
|
||||
QRCodeDesktopPopupContent(
|
||||
value: args,
|
||||
),
|
||||
settings: RouteSettings(
|
||||
RouteSettings(
|
||||
name: settings.name,
|
||||
),
|
||||
);
|
||||
// return getRoute(
|
||||
// shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
// builder: (_) => QRCodeDesktopPopupContent(
|
||||
// value: args,
|
||||
// ),
|
||||
// settings: RouteSettings(
|
||||
// name: settings.name,
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
|
@ -1181,3 +1220,37 @@ class RouteGenerator {
|
|||
builder: (_) => errorView);
|
||||
}
|
||||
}
|
||||
|
||||
class FadePageRoute<T> extends PageRoute<T> {
|
||||
FadePageRoute(this.child, RouteSettings settings) : _settings = settings;
|
||||
|
||||
final Widget child;
|
||||
final RouteSettings _settings;
|
||||
|
||||
@override
|
||||
Color? get barrierColor => null;
|
||||
|
||||
@override
|
||||
String? get barrierLabel => null;
|
||||
|
||||
@override
|
||||
Widget buildPage(
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) {
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get maintainState => true;
|
||||
|
||||
@override
|
||||
Duration get transitionDuration => const Duration(milliseconds: 100);
|
||||
|
||||
@override
|
||||
RouteSettings get settings => _settings;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue