Skip to content

Commit d11c7cd

Browse files
committed
reactive_phone_form_field 5.0.0
1 parent 509f606 commit d11c7cd

File tree

5 files changed

+30
-44
lines changed

5 files changed

+30
-44
lines changed

packages/reactive_phone_form_field/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [5.0.0]
2+
3+
* phone_form_field: ^10.0.0
4+
15
## [3.1.0]
26

37
* added `PhoneNumberValueAccessor` which assigns `null` if `nsn` is empty could be added upon demand
@@ -6,7 +10,8 @@
610
## [3.0.0]
711

812
* Support `reactive_forms: 17.x`
9-
* Support `phone_form_field: 9.x` (read [BREAKING CHANGES](https://pub.dev/packages/phone_form_field/changelog#900))
13+
* Support `phone_form_field: 9.x` (
14+
read [BREAKING CHANGES](https://pub.dev/packages/phone_form_field/changelog#900))
1015

1116
## [2.0.1]
1217

packages/reactive_phone_form_field/example/ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22
import Flutter
33

4-
@UIApplicationMain
4+
@main
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,

packages/reactive_phone_form_field/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ void main() {
77
}
88

99
class MyApp extends StatelessWidget {
10-
const MyApp({Key? key}) : super(key: key);
10+
const MyApp({super.key});
1111

1212
FormGroup buildForm() => fb.group({
1313
'input': FormControl<PhoneNumber>(

packages/reactive_phone_form_field/lib/src/reactive_phone_form_field.dart

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,15 @@ class ReactivePhoneFormField<T>
139139
Widget Function(BuildContext, EditableTextState)? contextMenuBuilder,
140140
Function(PointerDownEvent)? onTapOutside,
141141
PhoneController? controller,
142+
Widget Function(BuildContext context, String error)? errorBuilder,
142143
}) : _textController = controller,
143144
super(
144145
builder: (field) {
145146
final state = field as _ReactivePhoneFormFieldState<T>;
146147
final effectiveDecoration = decoration
147148
.applyDefaults(Theme.of(state.context).inputDecorationTheme);
149+
final errorText = field.errorText;
150+
148151
return PhoneFormField(
149152
countryButtonStyle: countryButtonStyle,
150153
focusNode: state.focusNode,
@@ -156,8 +159,23 @@ class ReactivePhoneFormField<T>
156159
countrySelectorNavigator: countrySelectorNavigator,
157160
onSaved: onSaved,
158161
decoration: effectiveDecoration.copyWith(
159-
errorText: field.errorText,
162+
errorText: errorBuilder == null ? field.errorText : null,
160163
enabled: field.control.enabled,
164+
error: errorBuilder != null && errorText != null
165+
? DefaultTextStyle.merge(
166+
style: Theme.of(field.context)
167+
.textTheme
168+
.bodySmall
169+
?.copyWith(
170+
color: Theme.of(field.context).colorScheme.error,
171+
)
172+
.merge(effectiveDecoration.errorStyle),
173+
child: errorBuilder.call(
174+
field.context,
175+
errorText,
176+
),
177+
)
178+
: null,
161179
),
162180
cursorColor: cursorColor,
163181
autovalidateMode: AutovalidateMode.disabled,
Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: reactive_phone_form_field
22
description: Wrapper around phone_form_field to use with reactive_forms
3-
version: 3.1.0
3+
version: 5.0.0
44
repository: https://github.com/artflutter/reactive_forms_widgets/tree/master/packages/reactive_phone_form_field
55
issue_tracker: https://github.com/artflutter/reactive_forms_widgets/issues
66

@@ -12,46 +12,9 @@ dependencies:
1212
flutter:
1313
sdk: flutter
1414
reactive_forms: ">=16.0.0 <18.0.0"
15-
phone_form_field: ^9.2.5
15+
phone_form_field: ^10.0.4
1616

1717
dev_dependencies:
1818
flutter_test:
1919
sdk: flutter
20-
flutter_lints: ^4.0.0
21-
22-
# For information on the generic Dart part of this file, see the
23-
# following page: https://dart.dev/tools/pub/pubspec
24-
25-
# The following section is specific to Flutter.
26-
flutter:
27-
28-
# To add assets to your package, add an assets section, like this:
29-
# assets:
30-
# - images/a_dot_burr.jpeg
31-
# - images/a_dot_ham.jpeg
32-
#
33-
# For details regarding assets in packages, see
34-
# https://flutter.dev/assets-and-images/#from-packages
35-
#
36-
# An image asset can refer to one or more resolution-specific "variants", see
37-
# https://flutter.dev/assets-and-images/#resolution-aware.
38-
39-
# To add custom fonts to your package, add a fonts section here,
40-
# in this "flutter" section. Each entry in this list should have a
41-
# "family" key with the font family name, and a "fonts" key with a
42-
# list giving the asset and other descriptors for the font. For
43-
# example:
44-
# fonts:
45-
# - family: Schyler
46-
# fonts:
47-
# - asset: fonts/Schyler-Regular.ttf
48-
# - asset: fonts/Schyler-Italic.ttf
49-
# style: italic
50-
# - family: Trajan Pro
51-
# fonts:
52-
# - asset: fonts/TrajanPro.ttf
53-
# - asset: fonts/TrajanPro_Bold.ttf
54-
# weight: 700
55-
#
56-
# For details regarding fonts in packages, see
57-
# https://flutter.dev/custom-fonts/#from-packages
20+
flutter_lints: ^5.0.0

0 commit comments

Comments
 (0)