|
|
|
@ -3,7 +3,7 @@ import 'dart:io'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
|
|
|
|
|
import '../models/documents/attribute.dart'; |
|
|
|
|
import '../utils/media_source.dart'; |
|
|
|
|
import '../utils/media_pick_setting.dart'; |
|
|
|
|
import 'controller.dart'; |
|
|
|
|
import 'toolbar/arrow_indicated_button_list.dart'; |
|
|
|
|
import 'toolbar/camera_button.dart'; |
|
|
|
@ -19,6 +19,7 @@ import 'toolbar/toggle_check_list_button.dart'; |
|
|
|
|
import 'toolbar/toggle_style_button.dart'; |
|
|
|
|
import 'toolbar/video_button.dart'; |
|
|
|
|
|
|
|
|
|
export '../utils/media_pick_setting.dart'; |
|
|
|
|
export 'toolbar/clear_format_button.dart'; |
|
|
|
|
export 'toolbar/color_button.dart'; |
|
|
|
|
export 'toolbar/history_button.dart'; |
|
|
|
@ -31,6 +32,7 @@ export 'toolbar/quill_icon_button.dart'; |
|
|
|
|
export 'toolbar/select_header_style_button.dart'; |
|
|
|
|
export 'toolbar/toggle_check_list_button.dart'; |
|
|
|
|
export 'toolbar/toggle_style_button.dart'; |
|
|
|
|
export 'toolbar/video_button.dart'; |
|
|
|
|
|
|
|
|
|
typedef OnImagePickCallback = Future<String?> Function(File file); |
|
|
|
|
typedef OnVideoPickCallback = Future<String?> Function(File file); |
|
|
|
@ -39,7 +41,7 @@ typedef WebImagePickImpl = Future<String?> Function( |
|
|
|
|
OnImagePickCallback onImagePickCallback); |
|
|
|
|
typedef WebVideoPickImpl = Future<String?> Function( |
|
|
|
|
OnVideoPickCallback onImagePickCallback); |
|
|
|
|
typedef MediaSourceSelectorBuilder = Future<MediaSource?> Function( |
|
|
|
|
typedef MediaPickSettingSelector = Future<MediaPickSetting?> Function( |
|
|
|
|
BuildContext context); |
|
|
|
|
|
|
|
|
|
// The default size of the icon of a button. |
|
|
|
@ -79,12 +81,12 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { |
|
|
|
|
bool showHistory = true, |
|
|
|
|
bool showHorizontalRule = false, |
|
|
|
|
bool multiRowsDisplay = true, |
|
|
|
|
bool showCamera = true, |
|
|
|
|
MediaSource? imageSource, |
|
|
|
|
bool showImageButton = true, |
|
|
|
|
bool showVideoButton = true, |
|
|
|
|
bool showCameraButton = true, |
|
|
|
|
OnImagePickCallback? onImagePickCallback, |
|
|
|
|
MediaSource? videoSource, |
|
|
|
|
OnVideoPickCallback? onVideoPickCallback, |
|
|
|
|
MediaSourceSelectorBuilder? mediaSourceSelectorBuilder, |
|
|
|
|
MediaPickSettingSelector? mediaPickSettingSelector, |
|
|
|
|
FilePickImpl? filePickImpl, |
|
|
|
|
WebImagePickImpl? webImagePickImpl, |
|
|
|
|
WebVideoPickImpl? webVideoPickImpl, |
|
|
|
@ -174,30 +176,28 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { |
|
|
|
|
iconSize: toolbarIconSize, |
|
|
|
|
controller: controller, |
|
|
|
|
), |
|
|
|
|
if (imageSource != null) |
|
|
|
|
if (showImageButton) |
|
|
|
|
ImageButton( |
|
|
|
|
icon: Icons.image, |
|
|
|
|
iconSize: toolbarIconSize, |
|
|
|
|
controller: controller, |
|
|
|
|
source: imageSource, |
|
|
|
|
onImagePickCallback: onImagePickCallback, |
|
|
|
|
filePickImpl: filePickImpl, |
|
|
|
|
webImagePickImpl: webImagePickImpl, |
|
|
|
|
mediaSourceSelectorBuilder: mediaSourceSelectorBuilder, |
|
|
|
|
mediaPickSettingSelector: mediaPickSettingSelector, |
|
|
|
|
), |
|
|
|
|
if (videoSource != null) |
|
|
|
|
if (showVideoButton) |
|
|
|
|
VideoButton( |
|
|
|
|
icon: Icons.movie_creation, |
|
|
|
|
iconSize: toolbarIconSize, |
|
|
|
|
controller: controller, |
|
|
|
|
source: videoSource, |
|
|
|
|
onVideoPickCallback: onVideoPickCallback, |
|
|
|
|
filePickImpl: filePickImpl, |
|
|
|
|
webVideoPickImpl: webImagePickImpl, |
|
|
|
|
mediaSourceSelectorBuilder: mediaSourceSelectorBuilder, |
|
|
|
|
mediaPickSettingSelector: mediaPickSettingSelector, |
|
|
|
|
), |
|
|
|
|
if ((onImagePickCallback != null || onVideoPickCallback != null) && |
|
|
|
|
showCamera) |
|
|
|
|
showCameraButton) |
|
|
|
|
CameraButton( |
|
|
|
|
icon: Icons.photo_camera, |
|
|
|
|
iconSize: toolbarIconSize, |
|
|
|
|