Comments (12)
To add more info, I found that the form is always redraw when a input is getting focus.
These printed whenever I try to focus on the input textbox.
from flutter_form_builder.
I have made a small changed in the code and it seems working, however, the behavior is still somewhat strange due to the formKey keep changing.
from flutter_form_builder.
Hey @jasonlaw,
Thanks for the help, you're the best.
Seems like I accidentally merged another branch which I was doing some experimental stuff on.
from flutter_form_builder.
@jasonlaw To avoid key changing, don't declare the global key inside your build method.
from flutter_form_builder.
@danvick, thanks for the quick response. Indeed after moving out from the build method, it works normally now, you are awesome! :)
from flutter_form_builder.
Hi,
I have the same behavior even if I move the global key in the class. I upgraded the package to the latest version (flutter_form_builder: ^2.0.3). It is impossible to enter a value in the fields.
Here is a sample of my code :
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
class ActivityPage extends StatelessWidget {
final GlobalKey<FormBuilderState> _fbKey = GlobalKey();
var data;
final allCountries = [
"Afghanistan",
"Albania",
"Algeria",
"American Samoa",
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('New activity'),
),
body: SingleChildScrollView(
child: FormBuilder(context, key: _fbKey, controls: [
FormBuilderInput.typeAhead(
decoration: InputDecoration(labelText: "Country"),
attribute: 'country',
// require: true,
itemBuilder: (context, country) {
return ListTile(
title: Text(country),
);
},
suggestionsCallback: (query) {
if (query.length != 0) {
var lowercaseQuery = query.toLowerCase();
return allCountries.where((country) {
return country.toLowerCase().contains(lowercaseQuery);
}).toList(growable: false)
..sort((a, b) => a.toLowerCase().indexOf(lowercaseQuery).compareTo(b.toLowerCase().indexOf(lowercaseQuery)));
} else {
return allCountries;
}
},
),
FormBuilderInput.textField(
type: FormBuilderInput.TYPE_TEXT,
attribute: "name",
decoration: InputDecoration(labelText: "Full Name"),
value: "John Doe",
),
]),
),
);
}
}
Could you please help me with this ?
Thanks a lot !
from flutter_form_builder.
Hi @benoitverstraete,
I've been unable to reproduce your error. Could you kindly share your version of flutter or the result of your flutter doctor
from flutter_form_builder.
You could also try converting your widget to a StatefulWidget especially if you want to make use of the data variable to get the result of your form
from flutter_form_builder.
Yes, sure :
C:\src\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17763.379], locale en-GB)
• Flutter version 1.2.1 at C:\src\flutter
• Framework revision 8661d8aecd (7 weeks ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\bve\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 34.0.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[!] VS Code (version 1.32.3)
• VS Code at C:\Users\bve\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (2 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• Android SDK built for x86 • emulator-5556 • android-x86 • Android 9 (API 28) (emulator)
! Doctor found issues in 1 category.
from flutter_form_builder.
@danvick this bug disappear when I convert the StatelessWidget to a Stateful one, thanks !lba
But, I keep getting the error from the issue #33 for the typeAhead control...
from flutter_form_builder.
@benoitverstraete I'm quite sorry for the inconveniences. The package, as I later realized has quite a number of issues with state management. That's why I've taken to do complete rewrite coming out as version 3.0.0, in fact I've released a beta version of it just a few hours ago.
Feel free to test it out. I doubt if there will be major API changes before it's release
from flutter_form_builder.
@danvick Ok, I will take a look at the new version and will open another issue if I encounter some issues.
from flutter_form_builder.
Related Issues (20)
- When using globalKey.currentState?.saveAndValidate to save and validate a form, a date picker will pop up. HOT 4
- [FormBuilderDateTimePicker]: onPressed of suffixIcon don't work on Windows / Web HOT 1
- [FormBuilderRangeSlider]: Add maxRange value
- No named parameter with the name 'onPopInvoked' HOT 9
- State dos not contain all fields HOT 1
- [Field name or General]: FormBuilderDropdown silently ignores an unknown initialValue
- Resetting form shows error messages HOT 1
- Reuse same widget causes child form field to be overwritten
- [FormBuilderRadioGroup]: No way to decrease padding of Radio widget HOT 4
- [FormBuilderDateTimePicker]: Got problem if initialDate is null and lastDate is years ago.
- [FormBuilderTextField]: Cannot swith to chinese keyborad with keyboardType: TextInputType.text HOT 5
- Internal field 'isDirty' flag is reset too late.
- FormBuilderDropdown onChanged fires twice during form Reset HOT 1
- FormBuilderDropdown when selected keeps triggering a rebuild HOT 1
- [Documentation] RaisedButton is removed.
- [FormBuilderTextField]: TextInputType.emailAddress - not working
- [FormBuilderTextField]: Cannot type the latin text (Vietnamese) on Android HOT 4
- [General]: Add support for lists with multiple fields in each item HOT 1
- [Localizations]: Language code fow Swedish is wrong HOT 1
- [FormBuilderTextField]: Can we add canRequestFocus
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_form_builder.