diff --git a/assets/svg/connected-button.svg b/assets/svg/connected-button.svg new file mode 100644 index 000000000..96a9970c0 --- /dev/null +++ b/assets/svg/connected-button.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/svg/connecting-button.svg b/assets/svg/connecting-button.svg new file mode 100644 index 000000000..1bc6e953b --- /dev/null +++ b/assets/svg/connecting-button.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/svg/disconnected-button.svg b/assets/svg/disconnected-button.svg new file mode 100644 index 000000000..03a8067d7 --- /dev/null +++ b/assets/svg/disconnected-button.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/svg/tor-circle.svg b/assets/svg/tor-circle.svg new file mode 100644 index 000000000..8268a00f6 --- /dev/null +++ b/assets/svg/tor-circle.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart b/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart index d97cb34e2..406f7ebf4 100644 --- a/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart @@ -61,7 +61,7 @@ class _TorSettingsViewState extends ConsumerState { }, ), title: Text( - "Tor Settings", + "Tor settings", style: STextStyles.navBarTitle(context), ), actions: [ diff --git a/lib/pages_desktop_specific/settings/desktop_settings_view.dart b/lib/pages_desktop_specific/settings/desktop_settings_view.dart index e1920aa0b..6a785fc8a 100644 --- a/lib/pages_desktop_specific/settings/desktop_settings_view.dart +++ b/lib/pages_desktop_specific/settings/desktop_settings_view.dart @@ -10,7 +10,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackwallet/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart'; @@ -20,6 +19,7 @@ import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/langua import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/nodes_settings.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/security_settings.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/syncing_preferences_settings.dart'; +import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart'; import 'package:stackwallet/route_generator.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/text_styles.dart'; @@ -61,8 +61,8 @@ class _DesktopSettingsViewState extends ConsumerState { const Navigator( key: Key("settingsTorDesktopKey"), onGenerateRoute: RouteGenerator.generateRoute, - initialRoute: TorSettingsView.routeName, - ), //language + initialRoute: TorSettings.routeName, + ), //tor const Navigator( key: Key("settingsNodesDesktopKey"), onGenerateRoute: RouteGenerator.generateRoute, diff --git a/lib/pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart new file mode 100644 index 000000000..6a8a8e8c8 --- /dev/null +++ b/lib/pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart @@ -0,0 +1,181 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:stackwallet/utilities/assets.dart'; +import 'package:stackwallet/utilities/text_styles.dart'; +import 'package:stackwallet/utilities/util.dart'; +import 'package:stackwallet/widgets/desktop/secondary_button.dart'; +import 'package:stackwallet/widgets/rounded_white_container.dart'; + +import '../../../../providers/global/prefs_provider.dart'; +import '../../../../themes/stack_colors.dart'; +import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; + +class TorSettings extends ConsumerStatefulWidget { + const TorSettings({Key? key}) : super(key: key); + + static const String routeName = "/torDesktopSettings"; + + @override + ConsumerState createState() => _TorSettingsState(); +} + +class _TorSettingsState extends ConsumerState { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final isDesktop = Util.isDesktop; + + return Column( + children: [ + Padding( + padding: const EdgeInsets.only( + right: 30, + ), + child: RoundedWhiteContainer( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: SvgPicture.asset( + Assets.svg.circleTor, + width: 48, + height: 48, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: SvgPicture.asset( + Assets.svg.disconnectedButton, + width: 48, + height: 48, + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Tor settings", + style: STextStyles.desktopTextSmall(context), + ), + RichText( + textAlign: TextAlign.start, + text: TextSpan( + children: [ + TextSpan( + text: + "\nConnect to the Tor Network with one click.", + style: STextStyles.desktopTextExtraExtraSmall( + context), + ), + TextSpan( + text: "\tWhat is Tor?", + style: STextStyles.richLink(context).copyWith( + fontSize: 14, + ), + recognizer: TapGestureRecognizer()..onTap = () {}, + ), + ], + ), + ), + ], + ), + ), + const SizedBox( + height: 20, + ), + SecondaryButton( + label: "Disconnect from Tor", + width: 200, + buttonHeight: ButtonHeight.m, + onPressed: () {}, + ), + const SizedBox( + height: 40, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + RichText( + textAlign: TextAlign.start, + text: TextSpan( + children: [ + TextSpan( + text: "Tor killswitch", + style: STextStyles.desktopTextExtraExtraSmall( + context) + .copyWith( + color: Theme.of(context) + .extension()! + .accentColorDark), + ), + TextSpan( + text: "\nWhat is Tor killswitch?", + style: STextStyles.richLink(context).copyWith( + fontSize: 14, + ), + recognizer: TapGestureRecognizer() + ..onTap = () {}, + ), + ], + ), + ), + ], + ), + SizedBox( + height: 20, + width: 40, + child: DraggableSwitchButton( + isOn: ref.watch( + prefsChangeNotifierProvider + .select((value) => value.torKillswitch), + ), + onValueChanged: (newValue) { + ref.read(prefsChangeNotifierProvider).torKillswitch = + newValue; + }, + ), + ), + ], + ), + const SizedBox( + height: 10, + ), + ], + ), + ), + ), + ], + ); + } +} diff --git a/lib/route_generator.dart b/lib/route_generator.dart index 4f18b32d4..38604bc33 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -167,6 +167,7 @@ import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/langua import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/nodes_settings.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/security_settings.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/syncing_preferences_settings.dart'; +import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart'; import 'package:stackwallet/services/coins/manager.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'; @@ -661,6 +662,12 @@ class RouteGenerator { builder: (_) => const TorSettingsView(), settings: RouteSettings(name: settings.name)); + case TorSettings.routeName: + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => const TorSettings(), + settings: RouteSettings(name: settings.name)); + case AboutView.routeName: return getRoute( shouldUseMaterialRoute: useMaterialPageRoute, diff --git a/lib/utilities/assets.dart b/lib/utilities/assets.dart index 2e0bd0949..9880e12c5 100644 --- a/lib/utilities/assets.dart +++ b/lib/utilities/assets.dart @@ -92,8 +92,10 @@ class _SVG { final coinControl = const _COIN_CONTROL(); - String get torConnected => "assets/svg/tor-synced.svg"; - String get torConnecting => "assets/svg/tor-syncing.svg"; + String get connectedButton => "assets/svg/connected-button.svg"; + String get connectingButton => "assets/svg/connecting-button.svg"; + String get disconnectedButton => "assets/svg/disconnected-button.svg"; + String get circleTor => "assets/svg/tor-circle.svg"; String get tor => "assets/svg/tor.svg"; String get monkey => "assets/svg/monkey.svg"; String get circleSliders => "assets/svg/configuration.svg"; diff --git a/pubspec.yaml b/pubspec.yaml index 7d69fdab6..0a52e183c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -343,8 +343,10 @@ flutter: - assets/svg/ordinal.svg - assets/svg/monkey.svg - assets/svg/tor.svg - - assets/svg/tor-syncing.svg - - assets/svg/tor-synced.svg + - assets/svg/tor-circle.svg + - assets/svg/connected-button.svg + - assets/svg/connecting-button.svg + - assets/svg/disconnected-button.svg # coin control icons - assets/svg/coin_control/