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>
This commit is contained in:
cyan
2025-07-04 02:48:50 +03:00
committed by GitHub
co-authored by Omar Hatem
parent d9fc4d7b57
commit 068558d0c8
4 changed files with 22 additions and 3 deletions
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
<title>torbrowser</title>
<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>
</svg>

After

Width:  |  Height:  |  Size: 892 B

@@ -58,7 +58,11 @@ class SyncIndicator extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SyncIndicatorIcon(isSynced: status is SyncedSyncStatus),
SyncIndicatorIcon(
isSynced: status is SyncedSyncStatus,
showTorIcon: dashboardViewModel.builtinTor,
size: dashboardViewModel.builtinTor ? 16 : 6,
),
Padding(
padding: EdgeInsets.only(left: 6),
child: Text(
@@ -1,14 +1,16 @@
import 'package:cake_wallet/themes/utils/custom_theme_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class SyncIndicatorIcon extends StatelessWidget {
SyncIndicatorIcon(
{this.boolMode = true, this.isSynced = false, this.value = waiting, this.size = 6.0});
{this.boolMode = true, this.isSynced = false, this.value = waiting, this.size = 6.0, this.showTorIcon = false});
final bool boolMode;
final bool isSynced;
final String value;
final double size;
final bool showTorIcon;
static const String waiting = 'waiting';
static const String actionRequired = 'action required';
@@ -46,10 +48,14 @@ class SyncIndicatorIcon extends StatelessWidget {
return Container(
height: size,
width: size,
decoration: BoxDecoration(
decoration: showTorIcon ? null : BoxDecoration(
shape: BoxShape.circle,
color: indicatorColor,
),
child: showTorIcon ? SvgPicture.asset(
"assets/images/tor.svg",
color: indicatorColor,
) : null,
);
}
}
@@ -388,6 +388,9 @@ abstract class DashboardViewModelBase with Store {
@computed
String get address => wallet.walletAddresses.address;
@computed
bool get isTorEnabled => CakeTor.instance.enabled;
@computed
SyncStatus get status => wallet.syncStatus;