Skip to content

Commit 29ab4b1

Browse files
feat: remove deprecated properties
1 parent 650c39f commit 29ab4b1

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
File Picker Field for [flutter_form_builder](https://pub.dev/packages/flutter_form_builder) package
44

55
[![Pub Version](https://img.shields.io/pub/v/form_builder_file_picker?logo=flutter&style=for-the-badge)](https://pub.dev/packages/form_builder_file_picker)
6-
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/flutter-form-builder-ecosystem/form_builder_file_picker/Base?logo=github&style=for-the-badge)](https://github.com/flutter-form-builder-ecosystem/form_builder_file_picker/actions/workflows/base.yaml)
6+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/flutter-form-builder-ecosystem/form_builder_file_picker/base.yaml?branch=main&logo=github&style=for-the-badge)](https://github.com/flutter-form-builder-ecosystem/form_builder_file_picker/actions/workflows/base.yaml)
77
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/flutter-form-builder-ecosystem/form_builder_file_picker?logo=codefactor&style=for-the-badge)](https://www.codefactor.io/repository/github/flutter-form-builder-ecosystem/form_builder_file_picker)
88
[![Codecov](https://img.shields.io/codecov/c/github/flutter-form-builder-ecosystem/form_builder_file_picker?logo=codecov&style=for-the-badge)](https://codecov.io/gh/flutter-form-builder-ecosystem/form_builder_file_picker/)
99
___
@@ -68,9 +68,8 @@ Since this package makes use of [file_picker](https://pub.dev/packages/file_pick
6868
### Specific uses
6969

7070
On mobile platforms the file picker will open a default document picker if used with `FileType.any`.
71-
If you want to be able to pick documents and images in the same form field, you will need to define different file types and thus different selectors. To achieve this use the `typeSelectors` parameter.
72-
This way the user will see two buttons to open a file picker for documents and a file picker for the photos
73-
gallery.
71+
If you want to be able to pick documents and images in the same form field, you will need to define different file types and different selectors. To achieve this use the `typeSelectors` parameter.
72+
This way the user will see two buttons to open a file picker for documents and a file picker for the photos gallery.
7473

7574
For example:
7675

lib/src/form_builder_file_picker.dart

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
3838
/// icon will be displayed depending on file type
3939
final bool previewImages;
4040

41-
/// Widget to be tapped on by user in order to pick files
42-
final Widget selector;
43-
44-
final List<TypeSelector>? typeSelectors;
45-
46-
/// Default types of files to be picked. Default set to [FileType.any]
47-
final FileType type;
41+
/// Create a list of type of document that you can pick
42+
///
43+
/// Useful if you want to be able to pick documents and images in the same form field and
44+
/// need to define different file types and different selectors.
45+
///
46+
/// By default use `[TypeSelector(type: FileType.any, selector: Icon(Icons.add_circle))]`
47+
final List<TypeSelector> typeSelectors;
4848

4949
/// Allowed file extensions for files to be selected
5050
final List<String>? allowedExtensions;
@@ -90,14 +90,9 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
9090
this.withReadStream = false,
9191
this.allowMultiple = false,
9292
this.previewImages = true,
93-
@Deprecated("please use typeSelectors for better picker and file type control")
94-
this.selector = const Icon(Icons.add_circle),
95-
@Deprecated("please use typeSelectors for better picker and file type control")
96-
this.type = FileType.any,
97-
// TODO: once the above fields are removed typeSelectors should be made not null and initialized as
98-
// const [TypeSelector(type: FileType.any, selector: Icon(Icons.add_circle))]
99-
// the typeSelectorList variable can be then removed and we can use typeSelectors directly
100-
this.typeSelectors,
93+
this.typeSelectors = const [
94+
TypeSelector(type: FileType.any, selector: Icon(Icons.add_circle))
95+
],
10196
this.allowedExtensions,
10297
this.onFileLoading,
10398
this.allowCompression = true,
@@ -106,9 +101,6 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
106101
builder: (FormFieldState<List<PlatformFile>?> field) {
107102
final state = field as _FormBuilderFilePickerState;
108103

109-
List<TypeSelector> typeSelectorList =
110-
typeSelectors ?? [TypeSelector(type: type, selector: selector)];
111-
112104
return InputDecorator(
113105
decoration: state.decoration.copyWith(
114106
counterText: maxFiles != null
@@ -119,7 +111,7 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
119111
Row(
120112
mainAxisAlignment: MainAxisAlignment.spaceBetween,
121113
children: <Widget>[
122-
...typeSelectorList.map(
114+
...typeSelectors.map(
123115
(typeSelector) => InkWell(
124116
onTap: state.enabled &&
125117
(null == state._remainingItemCount ||

0 commit comments

Comments
 (0)