Skip to content

Commit cad8625

Browse files
committed
Merge branch 'Bdaya-Dev/main'
# Conflicts: # example/pubspec.lock # lib/src/image_source_sheet.dart # pubspec.lock # pubspec.yaml
2 parents 69b3972 + a51dda7 commit cad8625

File tree

7 files changed

+282
-152
lines changed

7 files changed

+282
-152
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
## [1.0.0-nullsafety.0] - 03-Apr-2020
1+
## [2.0.0] - 28-Oct-2021
2+
* Use XFile instead of the old picker
3+
* Proper null safety
4+
* Added `displayCustomType` to accept any type for the values
5+
* Used ListView.builder for lazy loading items
6+
## [1.0.0-nullsafety.0] - 03-Apr-2021
27
* Started working on null-safety
38

49
## [0.1.2] - 31-Dec-2020

example/lib/main.dart

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_form_builder/flutter_form_builder.dart';
3+
34
import 'package:form_builder_image_picker/form_builder_image_picker.dart';
45

56
void main() {
@@ -20,6 +21,15 @@ class MyApp extends StatelessWidget {
2021
}
2122
}
2223

24+
class ApiImage {
25+
final String imageUrl;
26+
final String id;
27+
ApiImage({
28+
required this.imageUrl,
29+
required this.id,
30+
});
31+
}
32+
2333
class MyHomePage extends StatelessWidget {
2434
final _formKey = GlobalKey<FormBuilderState>();
2535

@@ -39,17 +49,35 @@ class MyHomePage extends StatelessWidget {
3949
children: <Widget>[
4050
FormBuilderImagePicker(
4151
name: 'photos',
52+
displayCustomType: (obj) =>
53+
obj is ApiImage ? obj.imageUrl : obj,
4254
decoration: const InputDecoration(labelText: 'Pick Photos'),
43-
maxImages: 1,
55+
maxImages: 5,
56+
initialValue: [
57+
'https://images.pexels.com/photos/7078045/pexels-photo-7078045.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
58+
Text('this is an image\nas a widget !'),
59+
ApiImage(
60+
id: 'whatever',
61+
imageUrl:
62+
'https://images.pexels.com/photos/8311418/pexels-photo-8311418.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260',
63+
),
64+
],
4465
),
4566
const SizedBox(height: 15),
4667
ElevatedButton(
47-
child: Text('Submit'),
48-
onPressed: () {
49-
if (_formKey.currentState.saveAndValidate()) {
50-
print(_formKey.currentState.value);
51-
}
52-
})
68+
child: Text('Submit'),
69+
onPressed: () {
70+
if (_formKey.currentState?.saveAndValidate() == true) {
71+
print(_formKey.currentState!.value);
72+
}
73+
},
74+
),
75+
ElevatedButton(
76+
child: Text('Reset'),
77+
onPressed: () {
78+
_formKey.currentState?.reset();
79+
},
80+
)
5381
],
5482
),
5583
),

example/pubspec.lock

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ packages:
5656
name: cross_file
5757
url: "https://pub.dartlang.org"
5858
source: hosted
59-
version: "0.3.1+5"
59+
version: "0.3.2"
6060
crypto:
6161
dependency: transitive
6262
description:
@@ -89,24 +89,19 @@ packages:
8989
source: sdk
9090
version: "0.0.0"
9191
flutter_form_builder:
92-
dependency: "direct main"
92+
dependency: transitive
9393
description:
9494
name: flutter_form_builder
9595
url: "https://pub.dartlang.org"
9696
source: hosted
97-
version: "6.1.0+1"
98-
flutter_localizations:
99-
dependency: transitive
100-
description: flutter
101-
source: sdk
102-
version: "0.0.0"
97+
version: "7.0.0"
10398
flutter_plugin_android_lifecycle:
10499
dependency: transitive
105100
description:
106101
name: flutter_plugin_android_lifecycle
107102
url: "https://pub.dartlang.org"
108103
source: hosted
109-
version: "2.0.1"
104+
version: "2.0.4"
110105
flutter_test:
111106
dependency: "direct dev"
112107
description: flutter
@@ -123,7 +118,7 @@ packages:
123118
path: ".."
124119
relative: true
125120
source: path
126-
version: "1.0.0-nullsafety.0"
121+
version: "2.0.0"
127122
fuchsia_remote_debug_protocol:
128123
dependency: transitive
129124
description: flutter
@@ -135,7 +130,7 @@ packages:
135130
name: http
136131
url: "https://pub.dartlang.org"
137132
source: hosted
138-
version: "0.13.3"
133+
version: "0.13.4"
139134
http_parser:
140135
dependency: transitive
141136
description:
@@ -149,14 +144,14 @@ packages:
149144
name: image_picker
150145
url: "https://pub.dartlang.org"
151146
source: hosted
152-
version: "0.8.4"
147+
version: "0.8.4+4"
153148
image_picker_for_web:
154149
dependency: transitive
155150
description:
156151
name: image_picker_for_web
157152
url: "https://pub.dartlang.org"
158153
source: hosted
159-
version: "2.1.3"
154+
version: "2.1.4"
160155
image_picker_platform_interface:
161156
dependency: transitive
162157
description:
@@ -204,13 +199,6 @@ packages:
204199
url: "https://pub.dartlang.org"
205200
source: hosted
206201
version: "1.8.0"
207-
pedantic:
208-
dependency: transitive
209-
description:
210-
name: pedantic
211-
url: "https://pub.dartlang.org"
212-
source: hosted
213-
version: "1.11.0"
214202
platform:
215203
dependency: transitive
216204
description:
@@ -224,7 +212,7 @@ packages:
224212
name: plugin_platform_interface
225213
url: "https://pub.dartlang.org"
226214
source: hosted
227-
version: "2.0.0"
215+
version: "2.0.2"
228216
process:
229217
dependency: transitive
230218
description:
@@ -315,5 +303,5 @@ packages:
315303
source: hosted
316304
version: "3.0.0"
317305
sdks:
318-
dart: ">=2.12.0 <3.0.0"
319-
flutter: ">=2.0.0"
306+
dart: ">=2.14.0 <3.0.0"
307+
flutter: ">=2.5.0"

example/pubspec.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
55
version: 1.0.0+1
66

77
environment:
8-
sdk: ">=2.7.0 <3.0.0"
8+
sdk: ">=2.12.0 <3.0.0"
99

1010
dependencies:
1111
flutter:
12-
sdk: flutter
13-
flutter_form_builder: ^6.0.0-nullsafety.0
12+
sdk: flutter
1413
form_builder_image_picker:
1514
path: ../
1615

0 commit comments

Comments
 (0)