Skip to content

Commit

Permalink
fix: fix url is not selected on debug screen
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-struk-surf committed Mar 25, 2024
1 parent f5bae85 commit 1a8e773
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions lib/features/debug/presentation/debug/debug_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class _ServerSwitchCard extends StatelessWidget {

final ValueListenable<Url> urlState;
final ValueChanged<Url?> onUrlRadioButtonPressed;
final ValueChanged<Url> onChangeServerPressed;
final VoidCallback onChangeServerPressed;

@override
Widget build(BuildContext context) {
Expand All @@ -70,20 +70,20 @@ class _ServerSwitchCard extends StatelessWidget {
Text(l10n.debugScreenServerSubtitle),
ValueListenableBuilder<Url>(
valueListenable: urlState,
builder: (_, url, __) {
builder: (_, selectedUrl, __) {
return Column(
children: [
...Url.values.map(
(u) => RadioListTile<Url>(
(url) => RadioListTile<Url>(
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),
Expand Down
6 changes: 3 additions & 3 deletions lib/features/debug/presentation/debug/debug_wm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -107,8 +107,8 @@ class DebugScreenWM extends WidgetModel<DebugScreen, DebugModel> with Localizati
}

@override
Future<void> onChangeServerPressed(Url url) async {
await model.saveServerUrl(url);
Future<void> onChangeServerPressed() async {
await model.saveServerUrl(_serverUrlState.value);
_showReloadAppSnackBar();
}

Expand Down

0 comments on commit 1a8e773

Please sign in to comment.