This commit is contained in:
Matthew Fosse 2024-01-04 13:48:57 -05:00
parent e407a6d385
commit 56e026e422
3 changed files with 35 additions and 37 deletions
lib
src/screens/settings
view_model/settings

View file

@ -106,23 +106,24 @@ class ConnectionSyncPage extends BasePage {
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25), topRight: Radius.circular(25)),
color: Theme.of(context).extension<SyncIndicatorTheme>()!.notSyncedBackgroundColor,
color: Theme.of(context)
.extension<SyncIndicatorTheme>()!
.notSyncedBackgroundColor,
),
);
}),
Observer(builder: (context) {
return TorStatus(
torViewModel: dashboardViewModel.torViewModel,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(25), bottomRight: Radius.circular(25)),
color: Theme.of(context).extension<SyncIndicatorTheme>()!.notSyncedBackgroundColor,
),
title: S.current.tor_status,
isSelected: false,
onTap: (context) {},
);
}),
TorStatus(
torViewModel: dashboardViewModel.torViewModel,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(25), bottomRight: Radius.circular(25)),
color:
Theme.of(context).extension<SyncIndicatorTheme>()!.notSyncedBackgroundColor,
),
title: S.current.tor_status,
isSelected: false,
onTap: (context) {},
),
]),
),
],

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:cake_wallet/view_model/settings/tor_view_model.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
class TorStatus extends StandardListRow {
TorStatus(
@ -19,23 +20,25 @@ class TorStatus extends StandardListRow {
@override
Widget buildTrailing(BuildContext context) {
Color? color;
String? text;
switch (torViewModel.torConnectionStatus) {
case TorConnectionStatus.connected:
color = Palette.green;
text = S.current.connected;
break;
case TorConnectionStatus.connecting:
color = Colors.amber;
text = S.current.connecting;
break;
case TorConnectionStatus.disconnected:
color = Palette.red;
text = S.current.disconnected;
break;
}
return NodeIndicator(color: color, text: text);
return Observer(builder: (context) {
Color? color;
String? text;
switch (torViewModel.torConnectionStatus) {
case TorConnectionStatus.connected:
color = Palette.green;
text = S.current.connected;
break;
case TorConnectionStatus.connecting:
color = Colors.amber;
text = S.current.connecting;
break;
case TorConnectionStatus.disconnected:
color = Palette.red;
text = S.current.disconnected;
break;
}
return NodeIndicator(color: color, text: text);
});
}
}

View file

@ -25,12 +25,6 @@ abstract class TorViewModelBase with Store {
@action
void setTorConnectionMode(TorConnectionMode mode) => _settingsStore.torConnectionMode = mode;
// @computed
// bool get isTorConnected =>
// (_settingsStore.torConnectionMode == TorConnectionMode.enabled ||
// _settingsStore.torConnectionMode == TorConnectionMode.onionOnly) &&
// (Tor.instance.port != -1);
@computed
TorConnectionStatus get torConnectionStatus {