Skip to content

Commit ed0a332

Browse files
Merge pull request #1486 from flutter-form-builder-ecosystem/feature/#1480-support-error-builder
feat: #1480 support error builder
2 parents fffb27d + 490679b commit ed0a332

20 files changed

+137
-16
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]

example/lib/sources/complete_form.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ class _CompleteFormState extends State<CompleteForm> {
8989
validator: FormBuilderValidators.compose([
9090
FormBuilderValidators.min(6),
9191
]),
92+
errorBuilder: (context, errorText) => TextButton(
93+
onPressed: () {
94+
ScaffoldMessenger.of(context).showSnackBar(
95+
SnackBar(
96+
content: Text(errorText),
97+
duration: const Duration(seconds: 2),
98+
),
99+
);
100+
},
101+
child: Text(
102+
errorText,
103+
style: const TextStyle(color: Colors.red),
104+
),
105+
),
92106
onChanged: _onChanged,
93107
min: 0.0,
94108
max: 10.0,

example/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ packages:
55
dependency: transitive
66
description:
77
name: async
8-
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
8+
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "2.12.0"
11+
version: "2.13.0"
1212
boolean_selector:
1313
dependency: transitive
1414
description:

lib/src/fields/form_builder_checkbox.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class FormBuilderCheckbox extends FormBuilderFieldDecoration<bool> {
106106
super.onReset,
107107
super.focusNode,
108108
super.restorationId,
109+
super.errorBuilder,
109110
required this.title,
110111
this.activeColor,
111112
this.autofocus = false,

lib/src/fields/form_builder_checkbox_group.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
4545
super.onReset,
4646
super.focusNode,
4747
super.restorationId,
48+
super.errorBuilder,
4849
required this.options,
4950
this.activeColor,
5051
this.checkColor,

lib/src/fields/form_builder_choice_chips.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ class FormBuilderChoiceChips<T> extends FormBuilderFieldDecoration<T> {
359359
super.onChanged,
360360
super.valueTransformer,
361361
super.onReset,
362+
super.errorBuilder,
362363
this.alignment = WrapAlignment.start,
363364
this.avatarBorder = const CircleBorder(),
364365
this.backgroundColor,

lib/src/fields/form_builder_date_range_picker.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class FormBuilderDateRangePicker
7979
super.onReset,
8080
super.focusNode,
8181
super.restorationId,
82+
super.errorBuilder,
8283
required this.firstDate,
8384
required this.lastDate,
8485
this.format,

lib/src/fields/form_builder_date_time_picker.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class FormBuilderDateTimePicker extends FormBuilderFieldDecoration<DateTime> {
138138
super.onReset,
139139
super.focusNode,
140140
super.restorationId,
141+
super.errorBuilder,
141142
this.inputType = InputType.both,
142143
this.scrollPadding = const EdgeInsets.all(20.0),
143144
this.cursorWidth = 2.0,

lib/src/fields/form_builder_dropdown.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ class FormBuilderDropdown<T> extends FormBuilderFieldDecoration<T> {
264264
super.onReset,
265265
super.focusNode,
266266
super.restorationId,
267+
super.errorBuilder,
267268
required this.items,
268269
this.isExpanded = true,
269270
this.isDense = true,

0 commit comments

Comments
 (0)