Skip to content

Commit

Permalink
Merge branch 'release/17.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
joanpablo committed Mar 30, 2024
2 parents 18243cf + c5f3b8f commit 839968f
Show file tree
Hide file tree
Showing 55 changed files with 473 additions and 268 deletions.
53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: "\U0001F41B Bug"
about: Something is crashing or not working as intended
labels: bug

---

## Environment

**Package version:**

<details>
<summary>Flutter doctor</summary>

<!-- Paste the output of running `flutter doctor -v` below inside ``` and ``` -->
```
```

</details>

<details>
<summary>Code sample</summary>

<!--
Please create a minimal reproducible sample that shows the problem
and attach it below between the lines with the backticks.
You can use a example code or Flutter sample app
Without this we will unlikely be able to progress on the issue, and because of that
we regretfully will have to close it.
-->

```dart
```

</details>

## Description

**Expected behavior:**

**Current behavior:**

## Steps to reproduce

1. This
2. Than that
3. Then

## Images <!-- if available, else delete -->

## Stacktrace/Logcat <!-- if available, else delete -->
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "\U0001F4C3 Documentation Bug"
about: You want to report something that is wrong or missing from the documentation.
labels: documentation

---

### Describe the change you would like to see
<!-- A clear and concise description of the bug or documentation you feel is missing.
For example: The Technical Reference does not include information about the FormBuilderFilterChip widget. -->

### How would the suggested change make the documentation more useful?
<!-- Provide context for how the requested change would make the docs easier to use and improve your ability to develop successful applications with this packages.
For example: It's hard to know a method exists or understand its use when you have to search through the code base to learn about it. Properly documenting it in the Technical Reference makes it easier for me to know what the flutter_fom_builder is (and is not capable of). -->

### Additional context
<!-- Add any other context about your feedback here.
For example: I am reading the docs directly from GitHub, so it's harder for me to find information on a particular method if it's not included in the documentation. -->
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "\U0001F680 Feature request"
about: Suggest new feature or request for this project
labels: enhancement

---

## Environment

**Package version:**

## Description

**What you'd like to happen:**

**Alternatives you've considered:** <!-- if available, else delete -->

**Images:** <!-- if available, else delete -->
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: "\U0001F914 Questions and Help"
about: You have a quetion or need help using this packages
labels: question

---

## Environment

**Package version:**

## Describe your question
<!-- A clear and concise description of your question or help wanted.
For example: How can I add a datetime field? -->
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

## Breaking changes

- Remove `onWillPop` from `ReactiveForm` and `ReactiveFormBuilder` widgets.
- Removed deprecated `onWillPop` from `ReactiveForm` and `ReactiveFormBuilder` widgets.
It was replaced with the `PopScope` widget.
- `Validators.number` allows now to define negative numbers and decimal numbers with the addition
of two optional arguments `allowNegatives` and `allowedDecimals`.

## Features

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ samples, guidance on mobile development, and a full API reference.

## Minimum Requirements

- Dart SDK: >=3.0.0 <4.0.0
- Flutter: >=3.10.0
- Dart SDK: >=3.2.0 <4.0.0
- Flutter: >=3.16.0

> For using **Reactive Forms** in projects below Flutter 2.8.0 please use the version <= 10.7.0 of
> **Reactive Forms**.
Expand All @@ -88,7 +88,7 @@ dependencies:
flutter:
sdk: flutter

