mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 02:54:30 +00:00
add tor network status to desktop home
This commit is contained in:
parent
c3aaf0574b
commit
6377b73deb
2 changed files with 83 additions and 3 deletions
|
@ -122,7 +122,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
case TorSyncStatus.unableToSync:
|
case TorSyncStatus.unableToSync:
|
||||||
return SvgPicture.asset(
|
return SvgPicture.asset(
|
||||||
Assets.svg.tor,
|
Assets.svg.tor,
|
||||||
color: Theme.of(context).extension<StackColors>()!.accentColorRed,
|
color: Theme.of(context).extension<StackColors>()!.infoItemLabel,
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
);
|
);
|
||||||
|
@ -261,7 +261,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.backgroundAppBar,
|
.backgroundAppBar,
|
||||||
icon: _buildTorIcon(TorSyncStatus.syncing),
|
icon: _buildTorIcon(TorSyncStatus.unableToSync),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.pushNamed(TorSettingsView.routeName);
|
.pushNamed(TorSettingsView.routeName);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.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_desktop_specific/desktop_menu_item.dart';
|
import 'package:stackwallet/pages_desktop_specific/desktop_menu_item.dart';
|
||||||
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
|
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
|
@ -57,6 +58,70 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
|
|
||||||
// final _buyDataLoadingService = BuyDataLoadingService();
|
// final _buyDataLoadingService = BuyDataLoadingService();
|
||||||
|
|
||||||
|
Widget _buildTorIcon(TorSyncStatus status) {
|
||||||
|
switch (status) {
|
||||||
|
case TorSyncStatus.unableToSync:
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.svg.tor,
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.infoItemLabel,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"\tDisconnected",
|
||||||
|
style: STextStyles.smallMed12(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.infoItemLabel),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
case TorSyncStatus.synced:
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.svg.tor,
|
||||||
|
color:
|
||||||
|
Theme.of(context).extension<StackColors>()!.accentColorGreen,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"\tConnected",
|
||||||
|
style: STextStyles.smallMed12(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorGreen),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
case TorSyncStatus.syncing:
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.svg.tor,
|
||||||
|
color:
|
||||||
|
Theme.of(context).extension<StackColors>()!.accentColorYellow,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"\tConnecting",
|
||||||
|
style: STextStyles.smallMed12(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorYellow),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void updateSelectedMenuItem(DesktopMenuItemId idKey) {
|
void updateSelectedMenuItem(DesktopMenuItemId idKey) {
|
||||||
widget.onSelectionWillChange?.call(idKey);
|
widget.onSelectionWillChange?.call(idKey);
|
||||||
|
|
||||||
|
@ -140,7 +205,22 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 60,
|
height: 5,
|
||||||
|
),
|
||||||
|
MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
// ref.watch(selectedSettingsMenuItemStateProvider.state).state =
|
||||||
|
// 4;
|
||||||
|
// ref.watch(selectedSettingsMenuItemStateProvider.state).state =
|
||||||
|
// 5;
|
||||||
|
// Navigator.of(context).pushNamed(DesktopHomeView.routeName);
|
||||||
|
},
|
||||||
|
child: _buildTorIcon(TorSyncStatus.unableToSync)),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 40,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
|
|
Loading…
Reference in a new issue