diff --git a/.fvmrc b/.fvmrc new file mode 100644 index 0000000000..c300356c37 --- /dev/null +++ b/.fvmrc @@ -0,0 +1,3 @@ +{ + "flutter": "stable" +} \ No newline at end of file diff --git a/.github/workflows/base.yaml b/.github/workflows/base.yaml index 8bfd069c76..b0c53ec5a4 100644 --- a/.github/workflows/base.yaml +++ b/.github/workflows/base.yaml @@ -11,6 +11,11 @@ on: workflow_dispatch: +# This ensures that previous jobs for the PR are canceled when PR is updated +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: runs-on: macos-latest @@ -33,6 +38,7 @@ jobs: uses: subosito/flutter-action@v2 with: channel: 'stable' + cache: true - name: Install dependencies run: flutter pub get @@ -43,7 +49,9 @@ jobs: - name: Run tests run: flutter test --coverage - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: files: coverage/lcov.info name: flutter_form_builder @@ -70,5 +78,6 @@ jobs: uses: subosito/flutter-action@v2 with: channel: 'stable' + cache: true - name: Publish package run: dart pub publish -v -f diff --git a/.gitignore b/.gitignore index 92fc30b095..ac27992e94 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b1baf0d6..b2d256f496 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# [9.3.0] + +* Set minimal Flutter version to 3.22.0 +* Set minimal Dart version to 3.4.0 +* Update readme +* Add OverflowBar layout for radios and checkboxes +* fix: #1396 fix dynamic fields example widget issues +* Update to use 0.19.0 of intl package + # [9.2.1] * Set minimal Flutter version to 3.16.0 diff --git a/README.md b/README.md index 321c1130c3..509b1b06d2 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ Also included are common ready-made form input fields for FormBuilder. This give [![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/flutter-form-builder-ecosystem/flutter_form_builder?logo=codefactor&style=for-the-badge)](https://www.codefactor.io/repository/github/flutter-form-builder-ecosystem/flutter_form_builder) ___ +## Call for Maintainers + +> We are looking for maintainers to contribute to the development and maintenance of Flutter Form Builder Ecosystem. Is very important to keep the project alive and growing, so we need your help to keep it up to date and with new features. You can contribute in many ways, we describe some of them in [Support](#support) section. + - [Features](#features) - [Inputs](#inputs) - [Parameters](#parameters) @@ -281,7 +285,7 @@ FormBuilderTextField( Set the error text ```dart -RaisedButton( +ElevatedButton( child: Text('Submit'), onPressed: () async { setState(() => _emailError = null); diff --git a/example/.metadata b/example/.metadata index 732ba6d37c..784ce12982 100644 --- a/example/.metadata +++ b/example/.metadata @@ -1,11 +1,11 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled. +# This file should be version controlled and should not be manually edited. version: - revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - channel: stable + revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3" + channel: "stable" project_type: app @@ -13,11 +13,11 @@ project_type: app migration: platforms: - platform: root - create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - - platform: android - create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 - base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + - platform: web + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 # User provided section diff --git a/example/lib/main.dart b/example/lib/main.dart index c22b2aa9f1..a4b17b63e5 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -15,7 +15,7 @@ import 'sources/signup_form.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); + const MyApp({super.key}); @override Widget build(BuildContext context) { @@ -37,7 +37,7 @@ class MyApp extends StatelessWidget { } class _HomePage extends StatelessWidget { - const _HomePage({Key? key}) : super(key: key); + const _HomePage(); @override Widget build(BuildContext context) { diff --git a/example/lib/sources/complete_form.dart b/example/lib/sources/complete_form.dart index 3c41c7ad99..456ab5fc52 100644 --- a/example/lib/sources/complete_form.dart +++ b/example/lib/sources/complete_form.dart @@ -4,7 +4,7 @@ import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:intl/intl.dart'; class CompleteForm extends StatefulWidget { - const CompleteForm({Key? key}) : super(key: key); + const CompleteForm({super.key}); @override State createState() { diff --git a/example/lib/sources/conditional_fields.dart b/example/lib/sources/conditional_fields.dart index d221f30b12..291289b2d8 100644 --- a/example/lib/sources/conditional_fields.dart +++ b/example/lib/sources/conditional_fields.dart @@ -3,7 +3,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:form_builder_validators/form_builder_validators.dart'; class ConditionalFields extends StatefulWidget { - const ConditionalFields({Key? key}) : super(key: key); + const ConditionalFields({super.key}); @override State createState() => _ConditionalFieldsState(); diff --git a/example/lib/sources/custom_fields.dart b/example/lib/sources/custom_fields.dart index 92a74fb84e..c73050e9f0 100644 --- a/example/lib/sources/custom_fields.dart +++ b/example/lib/sources/custom_fields.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; class CustomFields extends StatefulWidget { - const CustomFields({Key? key}) : super(key: key); + const CustomFields({super.key}); @override State createState() => _CustomFieldsState(); diff --git a/example/lib/sources/decorated_radio_checkbox.dart b/example/lib/sources/decorated_radio_checkbox.dart index ecab94c34d..e17bd3d0c8 100644 --- a/example/lib/sources/decorated_radio_checkbox.dart +++ b/example/lib/sources/decorated_radio_checkbox.dart @@ -3,7 +3,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart'; /// Demonstrates the use of itemDecorators to wrap a box around selection items class DecoratedRadioCheckbox extends StatefulWidget { - const DecoratedRadioCheckbox({Key? key}) : super(key: key); + const DecoratedRadioCheckbox({super.key}); @override State createState() => _DecoratedRadioCheckboxState(); diff --git a/example/lib/sources/dynamic_fields.dart b/example/lib/sources/dynamic_fields.dart index 8a188fc0ea..d92a365f62 100644 --- a/example/lib/sources/dynamic_fields.dart +++ b/example/lib/sources/dynamic_fields.dart @@ -7,7 +7,7 @@ import 'package:form_builder_validators/form_builder_validators.dart'; /// fields that can be added to this widget. For the purposes of the widget, it /// is more than sufficient. class DynamicFields extends StatefulWidget { - const DynamicFields({Key? key}) : super(key: key); + const DynamicFields({super.key}); @override State createState() => _DynamicFieldsState(); diff --git a/example/lib/sources/grouped_radio_checkbox.dart b/example/lib/sources/grouped_radio_checkbox.dart index d6f95a0b3c..ea380165b2 100644 --- a/example/lib/sources/grouped_radio_checkbox.dart +++ b/example/lib/sources/grouped_radio_checkbox.dart @@ -3,7 +3,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:form_builder_validators/form_builder_validators.dart'; class GroupedRadioCheckbox extends StatefulWidget { - const GroupedRadioCheckbox({Key? key}) : super(key: key); + const GroupedRadioCheckbox({super.key}); @override State createState() { diff --git a/example/lib/sources/related_fields.dart b/example/lib/sources/related_fields.dart index de982054c1..691767fab7 100644 --- a/example/lib/sources/related_fields.dart +++ b/example/lib/sources/related_fields.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; class RelatedFields extends StatefulWidget { - const RelatedFields({Key? key}) : super(key: key); + const RelatedFields({super.key}); @override State createState() => _RelatedFieldsState(); diff --git a/example/lib/sources/signup_form.dart b/example/lib/sources/signup_form.dart index 500d1b7dd2..4f287c7d52 100644 --- a/example/lib/sources/signup_form.dart +++ b/example/lib/sources/signup_form.dart @@ -3,7 +3,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:form_builder_validators/form_builder_validators.dart'; class SignupForm extends StatefulWidget { - const SignupForm({Key? key}) : super(key: key); + const SignupForm({super.key}); @override State createState() => _SignupFormState(); diff --git a/example/pubspec.lock b/example/pubspec.lock index 01507f0f1b..023602e898 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -65,10 +65,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "4.0.0" flutter_localizations: dependency: "direct main" description: flutter @@ -82,12 +82,11 @@ packages: form_builder_validators: dependency: "direct main" description: - path: "." - ref: HEAD - resolved-ref: a4950b46152220c709d0860df1f32fbaa2e79846 - url: "https://github.com/flutter-form-builder-ecosystem/form_builder_validators.git" - source: git - version: "9.1.0" + name: form_builder_validators + sha256: "475853a177bfc832ec12551f752fd0001278358a6d42d2364681ff15f48f67cf" + url: "https://pub.dev" + source: hosted + version: "10.0.1" intl: dependency: "direct main" description: @@ -124,10 +123,10 @@ packages: dependency: transitive description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "4.0.0" matcher: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 1b954a5523..674a8f012a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,21 +4,21 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" dependencies: flutter: sdk: flutter flutter_form_builder: path: ../ - form_builder_validators: ^10.0.0 + form_builder_validators: ^10.0.1 flutter_localizations: sdk: flutter intl: ^0.19.0 dev_dependencies: - flutter_lints: ^2.0.1 + flutter_lints: ^4.0.0 flutter_test: sdk: flutter diff --git a/example/web/index.html b/example/web/index.html index 41b3bc336f..1aa025dd68 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -31,28 +31,8 @@ example - - - - - + diff --git a/lib/src/fields/form_builder_choice_chips.dart b/lib/src/fields/form_builder_choice_chips.dart index 31f2d8811b..58db23f2c2 100644 --- a/lib/src/fields/form_builder_choice_chips.dart +++ b/lib/src/fields/form_builder_choice_chips.dart @@ -57,15 +57,15 @@ class FormBuilderChoiceChip extends FormBuilderFieldDecoration { /// shape resolves to null, the default is [StadiumBorder]. /// /// This shape is combined with [side] to create a shape decorated with an - /// outline. If it is a [MaterialStateOutlinedBorder], - /// [MaterialStateProperty.resolve] is used for the following - /// [MaterialState]s: - /// - /// * [MaterialState.disabled]. - /// * [MaterialState.selected]. - /// * [MaterialState.hovered]. - /// * [MaterialState.focused]. - /// * [MaterialState.pressed]. + /// outline. If it is a [WidgetStateOutlinedBorder], + /// [WidgetStateProperty.resolve] is used for the following + /// [WidgetState]s: + /// + /// * [WidgetState.disabled]. + /// * [WidgetState.selected]. + /// * [WidgetState.hovered]. + /// * [WidgetState.focused]. + /// * [WidgetState.pressed]. final OutlinedBorder? shape; /// Configures the minimum size of the tap target. @@ -90,14 +90,14 @@ class FormBuilderChoiceChip extends FormBuilderFieldDecoration { /// This only has an effect on widgets that respect the [DefaultTextStyle], /// such as [Text]. /// - /// If [labelStyle.color] is a [MaterialStateProperty], [MaterialStateProperty.resolve] - /// is used for the following [MaterialState]s: + /// If [labelStyle.color] is a [MaterialStateProperty], [WidgetStateProperty.resolve] + /// is used for the following [WidgetState]s: /// - /// * [MaterialState.disabled]. - /// * [MaterialState.selected]. - /// * [MaterialState.hovered]. - /// * [MaterialState.focused]. - /// * [MaterialState.pressed]. + /// * [WidgetState.disabled]. + /// * [WidgetState.selected]. + /// * [WidgetState.hovered]. + /// * [WidgetState.focused]. + /// * [WidgetState.pressed]. final TextStyle? labelStyle; /// The padding between the contents of the chip and the outside [shape]. diff --git a/lib/src/fields/form_builder_date_time_picker.dart b/lib/src/fields/form_builder_date_time_picker.dart index a58561ed6d..84c70f3f44 100644 --- a/lib/src/fields/form_builder_date_time_picker.dart +++ b/lib/src/fields/form_builder_date_time_picker.dart @@ -272,7 +272,7 @@ class _FormBuilderDateTimePickerState extends FormBuilderFieldDecorationState< Future _handleFocus() async { if (effectiveFocusNode.hasFocus && enabled) { effectiveFocusNode.unfocus(); - await onShowPicker(context, value); + await onShowPicker(value); } } @@ -289,24 +289,23 @@ class _FormBuilderDateTimePickerState extends FormBuilderFieldDecorationState< } } - Future onShowPicker( - BuildContext context, DateTime? currentValue) async { + Future onShowPicker(DateTime? currentValue) async { currentValue = value; DateTime? newValue; switch (widget.inputType) { case InputType.date: - newValue = await _showDatePicker(context, currentValue); + newValue = await _showDatePicker(currentValue); break; case InputType.time: - if (!context.mounted) return null; - newValue = convert(await _showTimePicker(context, currentValue)); + if (!context.mounted) break; + newValue = convert(await _showTimePicker(currentValue)); break; case InputType.both: - if (!context.mounted) return null; - final date = await _showDatePicker(context, currentValue); + if (!context.mounted) break; + final date = await _showDatePicker(currentValue); if (date != null) { if (!mounted) break; - final time = await _showTimePicker(context, currentValue); + final time = await _showTimePicker(currentValue); newValue = combine(date, time); } break; @@ -319,8 +318,7 @@ class _FormBuilderDateTimePickerState extends FormBuilderFieldDecorationState< return finalValue; } - Future _showDatePicker( - BuildContext context, DateTime? currentValue) { + Future _showDatePicker(DateTime? currentValue) { return showDatePicker( context: context, selectableDayPredicate: widget.selectableDayPredicate, @@ -347,8 +345,7 @@ class _FormBuilderDateTimePickerState extends FormBuilderFieldDecorationState< ); } - Future _showTimePicker( - BuildContext context, DateTime? currentValue) async { + Future _showTimePicker(DateTime? currentValue) async { var builder = widget.transitionBuilder; if (widget.locale != null) { builder = (context, child) { diff --git a/lib/src/fields/form_builder_slider.dart b/lib/src/fields/form_builder_slider.dart index 9d9e23c681..ab0799612c 100644 --- a/lib/src/fields/form_builder_slider.dart +++ b/lib/src/fields/form_builder_slider.dart @@ -100,13 +100,13 @@ class FormBuilderSlider extends FormBuilderFieldDecoration { /// widget. /// /// If [mouseCursor] is a [MaterialStateProperty], - /// [MaterialStateProperty.resolve] is used for the following [MaterialState]s: + /// [WidgetStateProperty.resolve] is used for the following [WidgetState]s: /// - /// * [MaterialState.hovered]. - /// * [MaterialState.focused]. - /// * [MaterialState.disabled]. + /// * [WidgetState.hovered]. + /// * [WidgetState.focused]. + /// * [WidgetState.disabled]. /// - /// If this property is null, [MaterialStateMouseCursor.clickable] will be used. + /// If this property is null, [WidgetStateMouseCursor.clickable] will be used. final MouseCursor? mouseCursor; /// The callback used to create a semantic value from a slider value. diff --git a/lib/src/fields/form_builder_text_field.dart b/lib/src/fields/form_builder_text_field.dart index caa2be970c..52984a77fa 100644 --- a/lib/src/fields/form_builder_text_field.dart +++ b/lib/src/fields/form_builder_text_field.dart @@ -218,14 +218,14 @@ class FormBuilderTextField extends FormBuilderFieldDecoration { /// widget. /// /// If [mouseCursor] is a [MaterialStateProperty], - /// [MaterialStateProperty.resolve] is used for the following [MaterialState]s: + /// [WidgetStateProperty.resolve] is used for the following [WidgetState]s: /// - /// * [MaterialState.error]. - /// * [MaterialState.hovered]. - /// * [MaterialState.focused]. - /// * [MaterialState.disabled]. + /// * [WidgetState.error]. + /// * [WidgetState.hovered]. + /// * [WidgetState.focused]. + /// * [WidgetState.disabled]. /// - /// If this property is null, [MaterialStateMouseCursor.textable] will be used. + /// If this property is null, [WidgetStateMouseCursor.textable] will be used. /// /// The [mouseCursor] is the only property of [TextField] that controls the /// appearance of the mouse pointer. All other properties related to "cursor" diff --git a/pubspec.lock b/pubspec.lock index d1116e985e..5c8e00c66f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -58,10 +58,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "4.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -103,10 +103,10 @@ packages: dependency: transitive description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.0" matcher: dependency: transitive description: @@ -209,5 +209,5 @@ packages: source: hosted version: "14.2.1" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 01073bc952..b8b7e57008 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_form_builder description: This package helps in creation of forms in Flutter by removing the boilerplate code, reusing validation, react to changes, and collect final user input. -version: 9.2.2 +version: 9.3.0 repository: https://github.com/flutter-form-builder-ecosystem/flutter_form_builder issue_tracker: https://github.com/flutter-form-builder-ecosystem/flutter_form_builder/issues homepage: https://github.com/flutter-form-builder-ecosystem @@ -17,6 +17,6 @@ dependencies: intl: ">=0.19.0 <0.20.0" dev_dependencies: - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 flutter_test: sdk: flutter