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