From 08eb54b3b31e63df6ad67ddf1fa275cc4715dff0 Mon Sep 17 00:00:00 2001 From: Matthew Fosse <matt@fosse.co> Date: Mon, 18 Mar 2024 14:11:19 -0700 Subject: [PATCH] make tor warning only appear if tor is enabled --- .../settings/connection_sync_page.dart | 74 ++++++++++--------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/lib/src/screens/settings/connection_sync_page.dart b/lib/src/screens/settings/connection_sync_page.dart index 03dd6f9fd..35bdc2fd4 100644 --- a/lib/src/screens/settings/connection_sync_page.dart +++ b/lib/src/screens/settings/connection_sync_page.dart @@ -118,44 +118,48 @@ class ConnectionSyncPage extends BasePage { ), ], if (FeatureFlag.isInAppTorEnabled && DeviceInfo.instance.isMobile) ...[ - if (!dashboardViewModel.torViewModel.supportsNodeProxy) - Container( - padding: const EdgeInsets.only(top: 12, bottom: 12, right: 6), - margin: const EdgeInsets.only(left: 24, right: 24, top: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(15)), - color: Color.fromARGB(200, 255, 221, 44), - border: Border.all( - color: Color.fromARGB(178, 223, 214, 0), - width: 2, - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: 48, - height: 48, - margin: EdgeInsets.only(left: 12, bottom: 48, right: 20), - child: Image.asset( - "assets/images/warning.png", - color: Color.fromARGB(128, 255, 255, 255), - ), + Observer(builder: (context) { + if (!dashboardViewModel.torViewModel.supportsNodeProxy && + dashboardViewModel.torViewModel.torConnectionMode == TorConnectionMode.enabled) + return Container( + padding: const EdgeInsets.only(top: 12, bottom: 12, right: 6), + margin: const EdgeInsets.only(left: 24, right: 24, top: 10), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(15)), + color: Color.fromARGB(200, 255, 221, 44), + border: Border.all( + color: Color.fromARGB(178, 223, 214, 0), + width: 2, ), - Expanded( - child: Text( - S.of(context).tor_node_warning, - maxLines: 5, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500, - color: Theme.of(context).extension<DashboardPageTheme>()!.textColor, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + width: 48, + height: 48, + margin: EdgeInsets.only(left: 12, bottom: 48, right: 20), + child: Image.asset( + "assets/images/warning.png", + color: Color.fromARGB(128, 255, 255, 255), ), ), - ), - ], - ), - ), + Expanded( + child: Text( + S.of(context).tor_node_warning, + maxLines: 5, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Theme.of(context).extension<DashboardPageTheme>()!.textColor, + ), + ), + ), + ], + ), + ); + return const SizedBox(); + }), Container( padding: EdgeInsets.symmetric(horizontal: 12, vertical: 10), child: Column(children: [