Fix connection status icon not showing up and add tooltip
What changed, and why it matters
This commit is a routine user-interface bug fix. It makes a wallet connection status icon appear correctly and adds a hover/tooltip message showing connection details (such as address, Tor, or proxy port). There is no security problem or security fix here.
No security action needed. Review as a normal UI fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch exposes four previously private WalletModel fields as getters (connectionAddress, connectionProxyPort, connectionUseSsl, connectionUseTor), refactors wallet_home.dart to build a Tooltip containing a new StatusIcon widget, and rewrites status_icon.dart so the icon renders correctly for both Tor and non-Tor modes. The change is purely presentational.
Changed components
lib/models/wallet_model.dartlib/screens/wallet_home.dartlib/widgets/status_icon.dartInspect captured patch +56 / −54
diff --git a/lib/models/wallet_model.dart b/lib/models/wallet_model.dart
index 75c1f8f..4bee295 100644
--- a/lib/models/wallet_model.dart
+++ b/lib/models/wallet_model.dart
@@ -152,6 +152,10 @@ class WalletModel with ChangeNotifier {
String? _desktopWalletPassword;
Wallet2Wallet? get w2Wallet => _w2Wallet;
+ String get connectionAddress => _connectionAddress;
+ String get connectionProxyPort => _connectionProxyPort;
+ bool get connectionUseTor => _connectionUseTor;
+ bool get connectionUseSsl => _connectionUseSsl;
bool get hasAttemptedConnection => _hasAttemptedConnection;
bool get isConnected => _isConnected;
bool get isSynced => _isSynced;
diff --git a/lib/screens/wallet_home.dart b/lib/screens/wallet_home.dart
index baabba6..7dad8e2 100644
--- a/lib/screens/wallet_home.dart
+++ b/lib/screens/wallet_home.dart
@@ -194,27 +194,23 @@ class _WalletHomeScreenState extends State<WalletHomeScreen> {
}
Widget _buildStatusIcons(WalletModel wallet, StatusIconStatus lwsConnectionIconStatus) {
- return Column(
- spacing: 10,
- children: [
- if (!wallet.usingTor && lwsConnectionIconStatus == StatusIconStatus.complete)
- SizedBox(
- width: 26,
- height: 26,
- child: Icon(Icons.check_circle, size: 26, color: Colors.teal),
- ),
- if (!wallet.usingTor && lwsConnectionIconStatus == StatusIconStatus.loading)
- SizedBox(
- width: 22,
- height: 22,
- child: CircularProgressIndicator(
- constraints: BoxConstraints(maxWidth: 22, maxHeight: 22),
- strokeWidth: 2,
- ),
- ),
- if (!wallet.usingTor && lwsConnectionIconStatus == StatusIconStatus.fail)
- SizedBox(width: 26, height: 26, child: Icon(Icons.cancel, color: Colors.red)),
- ],
+ var message = lwsConnectionIconStatus == StatusIconStatus.complete
+ ? 'Connected to ${wallet.connectionUseSsl ? 'https' : 'http'}://${wallet.connectionAddress}'
+ : lwsConnectionIconStatus == StatusIconStatus.loading
+ ? 'Connecting to ${wallet.connectionUseSsl ? 'https' : 'http'}://${wallet.connectionAddress}...'
+ : 'Failed to connect to ${wallet.connectionUseSsl ? 'https' : 'http'}://${wallet.connectionAddress}';
+
+ if (wallet.connectionUseTor) {
+ message += ' via Tor';
+ }
+
+ if (wallet.connectionProxyPort != '') {
+ message += ' via proxy port ${wallet.connectionProxyPort}';
+ }
+
+ return Tooltip(
+ message: message,
+ child: StatusIcon(status: lwsConnectionIconStatus, torIsEnabled: wallet.usingTor),
);
}
diff --git a/lib/widgets/status_icon.dart b/lib/widgets/status_icon.dart
index 9e38445..860e7a2 100644
--- a/lib/widgets/status_icon.dart
+++ b/lib/widgets/status_icon.dart
@@ -1,51 +1,53 @@
import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
enum StatusIconStatus { loading, complete, fail }
class StatusIcon extends StatelessWidget {
- const StatusIcon({super.key, required this.child, required this.status});
+ const StatusIcon({super.key, required this.status, required this.torIsEnabled});
- final Widget child;
final StatusIconStatus status;
+ final bool torIsEnabled;
@override
Widget build(BuildContext context) {
final brightness = Theme.of(context).brightness;
final isDarkTheme = brightness == Brightness.dark;
- return SizedBox(
- width: 22,
- height: 22,
- child: Stack(
- fit: StackFit.loose,
- children: [
- child,
- Positioned(
- bottom: 0,
- right: 0,
- child: Container(
- width: 12,
- height: 12,
- decoration: BoxDecoration(
- color: isDarkTheme ? Colors.grey[900] : Colors.white,
- shape: BoxShape.circle,
- ),
- child: status == StatusIconStatus.complete
- ? Icon(
- Icons.check_circle_rounded,
- size: 12,
- color: Colors.teal,
- )
- : status == StatusIconStatus.fail
- ? Icon(Icons.cancel, size: 12, color: Colors.red)
- : CircularProgressIndicator(
- strokeWidth: 2,
- padding: EdgeInsets.all(2),
- ),
+ if (!torIsEnabled) {
+ return status == StatusIconStatus.complete
+ ? Icon(Icons.check_circle_rounded, size: 26, color: Colors.teal)
+ : status == StatusIconStatus.fail
+ ? Icon(Icons.cancel, size: 26, color: Colors.red)
+ : SizedBox(
+ width: 26,
+ height: 26,
+ child: CircularProgressIndicator(padding: EdgeInsets.all(3), strokeWidth: 2),
+ );
+ }
+
+ return Stack(
+ fit: StackFit.loose,
+ children: [
+ if (torIsEnabled) SvgPicture.asset('assets/icons/tor.svg', width: 22, height: 22),
+ Positioned(
+ bottom: 0,
+ right: 0,
+ child: Container(
+ width: 12,
+ height: 12,
+ decoration: BoxDecoration(
+ color: isDarkTheme ? Colors.grey[900] : Colors.white,
+ shape: BoxShape.circle,
),
+ child: status == StatusIconStatus.complete
+ ? Icon(Icons.check_circle_rounded, size: 12, color: Colors.teal)
+ : status == StatusIconStatus.fail
+ ? Icon(Icons.cancel, size: 12, color: Colors.red)
+ : CircularProgressIndicator(strokeWidth: 2, padding: EdgeInsets.all(2)),
),
- ],
- ),
+ ),
+ ],
);
}
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.