onTapUpload method

Future<void> onTapUpload()

Implementation

Future<void> onTapUpload() async {
  if (kIsWeb) {
    List<Uint8List> bytes = await getImagesFromGallery();
    onChanged!(bytes);
  } else {
    ImageSource? imageSource =
        await ModernFormImageHelper.showBottonSheetImageSource();

    if (imageSource != null) {
      if (imageSource == ImageSource.camera) {
        List<Uint8List>? bytes = await getImagesFromCamera();
        if (bytes != null) {
          onChanged!(bytes);
        }
      } else {
        List<Uint8List> bytes = await getImagesFromGallery();
        onChanged!(bytes);
      }
    }
  }
}