reactive_forms: ^16.1.1
reactive_forms: ^17.0.0
```
Then run the command `flutter packages get` on the console.
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.reactive_forms_example"
minSdkVersion 16
minSdkVersion flutter.minSdkVersion
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
3 changes: 1 addition & 2 deletions example/lib/sample_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ class SampleScreen extends StatelessWidget {
final Widget body;
final Widget? title;

const SampleScreen({Key? key, required this.body, this.title})
: super(key: key);
const SampleScreen({super.key, required this.body, this.title});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/samples/add_dynamic_controls_sample.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class ViewModelProvider extends InheritedWidget {

ViewModelProvider({
required this.viewModel,
required Widget child,
}) : super(child: child);
required super.child,
});

static NewContactViewModel? of(BuildContext context) =>
context.findAncestorWidgetOfExactType<ViewModelProvider>()?.viewModel;
Expand Down
14 changes: 5 additions & 9 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,30 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"
sdk: ">=3.2.0 <4.0.0"
flutter: ">=3.16.0"

dependencies:
flutter:
sdk: flutter
intl: ^0.18.0
intl: ^0.19.0
reactive_forms:
path: ../
#reactive_forms_widgets: ^0.3.1

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.5
cupertino_icons: ^1.0.6
#reactive_dropdown_search: ^0.9.0
#reactive_touch_spin: ^0.6.0
#reactive_segmented_control: ^0.4.0
#reactive_date_time_picker: ^0.4.0

dev_dependencies:
lints: ^2.0.0
flutter_lints: ^3.0.2
flutter_test:
sdk: flutter

dependency_overrides:
reactive_forms:
path: ../

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

Expand Down
51 changes: 17 additions & 34 deletions lib/src/models/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -833,18 +833,12 @@ class FormControl<T> extends AbstractControl<T> {
///
FormControl({
T? value,
List<Validator<dynamic>> validators = const [],
List<AsyncValidator<dynamic>> asyncValidators = const [],
int asyncValidatorsDebounceTime = 250,
bool touched = false,
bool disabled = false,
}) : super(
validators: validators,
asyncValidators: asyncValidators,
asyncValidatorsDebounceTime: asyncValidatorsDebounceTime,
disabled: disabled,
touched: touched,
) {
super.validators,
super.asyncValidators,
super.asyncValidatorsDebounceTime,
super.touched,
super.disabled,
}) {
if (value != null) {
this.value = value;
} else {
Expand Down Expand Up @@ -1039,16 +1033,11 @@ class FormControl<T> extends AbstractControl<T> {
/// that emits events each time you add or remove a control to the collection.
abstract class FormControlCollection<T> extends AbstractControl<T> {
FormControlCollection({
List<Validator<dynamic>> validators = const [],
List<AsyncValidator<dynamic>> asyncValidators = const [],
int asyncValidatorsDebounceTime = 250,
bool disabled = false,
}) : super(
validators: validators,
asyncValidators: asyncValidators,
asyncValidatorsDebounceTime: asyncValidatorsDebounceTime,
disabled: disabled,
);
super.validators,
super.asyncValidators,
super.asyncValidatorsDebounceTime,
super.disabled,
});

final _collectionChanges =
StreamController<List<AbstractControl<Object?>>>.broadcast();
Expand Down Expand Up @@ -1156,17 +1145,14 @@ class FormGroup extends FormControlCollection<Map<String, Object?>> {
/// See also [AbstractControl.validators]
FormGroup(
Map<String, AbstractControl<dynamic>> controls, {
List<Validator<dynamic>> validators = const [],
List<AsyncValidator<dynamic>> asyncValidators = const [],
int asyncValidatorsDebounceTime = 250,
super.validators,
super.asyncValidators,
super.asyncValidatorsDebounceTime,
bool disabled = false,
}) : assert(
!controls.keys.any((name) => name.contains(_controlNameDelimiter)),
'Control name should not contain dot($_controlNameDelimiter)'),
super(
validators: validators,
asyncValidators: asyncValidators,
asyncValidatorsDebounceTime: asyncValidatorsDebounceTime,
disabled: disabled,
) {
addAll(controls);
Expand Down Expand Up @@ -1670,14 +1656,11 @@ class FormArray<T> extends FormControlCollection<List<T?>> {
/// See also [AbstractControl.validators]
FormArray(
List<AbstractControl<T>> controls, {
List<Validator<dynamic>> validators = const [],
List<AsyncValidator<dynamic>> asyncValidators = const [],
int asyncValidatorsDebounceTime = 250,
super.validators,
super.asyncValidators,
super.asyncValidatorsDebounceTime,
bool disabled = false,
}) : super(
validators: validators,
asyncValidators: asyncValidators,
asyncValidatorsDebounceTime: asyncValidatorsDebounceTime,
disabled: disabled,
) {
addAll(controls);
Expand Down
4 changes: 3 additions & 1 deletion lib/src/validators/credit_card_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'package:reactive_forms/reactive_forms.dart';
/// A credit card validator that validates that the control's value is a valid
/// credit card.
class CreditCardValidator extends Validator<dynamic> {
static final RegExp onlyNumbersRegex = RegExp(r'^[0-9]+$');

const CreditCardValidator() : super();

@override
Expand All @@ -18,7 +20,7 @@ class CreditCardValidator extends Validator<dynamic> {
}

final cardNumber = control.value.toString().replaceAll(' ', '');
final isNumber = NumberValidator.numberRegex.hasMatch(cardNumber);
final isNumber = onlyNumbersRegex.hasMatch(cardNumber);

return isNumber &&
cardNumber.length >= 13 &&
Expand Down
Loading

0 comments on commit 839968f

Please sign in to comment.