type
status
date
slug
summary
tags
category
icon
password
简单记录一下
image_picker
的使用从相册选择图片
static Future<File> pickImageFromGallery() async { final pickedFile = await ImagePicker().getImage(source: ImageSource.gallery); return File(pickedFile.path); }
从相机拍摄照片并选择
static Future<File> pickImageFromCamera() async { final pickedFile = await ImagePicker().getImage(source: ImageSource.camera); return File(pickedFile.path); }
从相册选择视频
static Future<File> pickVideoFromGallery() async { final pickedFile = await ImagePicker().getVideo(source: ImageSource.gallery); return File(pickedFile.path); }
从相机拍摄视频并选择
static Future<File> pickVideoFromCamera() async { final pickedFile = await ImagePicker().getVideo(source: ImageSource.camera); return File(pickedFile.path); }
项目
- 作者:姜康
- 链接:https://jiangkang.tech/article/6bc65363-ed2b-4f9e-9703-8077bfccf2c9
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。
相关文章