From 77b86da4930882214cf9c97db9cff82f7359bada Mon Sep 17 00:00:00 2001 From: Moritz Weber Date: Sat, 23 Jul 2022 14:34:51 +0200 Subject: [PATCH] improvement of SwitchTextListTile --- .../pages/smart_list_form_page.dart | 14 ++++++++--- .../widgets/switch_text_listtile.dart | 23 +++++++++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/lib/presentation/pages/smart_list_form_page.dart b/lib/presentation/pages/smart_list_form_page.dart index 0c7f3cb..cbd9b28 100644 --- a/lib/presentation/pages/smart_list_form_page.dart +++ b/lib/presentation/pages/smart_list_form_page.dart @@ -115,7 +115,10 @@ class _SmartListFormPageState extends State { borderSide: BorderSide.none, borderRadius: BorderRadius.all(Radius.circular(4.0)), ), - contentPadding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 8.0), + contentPadding: const EdgeInsets.symmetric( + vertical: 4.0, + horizontal: 8.0, + ), ), ), ), @@ -133,7 +136,9 @@ class _SmartListFormPageState extends State { child: Observer( builder: (_) { final RangeValues _currentRangeValues = RangeValues( - store.minLikeCount.toDouble(), store.maxLikeCount.toDouble()); + store.minLikeCount.toDouble(), + store.maxLikeCount.toDouble(), + ); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -363,7 +368,10 @@ class _SmartListFormPageState extends State { ], ), const Spacer(), - const Icon(Icons.chevron_right_rounded), + const SizedBox( + width: 56.0, + child: Icon(Icons.chevron_right_rounded), + ), ], ), ), diff --git a/lib/presentation/widgets/switch_text_listtile.dart b/lib/presentation/widgets/switch_text_listtile.dart index 752c745..13353b2 100644 --- a/lib/presentation/widgets/switch_text_listtile.dart +++ b/lib/presentation/widgets/switch_text_listtile.dart @@ -10,7 +10,7 @@ class SwitchTextListTile extends StatelessWidget { required this.onSwitchChanged, required this.textValue, required this.onTextChanged, - this.errorText, + this.errorText, }) : super(key: key); final String title; @@ -33,11 +33,24 @@ class SwitchTextListTile extends StatelessWidget { onChanged: (bool value) => onSwitchChanged(value), ), ), - const SizedBox(width: 6.0), - Text(title), - const Spacer(), + Expanded( + child: GestureDetector( + onTap: () => onSwitchChanged(!switchValue), + child: Container( + color: Colors.transparent, + height: 48.0, + child: Row( + children: [ + const SizedBox(width: 6.0), + Text(title), + const Spacer(), + ], + ), + ), + ), + ), SizedBox( - width: 64.0, + width: 56.0, child: TextFormField( enabled: switchValue, keyboardType: TextInputType.number,