From 1d47832718addb4621cbabeb3fe53a70a26348c6 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Tue, 1 Nov 2022 16:39:47 -0600 Subject: [PATCH] WIP: needs popup for stack experience and debug info --- .../home/settings_menu/advanced_settings.dart | 153 ++++++++++++++++-- 1 file changed, 140 insertions(+), 13 deletions(-) diff --git a/lib/pages_desktop_specific/home/settings_menu/advanced_settings.dart b/lib/pages_desktop_specific/home/settings_menu/advanced_settings.dart index e470a73aa..e55326527 100644 --- a/lib/pages_desktop_specific/home/settings_menu/advanced_settings.dart +++ b/lib/pages_desktop_specific/home/settings_menu/advanced_settings.dart @@ -2,11 +2,16 @@ import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackwallet/pages/stack_privacy_calls.dart'; import 'package:stackwallet/utilities/assets.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/advanced_views/debug_view.dart'; +import '../../../providers/global/prefs_provider.dart'; +import '../../../widgets/custom_buttons/draggable_switch_button.dart'; + class AdvancedSettings extends ConsumerStatefulWidget { const AdvancedSettings({Key? key}) : super(key: key); @@ -58,16 +63,106 @@ class _AdvancedSettings extends ConsumerState { ), ), ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: const [ - Padding( - padding: EdgeInsets.all( - 10, + const Padding( + padding: EdgeInsets.all(10.0), + child: Divider( + thickness: 0.5, + ), + ), + Padding( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Toggle testnet coins", + style: STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark), + textAlign: TextAlign.left, + ), + SizedBox( + height: 20, + width: 40, + child: DraggableSwitchButton( + isOn: ref.watch( + prefsChangeNotifierProvider + .select((value) => value.showTestNetCoins), + ), + onValueChanged: (newValue) { + ref + .read(prefsChangeNotifierProvider) + .showTestNetCoins = newValue; + }, + ), + ), + ], + ), + ), + const Padding( + padding: EdgeInsets.all(10.0), + child: Divider( + thickness: 0.5, + ), + ), + + /// TODO: Make a dialog popup + Padding( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Stack Experience", + style: + STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark), + textAlign: TextAlign.left, + ), + Text( + "Easy Crypto", + style: STextStyles.desktopTextExtraExtraSmall( + context), + ), + ], + ), + const StackPrivacyButton(), + ], + ), + ), + const Padding( + padding: EdgeInsets.all(10.0), + child: Divider( + thickness: 0.5, + ), + ), + + /// TODO: Make a dialog popup + Padding( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Debug info", + style: STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark), + textAlign: TextAlign.left, + ), + ShowLogsButton(), + ], ), - child: ShowLogsButton(), ), ], ), @@ -80,6 +175,35 @@ class _AdvancedSettings extends ConsumerState { } } +class StackPrivacyButton extends ConsumerWidget { + const StackPrivacyButton({ + Key? key, + }) : super(key: key); + @override + Widget build(BuildContext context, WidgetRef ref) { + return SizedBox( + width: 84, + height: 37, + child: TextButton( + style: Theme.of(context) + .extension()! + .getPrimaryEnabledButtonColor(context), + onPressed: () { + Navigator.of(context).pushNamed( + StackPrivacyCalls.routeName, + arguments: false, + ); + }, + child: Text( + "Change", + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith(color: Colors.white), + ), + ), + ); + } +} + class ShowLogsButton extends ConsumerWidget { const ShowLogsButton({ Key? key, @@ -87,16 +211,19 @@ class ShowLogsButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return SizedBox( - width: 200, - height: 48, + width: 101, + height: 37, child: TextButton( style: Theme.of(context) .extension()! .getPrimaryEnabledButtonColor(context), - onPressed: () {}, + onPressed: () { + Navigator.of(context).pushNamed(DebugView.routeName); + }, child: Text( "Show logs", - style: STextStyles.button(context), + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith(color: Colors.white), ), ), );