improvement of SwitchTextListTile

This commit is contained in:
Moritz Weber 2022-07-23 14:34:51 +02:00
parent 0ef0bd1647
commit 77b86da493
2 changed files with 29 additions and 8 deletions

View file

@ -115,7 +115,10 @@ class _SmartListFormPageState extends State<SmartListFormPage> {
borderSide: BorderSide.none, borderSide: BorderSide.none,
borderRadius: BorderRadius.all(Radius.circular(4.0)), 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<SmartListFormPage> {
child: Observer( child: Observer(
builder: (_) { builder: (_) {
final RangeValues _currentRangeValues = RangeValues( final RangeValues _currentRangeValues = RangeValues(
store.minLikeCount.toDouble(), store.maxLikeCount.toDouble()); store.minLikeCount.toDouble(),
store.maxLikeCount.toDouble(),
);
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -363,7 +368,10 @@ class _SmartListFormPageState extends State<SmartListFormPage> {
], ],
), ),
const Spacer(), const Spacer(),
const Icon(Icons.chevron_right_rounded), const SizedBox(
width: 56.0,
child: Icon(Icons.chevron_right_rounded),
),
], ],
), ),
), ),

View file

@ -10,7 +10,7 @@ class SwitchTextListTile extends StatelessWidget {
required this.onSwitchChanged, required this.onSwitchChanged,
required this.textValue, required this.textValue,
required this.onTextChanged, required this.onTextChanged,
this.errorText, this.errorText,
}) : super(key: key); }) : super(key: key);
final String title; final String title;
@ -33,11 +33,24 @@ class SwitchTextListTile extends StatelessWidget {
onChanged: (bool value) => onSwitchChanged(value), onChanged: (bool value) => onSwitchChanged(value),
), ),
), ),
const SizedBox(width: 6.0), Expanded(
Text(title), child: GestureDetector(
const Spacer(), onTap: () => onSwitchChanged(!switchValue),
child: Container(
color: Colors.transparent,
height: 48.0,
child: Row(
children: [
const SizedBox(width: 6.0),
Text(title),
const Spacer(),
],
),
),
),
),
SizedBox( SizedBox(
width: 64.0, width: 56.0,
child: TextFormField( child: TextFormField(
enabled: switchValue, enabled: switchValue,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,