-
-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FormBuilderTextField]: Keyboard closes immediately when using FormBuilderTextField in Flutter Web 3.29.0 #1481
Comments
Hi!
Example: import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter FormBuilder Example',
debugShowCheckedModeBanner: false,
localizationsDelegates: const [
FormBuilderLocalizations.delegate,
...GlobalMaterialLocalizations.delegates,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: FormBuilderLocalizations.supportedLocales,
home: const _ExamplePage(),
);
}
}
class _ExamplePage extends StatefulWidget {
const _ExamplePage();
@override
State<_ExamplePage> createState() => _ExamplePageState();
}
class _ExamplePageState extends State<_ExamplePage> {
final _formKey = GlobalKey<FormBuilderState>();
@override
Widget build(BuildContext context) {
return Scaffold(
body: FormBuilder(
key: _formKey,
child: Column(
children: [
FormBuilderTextField(
name: 'full_name',
decoration: const InputDecoration(labelText: 'Full Name'),
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(),
]),
),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () {
_formKey.currentState?.saveAndValidate();
debugPrint(_formKey.currentState?.value.toString());
},
child: const Text('Print'),
)
],
),
),
);
}
} Thanks a lot |
Related with flutter/flutter#164071 |
This example you added should reproduce the problem. I found the arg that creates the problem (in Probably something down the chain broke it, maybe |
You add a property I think that this bug is related to Flutter and no to this package, but need to confirm |
I initialized the controller like this: late final TextEditingController controller;
@override
void initState() {
super.initState();
controller = TextEditingController(text: '');
} The bug is related to Flutter. It has to do with |
Is there an existing issue for this?
Package/Plugin version
10.0.0
Platforms
Flutter doctor
Flutter doctor
Minimal code example
Code sample
Current Behavior
When running in web mobile, when tapping on the field, it doesn't allow to focus or open the keyboard. (listening to the focus node it shows gaining focus for a split second and being unfocused immediately).
It also doesn't work with
autofocus: true
.The same Issue happens when using
TextFormField
. But the issue does not exists when usingTextField
.Expected Behavior
The field should receive focus when tapped.
Steps To Reproduce
Run any flutter app in web on mobile devices (or emulator)
open
localhost:<PORT>
in the mobile device browser.Aditional information
No response
The text was updated successfully, but these errors were encountered: