@@ -182,10 +182,7 @@ class PickMethod {
182
182
icon: '⏳' ,
183
183
name: 'Custom filter options' ,
184
184
description: 'Add filter options for the picker.' ,
185
- method: (
186
- BuildContext context,
187
- List <AssetEntity > assets,
188
- ) {
185
+ method: (BuildContext context, List <AssetEntity > assets) {
189
186
return AssetPicker .pickAssets (
190
187
context,
191
188
maxAssets: maxAssetsCount,
@@ -210,11 +207,8 @@ class PickMethod {
210
207
icon: '➕' ,
211
208
name: 'Prepend special item' ,
212
209
description: 'A special item will prepend to the assets grid.' ,
213
- method: (
214
- BuildContext context,
215
- List <AssetEntity > assets,
216
- ) async {
217
- return await AssetPicker .pickAssets (
210
+ method: (BuildContext context, List <AssetEntity > assets) {
211
+ return AssetPicker .pickAssets (
218
212
context,
219
213
maxAssets: maxAssetsCount,
220
214
selectedAssets: assets,
@@ -235,11 +229,8 @@ class PickMethod {
235
229
icon: '👁️🗨️' ,
236
230
name: 'No preview' ,
237
231
description: 'Pick assets like the WhatsApp/MegaTok pattern.' ,
238
- method: (
239
- BuildContext context,
240
- List <AssetEntity > assets,
241
- ) async {
242
- return await AssetPicker .pickAssets (
232
+ method: (BuildContext context, List <AssetEntity > assets) {
233
+ return AssetPicker .pickAssets (
243
234
context,
244
235
maxAssets: maxAssetsCount,
245
236
selectedAssets: assets,
@@ -284,11 +275,8 @@ class PickMethod {
284
275
name: 'Change Languages' ,
285
276
description: 'Pass text delegates to change between languages. '
286
277
'(e.g. EnglishTextDelegate)' ,
287
- method: (
288
- BuildContext context,
289
- List <AssetEntity > assets,
290
- ) async {
291
- return await AssetPicker .pickAssets (
278
+ method: (BuildContext context, List <AssetEntity > assets) {
279
+ return AssetPicker .pickAssets (
292
280
context,
293
281
maxAssets: maxAssetsCount,
294
282
selectedAssets: assets,
@@ -298,6 +286,28 @@ class PickMethod {
298
286
);
299
287
}
300
288
289
+ factory PickMethod .preventGIFPicked (int maxAssetsCount) {
290
+ return PickMethod (
291
+ icon: '🈲' ,
292
+ name: 'Prevent GIF being picked' ,
293
+ description: 'Use selectPredicate to banned GIF picking when tapped.' ,
294
+ method: (BuildContext context, List <AssetEntity > assets) {
295
+ return AssetPicker .pickAssets (
296
+ context,
297
+ maxAssets: maxAssetsCount,
298
+ selectedAssets: assets,
299
+ selectPredicate: (BuildContext c, AssetEntity a, bool isSelected) {
300
+ print ('Asset title: ${a .title }' );
301
+ if (a.title? .endsWith ('.gif' ) == true ) {
302
+ return false ;
303
+ }
304
+ return true ;
305
+ }
306
+ );
307
+ },
308
+ );
309
+ }
310
+
301
311
final String icon;
302
312
final String name;
303
313
final String description;
0 commit comments