Skip to content

Commit 1afc718

Browse files
committed
Merge branch 'master' of github.com:danvick/flutter_form_builder into duplicate_field_handling
2 parents 43702c8 + 31984f1 commit 1afc718

32 files changed

+320
-322
lines changed

.github/workflows/form_builder_core.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ name: Form Builder Core
66
on:
77
# Triggers the workflow on push or pull request events but only for the master branch
88
push:
9-
branches: [split_packages]
9+
branches: [master]
1010
paths:
1111
- "packages/flutter_form_builder/**"
1212
- ".github/workflows/form_builder_core.yaml"
1313

1414
pull_request:
15-
branches: [split_packages]
15+
branches: [master]
1616
paths:
1717
- "packages/flutter_form_builder/**"
1818
- ".github/workflows/form_builder_core.yaml"

.github/workflows/form_builder_extra_fields.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ name: Form Builder Extra Fields
66
on:
77
# Triggers the workflow on push or pull request events but only for the master branch
88
push:
9-
branches: [split_packages]
9+
branches: [master]
1010
paths:
1111
- "packages/form_builder_extra_fields/**"
1212
- ".github/workflows/form_builder_extra_fields.yaml"
1313

1414
pull_request:
15-
branches: [split_packages]
15+
branches: [master]
1616
paths:
1717
- "packages/form_builder_extra_fields/**"
1818
- ".github/workflows/form_builder_extra_fields.yaml"

.github/workflows/form_builder_validators.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ name: Form Builder Validators
66
on:
77
# Triggers the workflow on push or pull request events but only for the master branch
88
push:
9-
branches: [split_packages]
9+
branches: [master]
1010
paths:
1111
- "packages/form_builder_validators/**"
1212
- ".github/workflows/form_builder_validators.yaml"
1313

1414
pull_request:
15-
branches: [split_packages]
15+
branches: [master]
1616
paths:
1717
- "packages/form_builder_validators/**"
1818
- ".github/workflows/form_builder_validators.yaml"

.github/workflows/main.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

