feat: add tor icon to sync bar (#2359)
* feat: add tor icon to sync bar * minor readability [skip ci] --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
cyan committed
Jul 4, 2025 at 01:48 UTC
068558d0c8c03f750a8f9fbeb50ab5d2efedae57
4 files changed
+22
-3
assets/images/tor.svg
new
+6
@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+<svg fill="#000000" width="800px" height="800px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
4
+<title>torbrowser</title>
5
+<path d="M1.004 16c0 8.282 6.714 14.996 14.996 14.996s14.996-6.714 14.996-14.996c0-8.282-6.714-14.996-14.996-14.996-4.141 0-7.89 1.678-10.604 4.392v0c-2.714 2.714-4.392 6.463-4.392 10.604v0zM16 12.826c0.008-0 0.018-0 0.028-0 1.753 0 3.174 1.421 3.174 3.174s-1.421 3.174-3.174 3.174c-0.010 0-0.019-0-0.029-0h0.001zM16 21.911c3.264 0 5.911-2.646 5.911-5.911s-2.646-5.911-5.911-5.911v0-1.812c4.265 0 7.723 3.458 7.723 7.723s-3.458 7.723-7.723 7.723v0zM16 28.271v-1.824c5.77 0 10.447-4.677 10.447-10.447s-4.677-10.447-10.447-10.447v-1.824c6.771 0.009 12.256 5.5 12.256 12.271s-5.485 12.263-12.255 12.271h-0.001z"></path>
6
+</svg>
\ No newline at end of file
lib/src/screens/dashboard/widgets/sync_indicator.dart
+5
-1
@@ -58,7 +58,11 @@ class SyncIndicator extends StatelessWidget {
58
mainAxisAlignment: MainAxisAlignment.center,
59
crossAxisAlignment: CrossAxisAlignment.center,
60
children: <Widget>[
61
- SyncIndicatorIcon(isSynced: status is SyncedSyncStatus),
61
+ SyncIndicatorIcon(
62
+ isSynced: status is SyncedSyncStatus,
63
+ showTorIcon: dashboardViewModel.builtinTor,
64
+ size: dashboardViewModel.builtinTor ? 16 : 6,
65
+ ),
66
Padding(
67
padding: EdgeInsets.only(left: 6),
68
child: Text(
lib/src/screens/dashboard/widgets/sync_indicator_icon.dart
+8
-2
@@ -1,14 +1,16 @@
1
import 'package:cake_wallet/themes/utils/custom_theme_colors.dart';
2
import 'package:flutter/material.dart';
3
+import 'package:flutter_svg/svg.dart';
4
5
class SyncIndicatorIcon extends StatelessWidget {
6
SyncIndicatorIcon(
6
- {this.boolMode = true, this.isSynced = false, this.value = waiting, this.size = 6.0});
7
+ {this.boolMode = true, this.isSynced = false, this.value = waiting, this.size = 6.0, this.showTorIcon = false});
8
9
final bool boolMode;
10
final bool isSynced;
11
final String value;
12
final double size;
13
+ final bool showTorIcon;
14
15
static const String waiting = 'waiting';
16
static const String actionRequired = 'action required';
@@ -46,10 +48,14 @@ class SyncIndicatorIcon extends StatelessWidget {
48
return Container(
49
height: size,
50
width: size,
49
- decoration: BoxDecoration(
51
+ decoration: showTorIcon ? null : BoxDecoration(
52
shape: BoxShape.circle,
53
color: indicatorColor,
54
),
55
+ child: showTorIcon ? SvgPicture.asset(
56
+ "assets/images/tor.svg",
57
+ color: indicatorColor,
58
+ ) : null,
59
);
60
}
61
}
lib/view_model/dashboard/dashboard_view_model.dart
+3
@@ -388,6 +388,9 @@ abstract class DashboardViewModelBase with Store {
388
@computed
389
String get address => wallet.walletAddresses.address;
390
391
+ @computed
392
+ bool get isTorEnabled => CakeTor.instance.enabled;
393
+
394
@computed
395
SyncStatus get status => wallet.syncStatus;
396