Skip to content

Commit e6d7414

Browse files
Merge branch 'beta'
2 parents a0af924 + 84dd066 commit e6d7414

39 files changed

+599
-488
lines changed

.github/workflows/base-beta.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Base (beta)
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 */15 * *' # Runs every 15 days for verifying changes on Flutter beta channel
6+
push:
7+
branches: [beta]
8+
tags:
9+
- '[0-9]+.[0-9]+.[0-9]+-*'
10+
11+
pull_request:
12+
branches: [beta]
13+
14+
workflow_dispatch:
15+
16+
# This ensures that previous jobs for the PR are canceled when PR is updated
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
uses: flutter-form-builder-ecosystem/.github/.github/workflows/minimal-quality.yaml@main
24+
with:
25+
codecov-name: flutter_form_builder
26+
enable-fix-tests: true
27+
fvm-flavor: beta
28+
example:
29+
uses: flutter-form-builder-ecosystem/.github/.github/workflows/build-examples.yaml@main
30+
with:
31+
fvm-flavor: beta
32+
33+
34+
deployment:
35+
permissions:
36+
id-token: write
37+
uses: flutter-form-builder-ecosystem/.github/.github/workflows/deployment.yaml@main
38+
if: ${{ github.ref_type == 'tag' }}
39+
needs: [build, example]

.github/workflows/base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [main]
66
tags:
7-
- '[0-9]+.[0-9]+.[0-9]+*'
7+
- '[0-9]+.[0-9]+.[0-9]+'
88

99
pull_request:
1010
branches: [main]

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 10.1.0-beta
2+
3+
* Add support for errorBuilder [created on Flutter core](https://github.com/flutter/flutter/pull/162255). By @deandreamatias on [#1480](https://github.com/flutter-form-builder-ecosystem/flutter_form_builder/issues/1480)
4+
15
# 10.0.1
26

37
* feat: [#1473](https://github.com/flutter-form-builder-ecosystem/flutter_form_builder/pull/1475) update intl constraints to allow use <0.21.0 by @deandreamatias

example/lib/code_page.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,13 @@ class CodePage extends StatelessWidget {
44
final String title;
55
final Widget child;
66

7-
const CodePage({
8-
super.key,
9-
required this.title,
10-
required this.child,
11-
});
7+
const CodePage({super.key, required this.title, required this.child});
128

139
@override
1410
Widget build(BuildContext context) {
1511
return Scaffold(
1612
appBar: AppBar(title: Text(title), elevation: 0),
17-
body: Padding(
18-
padding: const EdgeInsets.all(24),
19-
child: child,
20-
),
13+
body: Padding(padding: const EdgeInsets.all(24), child: child),
2114
);
2215
}
2316
}

example/lib/main.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ class MyApp extends StatelessWidget {
2929
],
3030
supportedLocales: FormBuilderLocalizations.supportedLocales,
3131
theme: ThemeData.light().copyWith(
32-
appBarTheme: const AppBarTheme()
33-
.copyWith(backgroundColor: Colors.blue.shade200)),
32+
appBarTheme: const AppBarTheme().copyWith(
33+
backgroundColor: Colors.blue.shade200,
34+
),
35+
),
3436
home: const _HomePage(),
3537
);
3638
}

example/lib/minimal_code_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class _ExamplePageState extends State<_ExamplePage> {
8484
debugPrint(_formKey.currentState?.value.toString());
8585
},
8686
child: const Text('Print'),
87-
)
87+
),
8888
],
8989
),
9090
),

