Skip to content

Commit 8c6641f

Browse files
Merge pull request #1465 from flutter-form-builder-ecosystem/feature/#1456-remove-deprecated-code
feat: #1456-remove-deprecated-code
2 parents 7754009 + 8bbfdbf commit 8c6641f

21 files changed

+314
-47
lines changed

.github/workflows/base.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ jobs:
4242
- name: Install dependencies
4343
run: flutter pub get
4444
- name: Format code
45-
run: dart format --set-exit-if-changed .
45+
run: dart format --set-exit-if-changed lib/ test/ example/
4646
- name: Analyze static code
4747
run: flutter analyze
4848
- name: Run tests
4949
run: flutter test --coverage
50+
- name: Run fixes tests
51+
run: dart fix --compare-to-golden test_fixes/
5052
- name: Upload coverage to Codecov
5153
uses: codecov/codecov-action@v5
5254
with:

analysis_options.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
include: package:flutter_lints/flutter.yaml
2+
3+
analyzer:
4+
exclude:
5+
- "test_fixes/**"

example/lib/minimal_code_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class _ExamplePageState extends State<_ExamplePage> {
4444
key: _formKey,
4545
child: Column(
4646
children: [
47-
FormBuilderFilterChip<String>(
47+
FormBuilderFilterChips<String>(
4848
decoration: const InputDecoration(
4949
labelText: 'The language of my people',
5050
enabled: false,

example/lib/sources/complete_form.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class _CompleteFormState extends State<CompleteForm> {
252252
FormBuilderValidators.maxLength(3),
253253
]),
254254
),
255-
FormBuilderFilterChip<String>(
255+
FormBuilderFilterChips<String>(
256256
autovalidateMode: AutovalidateMode.onUserInteraction,
257257
decoration: const InputDecoration(
258258
labelText: 'The language of my people'),
@@ -286,7 +286,7 @@ class _CompleteFormState extends State<CompleteForm> {
286286
FormBuilderValidators.maxLength(3),
287287
]),
288288
),
289-
FormBuilderChoiceChip<String>(
289+
FormBuilderChoiceChips<String>(
290290
autovalidateMode: AutovalidateMode.onUserInteraction,
291291
decoration: const InputDecoration(
292292
labelText:

lib/fix_data.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: 1
2+
transforms:
3+
- title: 'Remove deprecated maxChips property on FormBuilderFilterChip'
4+
date: 2025-01-15
5+
element:
6+
uris: [ 'flutter_form_builder.dart' ]
7+
constructor: ''
8+
inClass: 'FormBuilderFilterChip'
9+
changes:
10+
- kind: 'removeParameter'
11+
name: 'maxChips'
12+
- title: 'Remove deprecated resetIcon property on FormBuilderDateTimePicker'
13+
date: 2025-01-15
14+
element:
15+
uris: [ 'flutter_form_builder.dart' ]
16+
constructor: ''
17+
inClass: 'FormBuilderDateTimePicker'
18+
changes:
19+
- kind: 'removeParameter'
20+
name: 'resetIcon'
21+
- title: 'Remove deprecated onPopInvoked property on FormBuilder'
22+
date: 2025-01-15
23+
element:
24+
uris: [ 'flutter_form_builder.dart' ]
25+
constructor: ''
26+
inClass: 'FormBuilder'
27+
changes:
28+
- kind: 'removeParameter'
29+
name: 'onPopInvoked'
30+
- title: 'Rename FormBuilderChoiceChip to be plural'
31+
date: 2025-01-15
32+
element:
33+
uris: [ 'flutter_form_builder.dart' ]
34+
class: 'FormBuilderChoiceChip'
35+
changes:
36+
- kind: 'rename'
37+
newName: 'FormBuilderChoiceChips'
38+
- title: 'Rename FormBuilderFilterChip to be plural'
39+
date: 2025-01-15
40+
element:
41+
uris: [ 'flutter_form_builder.dart' ]
42+
class: 'FormBuilderFilterChip'
43+
changes:
44+
- kind: 'rename'
45+
newName: 'FormBuilderFilterChips'

lib/src/extensions/generic_validator.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
extension GenericValidator<T> on T? {
2+
/// Check if the value is empty in a generic way
23
bool emptyValidator() {
34
if (this == null) return true;
45
if (this is Iterable) return (this as Iterable).isEmpty;

lib/src/fields/form_builder_choice_chips.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:flutter_form_builder/flutter_form_builder.dart';
33

44
/// A list of `Chip`s that acts like radio buttons
5-
class FormBuilderChoiceChip<T> extends FormBuilderFieldDecoration<T> {
5+
class FormBuilderChoiceChips<T> extends FormBuilderFieldDecoration<T> {
66
/// The list of items the user can select.
77
final List<FormBuilderChipOption<T>> options;
88

@@ -344,7 +344,7 @@ class FormBuilderChoiceChip<T> extends FormBuilderFieldDecoration<T> {
344344
final String? tooltip;
345345

346346
/// Creates a list of `Chip`s that acts like radio buttons
347-
FormBuilderChoiceChip({
347+
FormBuilderChoiceChips({
348348
super.autovalidateMode = AutovalidateMode.disabled,
349349
super.enabled,
350350
super.focusNode,
@@ -457,12 +457,12 @@ class FormBuilderChoiceChip<T> extends FormBuilderFieldDecoration<T> {
457457
});
458458

459459
@override
460-
FormBuilderFieldDecorationState<FormBuilderChoiceChip<T>, T> createState() =>
460+
FormBuilderFieldDecorationState<FormBuilderChoiceChips<T>, T> createState() =>
461461
_FormBuilderChoiceChipState<T>();
462462
}
463463

464464
class _FormBuilderChoiceChipState<T>
465-
extends FormBuilderFieldDecorationState<FormBuilderChoiceChip<T>, T> {
465+
extends FormBuilderFieldDecorationState<FormBuilderChoiceChips<T>, T> {
466466
void handleFocusChange() {
467467
setState(() {});
468468
}

lib/src/fields/form_builder_date_time_picker.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ class FormBuilderDateTimePicker extends FormBuilderFieldDecoration<DateTime> {
4040
/// to noon. Explicitly set this to `null` to use the current time.
4141
final TimeOfDay initialTime;
4242

43-
@Deprecated(
44-
'This property is no used anymore. Please use decoration.suffixIcon to set your desired icon')
45-
final Widget? resetIcon;
46-
4743
/// Called when an enclosing form is saved. The value passed will be `null`
4844
/// if [format] fails to parse the text.
4945
// final FormFieldSetter<DateTime> onSaved;
@@ -146,7 +142,6 @@ class FormBuilderDateTimePicker extends FormBuilderFieldDecoration<DateTime> {
146142
this.scrollPadding = const EdgeInsets.all(20.0),
147143
this.cursorWidth = 2.0,
148144
this.enableInteractiveSelection = true,
149-
this.resetIcon = const Icon(Icons.close),
150145
this.initialTime = const TimeOfDay(hour: 12, minute: 0),
151146
this.keyboardType,
152147
this.textAlign = TextAlign.start,

lib/src/fields/form_builder_filter_chips.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
33
import 'package:flutter_form_builder/flutter_form_builder.dart';
44

55
/// Field with chips that acts like a list checkboxes.
6-
class FormBuilderFilterChip<T> extends FormBuilderFieldDecoration<List<T>> {
6+
class FormBuilderFilterChips<T> extends FormBuilderFieldDecoration<List<T>> {
77
//TODO: Add documentation
88
final Color? backgroundColor;
99
final Color? disabledColor;
@@ -35,7 +35,7 @@ class FormBuilderFilterChip<T> extends FormBuilderFieldDecoration<List<T>> {
3535
final ShapeBorder avatarBorder;
3636

3737
/// Creates field with chips that acts like a list checkboxes.
38-
FormBuilderFilterChip({
38+
FormBuilderFilterChips({
3939
super.autovalidateMode = AutovalidateMode.disabled,
4040
super.enabled,
4141
super.focusNode,
@@ -59,7 +59,7 @@ class FormBuilderFilterChip<T> extends FormBuilderFieldDecoration<List<T>> {
5959
this.labelPadding,
6060
this.labelStyle,
6161
this.materialTapTargetSize,
62-
this.maxChips,
62+
@Deprecated('Useless property. Please remove it.') this.maxChips,
6363
this.padding,
6464
this.pressElevation,
6565
this.runAlignment = WrapAlignment.start,
@@ -143,9 +143,9 @@ class FormBuilderFilterChip<T> extends FormBuilderFieldDecoration<List<T>> {
143143
);
144144

145145
@override
146-
FormBuilderFieldDecorationState<FormBuilderFilterChip<T>, List<T>>
146+
FormBuilderFieldDecorationState<FormBuilderFilterChips<T>, List<T>>
147147
createState() => _FormBuilderFilterChipState<T>();
148148
}
149149

150150
class _FormBuilderFilterChipState<T> extends FormBuilderFieldDecorationState<
151-
FormBuilderFilterChip<T>, List<T>> {}
151+
FormBuilderFilterChips<T>, List<T>> {}

lib/src/fields/form_builder_text_field.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,11 @@ class FormBuilderTextField extends FormBuilderFieldDecoration<String> {
424424
this.contentInsertionConfiguration,
425425
this.spellCheckConfiguration,
426426
this.clipBehavior = Clip.hardEdge,
427+
@Deprecated(
428+
'This property will be removed in the next Flutter stable versions. '
429+
'Use FocusNode.canRequestFocus instead. '
430+
'Ref: https://docs.flutter.dev/release/breaking-changes/can-request-focus',
431+
)
427432
this.canRequestFocus = true,
428433
this.cursorErrorColor,
429434
this.cursorOpacityAnimates,

0 commit comments

Comments
 (0)