From 1a8e773c6b3444c5066bf12bf2845a5962a4f7b7 Mon Sep 17 00:00:00 2001 From: dzmitry-struk-surf Date: Mon, 25 Mar 2024 15:48:02 +0300 Subject: [PATCH] fix: fix url is not selected on debug screen --- .../debug/presentation/debug/debug_screen.dart | 10 +++++----- lib/features/debug/presentation/debug/debug_wm.dart | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/features/debug/presentation/debug/debug_screen.dart b/lib/features/debug/presentation/debug/debug_screen.dart index b7ae710e..6889dde1 100644 --- a/lib/features/debug/presentation/debug/debug_screen.dart +++ b/lib/features/debug/presentation/debug/debug_screen.dart @@ -56,7 +56,7 @@ class _ServerSwitchCard extends StatelessWidget { final ValueListenable urlState; final ValueChanged onUrlRadioButtonPressed; - final ValueChanged onChangeServerPressed; + final VoidCallback onChangeServerPressed; @override Widget build(BuildContext context) { @@ -70,20 +70,20 @@ class _ServerSwitchCard extends StatelessWidget { Text(l10n.debugScreenServerSubtitle), ValueListenableBuilder( valueListenable: urlState, - builder: (_, url, __) { + builder: (_, selectedUrl, __) { return Column( children: [ ...Url.values.map( - (u) => RadioListTile( + (url) => RadioListTile( value: url, - groupValue: url, + groupValue: selectedUrl, onChanged: onUrlRadioButtonPressed, title: Text(url.toString()), subtitle: Text(url.value), ), ), MaterialButton( - onPressed: () => onChangeServerPressed(url), + onPressed: onChangeServerPressed, child: Text( l10n.debugScreenServerConnectButton, style: const TextStyle(fontSize: AppSizes.double16), diff --git a/lib/features/debug/presentation/debug/debug_wm.dart b/lib/features/debug/presentation/debug/debug_wm.dart index c0bf182c..750bba50 100644 --- a/lib/features/debug/presentation/debug/debug_wm.dart +++ b/lib/features/debug/presentation/debug/debug_wm.dart @@ -46,7 +46,7 @@ abstract interface class IDebugScreenWM with ILocalizationMixin implements IWidg void onUrlRadioButtonPressed(Url? url); /// Callback of pressed on the server change button. - void onChangeServerPressed(Url url); + void onChangeServerPressed(); /// Callback of pressed on the connect proxy button. void onConnectProxyPressed(); @@ -107,8 +107,8 @@ class DebugScreenWM extends WidgetModel with Localizati } @override - Future onChangeServerPressed(Url url) async { - await model.saveServerUrl(url); + Future onChangeServerPressed() async { + await model.saveServerUrl(_serverUrlState.value); _showReloadAppSnackBar(); }