analysis_options.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/flutter_form_builder/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [7.0.0] - 27-Oct-2021
2+
**BREAKING CHANGE**:
3+
* For ease of maintainability, validation functionality has been broken up into a separate package: [form_builder_validators](https://pub.dev/packages/form_builder_validators)
4+
15
## [7.0.0-beta.0] - 02-Sep-2021
26
* Merged back `form_builder_fields` into `flutter_form_builder`
37

@@ -15,6 +19,16 @@
1519
## [7.0.0-alpha.0] - 16-May-2021
1620
* Split up packages - removed fields and validation from core
1721

22+
## [6.2.1] - 27-Oct-2021
23+
* Fixed bug where `didChange` and `reset` on FormBuilderCheckboxGroup has no visible effect
24+
25+
## [6.2.0] - 21-Oct-2021
26+
* Fixed `didChange` unable to handle null value in `FormBuilderTextField`
27+
28+
**BREAKING CHANGE**
29+
* Added new attribute - `autoFocusOnValidationFailure` (default: `false`) - to FormBuilder to set whether should scroll to first error if validation fails
30+
31+
1832
## [6.1.0] - 01-Sep-2021
1933
* When form validation fails, automatically scroll to first error
2034
* New way to programmatically induce custom errors by calling `GlobalKey<FormBuilderState>.invalidateField()` or `GlobalKey<FormBuilderFieldState>.invalidate()`

packages/flutter_form_builder/example/lib/home_page.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import 'code_page.dart';
77
import 'sources/complete_form.dart';
88

99
class HomePage extends StatelessWidget {
10+
const HomePage({Key? key}) : super(key: key);
11+
1012
@override
1113
Widget build(BuildContext context) {
1214
return Scaffold(
13-
appBar: AppBar(
14-
title: const Text('Flutter Form Builder')
15-
),
15+
appBar: AppBar(title: const Text('Flutter Form Builder')),
1616
body: ListView(
1717
children: <Widget>[
1818
ListTile(
@@ -22,7 +22,7 @@ class HomePage extends StatelessWidget {
2222
Navigator.of(context).push(
2323
MaterialPageRoute(
2424
builder: (context) {
25-
return CodePage(
25+
return const CodePage(
2626
title: 'Complete Form',
2727
sourceFilePath: 'lib/sources/complete_form.dart',
2828
child: CompleteForm(),
@@ -40,7 +40,7 @@ class HomePage extends StatelessWidget {
4040
Navigator.of(context).push(
4141
MaterialPageRoute(
4242
builder: (context) {
43-
return CodePage(
43+
return const CodePage(
4444
title: 'Custom Fields',
4545
sourceFilePath: 'lib/sources/custom_fields.dart',
4646
child: CustomFields(),
@@ -58,7 +58,7 @@ class HomePage extends StatelessWidget {
5858
Navigator.of(context).push(
5959
MaterialPageRoute(
6060
builder: (context) {
61-
return CodePage(
61+
return const CodePage(
6262
title: 'Signup Form',
6363
sourceFilePath: 'lib/sources/signup_form.dart',
6464
child: SignupForm(),

packages/flutter_form_builder/example/lib/main.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@ import 'package:form_builder_validators/form_builder_validators.dart';
55

66
import 'home_page.dart';
77

8-
void main() => runApp(MyApp());
8+
void main() => runApp(const MyApp());
99

1010
class MyApp extends StatelessWidget {
11+
const MyApp({Key? key}) : super(key: key);
12+
1113
@override
1214
Widget build(BuildContext context) {
1315
return MaterialApp(
1416
title: 'Flutter FormBuilder Demo',
1517
theme: ThemeData(
1618
primarySwatch: Colors.blue,
17-
inputDecorationTheme: InputDecorationTheme(
19+
inputDecorationTheme: const InputDecorationTheme(
1820
labelStyle: TextStyle(color: Colors.blueAccent),
1921
),
2022
),
21-
localizationsDelegates: [
23+
localizationsDelegates: const [
2224
FormBuilderLocalizations.delegate,
2325
GlobalMaterialLocalizations.delegate,
2426
GlobalWidgetsLocalizations.delegate,
2527
],
26-
supportedLocales: [
28+
supportedLocales: const [
2729
Locale('en', ''),
2830
Locale('es', ''),
2931
Locale('fa', ''),
@@ -33,7 +35,7 @@ class MyApp extends StatelessWidget {
3335
Locale('sk', ''),
3436
Locale('pl', ''),
3537
],
36-
home: HomePage(),
38+
home: const HomePage(),
3739
);
3840
}
3941
}

packages/flutter_form_builder/example/lib/sources/complete_form.dart

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import 'package:form_builder_validators/form_builder_validators.dart';
55
import 'package:intl/intl.dart';
66

77
class CompleteForm extends StatefulWidget {
8+
const CompleteForm({Key? key}) : super(key: key);
9+
810
@override
911
CompleteFormState createState() {
1012
return CompleteFormState();
@@ -19,9 +21,10 @@ class CompleteFormState extends State<CompleteForm> {
1921
bool _ageHasError = false;
2022
bool _genderHasError = false;
2123

22-
final ValueChanged _onChanged = (dynamic val) => print(val);
2324
var genderOptions = ['Male', 'Female', 'Other'];
2425

26+
void _onChanged(dynamic val) => debugPrint(val);
27+
2528
@override
2629
Widget build(BuildContext context) {
2730
return Padding(
@@ -50,14 +53,14 @@ class CompleteFormState extends State<CompleteForm> {
5053
decoration: InputDecoration(
5154
labelText: 'Appointment Time',
5255
suffixIcon: IconButton(
53-
icon: Icon(Icons.close),
56+
icon: const Icon(Icons.close),
5457
onPressed: () {
5558
_formKey.currentState!.fields['date']
5659
?.didChange(null);
5760
}),
5861
),
59-
initialTime: TimeOfDay(hour: 8, minute: 0),
60-
locale: Locale.fromSubtags(languageCode: 'fr'),
62+
initialTime: const TimeOfDay(hour: 8, minute: 0),
63+
locale: const Locale.fromSubtags(languageCode: 'fr'),
6164
),
6265
FormBuilderDateRangePicker(
6366
name: 'date_range',
@@ -70,7 +73,7 @@ class CompleteFormState extends State<CompleteForm> {
7073
helperText: 'Helper text',
7174
hintText: 'Hint text',
7275
suffixIcon: IconButton(
73-
icon: Icon(Icons.close),
76+
icon: const Icon(Icons.close),
7477
onPressed: () {
7578
_formKey.currentState!.fields['date_range']
7679
?.didChange(null);
@@ -99,7 +102,7 @@ class CompleteFormState extends State<CompleteForm> {
99102
onChanged: _onChanged,
100103
min: 0.0,
101104
max: 100.0,
102-
initialValue: RangeValues(4, 7),
105+
initialValue: const RangeValues(4, 7),
103106
divisions: 20,
104107
activeColor: Colors.red,
105108
inactiveColor: Colors.pink[100],
@@ -110,7 +113,7 @@ class CompleteFormState extends State<CompleteForm> {
110113
initialValue: false,
111114
onChanged: _onChanged,
112115
title: RichText(
113-
text: TextSpan(
116+
text: const TextSpan(
114117
children: [
115118
TextSpan(
116119
text: 'I have read and agree to the ',
@@ -175,7 +178,7 @@ class CompleteFormState extends State<CompleteForm> {
175178
),
176179
// initialValue: 'Male',
177180
allowClear: true,
178-
hint: Text('Select Gender'),
181+
hint: const Text('Select Gender'),
179182
validator: FormBuilderValidators.compose(
180183
[FormBuilderValidators.required(context)]),
181184
items: genderOptions
@@ -270,10 +273,10 @@ class CompleteFormState extends State<CompleteForm> {
270273
color: Theme.of(context).colorScheme.secondary,
271274
onPressed: () {
272275
if (_formKey.currentState?.saveAndValidate() ?? false) {
273-
print(_formKey.currentState?.value);
276+
debugPrint(_formKey.currentState?.value.toString());
274277
} else {
275-
print(_formKey.currentState?.value);
276-
print('validation failed');
278+
debugPrint(_formKey.currentState?.value.toString());
279+
debugPrint('validation failed');
277280
}
278281
},
279282
child: const Text(

packages/flutter_form_builder/example/lib/sources/custom_fields.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
33
import 'package:flutter_form_builder/flutter_form_builder.dart';
44

55
class CustomFields extends StatefulWidget {
6+
const CustomFields({Key? key}) : super(key: key);
7+
68
@override
79
_CustomFieldsState createState() => _CustomFieldsState();
810
}
@@ -21,15 +23,12 @@ class _CustomFieldsState extends State<CustomFields> {
2123
children: <Widget>[
2224
FormBuilderField<String?>(
2325
name: 'name',
24-
onChanged: (val) => print(val),
26+
onChanged: (val) => debugPrint(val.toString()),
2527
builder: (FormFieldState field) {
2628
return Row(
2729
crossAxisAlignment: CrossAxisAlignment.center,
2830
children: [
29-
Expanded(
30-
child: Text('Name'),
31-
flex: 1,
32-
),
31+
const Expanded(child: Text('Name'), flex: 1),
3332
Expanded(
3433
flex: 2,
3534
child: InputDecorator(
@@ -71,11 +70,12 @@ class _CustomFieldsState extends State<CustomFields> {
7170
return InputDecorator(
7271
decoration: InputDecoration(
7372
labelText: "Select option",
74-
contentPadding: EdgeInsets.only(top: 10.0, bottom: 0.0),
73+
contentPadding:
74+
const EdgeInsets.only(top: 10.0, bottom: 0.0),
7575
border: InputBorder.none,
7676
errorText: field.errorText,
7777
),
78-
child: Container(
78+
child: SizedBox(
7979
height: 200,
8080
child: CupertinoPicker(
8181
itemExtent: 30,
@@ -93,25 +93,25 @@ class _CustomFieldsState extends State<CustomFields> {
9393
Expanded(
9494
child: MaterialButton(
9595
color: Theme.of(context).colorScheme.secondary,
96-
child: Text(
96+
child: const Text(
9797
"Submit",
9898
style: TextStyle(color: Colors.white),
9999
),
100100
onPressed: () {
101101
_formKey.currentState!.save();
102102
if (_formKey.currentState!.validate()) {
103-
print(_formKey.currentState!.value);
103+
debugPrint(_formKey.currentState!.value.toString());
104104
} else {
105-
print("validation failed");
105+
debugPrint("validation failed");
106106
}
107107
},
108108
),
109109
),
110-
SizedBox(width: 20),
110+
const SizedBox(width: 20),
111111
Expanded(
112112
child: MaterialButton(
113113
color: Theme.of(context).colorScheme.secondary,
114-
child: Text(
114+
child: const Text(
115115
"Reset",
116116
style: TextStyle(color: Colors.white),
117117
),

0 commit comments

Comments
 (0)