flow_builder
flow_builder copied to clipboard
TextFormField's autofocus from a second MaterialPages is not working.
Describe the bug Once the first textformfield gets focused then the next one from the second MaterialPage is not getting autofocused.
To Reproduce Let's say for example we have 2 MaterialPages: [ MaterialPage(child: FirstColumnTextField()), MaterialPage(child: SecondColumnTextField(autofocus: true)), ] Expected behavior Second textfield gets autofocused as the TextFormField is set. The only fix for now is to set the maintainState to false to the first MaterialPage as follows: MaterialPage(child: FirstColumnTextField(), maintainState: false),.
Hi @arnoldmitrica, can you share a minimal example project to reproduce this issue?
class CustomTextFieldColumn extends StatelessWidget { final int next; final bool isAutofocus;
const CustomTextFieldColumn( {required this.next, this.isAutofocus = false, super.key});
@override
Widget build(BuildContext context) {
return Column(
children: [
TextFormField(autofocus: isAutofocus),
ElevatedButton(
onPressed: () => context.flow
class PageFlow extends StatelessWidget { const PageFlow({super.key});
@override
Widget build(BuildContext context) {
return FlowBuilder
@arnoldmitrica the code you shared isn't a minimal reproduction sample because we can't run it. Can you please share a complete, runnable main.dart
or a link to a GitHub repo so we can easily reproduce the issue locally? Thanks!