example/lib/sources/complete_form.dart

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _CompleteFormState extends State<CompleteForm> {
4242
'best_language': 'Dart',
4343
'age': '13',
4444
'gender': 'Male',
45-
'languages_filter': ['Dart']
45+
'languages_filter': ['Dart'],
4646
},
4747
skipDisabled: true,
4848
child: Column(
@@ -78,8 +78,9 @@ class _CompleteFormState extends State<CompleteForm> {
7878
suffixIcon: IconButton(
7979
icon: const Icon(Icons.close),
8080
onPressed: () {
81-
_formKey.currentState!.fields['date_range']
82-
?.didChange(null);
81+
_formKey.currentState!.fields['date_range']?.didChange(
82+
null,
83+
);
8384
},
8485
),
8586
),
@@ -89,6 +90,20 @@ class _CompleteFormState extends State<CompleteForm> {
8990
validator: FormBuilderValidators.compose([
9091
FormBuilderValidators.min(6),
9192
]),
93+
errorBuilder: (context, errorText) => TextButton(
94+
onPressed: () {
95+
ScaffoldMessenger.of(context).showSnackBar(
96+
SnackBar(
97+
content: Text(errorText),
98+
duration: const Duration(seconds: 2),
99+
),
100+
);
101+
},
102+
child: Text(
103+
errorText,
104+
style: const TextStyle(color: Colors.red),
105+
),
106+
),
92107
onChanged: _onChanged,
93108
min: 0.0,
94109
max: 10.0,
@@ -109,9 +124,9 @@ class _CompleteFormState extends State<CompleteForm> {
109124
divisions: 20,
110125
maxValueWidget: (max) => TextButton(
111126
onPressed: () {
112-
_formKey.currentState?.patchValue(
113-
{'range_slider': const RangeValues(4, 100)},
114-
);
127+
_formKey.currentState?.patchValue({
128+
'range_slider': const RangeValues(4, 100),
129+
});
115130
},
116131
child: Text(max),
117132
),
@@ -186,21 +201,24 @@ class _CompleteFormState extends State<CompleteForm> {
186201
: const Icon(Icons.check),
187202
hintText: 'Select Gender',
188203
),
189-
validator: FormBuilderValidators.compose(
190-
[FormBuilderValidators.required()]),
204+
validator: FormBuilderValidators.compose([
205+
FormBuilderValidators.required(),
206+
]),
191207
items: genderOptions
192-
.map((gender) => DropdownMenuItem(
193-
alignment: AlignmentDirectional.center,
194-
value: gender,
195-
child: Text(gender),
196-
))
208+
.map(
209+
(gender) => DropdownMenuItem(
210+
alignment: AlignmentDirectional.center,
211+
value: gender,
212+
child: Text(gender),
213+
),
214+
)
197215
.toList(),
198216
onChanged: (val) {
199217
setState(() {
200-
_genderHasError = !(_formKey
201-
.currentState?.fields['gender']
202-
?.validate() ??
203-
false);
218+
_genderHasError =
219+
!(_formKey.currentState?.fields['gender']
220+
?.validate() ??
221+
false);
204222
});
205223
},
206224
valueTransformer: (val) => val?.toString(),
@@ -212,13 +230,16 @@ class _CompleteFormState extends State<CompleteForm> {
212230
initialValue: null,
213231
name: 'best_language',
214232
onChanged: _onChanged,
215-
validator: FormBuilderValidators.compose(
216-
[FormBuilderValidators.required()]),
233+
validator: FormBuilderValidators.compose([
234+
FormBuilderValidators.required(),
235+
]),
217236
options: ['Dart', 'Kotlin', 'Java', 'Swift', 'Objective-C']
218-
.map((lang) => FormBuilderFieldOption(
219-
value: lang,
220-
child: Text(lang),
221-
))
237+
.map(
238+
(lang) => FormBuilderFieldOption(
239+
value: lang,
240+
child: Text(lang),
241+
),
242+
)
222243
.toList(growable: false),
223244
controlAffinity: ControlAffinity.trailing,
224245
),
@@ -231,7 +252,8 @@ class _CompleteFormState extends State<CompleteForm> {
231252
FormBuilderCheckboxGroup<String>(
232253
autovalidateMode: AutovalidateMode.onUserInteraction,
233254
decoration: const InputDecoration(
234-
labelText: 'The language of my people'),
255+
labelText: 'The language of my people',
256+
),
235257
name: 'languages',
236258
// initialValue: const ['Dart'],
237259
options: const [
@@ -255,7 +277,8 @@ class _CompleteFormState extends State<CompleteForm> {
255277
FormBuilderFilterChips<String>(
256278
autovalidateMode: AutovalidateMode.onUserInteraction,
257279
decoration: const InputDecoration(
258-
labelText: 'The language of my people'),
280+
labelText: 'The language of my people',
281+
),
259282
name: 'languages_filter',
260283
selectedColor: Colors.red,
261284
options: const [
@@ -289,8 +312,9 @@ class _CompleteFormState extends State<CompleteForm> {
289312
FormBuilderChoiceChips<String>(
290313
autovalidateMode: AutovalidateMode.onUserInteraction,
291314
decoration: const InputDecoration(
292-
labelText:
293-
'Ok, if I had to choose one language, it would be:'),
315+
labelText:
316+
'Ok, if I had to choose one language, it would be:',
317+
),
294318
name: 'languages_choice',
295319
initialValue: 'Dart',
296320
options: const [
@@ -325,15 +349,16 @@ class _CompleteFormState extends State<CompleteForm> {
325349
children: <Widget>[
326350
Expanded(
327351
child: ElevatedButton(
328-
onPressed: () {
329-
if (_formKey.currentState?.saveAndValidate() ?? false) {
330-
debugPrint(_formKey.currentState?.value.toString());
331-
} else {
332-
debugPrint(_formKey.currentState?.value.toString());
333-
debugPrint('validation failed');
334-
}
335-
},
336-
child: const Text('Submit')),
352+
onPressed: () {
353+
if (_formKey.currentState?.saveAndValidate() ?? false) {
354+
debugPrint(_formKey.currentState?.value.toString());
355+
} else {
356+
debugPrint(_formKey.currentState?.value.toString());
357+
debugPrint('validation failed');
358+
}
359+
},
360+
child: const Text('Submit'),
361+
),
337362
),
338363
const SizedBox(width: 20),
339364
Expanded(

example/lib/sources/conditional_fields.dart

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ class _ConditionalFieldsState extends State<ConditionalFields> {
2323
FormBuilderDropdown<int>(
2424
name: 'options',
2525
validator: FormBuilderValidators.required(),
26-
decoration: const InputDecoration(
27-
label: Text('Select the option'),
28-
),
26+
decoration: const InputDecoration(label: Text('Select the option')),
2927
onChanged: (value) {
3028
setState(() {
3129
option = value;
@@ -44,15 +42,10 @@ class _ConditionalFieldsState extends State<ConditionalFields> {
4442
child: FormBuilderTextField(
4543
name: 'textfield',
4644
validator: FormBuilderValidators.minLength(4),
47-
decoration: const InputDecoration(
48-
label: Text('Magic field'),
49-
),
45+
decoration: const InputDecoration(label: Text('Magic field')),
5046
),
5147
),
52-
Visibility(
53-
visible: option == 1,
54-
child: const Text('Magic info'),
55-
),
48+
Visibility(visible: option == 1, child: const Text('Magic info')),
5649
const SizedBox(height: 10),
5750
ElevatedButton(
5851
child: const Text("Submit"),

0 commit comments

Comments
 (0)