Skip to content

Commit f21d843

Browse files
committed
Minor fixes and refactorings
1 parent 4576029 commit f21d843

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class MyHomePage extends StatelessWidget {
2727
margin: EdgeInsets.all(15.0),
2828
child: FormBuilder(
2929
context,
30-
autovalidate: false,
30+
// autovalidate: true,
3131
// showResetButton: true,
3232
// resetButtonContent: Text("Clear Form"),
3333
controls: [

flutter_form_builder.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
1313
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
1414
<excludeFolder url="file://$MODULE_DIR$/example/build" />
15+
<excludeFolder url="file://$MODULE_DIR$/example/ios/Flutter/flutter_assets/packages" />
1516
</content>
1617
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
1718
<orderEntry type="sourceFolder" forTests="false" />

lib/src/form_builder.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,12 @@ class _FormBuilderState extends State<FormBuilder> {
9191
}
9292

9393
formControlsList.add(TextFormField(
94-
//TODO: add min and max validation for non-numeric text to validate character count
9594
decoration: InputDecoration(
9695
labelText: formControl.label,
9796
hintText: formControl.hint,
9897
helperText: formControl.hint,
9998
),
100-
initialValue:
101-
formControl.value != null ? "${formControl.value}" : null,
99+
initialValue: "${formControl.value}" ?? null,
102100
maxLines: formControl.type == FormBuilderInput.TYPE_MULTILINE_TEXT
103101
? 5
104102
: 1,
@@ -646,8 +644,8 @@ class _FormBuilderState extends State<FormBuilder> {
646644
color: Theme.of(context).accentColor,
647645
textColor: Colors.white,
648646
onPressed: () {
647+
_formKey.currentState.save();
649648
if (_formKey.currentState.validate()) {
650-
_formKey.currentState.save();
651649
widget.onSubmit(formData);
652650
} else {
653651
debugPrint("Validation failed");

lib/src/form_builder_input.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class FormBuilderInput {
5656
this.validator,
5757
this.min,
5858
this.max,
59+
//TODO: Include maxLines for multiline text
5960
});
6061

6162
FormBuilderInput.password({

0 commit comments

Comments
 (0)