diff --git a/flutter_quill_extensions/CHANGELOG.md b/flutter_quill_extensions/CHANGELOG.md index 5ff6b595..0ae9e262 100644 --- a/flutter_quill_extensions/CHANGELOG.md +++ b/flutter_quill_extensions/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.6.0-dev.5 +- Update the camera button + ## 0.6.0-dev.4 - Add more exports - Update `README.md`` diff --git a/flutter_quill_extensions/lib/presentation/embeds/embed_types/camera.dart b/flutter_quill_extensions/lib/presentation/embeds/embed_types/camera.dart index 7ce65321..1e293123 100644 --- a/flutter_quill_extensions/lib/presentation/embeds/embed_types/camera.dart +++ b/flutter_quill_extensions/lib/presentation/embeds/embed_types/camera.dart @@ -2,6 +2,7 @@ import 'package:flutter/widgets.dart' show BuildContext; import 'package:meta/meta.dart' show immutable; import 'image.dart'; +import 'video.dart'; enum CameraAction { video, @@ -22,7 +23,10 @@ class QuillToolbarCameraConfigurations { this.onRequestCameraActionCallback, OnImageInsertCallback? onImageInsertCallback, this.onImageInsertedCallback, - }) : _onImageInsertCallback = onImageInsertCallback; + this.onVideoInsertedCallback, + OnVideoInsertCallback? onVideoInsertCallback, + }) : _onImageInsertCallback = onImageInsertCallback, + _onVideoInsertCallback = onVideoInsertCallback; final OnRequestCameraActionCallback? onRequestCameraActionCallback; @@ -33,4 +37,12 @@ class QuillToolbarCameraConfigurations { OnImageInsertCallback get onImageInsertCallback { return _onImageInsertCallback ?? defaultOnImageInsertCallback(); } + + final OnVideoInsertedCallback? onVideoInsertedCallback; + + final OnVideoInsertCallback? _onVideoInsertCallback; + + OnVideoInsertCallback get onVideoInsertCallback { + return _onVideoInsertCallback ?? defaultOnVideoInsertCallback(); + } } diff --git a/flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart b/flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart index 5cde1ace..43d74f04 100644 --- a/flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart +++ b/flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart @@ -149,6 +149,12 @@ class QuillToolbarCameraButton extends StatelessWidget { if (videoFile == null) { return; } + await options.cameraConfigurations.onVideoInsertCallback( + videoFile.path, + controller, + ); + await options.cameraConfigurations.onVideoInsertedCallback + ?.call(videoFile.path); case CameraAction.image: final imageFile = await imagePickerService.pickImage( source: ImageSource.camera, @@ -156,7 +162,7 @@ class QuillToolbarCameraButton extends StatelessWidget { if (imageFile == null) { return; } - options.cameraConfigurations.onImageInsertCallback( + await options.cameraConfigurations.onImageInsertCallback( imageFile.path, controller, ); @@ -170,28 +176,5 @@ class QuillToolbarCameraButton extends StatelessWidget { // CameraAction.video => // imagePickerService.pickVideo(source: ImageSource.camera), // }; - - // switch (source) { - // case MediaPickSetting.camera: - // await ImageVideoUtils.handleImageButtonTap( - // context, - // controller, - // ImageSource.camera, - // onImagePickCallback!, - // filePickImpl: filePickImpl, - // webImagePickImpl: webImagePickImpl, - // ); - // break; - // case MediaPickSetting.video: - // await ImageVideoUtils.handleVideoButtonTap( - // context, - // controller, - // ImageSource.camera, - // onVideoPickCallback!, - // filePickImpl: filePickImpl, - // webVideoPickImpl: options.webVideoPickImpl, - // ); - // break; - // } } } diff --git a/flutter_quill_extensions/pubspec.yaml b/flutter_quill_extensions/pubspec.yaml index beae97f6..3a6948f9 100644 --- a/flutter_quill_extensions/pubspec.yaml +++ b/flutter_quill_extensions/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill_extensions description: Embed extensions for flutter_quill including image, video, formula and etc. -version: 0.6.0-dev.4 +version: 0.6.0-dev.5 homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions