add desktop xpub dialog

This commit is contained in:
sneurlax 2023-04-05 16:40:01 -05:00
parent a6c793bdb9
commit 0c77537316
3 changed files with 122 additions and 26 deletions

View file

@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
class DesktopShowXpubDialog extends ConsumerStatefulWidget {
const DesktopShowXpubDialog({
Key? key,
required this.walletId,
}) : super(key: key);
final String walletId;
static const String routeName = "/desktopShowXpubDialog";
@override
ConsumerState<DesktopShowXpubDialog> createState() =>
_DesktopShowXpubDialog();
}
class _DesktopShowXpubDialog extends ConsumerState<DesktopShowXpubDialog> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return DesktopDialog(
maxWidth: 580,
maxHeight: double.infinity,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
DesktopDialogCloseButton(
onPressedOverride: Navigator.of(
context,
rootNavigator: true,
).pop,
),
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 26),
child: Column(
children: [
const SizedBox(height: 16),
Text(
"Wallet Xpub",
style: STextStyles.desktopH2(context),
),
const SizedBox(height: 50),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
PrimaryButton(
width: 250,
buttonHeight: ButtonHeight.xl,
label: "Continue",
onPressed: Navigator.of(
context,
rootNavigator: true,
).pop),
],
)
],
),
),
],
),
);
}
}

View file

@ -5,6 +5,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages_desktop_specific/addresses/desktop_wallet_addresses_view.dart'; import 'package:stackwallet/pages_desktop_specific/addresses/desktop_wallet_addresses_view.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_show_xpub_dialog.dart';
import 'package:stackwallet/route_generator.dart'; import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
@ -117,32 +118,31 @@ class _WalletOptionsButtonState extends ConsumerState<WalletOptionsButton> {
} }
break; break;
case _WalletOptions.showXpub: case _WalletOptions.showXpub:
print("TODO"); final result = await showDialog<bool?>(
// final result = await showDialog<bool?>( context: context,
// context: context, barrierDismissible: false,
// barrierDismissible: false, builder: (context) => Navigator(
// builder: (context) => Navigator( initialRoute: DesktopShowXpubDialog.routeName,
// initialRoute: DesktopShowXpubDialog.routeName, onGenerateRoute: RouteGenerator.generateRoute,
// onGenerateRoute: RouteGenerator.generateRoute, onGenerateInitialRoutes: (_, __) {
// onGenerateInitialRoutes: (_, __) { return [
// return [ RouteGenerator.generateRoute(
// RouteGenerator.generateRoute( RouteSettings(
// RouteSettings( name: DesktopShowXpubDialog.routeName,
// name: DesktopShowXpubDialog.routeName, arguments: walletId,
// arguments: walletId, ),
// ), ),
// ), ];
// ]; },
// }, ),
// ), );
// );
// if (result == true) {
// if (result == true) { if (mounted) {
// if (mounted) { Navigator.of(context).pop();
// Navigator.of(context).pop(); }
// } }
// } break;
// break;
} }
} }
}, },

View file

@ -111,6 +111,7 @@ import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/des
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/delete_wallet_keys_popup.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/delete_wallet_keys_popup.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_show_xpub_dialog.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart';
@ -1526,6 +1527,19 @@ class RouteGenerator {
} }
return _routeError("${settings.name} invalid args: ${args.toString()}"); return _routeError("${settings.name} invalid args: ${args.toString()}");
case DesktopShowXpubDialog.routeName:
if (args is String) {
return FadePageRoute(
DesktopShowXpubDialog(
walletId: args,
),
RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}");
case QRCodeDesktopPopupContent.routeName: case QRCodeDesktopPopupContent.routeName:
if (args is String) { if (args is String) {
return FadePageRoute( return FadePageRoute(