From b4e7e219a4a465f21d9cb86213e4a0e0b57bd76c Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Wed, 26 Oct 2022 16:07:37 -0600 Subject: [PATCH] started nodes dialog popup --- .../manage_nodes_views/coin_nodes_view.dart | 187 ++++++++++++------ .../settings_menu/enable_backup_dialog.dart | 0 .../home/settings_menu/nodes_settings.dart | 24 ++- 3 files changed, 141 insertions(+), 70 deletions(-) create mode 100644 lib/pages_desktop_specific/home/settings_menu/enable_backup_dialog.dart diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart index 12573042e..e3743d54e 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart @@ -7,7 +7,10 @@ import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart'; +import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; +import 'package:stackwallet/widgets/desktop/desktop_dialog.dart'; +import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart'; import 'package:tuple/tuple.dart'; class CoinNodesView extends ConsumerStatefulWidget { @@ -37,69 +40,139 @@ class _CoinNodesViewState extends ConsumerState { @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Theme.of(context).extension()!.background, - appBar: AppBar( - leading: AppBarBackButton( - onPressed: () { - Navigator.of(context).pop(); - }, - ), - title: Text( - "${widget.coin.prettyName} nodes", - style: STextStyles.navBarTitle(context), - ), - actions: [ - Padding( - padding: const EdgeInsets.only( - top: 10, - bottom: 10, - right: 10, - ), - child: AspectRatio( - aspectRatio: 1, - child: AppBarIconButton( - key: const Key("manageNodesAddNewNodeButtonKey"), - size: 36, - shadows: const [], - color: Theme.of(context).extension()!.background, - icon: SvgPicture.asset( - Assets.svg.plus, - color: Theme.of(context) - .extension()! - .accentColorDark, - width: 20, - height: 20, + if (Util.isDesktop) { + return DesktopDialog( + child: Column( + children: [ + Row( + children: [ + const SizedBox( + width: 32, ), - onPressed: () { - Navigator.of(context).pushNamed( - AddEditNodeView.routeName, - arguments: Tuple4( - AddEditNodeViewType.add, - widget.coin, - null, - CoinNodesView.routeName, + SvgPicture.asset( + Assets.svg.iconFor(coin: widget.coin), + width: 24, + height: 24, + ), + const SizedBox( + width: 12, + ), + Text( + "${widget.coin.prettyName} nodes", + style: STextStyles.desktopH3(context), + textAlign: TextAlign.center, + ), + Expanded( + child: const DesktopDialogCloseButton(), + ), + ], + ), + Padding( + padding: EdgeInsets.only( + left: 32, + right: 32, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "${widget.coin.prettyName} nodes", + style: STextStyles.desktopTextExtraSmall(context).copyWith( + color: + Theme.of(context).extension()!.textDark3, ), - ); - }, + textAlign: TextAlign.left, + ), + RichText( + text: TextSpan( + text: 'Add new nodes', + style: + STextStyles.desktopTextExtraSmall(context).copyWith( + color: Colors.blueAccent, + ), + ), + ), + ], ), ), - ), - ], - ), - body: Padding( - padding: const EdgeInsets.only( - top: 12, - left: 12, - right: 12, + const SizedBox( + width: 12, + ), + Padding( + padding: const EdgeInsets.all(20), + child: NodesList( + coin: widget.coin, + popBackToRoute: CoinNodesView.routeName, + ), + ), + ], ), - child: SingleChildScrollView( - child: NodesList( - coin: widget.coin, - popBackToRoute: CoinNodesView.routeName, + ); + } else { + return Scaffold( + backgroundColor: Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () { + Navigator.of(context).pop(); + }, + ), + title: Text( + "${widget.coin.prettyName} nodes", + style: STextStyles.navBarTitle(context), + ), + actions: [ + Padding( + padding: const EdgeInsets.only( + top: 10, + bottom: 10, + right: 10, + ), + child: AspectRatio( + aspectRatio: 1, + child: AppBarIconButton( + key: const Key("manageNodesAddNewNodeButtonKey"), + size: 36, + shadows: const [], + color: Theme.of(context).extension()!.background, + icon: SvgPicture.asset( + Assets.svg.plus, + color: Theme.of(context) + .extension()! + .accentColorDark, + width: 20, + height: 20, + ), + onPressed: () { + Navigator.of(context).pushNamed( + AddEditNodeView.routeName, + arguments: Tuple4( + AddEditNodeViewType.add, + widget.coin, + null, + CoinNodesView.routeName, + ), + ); + }, + ), + ), + ), + ], + ), + body: Padding( + padding: const EdgeInsets.only( + top: 12, + left: 12, + right: 12, + ), + child: SingleChildScrollView( + child: NodesList( + coin: widget.coin, + popBackToRoute: CoinNodesView.routeName, + ), ), ), - ), - ); + ); + } } } diff --git a/lib/pages_desktop_specific/home/settings_menu/enable_backup_dialog.dart b/lib/pages_desktop_specific/home/settings_menu/enable_backup_dialog.dart new file mode 100644 index 000000000..e69de29bb diff --git a/lib/pages_desktop_specific/home/settings_menu/nodes_settings.dart b/lib/pages_desktop_specific/home/settings_menu/nodes_settings.dart index 8608e79af..f354927c4 100644 --- a/lib/pages_desktop_specific/home/settings_menu/nodes_settings.dart +++ b/lib/pages_desktop_specific/home/settings_menu/nodes_settings.dart @@ -5,12 +5,13 @@ import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/providers/global/node_service_provider.dart'; import 'package:stackwallet/providers/global/prefs_provider.dart'; import 'package:stackwallet/utilities/assets.dart'; -import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/text_styles.dart'; -import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart'; +import '../../../pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart'; +import '../../../utilities/constants.dart'; + class NodesSettings extends ConsumerStatefulWidget { const NodesSettings({Key? key}) : super(key: key); @@ -37,9 +38,6 @@ class _NodesSettings extends ConsumerState { @override Widget build(BuildContext context) { - double deviceWidth(BuildContext context) => - MediaQuery.of(context).size.width; - bool showTestNet = ref.watch( prefsChangeNotifierProvider.select((value) => value.showTestNetCoins), ); @@ -108,18 +106,18 @@ class _NodesSettings extends ConsumerState { borderRadius: BorderRadius.circular( Constants.size.circularBorderRadius, ), - side: BorderSide( - color: Theme.of(context) - .extension()! - .shadow), + // side: BorderSide( + // color: Theme.of(context) + // .extension()! + // .shadow), ), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onPressed: () { - // Navigator.of(context).pushNamed( - // CoinNodesView.routeName, - // arguments: coin, - // ); + Navigator.of(context).pushNamed( + CoinNodesView.routeName, + arguments: coin, + ); }, child: Padding( padding: const EdgeInsets.all(