Skip to content

Commit f98d40d

Browse files
committed
chore: release form_builder_validators v8.1.0
1 parent b4b7fde commit f98d40d

File tree

4 files changed

+80
-64
lines changed

4 files changed

+80
-64
lines changed

packages/form_builder_validators/CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
## [8.0.0] - 10-Apr-2022
2-
**BREAKING CHANGE**:
3-
* Avoid passing context to validator functions.
1+
## [8.1.0] - 13-Apr-2022
2+
* Added Romanian (ro) language support
43

4+
## [8.0.0] - 10-Apr-2022
5+
* **BREAKING CHANGE**: Avoid passing context to validator functions.
56
* Added Swahili (sw) language support
67

7-
88
## [7.9.0] - 04-Apr-2022
99
* Added Bangla (bn) language support
1010

@@ -52,7 +52,7 @@
5252
* Added Arabic and Persian/Farsi support
5353

5454
## [7.0.0-beta.0] - 19-May-2021
55-
* Use intl_utils package for localization
55+
* Use `intl_utils` package for localization
5656
* Documentation and example improvements - added instructions for localization
5757
* Minor type fixes
5858

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:form_builder_validators/form_builder_validators.dart';
3+
4+
class HomePage extends StatefulWidget {
5+
const HomePage({Key key}) : super(key: key);
6+
7+
@override
8+
_HomePageState createState() => _HomePageState();
9+
}
10+
11+
class _HomePageState extends State<HomePage> {
12+
@override
13+
Widget build(BuildContext context) {
14+
return Scaffold(
15+
appBar: AppBar(title: const Text('Form Builder Validators')),
16+
body: Padding(
17+
padding: const EdgeInsets.all(8.0),
18+
child: Column(
19+
children: <Widget>[
20+
TextFormField(
21+
decoration: const InputDecoration(labelText: 'Name'),
22+
validator: FormBuilderValidators.required(),
23+
autovalidateMode: AutovalidateMode.always,
24+
),
25+
26+
// Composing multiple validators
27+
TextFormField(
28+
decoration: const InputDecoration(labelText: 'Age'),
29+
keyboardType: TextInputType.number,
30+
autovalidateMode: AutovalidateMode.always,
31+
validator: FormBuilderValidators.compose([
32+
/// Makes this field required
33+
FormBuilderValidators.required(),
34+
35+
/// Ensures the value entered is numeric - with custom error message
36+
FormBuilderValidators.numeric(
37+
errorText: 'La edad debe ser numérica.'),
38+
39+
/// Sets a maximum value of 70
40+
FormBuilderValidators.max(70),
41+
42+
/// Include your own custom `FormFieldValidator` function, if you want
43+
/// Ensures positive values only. We could also have used `FormBuilderValidators.min( 0)` instead
44+
(val) {
45+
final number = int.tryParse(val);
46+
if (number == null) return null;
47+
if (number < 0) return 'We cannot have a negative age';
48+
return null;
49+
}
50+
]),
51+
),
52+
],
53+
),
54+
),
55+
);
56+
}
57+
}

packages/form_builder_validators/example/lib/main.dart

Lines changed: 17 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
22
import 'package:flutter_localizations/flutter_localizations.dart';
33
import 'package:form_builder_validators/form_builder_validators.dart';
44

5+
import 'home_page.dart';
6+
57
void main() {
68
runApp(const MyApp());
79
}
@@ -14,78 +16,35 @@ class MyApp extends StatelessWidget {
1416
return MaterialApp(
1517
title: 'Form Builder Validators Demo',
1618
theme: ThemeData(primarySwatch: Colors.blue),
17-
home: const MyHomePage(),
19+
home: const HomePage(),
1820
supportedLocales: const [
21+
Locale('ar'),
1922
Locale('bn'),
23+
Locale('ca'),
2024
Locale('de'),
2125
Locale('en'),
2226
Locale('es'),
27+
Locale('et'),
28+
Locale('fa'),
2329
Locale('fr'),
30+
Locale('hu'),
31+
Locale('id'),
2432
Locale('it'),
33+
Locale('ja'),
34+
Locale('ko'),
2535
Locale('lo'),
26-
Locale('uk'),
36+
Locale('nl'),
37+
Locale('ro'),
2738
Locale('sw'),
39+
Locale('uk'),
40+
Locale('zh_Hans'),
41+
Locale('zh_Hant'),
2842
],
2943
localizationsDelegates: const [
30-
GlobalMaterialLocalizations.delegate,
44+
...GlobalMaterialLocalizations.delegates,
3145
GlobalWidgetsLocalizations.delegate,
3246
FormBuilderLocalizations.delegate,
3347
],
3448
);
3549
}
3650
}
37-
38-
class MyHomePage extends StatefulWidget {
39-
const MyHomePage({Key key}) : super(key: key);
40-
41-
@override
42-
_MyHomePageState createState() => _MyHomePageState();
43-
}
44-
45-
class _MyHomePageState extends State<MyHomePage> {
46-
@override
47-
Widget build(BuildContext context) {
48-
return Scaffold(
49-
appBar: AppBar(title: const Text('Form Builder Validators')),
50-
body: Padding(
51-
padding: const EdgeInsets.all(8.0),
52-
child: Column(
53-
children: <Widget>[
54-
TextFormField(
55-
decoration: const InputDecoration(labelText: 'Name'),
56-
validator: FormBuilderValidators.required(),
57-
autovalidateMode: AutovalidateMode.always,
58-
),
59-
60-
// Composing multiple validators
61-
TextFormField(
62-
decoration: const InputDecoration(labelText: 'Age'),
63-
keyboardType: TextInputType.number,
64-
autovalidateMode: AutovalidateMode.always,
65-
validator: FormBuilderValidators.compose([
66-
/// Makes this field required
67-
FormBuilderValidators.required(),
68-
69-
/// Ensures the value entered is numeric - with custom error message
70-
FormBuilderValidators.numeric(
71-
errorText: 'La edad debe ser numérica.'),
72-
73-
/// Sets a maximum value of 70
74-
FormBuilderValidators.max(70),
75-
76-
/// Include your own custom `FormFieldValidator` function, if you want
77-
/// Ensures positive values only. We could also have used `FormBuilderValidators.min( 0)` instead
78-
(val) {
79-
final number = int.tryParse(val);
80-
if (number == null) return null;
81-
if (number < 0) return 'We cannot have a negative age';
82-
return null;
83-
}
84-
]),
85-
),
86-
],
87-
),
88-
),
89-
);
90-
}
91-
}

packages/form_builder_validators/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: form_builder_validators
22
description: This package provides common reusable FormFieldValidators for Flutter FormField widgets with internationalization
3-
version: 8.0.0
3+
version: 8.1.0
44
homepage: https://github.com/danvick/flutter_form_builder
55

66
environment:

0 commit comments

Comments
 (0)