Skip to content

Commit 6704391

Browse files
committed
Disable InputDecoration when control is readonly
1 parent e4db31c commit 6704391

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/src/form_builder.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class _FormBuilderState extends State<FormBuilder> {
127127
: null,
128128
decoration: InputDecoration(
129129
labelText: formControl.label,
130+
enabled: !(widget.readonly || formControl.readonly),
130131
hintText: formControl.hint,
131132
helperText: formControl.hint,
132133
),
@@ -214,6 +215,7 @@ class _FormBuilderState extends State<FormBuilder> {
214215
: null,
215216
decoration: InputDecoration(
216217
labelText: formControl.label,
218+
enabled: !(widget.readonly || formControl.readonly),
217219
hintText: formControl.hint,
218220
),
219221
),
@@ -253,6 +255,7 @@ class _FormBuilderState extends State<FormBuilder> {
253255
return InputDecorator(
254256
decoration: InputDecoration(
255257
labelText: formControl.label,
258+
enabled: !(widget.readonly || formControl.readonly),
256259
helperText: formControl.hint,
257260
errorText: field.errorText,
258261
contentPadding: EdgeInsets.only(top: 10.0, bottom: 0.0),
@@ -324,6 +327,7 @@ class _FormBuilderState extends State<FormBuilder> {
324327
return InputDecorator(
325328
decoration: InputDecoration(
326329
labelText: formControl.label,
330+
enabled: !(widget.readonly || formControl.readonly),
327331
helperText: formControl.hint ?? "",
328332
errorText: field.errorText,
329333
contentPadding: EdgeInsets.only(top: 10.0, bottom: 0.0),
@@ -355,6 +359,7 @@ class _FormBuilderState extends State<FormBuilder> {
355359
return InputDecorator(
356360
decoration: InputDecoration(
357361
labelText: formControl.label,
362+
enabled: !(widget.readonly || formControl.readonly),
358363
helperText: formControl.hint,
359364
errorText: field.errorText,
360365
contentPadding: EdgeInsets.only(top: 10.0, bottom: 10.0),
@@ -406,6 +411,7 @@ class _FormBuilderState extends State<FormBuilder> {
406411
return InputDecorator(
407412
decoration: InputDecoration(
408413
// labelText: formControl.label,
414+
enabled: !(widget.readonly || formControl.readonly),
409415
helperText: formControl.hint ?? "",
410416
errorText: field.errorText,
411417
),
@@ -450,6 +456,7 @@ class _FormBuilderState extends State<FormBuilder> {
450456
return InputDecorator(
451457
decoration: InputDecoration(
452458
labelText: formControl.label,
459+
enabled: !(widget.readonly || formControl.readonly),
453460
helperText: formControl.hint ?? "",
454461
errorText: field.errorText,
455462
),
@@ -486,6 +493,7 @@ class _FormBuilderState extends State<FormBuilder> {
486493
return InputDecorator(
487494
decoration: InputDecoration(
488495
labelText: formControl.label,
496+
enabled: !(widget.readonly || formControl.readonly),
489497
helperText: formControl.hint ?? "",
490498
errorText: field.errorText,
491499
),
@@ -521,6 +529,7 @@ class _FormBuilderState extends State<FormBuilder> {
521529
return InputDecorator(
522530
decoration: InputDecoration(
523531
// labelText: formControl.label,
532+
enabled: !(widget.readonly || formControl.readonly),
524533
helperText: formControl.hint ?? "",
525534
errorText: field.errorText,
526535
),
@@ -566,6 +575,7 @@ class _FormBuilderState extends State<FormBuilder> {
566575
return InputDecorator(
567576
decoration: InputDecoration(
568577
labelText: formControl.label,
578+
enabled: !(widget.readonly || formControl.readonly),
569579
helperText: formControl.hint,
570580
errorText: field.errorText,
571581
),
@@ -655,6 +665,7 @@ class _FormBuilderState extends State<FormBuilder> {
655665
return InputDecorator(
656666
decoration: InputDecoration(
657667
labelText: formControl.label,
668+
enabled: !(widget.readonly || formControl.readonly),
658669
helperText: formControl.hint ?? "",
659670
errorText: field.errorText,
660671
contentPadding: EdgeInsets.only(top: 10.0, bottom: 0.0),
@@ -687,6 +698,7 @@ class _FormBuilderState extends State<FormBuilder> {
687698
initialValue: field.value,
688699
decoration: InputDecoration(
689700
// prefixIcon: Icon(Icons.search),
701+
enabled: !(widget.readonly || formControl.readonly),
690702
hintText: formControl.hint,
691703
labelText: formControl.label,
692704
errorText: field.errorText,
@@ -789,6 +801,7 @@ class _FormBuilderState extends State<FormBuilder> {
789801
controller: _inputController,
790802
decoration: InputDecoration(
791803
labelText: formControl.label,
804+
enabled: !(formWidget.readonly || formControl.readonly),
792805
hintText: formControl.hint ?? "",
793806
),
794807
onSaved: (value) {
@@ -839,6 +852,7 @@ class _FormBuilderState extends State<FormBuilder> {
839852
},
840853
decoration: InputDecoration(
841854
labelText: formControl.label,
855+
enabled: !(formWidget.readonly || formControl.readonly),
842856
hintText: formControl.hint ?? "",
843857
),
844858
onSaved: (value) {

0 commit comments

Comments
 (0)