diff --git a/flutter_quill_extensions/lib/embeds/toolbar/camera_button.dart b/flutter_quill_extensions/lib/embeds/toolbar/camera_button.dart index fbc2dfe6..b9cb4458 100644 --- a/flutter_quill_extensions/lib/embeds/toolbar/camera_button.dart +++ b/flutter_quill_extensions/lib/embeds/toolbar/camera_button.dart @@ -85,15 +85,6 @@ class CameraButton extends StatelessWidget { 'onImagePickCallback and onVideoPickCallback are both null', ); } - - var shouldShowPickPhotoByCamera = false; - var shouldShowRecordVideoByCamera = false; - if (onImagePickCallback != null) { - shouldShowPickPhotoByCamera = true; - } - if (onVideoPickCallback != null) { - shouldShowRecordVideoByCamera = true; - } final selector = cameraPickSettingSelector ?? (context) => showDialog( context: context, @@ -103,7 +94,7 @@ class CameraButton extends StatelessWidget { content: Column( mainAxisSize: MainAxisSize.min, children: [ - if (shouldShowPickPhotoByCamera) + if (onImagePickCallback != null) TextButton.icon( icon: const Icon( Icons.camera, @@ -113,7 +104,7 @@ class CameraButton extends StatelessWidget { onPressed: () => Navigator.pop(ctx, MediaPickSetting.Camera), ), - if (shouldShowRecordVideoByCamera) + if (onVideoPickCallback != null) TextButton.icon( icon: const Icon( Icons.video_call, diff --git a/flutter_quill_extensions/lib/embeds/utils.dart b/flutter_quill_extensions/lib/embeds/utils.dart index aea72e15..9d92f149 100644 --- a/flutter_quill_extensions/lib/embeds/utils.dart +++ b/flutter_quill_extensions/lib/embeds/utils.dart @@ -1,6 +1,6 @@ import 'dart:io' show File; -import 'package:flutter/foundation.dart' show Uint8List; +import 'package:flutter/foundation.dart' show Uint8List, immutable; import 'package:gal/gal.dart'; import 'package:http/http.dart' as http; @@ -41,6 +41,7 @@ bool isImageBase64(String imageUrl) { enum SaveImageResultMethod { network, localStorage } +@immutable class _SaveImageResult { const _SaveImageResult({required this.isSuccess, required this.method});