TorSyncStatusEvent->TorConnectionStatusEvent

and rename file
This commit is contained in:
sneurlax 2023-09-07 15:44:53 -05:00
parent 3e36723da3
commit a8ed46d804
4 changed files with 27 additions and 27 deletions

View file

@ -17,7 +17,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/buy_view/buy_view.dart';
import 'package:stackwallet/pages/exchange_view/exchange_view.dart';
import 'package:stackwallet/pages/home_view/sub_widgets/home_view_button_bar.dart';
import 'package:stackwallet/pages/home_view/sub_widgets/tor_sync_status_changed_event.dart';
import 'package:stackwallet/pages/home_view/sub_widgets/tor_connection_status_changed_event.dart';
import 'package:stackwallet/pages/notification_views/notifications_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/global_settings_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart';
@ -57,7 +57,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
bool _exitEnabled = false;
late TorSyncStatus _currentSyncStatus;
late TorConnectionStatus _currentSyncStatus;
// final _buyDataLoadingService = BuyDataLoadingService();
@ -117,23 +117,23 @@ class _HomeViewState extends ConsumerState<HomeView> {
);
}
Widget _buildTorIcon(TorSyncStatus status) {
Widget _buildTorIcon(TorConnectionStatus status) {
switch (status) {
case TorSyncStatus.unableToSync:
case TorConnectionStatus.unableToConnect:
return SvgPicture.asset(
Assets.svg.tor,
color: Theme.of(context).extension<StackColors>()!.textSubtitle3,
width: 20,
height: 20,
);
case TorSyncStatus.synced:
case TorConnectionStatus.connected:
return SvgPicture.asset(
Assets.svg.tor,
color: Theme.of(context).extension<StackColors>()!.accentColorGreen,
width: 20,
height: 20,
);
case TorSyncStatus.syncing:
case TorConnectionStatus.connecting:
return SvgPicture.asset(
Assets.svg.tor,
color: Theme.of(context).extension<StackColors>()!.accentColorYellow,
@ -261,7 +261,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
color: Theme.of(context)
.extension<StackColors>()!
.backgroundAppBar,
icon: _buildTorIcon(TorSyncStatus.unableToSync),
icon: _buildTorIcon(TorConnectionStatus.unableToConnect),
onPressed: () {
Navigator.of(context)
.pushNamed(TorSettingsView.routeName);

View file

@ -9,12 +9,12 @@
*/
import 'package:stackwallet/utilities/logger.dart';
enum TorSyncStatus { unableToSync, synced, syncing }
enum TorConnectionStatus { unableToConnect, connected, connecting }
class TorSyncStatusChangedEvent {
TorSyncStatus newStatus;
class TorConnectionStatusChangedEvent {
TorConnectionStatus newStatus;
TorSyncStatusChangedEvent(this.newStatus) {
TorConnectionStatusChangedEvent(this.newStatus) {
Logging.instance.log(
"TorSyncStatusChangedEvent fired with arg newStatus = $newStatus",
level: LogLevel.Info);

View file

@ -11,7 +11,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/pages/home_view/sub_widgets/tor_sync_status_changed_event.dart';
import 'package:stackwallet/pages/home_view/sub_widgets/tor_connection_status_changed_event.dart';
import 'package:stackwallet/providers/global/prefs_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart';
@ -35,11 +35,11 @@ class TorSettingsView extends ConsumerStatefulWidget {
}
class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
TorSyncStatus _networkStatus = TorSyncStatus.unableToSync;
TorConnectionStatus _networkStatus = TorConnectionStatus.unableToConnect;
Widget _buildTorIcon(TorSyncStatus status) {
Widget _buildTorIcon(TorConnectionStatus status) {
switch (status) {
case TorSyncStatus.unableToSync:
case TorConnectionStatus.unableToConnect:
return Stack(
alignment: AlignmentDirectional.center,
children: [
@ -56,7 +56,7 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
)
],
);
case TorSyncStatus.synced:
case TorConnectionStatus.connected:
return Stack(
alignment: AlignmentDirectional.center,
children: [
@ -74,7 +74,7 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
)
],
);
case TorSyncStatus.syncing:
case TorConnectionStatus.connecting:
return Stack(
alignment: AlignmentDirectional.center,
children: [
@ -95,22 +95,22 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
}
}
Widget _buildTorStatus(TorSyncStatus status) {
Widget _buildTorStatus(TorConnectionStatus status) {
switch (status) {
case TorSyncStatus.unableToSync:
case TorConnectionStatus.unableToConnect:
return Text(
"Disconnected",
style: STextStyles.itemSubtitle(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textSubtitle3),
);
case TorSyncStatus.synced:
case TorConnectionStatus.connected:
return Text(
"Connected",
style: STextStyles.itemSubtitle(context).copyWith(
color:
Theme.of(context).extension<StackColors>()!.accentColorGreen),
);
case TorSyncStatus.syncing:
case TorConnectionStatus.connecting:
return Text(
"Connecting",
style: STextStyles.itemSubtitle(context).copyWith(

View file

@ -14,7 +14,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/pages/home_view/sub_widgets/tor_sync_status_changed_event.dart';
import 'package:stackwallet/pages/home_view/sub_widgets/tor_connection_status_changed_event.dart';
import 'package:stackwallet/pages_desktop_specific/desktop_menu_item.dart';
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu.dart';
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
@ -59,9 +59,9 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
// final _buyDataLoadingService = BuyDataLoadingService();
Widget _buildTorIcon(TorSyncStatus status) {
Widget _buildTorIcon(TorConnectionStatus status) {
switch (status) {
case TorSyncStatus.unableToSync:
case TorConnectionStatus.unableToConnect:
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -80,7 +80,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
)
],
);
case TorSyncStatus.synced:
case TorConnectionStatus.connected:
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -100,7 +100,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
)
],
);
case TorSyncStatus.syncing:
case TorConnectionStatus.connecting:
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -218,7 +218,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
.watch(selectedSettingsMenuItemStateProvider.state)
.state = 4;
},
child: _buildTorIcon(TorSyncStatus.unableToSync)),
child: _buildTorIcon(TorConnectionStatus.unableToConnect)),
),
const SizedBox(
height: 40,