Skip to content

Commit 490679b

Browse files
feat: add example with error builder property
1 parent 8fc73b3 commit 490679b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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,

0 commit comments

Comments
 (0)