设置上传图片最大大小

hmxc
小赖 4 years ago
parent a09fcec1b9
commit 851ba38d3e

@ -12,17 +12,19 @@ import 'package:velocity_x/velocity_x.dart';
// Project imports: // Project imports:
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
//TODO
class BeeImagePicker { class BeeImagePicker {
static Future<File> pick({ static Future<File> pick(
String title, {String title, double maxWidth = 1000, double maxHeight = 1000}) async {
}) async {
PickedFile file = await Get.bottomSheet(CupertinoActionSheet( PickedFile file = await Get.bottomSheet(CupertinoActionSheet(
title: title.text.isIntrinsic.make(), title: title.text.isIntrinsic.make(),
actions: [ actions: [
CupertinoDialogAction( CupertinoDialogAction(
onPressed: () async => Get.back( onPressed: () async => Get.back(
result: await ImagePicker().getImage(source: ImageSource.gallery), result: await ImagePicker().getImage(
source: ImageSource.gallery,
maxHeight: maxHeight,
maxWidth: maxWidth,
),
), ),
child: [ child: [
Icon(CupertinoIcons.photo), Icon(CupertinoIcons.photo),
@ -32,7 +34,11 @@ class BeeImagePicker {
), ),
CupertinoDialogAction( CupertinoDialogAction(
onPressed: () async => Get.back( onPressed: () async => Get.back(
result: await ImagePicker().getImage(source: ImageSource.camera), result: await ImagePicker().getImage(
source: ImageSource.camera,
maxHeight: maxHeight,
maxWidth: maxWidth,
),
), ),
child: [ child: [
Icon(CupertinoIcons.camera), Icon(CupertinoIcons.camera),

Loading…
Cancel
Save