in ReactiveTextField widget set initial value as control(TextEditingController) value
@joanpablo
I needs to set initial value of TextEditingController()..text value, How to overcome this situation
ReactiveTextField<String>(
formControlName:"control",
controller: TextEditingController()..text = value.name ?? '',
textInputAction: TextInputAction.next,
keyboardType: TextInputType.name,
textAlign: TextAlign.start,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.account_circle_outlined),
),
),
You need to set you value in control and it will be automatically supplied to controller https://github.com/joanpablo/reactive_forms/blob/master/lib/src/widgets/reactive_text_field.dart#L278
final form = FormGroup({
'control': FormControl<String>(value: 'John Doe'),
});
You need to set you value in control and it will be automatically supplied to controller https://github.com/joanpablo/reactive_forms/blob/master/lib/src/widgets/reactive_text_field.dart#L278
final form = FormGroup({ 'control': FormControl<String>(value: 'John Doe'), });
@vasilich6107 In the ReactiveTextField widget parameter called FormControl<ModelDataType>? formControl , I needs to set the initial value to it. I have tried to do, its not working for me.
Is there any ways to do this?
@vasilich6107 have you understood my question
Hi @Imesh7,
Is there any reason why you don't want to set the initial value to the FormControl like
'control': FormControl<String>(value: 'John Doe'),
Just as @vasilich6107 suggested to you?