Merge pull request #6 from Iconica-Development/hotfix/keyboard-closing-fix

fixed keyboard closing ontap field
This commit is contained in:
FlutterJoey 2022-10-25 09:53:58 +02:00 committed by GitHub
commit 9827555723
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 24 deletions

View file

@ -23,9 +23,7 @@ class ItemBuilder {
inputDecoration = inputDecoration =
options.inputDecorationField?[key] ?? options.inputDecoration; options.inputDecorationField?[key] ?? options.inputDecoration;
return Form( return TextFormField(
key: formKey,
child: TextFormField(
key: Key(key), key: Key(key),
controller: controller, controller: controller,
decoration: inputDecoration, decoration: inputDecoration,
@ -38,7 +36,6 @@ class ItemBuilder {
validator: (value) { validator: (value) {
return options.validators?[key]?.call(value); return options.validators?[key]?.call(value);
}, },
),
); );
} }
return widget; return widget;

View file

@ -46,9 +46,7 @@ class ProfileWrapper extends StatefulWidget {
class _ProfileWrapperState extends State<ProfileWrapper> { class _ProfileWrapperState extends State<ProfileWrapper> {
List<Widget> defaultItems = []; List<Widget> defaultItems = [];
GlobalKey<FormState> firstNameKey = GlobalKey<FormState>(); GlobalKey<FormState> formKey = GlobalKey<FormState>();
GlobalKey<FormState> lastNameKey = GlobalKey<FormState>();
@override @override
void initState() { void initState() {
@ -61,7 +59,7 @@ class _ProfileWrapperState extends State<ProfileWrapper> {
defaultItems.add( defaultItems.add(
builder.build( builder.build(
'first_name', 'first_name',
firstNameKey, formKey,
widget.user.firstName, widget.user.firstName,
null, null,
(v) { (v) {
@ -79,7 +77,7 @@ class _ProfileWrapperState extends State<ProfileWrapper> {
defaultItems.add( defaultItems.add(
builder.build( builder.build(
'last_name', 'last_name',
lastNameKey, formKey,
widget.user.lastName, widget.user.lastName,
null, null,
(v) { (v) {
@ -98,7 +96,7 @@ class _ProfileWrapperState extends State<ProfileWrapper> {
defaultItems.add( defaultItems.add(
widget.itemBuilder!.build( widget.itemBuilder!.build(
'first_name', 'first_name',
firstNameKey, formKey,
widget.user.firstName, widget.user.firstName,
null, null,
(v) { (v) {
@ -116,7 +114,7 @@ class _ProfileWrapperState extends State<ProfileWrapper> {
defaultItems.add( defaultItems.add(
widget.itemBuilder!.build( widget.itemBuilder!.build(
'last_name', 'last_name',
lastNameKey, formKey,
widget.user.lastName, widget.user.lastName,
null, null,
(v) { (v) {
@ -197,7 +195,7 @@ class _ProfileWrapperState extends State<ProfileWrapper> {
), ),
], ],
// all the items that have priority above the default items // all the items that have priority above the default items
child, Form(key: formKey, child: child),
if (widget.bottomActionText != null) ...[ if (widget.bottomActionText != null) ...[
SizedBox( SizedBox(
height: widget.style.betweenDefaultItemPadding, height: widget.style.betweenDefaultItemPadding,