@@ -224,7 +224,7 @@ class _FormBuilderState extends State<FormBuilder> {
224
224
hint: Text (formControl.hint ?? '' ),
225
225
items: formControls[count].options.map ((option) {
226
226
return DropdownMenuItem (
227
- child: Text (option.label ?? option.value),
227
+ child: Text ("${ option .label ?? option .value }" ),
228
228
value: option.value,
229
229
);
230
230
}).toList (),
@@ -262,8 +262,9 @@ class _FormBuilderState extends State<FormBuilder> {
262
262
dense: true ,
263
263
isThreeLine: false ,
264
264
contentPadding: EdgeInsets .all (0.0 ),
265
- title: Text (formControls[count].options[i].label ??
266
- formControls[count].options[i].value),
265
+ leading: null ,
266
+ title: Text (
267
+ "${formControls [count ].options [i ].label ?? formControls [count ].options [i ].value }" ),
267
268
trailing: Radio <dynamic >(
268
269
value: formControls[count].options[i].value,
269
270
groupValue: field.value,
@@ -293,6 +294,8 @@ class _FormBuilderState extends State<FormBuilder> {
293
294
labelText: formControl.label,
294
295
helperText: formControl.hint ?? "" ,
295
296
errorText: field.errorText,
297
+ contentPadding: EdgeInsets .only (top: 10.0 , bottom: 0.0 ),
298
+ border: InputBorder .none,
296
299
),
297
300
child: Column (
298
301
children: radioList,
@@ -320,24 +323,31 @@ class _FormBuilderState extends State<FormBuilder> {
320
323
labelText: formControl.label,
321
324
helperText: formControl.hint,
322
325
errorText: field.errorText,
326
+ contentPadding: EdgeInsets .only (top: 10.0 , bottom: 10.0 ),
327
+ border: InputBorder .none,
323
328
),
324
- child: CupertinoSegmentedControl (
325
- borderColor: Theme .of (context).primaryColor,
326
- selectedColor: Theme .of (context).primaryColor,
327
- pressedColor: Theme .of (context).primaryColor,
328
- groupValue: field.value,
329
- children: Map .fromIterable (
330
- formControls[count].options,
331
- key: (v) => v.value,
332
- value: (v) =>
333
- Text (v.label != null ? "${v .label }" : "${v .value }" ),
329
+ child: Padding (
330
+ padding: EdgeInsets .only (top: 10.0 ),
331
+ child: CupertinoSegmentedControl (
332
+ borderColor: Theme .of (context).primaryColor,
333
+ selectedColor: Theme .of (context).primaryColor,
334
+ pressedColor: Theme .of (context).primaryColor,
335
+ groupValue: field.value,
336
+ children: Map .fromIterable (
337
+ formControls[count].options,
338
+ key: (v) => v.value,
339
+ value: (v) => Padding (
340
+ padding: EdgeInsets .symmetric (vertical: 10.0 ),
341
+ child: Text ("${v .label ?? v .value }" ),
342
+ ),
343
+ ),
344
+ onValueChanged: (dynamic value) {
345
+ setState (() {
346
+ formControls[count].value = value;
347
+ });
348
+ field.didChange (value);
349
+ },
334
350
),
335
- onValueChanged: (dynamic value) {
336
- setState (() {
337
- formControls[count].value = value;
338
- });
339
- field.didChange (value);
340
- },
341
351
),
342
352
);
343
353
},
@@ -626,6 +636,8 @@ class _FormBuilderState extends State<FormBuilder> {
626
636
labelText: formControl.label,
627
637
helperText: formControl.hint ?? "" ,
628
638
errorText: field.errorText,
639
+ contentPadding: EdgeInsets .only (top: 10.0 , bottom: 0.0 ),
640
+ border: InputBorder .none,
629
641
),
630
642
child: Column (
631
643
children: checkboxList,
@@ -716,9 +728,10 @@ class _FormBuilderState extends State<FormBuilder> {
716
728
_generateDatePicker (FormBuilderInput formControl, int count) {
717
729
TextEditingController _inputController =
718
730
new TextEditingController (text: formControl.value);
731
+ FocusNode _focusNode = FocusNode ();
719
732
return GestureDetector (
720
733
onTap: () {
721
- //TODO: Set focus on textfield when selected
734
+ FocusScope . of (context). requestFocus (_focusNode);
722
735
_showDatePickerDialog (
723
736
context,
724
737
initialDate: DateTime .tryParse (_inputController.value.text),
@@ -761,9 +774,10 @@ class _FormBuilderState extends State<FormBuilder> {
761
774
_generateTimePicker (FormBuilderInput formControl, int count) {
762
775
TextEditingController _inputController =
763
776
new TextEditingController (text: formControl.value);
777
+ FocusNode _focusNode = new FocusNode ();
764
778
return GestureDetector (
765
779
onTap: () {
766
- //TODO: Set focus on textfield when selected
780
+ FocusScope . of (context). requestFocus (_focusNode);
767
781
_showTimePickerDialog (
768
782
context,
769
783
// initialTime: new Time, //FIXME: Parse time from string
@@ -781,6 +795,7 @@ class _FormBuilderState extends State<FormBuilder> {
781
795
child: AbsorbPointer (
782
796
child: TextFormField (
783
797
controller: _inputController,
798
+ focusNode: _focusNode,
784
799
validator: (value) {
785
800
if (formControl.require && (value.isEmpty || value == null ))
786
801
return "${formControl .label } is required" ;
0 commit comments