diff --git a/assets/svg/tor-synced.svg b/assets/svg/tor-synced.svg
new file mode 100644
index 000000000..20cff1f37
--- /dev/null
+++ b/assets/svg/tor-synced.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/svg/tor-syncing.svg b/assets/svg/tor-syncing.svg
new file mode 100644
index 000000000..b51803c70
--- /dev/null
+++ b/assets/svg/tor-syncing.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/svg/tor.svg b/assets/svg/tor.svg
new file mode 100644
index 000000000..a893c0907
--- /dev/null
+++ b/assets/svg/tor.svg
@@ -0,0 +1,4 @@
+
diff --git a/lib/pages/settings_views/global_settings_view/global_settings_view.dart b/lib/pages/settings_views/global_settings_view/global_settings_view.dart
index 7cadc1a77..29984b928 100644
--- a/lib/pages/settings_views/global_settings_view/global_settings_view.dart
+++ b/lib/pages/settings_views/global_settings_view/global_settings_view.dart
@@ -25,6 +25,7 @@ import 'package:stackwallet/pages/settings_views/global_settings_view/stack_back
import 'package:stackwallet/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/support_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart';
+import 'package:stackwallet/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart';
import 'package:stackwallet/pages/settings_views/sub_widgets/settings_list_button.dart';
import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/themes/stack_colors.dart';
@@ -159,6 +160,18 @@ class GlobalSettingsView extends StatelessWidget {
const SizedBox(
height: 8,
),
+ SettingsListButton(
+ iconAssetName: Assets.svg.tor,
+ iconSize: 18,
+ title: "Tor Settings",
+ onPressed: () {
+ Navigator.of(context)
+ .pushNamed(TorSettingsView.routeName);
+ },
+ ),
+ const SizedBox(
+ height: 8,
+ ),
SettingsListButton(
iconAssetName: Assets.svg.node,
iconSize: 16,
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
new file mode 100644
index 000000000..d97cb34e2
--- /dev/null
+++ b/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart
@@ -0,0 +1,200 @@
+/*
+ * 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/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+import 'package:stackwallet/providers/global/prefs_provider.dart';
+import 'package:stackwallet/themes/stack_colors.dart';
+import 'package:stackwallet/utilities/assets.dart';
+import 'package:stackwallet/utilities/constants.dart';
+import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/util.dart';
+import 'package:stackwallet/widgets/background.dart';
+import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
+import 'package:stackwallet/widgets/custom_buttons/draggable_switch_button.dart';
+import 'package:stackwallet/widgets/desktop/secondary_button.dart';
+import 'package:stackwallet/widgets/rounded_white_container.dart';
+import 'package:stackwallet/widgets/stack_dialog.dart';
+
+class TorSettingsView extends ConsumerStatefulWidget {
+ const TorSettingsView({Key? key}) : super(key: key);
+
+ static const String routeName = "/torSettings";
+
+ @override
+ ConsumerState createState() => _TorSettingsViewState();
+}
+
+class _TorSettingsViewState extends ConsumerState {
+ @override
+ void initState() {
+ super.initState();
+ }
+
+ @override
+ void dispose() {
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final isDesktop = Util.isDesktop;
+
+ return Background(
+ child: Scaffold(
+ backgroundColor: Colors.transparent,
+ appBar: AppBar(
+ automaticallyImplyLeading: false,
+ backgroundColor:
+ Theme.of(context).extension()!.backgroundAppBar,
+ leading: AppBarBackButton(
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
+ ),
+ title: Text(
+ "Tor Settings",
+ style: STextStyles.navBarTitle(context),
+ ),
+ actions: [
+ AspectRatio(
+ aspectRatio: 1,
+ child: AppBarIconButton(
+ icon: SvgPicture.asset(
+ Assets.svg.circleQuestion,
+ ),
+ onPressed: () {
+ showDialog(
+ context: context,
+ useSafeArea: false,
+ barrierDismissible: true,
+ builder: (context) {
+ return const StackDialog(
+ title: "What is Tor?",
+ message:
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
+ "Sed sit amet nulla accumsan, ornare felis pellentesque, auctor nulla.",
+ rightButton: SecondaryButton(
+ label: "Close",
+ ),
+ );
+ },
+ );
+ },
+ ),
+ ),
+ ],
+ ),
+ body: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(10.0),
+ child: SvgPicture.asset(
+ Assets.svg.tor,
+ height: 200,
+ width: 200,
+ ),
+ ),
+ ],
+ ),
+ SizedBox(
+ height: 30,
+ ),
+ RoundedWhiteContainer(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8.0),
+ child: Row(
+ children: [
+ Text(
+ "Tor status",
+ style: STextStyles.titleBold12(context),
+ ),
+ const Spacer(),
+ Text(
+ "Tor network status",
+ style: STextStyles.itemSubtitle(context),
+ ),
+ ],
+ ),
+ ),
+ ),
+ SizedBox(
+ height: 8,
+ ),
+ RoundedWhiteContainer(
+ child: Consumer(
+ builder: (_, ref, __) {
+ return RawMaterialButton(
+ // splashColor: Theme.of(context).extension()!.highlight,
+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ onPressed: null,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Row(
+ children: [
+ Text(
+ "Tor killswitch",
+ style: STextStyles.titleBold12(context),
+ ),
+ const SizedBox(width: 8),
+ SvgPicture.asset(
+ Assets.svg.circleInfo,
+ height: 16,
+ width: 16,
+ color: Theme.of(context)
+ .extension()!
+ .infoItemLabel,
+ ),
+ ],
+ ),
+ SizedBox(
+ height: 20,
+ width: 40,
+ child: DraggableSwitchButton(
+ isOn: ref.watch(
+ prefsChangeNotifierProvider
+ .select((value) => value.torKillswitch),
+ ),
+ onValueChanged: (newValue) {
+ ref
+ .read(prefsChangeNotifierProvider)
+ .torKillswitch = newValue;
+ },
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ },
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/route_generator.dart b/lib/route_generator.dart
index 344eb7876..4f18b32d4 100644
--- a/lib/route_generator.dart
+++ b/lib/route_generator.dart
@@ -110,6 +110,7 @@ import 'package:stackwallet/pages/settings_views/global_settings_view/support_vi
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart';
+import 'package:stackwallet/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_view.dart';
@@ -654,6 +655,12 @@ class RouteGenerator {
builder: (_) => const LanguageSettingsView(),
settings: RouteSettings(name: settings.name));
+ case TorSettingsView.routeName:
+ return getRoute(
+ shouldUseMaterialRoute: useMaterialPageRoute,
+ builder: (_) => const TorSettingsView(),
+ 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 d1d7a55d8..2e0bd0949 100644
--- a/lib/utilities/assets.dart
+++ b/lib/utilities/assets.dart
@@ -92,6 +92,9 @@ 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 tor => "assets/svg/tor.svg";
String get monkey => "assets/svg/monkey.svg";
String get circleSliders => "assets/svg/configuration.svg";
String get circlePlus => "assets/svg/plus-circle.svg";
diff --git a/lib/utilities/prefs.dart b/lib/utilities/prefs.dart
index 7c306bfe5..3168d75f2 100644
--- a/lib/utilities/prefs.dart
+++ b/lib/utilities/prefs.dart
@@ -42,6 +42,7 @@ class Prefs extends ChangeNotifier {
_lastUnlocked = await _getLastUnlocked();
_lastUnlockedTimeout = await _getLastUnlockedTimeout();
_showTestNetCoins = await _getShowTestNetCoins();
+ _torKillswitch = await _getTorKillswitch();
_isAutoBackupEnabled = await _getIsAutoBackupEnabled();
_autoBackupLocation = await _getAutoBackupLocation();
_backupFrequencyType = await _getBackupFrequencyType();
@@ -393,6 +394,27 @@ class Prefs extends ChangeNotifier {
0;
}
+ // tor
+
+ bool _torKillswitch = false;
+
+ bool get torKillswitch => _torKillswitch;
+
+ set torKillswitch(bool torKillswitch) {
+ if (_torKillswitch != showTestNetCoins) {
+ DB.instance.put(
+ boxName: DB.boxNamePrefs, key: "torKillswitch", value: torKillswitch);
+ _torKillswitch = torKillswitch;
+ notifyListeners();
+ }
+ }
+
+ Future _getTorKillswitch() async {
+ return await DB.instance.get(
+ boxName: DB.boxNamePrefs, key: "torKillswitch") as bool? ??
+ false;
+ }
+
// show testnet coins
bool _showTestNetCoins = false;
diff --git a/pubspec.yaml b/pubspec.yaml
index dbb5ecfe5..7d69fdab6 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -342,6 +342,9 @@ flutter:
- assets/svg/send.svg
- assets/svg/ordinal.svg
- assets/svg/monkey.svg
+ - assets/svg/tor.svg
+ - assets/svg/tor-syncing.svg
+ - assets/svg/tor-synced.svg
# coin control icons
- assets/svg/coin_control/