-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
Hint / Label Text Not Show on app relaunch in release #1447
Comments
Hi @Crucialjun |
Here is the code for the login screen on the screenshot above
|
Need to be a minimal code example, without dependencies, with only form widgets |
Error seems to be coming from TextFormField, tried with TextFormField and getting the same behaviour |
I tried again using a clean form without the form builder, only utilizing TextFormField, and I didn’t encounter any errors. It seems that the issue originates from the form builder. This may be related to state management, as the error only occurs when the app restarts |
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 |
Is there an existing issue for this?
Package/Plugin version
9.3.0
Platforms
Flutter doctor
Flutter doctor
Minimal code example
Code sample
Current Behavior
FormBuilderTextField and setting either the label text or hint text functions well but when the app is closed and reopened they do not show. Tried setting hint text alone same scenario, and label text alone, same scenario. I tried setting floatingLabelBehavior: FloatingLabelBehavior.always, still same behaviour. Seems to work well in debug mode but buggy in release mode
Expected Behavior
The hint text or label text if set should show on the textfield is the text field is empty
Steps To Reproduce
Add either label text or hint text, create a release app, run the app , close app and reopen.
Aditional information
With only label text and floatingLabelBehavior: FloatingLabelBehavior.always,
With only hint text
The text was updated successfully, but these errors were encountered: