dartlangeditorflutterflutter-appsflutter-examplesflutter-packageflutter-widgetquillquill-deltaquilljsreactquillrich-textrich-text-editorwysiwygwysiwyg-editor
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
3.5 KiB
95 lines
3.5 KiB
3 years ago
|
library flutter_quill_extensions;
|
||
|
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_quill/flutter_quill.dart';
|
||
|
|
||
|
import 'embeds/builders.dart';
|
||
|
import 'embeds/embed_types.dart';
|
||
|
import 'embeds/toolbar/camera_button.dart';
|
||
|
import 'embeds/toolbar/formula_button.dart';
|
||
|
import 'embeds/toolbar/image_button.dart';
|
||
|
import 'embeds/toolbar/video_button.dart';
|
||
|
|
||
|
export 'embeds/embed_types.dart';
|
||
|
export 'embeds/toolbar/camera_button.dart';
|
||
|
export 'embeds/toolbar/formula_button.dart';
|
||
|
export 'embeds/toolbar/image_button.dart';
|
||
|
export 'embeds/toolbar/image_video_utils.dart';
|
||
|
export 'embeds/toolbar/video_button.dart';
|
||
|
export 'embeds/utils.dart';
|
||
|
|
||
|
class FlutterQuillEmbeds {
|
||
|
static List<EmbedBuilder> get builders => [
|
||
|
ImageEmbedBuilder(),
|
||
|
VideoEmbedBuilder(),
|
||
|
FormulaEmbedBuilder(),
|
||
|
];
|
||
|
|
||
|
static List<EmbedButtonBuilder> buttons({
|
||
|
bool showImageButton = true,
|
||
|
bool showVideoButton = true,
|
||
|
bool showCameraButton = true,
|
||
|
bool showFormulaButton = false,
|
||
|
OnImagePickCallback? onImagePickCallback,
|
||
|
OnVideoPickCallback? onVideoPickCallback,
|
||
|
MediaPickSettingSelector? mediaPickSettingSelector,
|
||
|
MediaPickSettingSelector? cameraPickSettingSelector,
|
||
|
FilePickImpl? filePickImpl,
|
||
|
WebImagePickImpl? webImagePickImpl,
|
||
|
WebVideoPickImpl? webVideoPickImpl,
|
||
|
}) {
|
||
|
return [
|
||
|
if (showImageButton)
|
||
|
(controller, toolbarIconSize, iconTheme, dialogTheme) => ImageButton(
|
||
|
icon: Icons.image,
|
||
|
iconSize: toolbarIconSize,
|
||
|
controller: controller,
|
||
|
onImagePickCallback: onImagePickCallback,
|
||
|
filePickImpl: filePickImpl,
|
||
|
webImagePickImpl: webImagePickImpl,
|
||
|
mediaPickSettingSelector: mediaPickSettingSelector,
|
||
|
iconTheme: iconTheme,
|
||
|
dialogTheme: dialogTheme,
|
||
|
),
|
||
|
if (showVideoButton)
|
||
|
(controller, toolbarIconSize, iconTheme, dialogTheme) => VideoButton(
|
||
|
icon: Icons.movie_creation,
|
||
|
iconSize: toolbarIconSize,
|
||
|
controller: controller,
|
||
|
onVideoPickCallback: onVideoPickCallback,
|
||
|
filePickImpl: filePickImpl,
|
||
|
webVideoPickImpl: webImagePickImpl,
|
||
|
mediaPickSettingSelector: mediaPickSettingSelector,
|
||
|
iconTheme: iconTheme,
|
||
|
dialogTheme: dialogTheme,
|
||
|
),
|
||
|
if ((onImagePickCallback != null || onVideoPickCallback != null) &&
|
||
|
showCameraButton)
|
||
|
(controller, toolbarIconSize, iconTheme, dialogTheme) => CameraButton(
|
||
|
icon: Icons.photo_camera,
|
||
|
iconSize: toolbarIconSize,
|
||
|
controller: controller,
|
||
|
onImagePickCallback: onImagePickCallback,
|
||
|
onVideoPickCallback: onVideoPickCallback,
|
||
|
filePickImpl: filePickImpl,
|
||
|
webImagePickImpl: webImagePickImpl,
|
||
|
webVideoPickImpl: webVideoPickImpl,
|
||
|
cameraPickSettingSelector: cameraPickSettingSelector,
|
||
|
iconTheme: iconTheme,
|
||
|
),
|
||
|
if (showFormulaButton)
|
||
|
(controller, toolbarIconSize, iconTheme, dialogTheme) => FormulaButton(
|
||
|
icon: Icons.functions,
|
||
|
iconSize: toolbarIconSize,
|
||
|
controller: controller,
|
||
|
onImagePickCallback: onImagePickCallback,
|
||
|
filePickImpl: filePickImpl,
|
||
|
webImagePickImpl: webImagePickImpl,
|
||
|
mediaPickSettingSelector: mediaPickSettingSelector,
|
||
|
iconTheme: iconTheme,
|
||
|
dialogTheme: dialogTheme,
|
||
|
)
|
||
|
];
|
||
|
}
|
||
|
}
|