mirror of
https://github.com/flutter/packages.git
synced 2025-06-30 23:03:11 +08:00
[image_picker] Update Android example (#4504)
Updates the Android implementation package's example app to use the latest version of the platform interface APIs, in preparation for formally deprecating the older versions.
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
## 0.8.7+4
|
||||||
|
|
||||||
|
* Updates the example to use the latest versions of the platform interface APIs.
|
||||||
|
|
||||||
## 0.8.7+3
|
## 0.8.7+3
|
||||||
|
|
||||||
* Bumps androidx.activity:activity from 1.7.1 to 1.7.2.
|
* Bumps androidx.activity:activity from 1.7.1 to 1.7.2.
|
||||||
|
@ -111,22 +111,23 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
await _displayPickImageDialog(context,
|
await _displayPickImageDialog(context,
|
||||||
(double? maxWidth, double? maxHeight, int? quality) async {
|
(double? maxWidth, double? maxHeight, int? quality) async {
|
||||||
try {
|
try {
|
||||||
final List<XFile>? pickedFileList = isMedia
|
final ImageOptions imageOptions = ImageOptions(
|
||||||
? await _picker.getMedia(
|
|
||||||
options: MediaOptions(
|
|
||||||
allowMultiple: isMultiImage,
|
|
||||||
imageOptions: ImageOptions(
|
|
||||||
maxWidth: maxWidth,
|
|
||||||
maxHeight: maxHeight,
|
|
||||||
imageQuality: quality,
|
|
||||||
)),
|
|
||||||
)
|
|
||||||
: await _picker.getMultiImage(
|
|
||||||
maxWidth: maxWidth,
|
maxWidth: maxWidth,
|
||||||
maxHeight: maxHeight,
|
maxHeight: maxHeight,
|
||||||
imageQuality: quality,
|
imageQuality: quality,
|
||||||
);
|
);
|
||||||
if (pickedFileList != null && context.mounted) {
|
final List<XFile> pickedFileList = isMedia
|
||||||
|
? await _picker.getMedia(
|
||||||
|
options: MediaOptions(
|
||||||
|
allowMultiple: isMultiImage,
|
||||||
|
imageOptions: imageOptions),
|
||||||
|
)
|
||||||
|
: await _picker.getMultiImageWithOptions(
|
||||||
|
options: MultiImagePickerOptions(
|
||||||
|
imageOptions: imageOptions,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (pickedFileList.isNotEmpty && context.mounted) {
|
||||||
_showPickedSnackBar(context, pickedFileList);
|
_showPickedSnackBar(context, pickedFileList);
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -167,11 +168,13 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
await _displayPickImageDialog(context,
|
await _displayPickImageDialog(context,
|
||||||
(double? maxWidth, double? maxHeight, int? quality) async {
|
(double? maxWidth, double? maxHeight, int? quality) async {
|
||||||
try {
|
try {
|
||||||
final XFile? pickedFile = await _picker.getImage(
|
final XFile? pickedFile = await _picker.getImageFromSource(
|
||||||
source: source,
|
source: source,
|
||||||
|
options: ImagePickerOptions(
|
||||||
maxWidth: maxWidth,
|
maxWidth: maxWidth,
|
||||||
maxHeight: maxHeight,
|
maxHeight: maxHeight,
|
||||||
imageQuality: quality,
|
imageQuality: quality,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
if (pickedFile != null && context.mounted) {
|
if (pickedFile != null && context.mounted) {
|
||||||
_showPickedSnackBar(context, <XFile>[pickedFile]);
|
_showPickedSnackBar(context, <XFile>[pickedFile]);
|
||||||
|
@ -3,7 +3,7 @@ description: Android implementation of the image_picker plugin.
|
|||||||
repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android
|
repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android
|
||||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
|
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
|
||||||
|
|
||||||
version: 0.8.7+3
|
version: 0.8.7+4
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.0 <4.0.0"
|
sdk: ">=2.18.0 <4.0.0"
|
||||||
|
Reference in New Issue
Block a user