@@ -107,13 +107,14 @@ class _MyHomePageState extends State<MyHomePage> {
107
107
});
108
108
} else {
109
109
await _displayPickImageDialog (context! ,
110
- (double ? maxWidth, double ? maxHeight, int ? quality) async {
110
+ (double ? maxWidth, double ? maxHeight, int ? quality, bool forceFullMetadata ) async {
111
111
try {
112
112
final pickedFile = await _picker.pickImage (
113
113
source: source,
114
114
maxWidth: maxWidth,
115
115
maxHeight: maxHeight,
116
116
imageQuality: quality,
117
+ forceFullMetadata: forceFullMetadata,
117
118
);
118
119
setState (() {
119
120
_imageFile = pickedFile;
@@ -358,60 +359,72 @@ class _MyHomePageState extends State<MyHomePage> {
358
359
return showDialog (
359
360
context: context,
360
361
builder: (context) {
361
- return AlertDialog (
362
- title: Text ('Add optional parameters' ),
363
- content: Column (
364
- children: < Widget > [
365
- TextField (
366
- controller: maxWidthController,
367
- keyboardType: TextInputType .numberWithOptions (decimal: true ),
368
- decoration:
369
- InputDecoration (hintText: "Enter maxWidth if desired" ),
370
- ),
371
- TextField (
372
- controller: maxHeightController,
373
- keyboardType: TextInputType .numberWithOptions (decimal: true ),
374
- decoration:
375
- InputDecoration (hintText: "Enter maxHeight if desired" ),
376
- ),
377
- TextField (
378
- controller: qualityController,
379
- keyboardType: TextInputType .number,
380
- decoration:
381
- InputDecoration (hintText: "Enter quality if desired" ),
382
- ),
383
- ],
384
- ),
385
- actions: < Widget > [
386
- TextButton (
387
- child: const Text ('CANCEL' ),
388
- onPressed: () {
389
- Navigator .of (context).pop ();
390
- },
362
+ bool forceFullMetadata = true ;
363
+ return StatefulBuilder (builder: (context, setState) {
364
+ return AlertDialog (
365
+ title: Text ('Add optional parameters' ),
366
+ content: Column (
367
+ children: < Widget > [
368
+ TextField (
369
+ controller: maxWidthController,
370
+ keyboardType: TextInputType .numberWithOptions (decimal: true ),
371
+ decoration:
372
+ InputDecoration (hintText: "Enter maxWidth if desired" ),
373
+ ),
374
+ TextField (
375
+ controller: maxHeightController,
376
+ keyboardType: TextInputType .numberWithOptions (decimal: true ),
377
+ decoration:
378
+ InputDecoration (hintText: "Enter maxHeight if desired" ),
379
+ ),
380
+ TextField (
381
+ controller: qualityController,
382
+ keyboardType: TextInputType .number,
383
+ decoration:
384
+ InputDecoration (hintText: "Enter quality if desired" ),
385
+ ),
386
+ CheckboxListTile (
387
+ value: forceFullMetadata,
388
+ onChanged: (bool ? value) {
389
+ setState (() {
390
+ forceFullMetadata = value ?? false ;
391
+ });
392
+ },
393
+ title: Text ("Force full metadata" ),
394
+ )
395
+ ],
391
396
),
392
- TextButton (
393
- child: const Text ('PICK' ),
397
+ actions: < Widget > [
398
+ TextButton (
399
+ child: const Text ('CANCEL' ),
394
400
onPressed: () {
395
- double ? width = maxWidthController.text.isNotEmpty
396
- ? double .parse (maxWidthController.text)
397
- : null ;
398
- double ? height = maxHeightController.text.isNotEmpty
399
- ? double .parse (maxHeightController.text)
400
- : null ;
401
- int ? quality = qualityController.text.isNotEmpty
402
- ? int .parse (qualityController.text)
403
- : null ;
404
- onPick (width, height, quality);
405
401
Navigator .of (context).pop ();
406
- }),
407
- ],
408
- );
402
+ },
403
+ ),
404
+ TextButton (
405
+ child: const Text ('PICK' ),
406
+ onPressed: () {
407
+ double ? width = maxWidthController.text.isNotEmpty
408
+ ? double .parse (maxWidthController.text)
409
+ : null ;
410
+ double ? height = maxHeightController.text.isNotEmpty
411
+ ? double .parse (maxHeightController.text)
412
+ : null ;
413
+ int ? quality = qualityController.text.isNotEmpty
414
+ ? int .parse (qualityController.text)
415
+ : null ;
416
+ onPick (width, height, quality, forceFullMetadata);
417
+ Navigator .of (context).pop ();
418
+ }),
419
+ ],
420
+ );
421
+ });
409
422
});
410
423
}
411
424
}
412
425
413
426
typedef void OnPickImageCallback (
414
- double ? maxWidth, double ? maxHeight, int ? quality);
427
+ double ? maxWidth, double ? maxHeight, int ? quality, bool forceFullMetadata );
415
428
416
429
class AspectRatioVideo extends StatefulWidget {
417
430
AspectRatioVideo (this .controller);
0 commit comments