I have a pretty basic form widget inside a scaffold app, with a single text field.
The form uses the flutter_form_builder library.
// Define a corresponding State class.
// This class holds data related to the form.
class GameCreationFormState extends State<GameCreationForm> {
// Create a global key that uniquely identifies the Form widget
// and allows validation of the form.
final _formKey = GlobalKey<FormBuilderState>();
@override
Widget build(BuildContext context) {
return Consumer<AppModel>(builder: (context, appModel, child) {
return FormBuilder(
key: _formKey,
onChanged: () {
_formKey.currentState!.save();
debugPrint(_formKey.currentState!.value.toString());
},
child: Column(
children: <Widget>[
FormBuilderTextField(
autovalidateMode: AutovalidateMode.always,
name: 'title',
key: const Key('create-game-title'),
decoration: const InputDecoration(
labelText: 'Game title',
),
// The validator receives the text that the user has entered.
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter some text';
}
return null;
},
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
),
ElevatedButton(
key: const Key('create-game-submit'),
onPressed: () {
// Validate returns true if the form is valid, or false otherwise.
if (_formKey.currentState!.saveAndValidate() ?? false) {
// I assume this will be the value of whatever what entered in the field
debugPrint(_formKey.currentState?.value.toString());
}
},
child: const Text('Submit'),
)
],
),
);
});
}
}
When I run the application using flutter run -d linux, as soon as I start typing text in the field, the whole window becomes blank (black in my case since I'm in dark mode.)
I see no error in the logs, and the debugPrint for onChanged is properly called with the content of the input.
Is that a limitation of running on linux ?