started nodes dialog popup

This commit is contained in:
ryleedavis 2022-10-26 16:07:37 -06:00
parent ab5190562d
commit b4e7e219a4
3 changed files with 141 additions and 70 deletions

View file

@ -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<CoinNodesView> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.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<StackColors>()!.background,
icon: SvgPicture.asset(
Assets.svg.plus,
color: Theme.of(context)
.extension<StackColors>()!
.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<StackColors>()!.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<StackColors>()!.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<StackColors>()!.background,
icon: SvgPicture.asset(
Assets.svg.plus,
color: Theme.of(context)
.extension<StackColors>()!
.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,
),
),
),
),
);
);
}
}
}

View file

@ -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<NodesSettings> {
@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<NodesSettings> {
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
side: BorderSide(
color: Theme.of(context)
.extension<StackColors>()!
.shadow),
// side: BorderSide(
// color: Theme.of(context)
// .extension<StackColors>()!
// .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(