Skip to content

Commit 01a7d8c

Browse files
feat: replace error builder
1 parent 4749d9b commit 01a7d8c

8 files changed

+23
-77
lines changed

example/pubspec.lock

Lines changed: 10 additions & 10 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:
@@ -53,10 +53,10 @@ packages:
5353
dependency: transitive
5454
description:
5555
name: fake_async
56-
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
56+
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
5757
url: "https://pub.dev"
5858
source: hosted
59-
version: "1.3.2"
59+
version: "1.3.3"
6060
flutter:
6161
dependency: "direct main"
6262
description: flutter
@@ -66,10 +66,10 @@ packages:
6666
dependency: "direct main"
6767
description:
6868
name: flutter_form_builder
69-
sha256: aa3901466c70b69ae6c7f3d03fcbccaec5fde179d3fded0b10203144b546ad28
69+
sha256: "46fe878dc78d2bee2df477d3224a005740408a8cd6965a03ea2371ef530a1d45"
7070
url: "https://pub.dev"
7171
source: hosted
72-
version: "10.0.1"
72+
version: "10.1.0-beta"
7373
flutter_lints:
7474
dependency: "direct dev"
7575
description:
@@ -102,10 +102,10 @@ packages:
102102
dependency: transitive
103103
description:
104104
name: leak_tracker
105-
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
105+
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
106106
url: "https://pub.dev"
107107
source: hosted
108-
version: "10.0.8"
108+
version: "10.0.9"
109109
leak_tracker_flutter_testing:
110110
dependency: transitive
111111
description:
@@ -227,10 +227,10 @@ packages:
227227
dependency: transitive
228228
description:
229229
name: vm_service
230-
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
230+
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
231231
url: "https://pub.dev"
232232
source: hosted
233-
version: "14.3.1"
233+
version: "15.0.0"
234234
sdks:
235235
dart: ">=3.7.0 <4.0.0"
236236
flutter: ">=3.29.0"

