From 7351c583363306e3d494ce0770a11895240cbc92 Mon Sep 17 00:00:00 2001 From: grummbeer Date: Thu, 30 Mar 2023 01:51:29 +0200 Subject: [PATCH 1/3] Dialogs Mobile. Remove custom contentPadding --- flutter/lib/mobile/pages/remote_page.dart | 7 ++-- flutter/lib/mobile/pages/settings_page.dart | 39 ++++++++++----------- flutter/lib/mobile/widgets/dialog.dart | 2 -- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index 8f4efaece..083cdcd1c 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -696,10 +696,8 @@ class _RemotePageState extends State { // return CustomAlertDialog( // title: Text(translate('Physical Keyboard Input Mode')), // content: Column(mainAxisSize: MainAxisSize.min, children: [ - // getRadio('Legacy mode', 'legacy', current, setMode, - // contentPadding: EdgeInsets.zero), - // getRadio('Map mode', 'map', current, setMode, - // contentPadding: EdgeInsets.zero), + // getRadio('Legacy mode', 'legacy', current, setMode), + // getRadio('Map mode', 'map', current, setMode), // ])); // }, clickMaskDismiss: true); // } @@ -1069,7 +1067,6 @@ void showOptions( content: Column( mainAxisSize: MainAxisSize.min, children: displays + radios + toggles + more), - contentPadding: 0, ); }, clickMaskDismiss: true, backDismiss: true); } diff --git a/flutter/lib/mobile/pages/settings_page.dart b/flutter/lib/mobile/pages/settings_page.dart index c19601956..96038f983 100644 --- a/flutter/lib/mobile/pages/settings_page.dart +++ b/flutter/lib/mobile/pages/settings_page.dart @@ -502,19 +502,18 @@ void showLanguageSettings(OverlayDialogManager dialogManager) async { } return CustomAlertDialog( - title: SizedBox.shrink(), - content: Column( - children: [ - getRadio('Default', '', lang, setLang), - Divider(color: MyTheme.border), - ] + - langs.map((e) { - final key = e[0] as String; - final name = e[1] as String; - return getRadio(name, key, lang, setLang); - }).toList(), - ), - actions: []); + content: Column( + children: [ + getRadio('Default', '', lang, setLang), + Divider(color: MyTheme.border), + ] + + langs.map((e) { + final key = e[0] as String; + final name = e[1] as String; + return getRadio(name, key, lang, setLang); + }).toList(), + ), + ); }, backDismiss: true, clickMaskDismiss: true); } catch (e) { // @@ -536,14 +535,12 @@ void showThemeSettings(OverlayDialogManager dialogManager) async { } return CustomAlertDialog( - title: SizedBox.shrink(), - contentPadding: 10, - content: Column(children: [ - getRadio('Light', ThemeMode.light, themeMode, setTheme), - getRadio('Dark', ThemeMode.dark, themeMode, setTheme), - getRadio('Follow System', ThemeMode.system, themeMode, setTheme) - ]), - actions: []); + content: Column(children: [ + getRadio('Light', ThemeMode.light, themeMode, setTheme), + getRadio('Dark', ThemeMode.dark, themeMode, setTheme), + getRadio('Follow System', ThemeMode.system, themeMode, setTheme) + ]), + ); }, backDismiss: true, clickMaskDismiss: true); } diff --git a/flutter/lib/mobile/widgets/dialog.dart b/flutter/lib/mobile/widgets/dialog.dart index b281895ff..cd7e0dab0 100644 --- a/flutter/lib/mobile/widgets/dialog.dart +++ b/flutter/lib/mobile/widgets/dialog.dart @@ -132,8 +132,6 @@ void setTemporaryPasswordLengthDialog( mainAxisSize: MainAxisSize.min, children: lengths.map((e) => getRadio(e, e, length, setLength)).toList()), - actions: [], - contentPadding: 14, ); }, backDismiss: true, clickMaskDismiss: true); } From 331d2d0fc588a75584f684cb16830ff568354361 Mon Sep 17 00:00:00 2001 From: grummbeer Date: Thu, 30 Mar 2023 02:33:04 +0200 Subject: [PATCH 2/3] Dialogs Mobile. Adjust radio und checkbox tiles --- flutter/lib/common.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 2d6c5401d..49cbd6091 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1154,25 +1154,32 @@ class AndroidPermissionManager { } } +// TODO move this to mobile/widgets. +// Used only for mobile, pages remote, settings, dialog +// TODO remove argument contentPadding, it’s not used, getToggle() has not RadioListTile getRadio( String name, T toValue, T curValue, void Function(T?) onChange, {EdgeInsetsGeometry? contentPadding}) { return RadioListTile( - contentPadding: contentPadding, + contentPadding: contentPadding ?? EdgeInsets.zero, + visualDensity: VisualDensity.compact, controlAffinity: ListTileControlAffinity.trailing, title: Text(translate(name)), value: toValue, groupValue: curValue, onChanged: onChange, - dense: true, ); } +// TODO move this to mobile/widgets. +// Used only for mobile, pages remote, settings, dialog CheckboxListTile getToggle( String id, void Function(void Function()) setState, option, name, {FFI? ffi}) { final opt = bind.sessionGetToggleOptionSync(id: id, arg: option); return CheckboxListTile( + contentPadding: EdgeInsets.zero, + visualDensity: VisualDensity.compact, value: opt, onChanged: (v) { setState(() { @@ -1182,7 +1189,6 @@ CheckboxListTile getToggle( (ffi ?? gFFI).qualityMonitorModel.checkShowQualityMonitor(id); } }, - dense: true, title: Text(translate(name))); } From 18ebd2e72714bd7375a2dc4d22b20016bc75dfa0 Mon Sep 17 00:00:00 2001 From: grummbeer Date: Thu, 30 Mar 2023 04:11:48 +0200 Subject: [PATCH 3/3] Dialogs Mobile. Options for password length horizontal --- flutter/lib/mobile/widgets/dialog.dart | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/flutter/lib/mobile/widgets/dialog.dart b/flutter/lib/mobile/widgets/dialog.dart index cd7e0dab0..3f22cee7c 100644 --- a/flutter/lib/mobile/widgets/dialog.dart +++ b/flutter/lib/mobile/widgets/dialog.dart @@ -128,10 +128,19 @@ void setTemporaryPasswordLengthDialog( return CustomAlertDialog( title: Text(translate("Set one-time password length")), - content: Column( - mainAxisSize: MainAxisSize.min, - children: - lengths.map((e) => getRadio(e, e, length, setLength)).toList()), + content: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: lengths + .map( + (value) => Row( + children: [ + Text(value), + Radio( + value: value, groupValue: length, onChanged: setLength), + ], + ), + ) + .toList()), ); }, backDismiss: true, clickMaskDismiss: true); }