flutter_form_builder
flutter_form_builder copied to clipboard
Is there a way to show/hide a form field according to value of another field?
thanks
you can do this using check _formkey current state and _formkey should not be as final and in the form change you have to setState
var _formKey = GlobalKey<FormBuilderState>();
FormBuilder(
key: _formKey,
onChanged: (){
setState(() {
});
},
child: Column(
children: [
_generateQuestions(context, widget.questions),
],
));
bool canShow = _formKey.currentState.fields['gender'].value.toString() == 'male';
if this boolean true you can show your component. it perfectly works for me.
This comments help to solve problem @wyxcoder ? If yes, can close this issue
Due to lack of response, I will close this issue. If the bug still exists, feel free to open a new issue