lib/src/fields/form_builder_cupertino_checkbox.dart

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ class FormBuilderCupertinoCheckbox extends FormBuilderField<bool> {
3636
/// null, the row is shorter.
3737
final Widget? helper;
3838

39-
/// A builder widget that is displayed underneath the [prefix] and [child] widgets.
40-
///
41-
/// The [error] widget is primarily used to inform users of input errors. When
42-
/// a [Text] is given to [error], it will be shown in
43-
/// [CupertinoColors.destructiveRed] coloring and medium-weighted font. The
44-
/// row becomes taller in order to display the [helper] widget underneath
45-
/// [prefix] and [child]. If null, the row is shorter.
46-
final Widget? Function(String error)? errorBuilder;
47-
4839
/// {@macro flutter.cupertino.CupertinoCheckbox.fillColor}
4940
///
5041
/// If [fillColor] resolves to null for the requested state, then the fill color
@@ -136,9 +127,9 @@ class FormBuilderCupertinoCheckbox extends FormBuilderField<bool> {
136127
super.onReset,
137128
super.focusNode,
138129
super.restorationId,
130+
super.errorBuilder,
139131
this.activeColor,
140132
this.shouldExpandedField = false,
141-
this.errorBuilder,
142133
this.helper,
143134
this.contentPadding,
144135
this.prefix,
@@ -179,7 +170,7 @@ class FormBuilderCupertinoCheckbox extends FormBuilderField<bool> {
179170
error:
180171
state.hasError
181172
? errorBuilder != null
182-
? errorBuilder(state.errorText ?? '')
173+
? errorBuilder(state.context, state.errorText ?? '')
183174
: Text(state.errorText ?? '')
184175
: null,
185176
helper: helper,

lib/src/fields/form_builder_cupertino_segmented_control.dart

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@ class FormBuilderCupertinoSegmentedControl<T extends Object>
6464
/// null, the row is shorter.
6565
final Widget? helper;
6666

67-
/// A builder widget that is displayed underneath the [prefix] and [child] widgets.
68-
///
69-
/// The [error] widget is primarily used to inform users of input errors. When
70-
/// a [Text] is given to [error], it will be shown in
71-
/// [CupertinoColors.destructiveRed] coloring and medium-weighted font. The
72-
/// row becomes taller in order to display the [helper] widget underneath
73-
/// [prefix] and [child]. If null, the row is shorter.
74-
final Widget? Function(String error)? errorBuilder;
75-
7667
/// Creates field for selection of a value from the `CupertinoSegmentedControl`
7768
FormBuilderCupertinoSegmentedControl({
7869
super.key,
@@ -87,14 +78,14 @@ class FormBuilderCupertinoSegmentedControl<T extends Object>
8778
super.onReset,
8879
super.focusNode,
8980
super.restorationId,
81+
super.errorBuilder,
9082
required this.options,
9183
this.borderColor,
9284
this.selectedColor,
9385
this.pressedColor,
9486
this.padding,
9587
this.unselectedColor,
9688
this.shouldExpandedField = false,
97-
this.errorBuilder,
9889
this.helper,
9990
this.contentPadding,
10091
this.prefix,
@@ -122,7 +113,7 @@ class FormBuilderCupertinoSegmentedControl<T extends Object>
122113
error:
123114
state.hasError
124115
? errorBuilder != null
125-
? errorBuilder(state.errorText ?? '')
116+
? errorBuilder(state.context, state.errorText ?? '')
126117
: Text(state.errorText ?? '')
127118
: null,
128119
helper: helper,

lib/src/fields/form_builder_cupertino_slider.dart

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,6 @@ class FormBuilderCupertinoSlider extends FormBuilderField<double> {
147147
/// null, the row is shorter.
148148
final Widget? helper;
149149

150-
/// A builder widget that is displayed underneath the [prefix] and [child] widgets.
151-
///
152-
/// The [error] widget is primarily used to inform users of input errors. When
153-
/// a [Text] is given to [error], it will be shown in
154-
/// [CupertinoColors.destructiveRed] coloring and medium-weighted font. The
155-
/// row becomes taller in order to display the [helper] widget underneath
156-
/// [prefix] and [child]. If null, the row is shorter.
157-
final Widget? Function(String error)? errorBuilder;
158-
159150
/// Creates field for selection of a numerical value on a slider
160151
FormBuilderCupertinoSlider({
161152
super.key,
@@ -170,6 +161,7 @@ class FormBuilderCupertinoSlider extends FormBuilderField<double> {
170161
super.onReset,
171162
super.focusNode,
172163
super.restorationId,
164+
super.errorBuilder,
173165
required this.min,
174166
required this.max,
175167
this.divisions,
@@ -182,7 +174,6 @@ class FormBuilderCupertinoSlider extends FormBuilderField<double> {
182174
this.maxValueWidget,
183175
this.minValueWidget,
184176
this.valueWidget,
185-
this.errorBuilder,
186177
this.helper,
187178
this.contentPadding,
188179
this.prefix,
@@ -240,7 +231,7 @@ class FormBuilderCupertinoSlider extends FormBuilderField<double> {
240231
error:
241232
state.hasError
242233
? errorBuilder != null
243-
? errorBuilder(state.errorText ?? '')
234+
? errorBuilder(state.context, state.errorText ?? '')
244235
: Text(state.errorText ?? '')
245236
: null,
246237
helper: helper,

lib/src/fields/form_builder_cupertino_sliding_segmented_control.dart

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ class FormBuilderCupertinoSlidingSegmentedControl<T extends Object>
5353
/// null, the row is shorter.
5454
final Widget? helper;
5555

56-
/// A builder widget that is displayed underneath the [prefix] and [child] widgets.
57-
///
58-
/// The [error] widget is primarily used to inform users of input errors. When
59-
/// a [Text] is given to [error], it will be shown in
60-
/// [CupertinoColors.destructiveRed] coloring and medium-weighted font. The
61-
/// row becomes taller in order to display the [helper] widget underneath
62-
/// [prefix] and [child]. If null, the row is shorter.
63-
final Widget? Function(String error)? errorBuilder;
64-
6556
/// Creates field for selection of a value from the `CupertinoSegmentedControl`
6657
FormBuilderCupertinoSlidingSegmentedControl({
6758
super.key,
@@ -76,12 +67,12 @@ class FormBuilderCupertinoSlidingSegmentedControl<T extends Object>
7667
super.onReset,
7768
super.focusNode,
7869
super.restorationId,
70+
super.errorBuilder,
7971
required this.options,
8072
this.backgroundColor,
8173
this.thumbColor,
8274
this.padding,
8375
this.shouldExpandedField = false,
84-
this.errorBuilder,
8576
this.helper,
8677
this.contentPadding,
8778
this.prefix,
@@ -111,7 +102,7 @@ class FormBuilderCupertinoSlidingSegmentedControl<T extends Object>
111102
error:
112103
state.hasError
113104
? errorBuilder != null
114-
? errorBuilder(state.errorText ?? '')
105+
? errorBuilder(state.context, state.errorText ?? '')
115106
: Text(state.errorText ?? '')
116107
: null,
117108
helper: helper,

lib/src/fields/form_builder_cupertino_switch.dart

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,6 @@ class FormBuilderCupertinoSwitch extends FormBuilderField<bool> {
287287
/// null, the row is shorter.
288288
final Widget? helper;
289289

290-
/// A builder widget that is displayed underneath the [prefix] and [child] widgets.
291-
///
292-
/// The [error] widget is primarily used to inform users of input errors. When
293-
/// a [Text] is given to [error], it will be shown in
294-
/// [CupertinoColors.destructiveRed] coloring and medium-weighted font. The
295-
/// row becomes taller in order to display the [helper] widget underneath
296-
/// [prefix] and [child]. If null, the row is shorter.
297-
final Widget? Function(String error)? errorBuilder;
298-
299290
/// Creates On/Off Cupertino switch field
300291
FormBuilderCupertinoSwitch({
301292
super.key,
@@ -310,12 +301,12 @@ class FormBuilderCupertinoSwitch extends FormBuilderField<bool> {
310301
super.onReset,
311302
super.focusNode,
312303
super.restorationId,
304+
super.errorBuilder,
313305
this.activeTrackColor,
314306
this.dragStartBehavior = DragStartBehavior.start,
315307
this.trackColor,
316308
this.thumbColor,
317309
this.shouldExpandedField = false,
318-
this.errorBuilder,
319310
this.helper,
320311
this.contentPadding,
321312
this.prefix,
@@ -372,7 +363,7 @@ class FormBuilderCupertinoSwitch extends FormBuilderField<bool> {
372363
error:
373364
state.hasError
374365
? errorBuilder != null
375-
? errorBuilder(state.errorText ?? '')
366+
? errorBuilder(state.context, state.errorText ?? '')
376367
: Text(state.errorText ?? '')
377368
: null,
378369
helper: helper,

lib/src/fields/form_builder_cupertino_text_field.dart

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,6 @@ class FormBuilderCupertinoTextField extends FormBuilderField<String> {
272272
/// null, the row is shorter.
273273
final Widget? helper;
274274

275-
/// A builder widget that is displayed underneath the [prefix] and [child] widgets.
276-
///
277-
/// The [error] widget is primarily used to inform users of input errors. When
278-
/// a [Text] is given to [error], it will be shown in
279-
/// [CupertinoColors.destructiveRed] coloring and medium-weighted font. The
280-
/// row becomes taller in order to display the [helper] widget underneath
281-
/// [prefix] and [child]. If null, the row is shorter.
282-
final Widget? Function(String error)? errorBuilder;
283-
284275
/// {@macro flutter.widgets.editableText.scribbleEnabled}
285276
final bool scribbleEnabled;
286277

@@ -339,6 +330,7 @@ class FormBuilderCupertinoTextField extends FormBuilderField<String> {
339330
super.onReset,
340331
super.focusNode,
341332
super.restorationId,
333+
super.errorBuilder,
342334
this.readOnly = false,
343335
this.maxLines = 1,
344336
this.obscureText = false,
@@ -384,7 +376,6 @@ class FormBuilderCupertinoTextField extends FormBuilderField<String> {
384376
this.magnifierConfiguration,
385377
this.decoration,
386378
this.shouldExpandedField = false,
387-
this.errorBuilder,
388379
this.helper,
389380
this.contentPadding,
390381
this.prefix,
@@ -499,7 +490,7 @@ class FormBuilderCupertinoTextField extends FormBuilderField<String> {
499490
error:
500491
state.hasError
501492
? errorBuilder != null
502-
? errorBuilder(state.errorText ?? '')
493+
? errorBuilder(state.context, state.errorText ?? '')
503494
: Text(state.errorText ?? '')
504495
: null,
505496
helper: helper,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ environment:
1717
dependencies:
1818
flutter:
1919
sdk: flutter
20-
flutter_form_builder: ^10.0.1
20+
flutter_form_builder: ^10.1.0-beta
2121
# This version would be max, the same version used on flutter_localizations
2222
# https://github.com/flutter/flutter/blob/17025dd88227cd9532c33fa78f5250d548d87e9a/packages/flutter_localizations/pubspec.yaml#L14
2323
intl: ">=0.19.0 <0.21.0"

0 commit comments

Comments
 (0)