Update flutter_quill_extensions

pull/1508/head
Ellet 1 year ago
parent 6de3a85046
commit 6c0a994a98
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 3
      flutter_quill_extensions/CHANGELOG.md
  2. 14
      flutter_quill_extensions/lib/presentation/embeds/embed_types/camera.dart
  3. 31
      flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart
  4. 2
      flutter_quill_extensions/pubspec.yaml

@ -1,3 +1,6 @@
## 0.6.0-dev.5
- Update the camera button
## 0.6.0-dev.4
- Add more exports
- Update `README.md``

@ -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();
}
}

@ -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;
// }
}
}

@ -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

Loading…
Cancel
Save