dialogImageSelect function

void dialogImageSelect(
  1. BuildContext ctx,
  2. ValueNotifier<File?> photo, {
  3. void next()?,
  4. num? size,
  5. num? paddingChild,
  6. num? wirePadding,
})

Implementation

void dialogImageSelect(
  BuildContext ctx,
  ValueNotifier<File?> photo, {
  void Function()? next,
  num? size,
  num? paddingChild,
  num? wirePadding,
}) {
  showDialogCustom(
    context: ctx,
    location: Location.bottom,
    offsetHandle: fromBottom,
    style: StyleText.one(size: size),
    builder: (_) => DialogListSelect(
      paddingChild: paddingChild,
      wirePadding: wirePadding,
      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();
        }),
      ],
    ),
  );
}