dialogImageSelect function

void dialogImageSelect(
  1. BuildContext ctx,
  2. ValueNotifier<File?> photo, {
  3. void next()?,
  4. num size = 40,
})

Implementation

void dialogImageSelect(BuildContext ctx, ValueNotifier<File?> photo,
    {void Function()? next, num size = 40}) {
  showDialogCustom(
    context: ctx,
    location: Location.bottom,
    offsetHandle: fromBottom,
    style: StyleText.normal(size: size),
    builder: (_) => DialogListSelect(
      children: [
        NameFunction("从相册选择", () async {
          var file = await ImagePicker().getImage(source: ImageSource.gallery);
          if (file != null) photo.value = File(file.path);
          if (next != null) next();
        }),
        NameFunction("拍摄", () async {
          var file = await ImagePicker().getImage(source: ImageSource.camera);
          if (file != null) photo.value = File(file.path);
          if (next != null) next();
        }),
      ],
    ),
  );
}