image_picker 第三方
import 'package:image_picker/image_picker.dart';
inal ImagePicker _picker = ImagePicker();
// 打开相册
final XFile? image = await _picker.pickImage(source: ImageSource.gallery);
// 打开相机
final XFile? photo = await _picker.pickImage(source: ImageSource.camera);
// 打开相机相册
final XFile? image = await _picker.pickVideo(source: ImageSource.gallery);
// 打开摄像机
final XFile? video = await _picker.pickVideo(source: ImageSource.camera);
照片回显
import "darat:io";
Image.File(File(image!.path))
视频回显
late VideoPlayerController videoPlayerController ;
late ChewieController chewieController ;
initVoide(url){
videoPlayerController = VideoPlayerController.file(url);
chewieController = ChewieController(
videoPlayerController:videoPlayerController
)
}
Chewie(
controller: chewieController,
)