isEnabledRM property
ReactiveState of type bool. It is used to set the value of isEnabled
of
all child input fields.
Example: Disabling inputs while the form is submitting:
final isEnabledRM = true.inj();
final formRM = RM.injectForm(
submissionSideEffects: SideEffects.onOrElse(
onWaiting: ()=> isEnabledRM = false,
orElse: (_)=> isEnabledRM = true,
submit: () => repository.submitForm( ... ),
),
);
// In the widget tree
OnFormBuilder(
listenTo: formRM,
// Adding this all child input's enabled and readOnly properties are controlled.
isEnabledRM: isEnabledRM,
builder: () => Column(
children: [
TextField(
controller: myText.controller,
enabled: myText.isEnabled,
),
OnFormFieldBuilder<bool>(
listenTo: myCheckBox,
builder: (value, onChanged){
return CheckBoxListTile(
value: value,
onChanged: onChanged,
title: Text('Accept me'),
);
}
)
]
),
)
Implementation
final ReactiveModel<bool?>? isEnabledRM;