Prepare for releasing 8.6.0

pull/1539/head
Ellet 1 year ago
parent 2bbb80cf84
commit 304f5a5f89
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 6
      .github/workflows/publish.yml
  2. 3
      .pubignore
  3. 7
      CHANGELOG.md
  4. 196
      doc/custom_toolbar.md
  5. 198
      example/lib/presentation/quill/quill_toolbar.dart
  6. 2
      example/macos/Flutter/GeneratedPluginRegistrant.swift
  7. 10
      example/macos/Podfile.lock
  8. 5
      flutter_quill_extensions/CHANGELOG.md
  9. 8
      flutter_quill_extensions/lib/flutter_quill_extensions.dart
  10. 35
      flutter_quill_extensions/lib/logic/extensions/controller.dart
  11. 16
      flutter_quill_extensions/lib/presentation/embeds/editor/image/image.dart
  12. 66
      flutter_quill_extensions/lib/presentation/embeds/editor/image/image_menu.dart
  13. 116
      flutter_quill_extensions/lib/presentation/embeds/editor/webview.dart
  14. 3
      flutter_quill_extensions/pubspec.yaml
  15. 3
      lib/flutter_quill.dart
  16. 24
      lib/src/extensions/quill_provider.dart
  17. 4
      lib/src/models/config/quill_configurations.dart
  18. 2
      lib/src/models/config/quill_shared_configurations.dart
  19. 33
      lib/src/models/config/toolbar/base_toolbar_configurations.dart
  20. 2
      lib/src/models/config/toolbar/buttons/color.dart
  21. 80
      lib/src/models/config/toolbar/toolbar_configurations.dart
  22. 20
      lib/src/models/config/toolbar/toolbar_shared_configurations.dart
  23. 18
      lib/src/models/documents/attribute.dart
  24. 38
      lib/src/utils/string.dart
  25. 11
      lib/src/widgets/editor/editor.dart
  26. 4
      lib/src/widgets/toolbar/base_toolbar.dart
  27. 2
      lib/src/widgets/toolbar/buttons/font_family.dart
  28. 6
      lib/src/widgets/toolbar/buttons/select_header_style.dart
  29. 2
      lib/src/widgets/toolbar/toolbar.dart
  30. 2
      lib/src/widgets/utils/provider.dart
  31. 2
      pubspec.yaml

@ -21,9 +21,11 @@ jobs:
run: flutter --version
# This is needed in order for the authentication to success
# pub token add https://pub.dev --env-var PUB_TOKEN
# dart pub token add https://pub.dev --env-var PUB_TOKEN
# Requests to "https://pub.dev" will now be authenticated using the secret token stored in the environment variable "PUB_TOKEN".
- uses: dart-lang/setup-dart@v1
# - uses: dart-lang/setup-dart@v1
- name: Update the authorization requests to "https://pub.dev" to use the environment variable "PUB_TOKEN".
run: dart pub token add https://pub.dev --env-var PUB_TOKEN
- name: Install dependencies
run: flutter pub get

@ -11,3 +11,6 @@ example/build/
example/.dart_tool/
scripts/
flutter_quill_extensions/
flutter_quill_test/
packages/

@ -2,8 +2,11 @@
All notable changes to this project will be documented in this file.
## 8.5.6
* Support [Flutter 3.16](https://medium.com/flutter/whats-new-in-flutter-3-16-dba6cb1015d1)
## 8.6.0
* **Breaking Change** Support [Flutter 3.16](https://medium.com/flutter/whats-new-in-flutter-3-16-dba6cb1015d1), please upgrade to the latest stable version of flutter in order to use this update
* **Breaking Change**: Remove Deprecated Fields
* **Breaking Change**: Extract the shared things between `QuillToolbarConfigurations` and `QuillBaseToolbarConfigurations`
* **Breaking Change**: You no longer need to use `QuillToolbarProvider` when using custom toolbar buttons, the example has been updated
## 8.5.5
* Now when opening dialogs by `QuillToolbar` you will not get an exception when you don't use `FlutterQuillLocalizations.delegate` in your `WidgetsApp`, `MaterialApp`, or `CupertinoApp`. The fix is for the `QuillToolbarSearchButton`, `QuillToolbarLinkStyleButton`, and `QuillToolbarColorButton` buttons

@ -3,8 +3,6 @@
If you want to use custom toolbar but still want the support of this libray
You can use the `QuillBaseToolbar` which is the base for the `QuillToolbar`
> If you are using the toolbar buttons like `QuillToolbarHistoryButton`, `QuillToolbarToggleStyleButton` in the somewhere like the the custom toolbar then you must provide them with `QuillToolbarProvider` inherited widget, you don't have to do this if you are using the `QuillToolbar` since it will be done for you
Example:
```dart
@ -15,115 +13,115 @@ QuillProvider(
),
child: Column(
children: [
QuillToolbarProvider(
toolbarConfigurations: const QuillToolbarConfigurations(),
child: QuillBaseToolbar(
configurations: QuillBaseToolbarConfigurations(
toolbarSize: 15 * 2,
multiRowsDisplay: false,
childrenBuilder: (context) {
final controller = context.requireQuillController;
return [
QuillToolbarHistoryButton(
controller: controller,
options: const QuillToolbarHistoryButtonOptions(
isUndo: true),
),
QuillToolbarHistoryButton(
controller: controller,
options: const QuillToolbarHistoryButtonOptions(
isUndo: false),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.bold,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_bold,
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.italic,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_italic,
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.underline,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_underline,
iconSize: 20,
),
QuillBaseToolbar(
configurations: QuillBaseToolbarConfigurations(
toolbarSize: 15 * 2,
multiRowsDisplay: false,
childrenBuilder: (context) {
final controller = context.requireQuillController;
return [
QuillToolbarImageButton(
controller: controller,
options: const QuillToolbarImageButtonOptions(),
),
QuillToolbarHistoryButton(
controller: controller,
options:
const QuillToolbarHistoryButtonOptions(isUndo: true),
),
QuillToolbarHistoryButton(
controller: controller,
options:
const QuillToolbarHistoryButtonOptions(isUndo: false),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.bold,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_bold,
iconSize: 20,
),
QuillToolbarClearFormatButton(
controller: controller,
options: const QuillToolbarClearFormatButtonOptions(
iconData: Icons.format_clear,
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.italic,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_italic,
iconSize: 20,
),
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
QuillToolbarToggleStyleButton(
attribute: Attribute.underline,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_underline,
iconSize: 20,
),
QuillToolbarSelectHeaderStyleButtons(
controller: controller,
options:
const QuillToolbarSelectHeaderStyleButtonsOptions(
iconSize: 20,
),
),
QuillToolbarClearFormatButton(
controller: controller,
options: const QuillToolbarClearFormatButtonOptions(
iconData: Icons.format_clear,
iconSize: 20,
),
QuillToolbarToggleStyleButton(
attribute: Attribute.ol,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_list_numbered,
iconSize: 20,
),
),
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
QuillToolbarSelectHeaderStyleButtons(
controller: controller,
options: const QuillToolbarSelectHeaderStyleButtonsOptions(
iconSize: 20,
),
QuillToolbarToggleStyleButton(
attribute: Attribute.ul,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_list_bulleted,
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.ol,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_list_numbered,
iconSize: 20,
),
QuillToolbarToggleStyleButton(
attribute: Attribute.blockQuote,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_quote,
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.ul,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_list_bulleted,
iconSize: 20,
),
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
QuillToolbarToggleStyleButton(
attribute: Attribute.blockQuote,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_quote,
iconSize: 20,
),
QuillToolbarIndentButton(
controller: controller,
isIncrease: true,
options: const QuillToolbarIndentButtonOptions(
iconData: Icons.format_indent_increase,
iconSize: 20,
)),
QuillToolbarIndentButton(
),
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
QuillToolbarIndentButton(
controller: controller,
isIncrease: false,
isIncrease: true,
options: const QuillToolbarIndentButtonOptions(
iconData: Icons.format_indent_decrease,
iconData: Icons.format_indent_increase,
iconSize: 20,
),
)),
QuillToolbarIndentButton(
controller: controller,
isIncrease: false,
options: const QuillToolbarIndentButtonOptions(
iconData: Icons.format_indent_decrease,
iconSize: 20,
),
];
},
),
),
];
},
),
),
Expanded(

@ -98,119 +98,115 @@ class MyQuillToolbar extends StatelessWidget {
if (state.useCustomQuillToolbar) {
// For more info
// https://github.com/singerdmx/flutter-quill/blob/master/doc/custom_toolbar.md
return QuillToolbarProvider(
toolbarConfigurations: const QuillToolbarConfigurations(),
child: QuillBaseToolbar(
configurations: QuillBaseToolbarConfigurations(
toolbarSize: 15 * 2,
multiRowsDisplay: false,
childrenBuilder: (context) {
final controller = context.requireQuillController;
return [
QuillToolbarImageButton(
controller: controller,
options: const QuillToolbarImageButtonOptions(),
return QuillBaseToolbar(
configurations: QuillBaseToolbarConfigurations(
toolbarSize: 15 * 2,
multiRowsDisplay: false,
childrenBuilder: (context) {
final controller = context.requireQuillController;
return [
QuillToolbarImageButton(
controller: controller,
options: const QuillToolbarImageButtonOptions(),
),
QuillToolbarHistoryButton(
controller: controller,
options:
const QuillToolbarHistoryButtonOptions(isUndo: true),
),
QuillToolbarHistoryButton(
controller: controller,
options:
const QuillToolbarHistoryButtonOptions(isUndo: false),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.bold,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_bold,
iconSize: 20,
),
QuillToolbarHistoryButton(
controller: controller,
options:
const QuillToolbarHistoryButtonOptions(isUndo: true),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.italic,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_italic,
iconSize: 20,
),
QuillToolbarHistoryButton(
controller: controller,
options:
const QuillToolbarHistoryButtonOptions(isUndo: false),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.underline,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_underline,
iconSize: 20,
),
QuillToolbarToggleStyleButton(
attribute: Attribute.bold,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_bold,
iconSize: 20,
),
),
QuillToolbarClearFormatButton(
controller: controller,
options: const QuillToolbarClearFormatButtonOptions(
iconData: Icons.format_clear,
iconSize: 20,
),
QuillToolbarToggleStyleButton(
attribute: Attribute.italic,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_italic,
iconSize: 20,
),
),
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
QuillToolbarSelectHeaderStyleButtons(
controller: controller,
options: const QuillToolbarSelectHeaderStyleButtonsOptions(
iconSize: 20,
),
QuillToolbarToggleStyleButton(
attribute: Attribute.underline,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_underline,
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.ol,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_list_numbered,
iconSize: 20,
),
QuillToolbarClearFormatButton(
controller: controller,
options: const QuillToolbarClearFormatButtonOptions(
iconData: Icons.format_clear,
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.ul,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_list_bulleted,
iconSize: 20,
),
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
QuillToolbarToggleStyleButton(
attribute: Attribute.blockQuote,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_quote,
iconSize: 20,
),
QuillToolbarSelectHeaderStyleButtons(
),
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
QuillToolbarIndentButton(
controller: controller,
options:
const QuillToolbarSelectHeaderStyleButtonsOptions(
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.ol,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_list_numbered,
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.ul,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_list_bulleted,
iconSize: 20,
),
),
QuillToolbarToggleStyleButton(
attribute: Attribute.blockQuote,
controller: controller,
options: const QuillToolbarToggleStyleButtonOptions(
iconData: Icons.format_quote,
iconSize: 20,
),
),
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
QuillToolbarIndentButton(
controller: controller,
isIncrease: true,
options: const QuillToolbarIndentButtonOptions(
iconData: Icons.format_indent_increase,
iconSize: 20,
)),
QuillToolbarIndentButton(
controller: controller,
isIncrease: false,
isIncrease: true,
options: const QuillToolbarIndentButtonOptions(
iconData: Icons.format_indent_decrease,
iconData: Icons.format_indent_increase,
iconSize: 20,
),
)),
QuillToolbarIndentButton(
controller: controller,
isIncrease: false,
options: const QuillToolbarIndentButtonOptions(
iconData: Icons.format_indent_decrease,
iconSize: 20,
),
];
},
),
),
];
},
),
);
}

@ -8,6 +8,7 @@ import Foundation
import desktop_drop
import device_info_plus
import file_selector_macos
import flutter_inappwebview
import gal
import pasteboard
import path_provider_foundation
@ -20,6 +21,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
GalPlugin.register(with: registry.registrar(forPlugin: "GalPlugin"))
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))

@ -5,6 +5,9 @@ PODS:
- FlutterMacOS
- file_selector_macos (0.0.1):
- FlutterMacOS
- flutter_inappwebview (0.0.1):
- FlutterMacOS
- OrderedSet (~> 5.0)
- FlutterMacOS (1.0.0)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
@ -12,6 +15,7 @@ PODS:
- gal (1.0.0):
- Flutter
- FlutterMacOS
- OrderedSet (5.0.0)
- pasteboard (0.0.1):
- FlutterMacOS
- path_provider_foundation (0.0.1):
@ -32,6 +36,7 @@ DEPENDENCIES:
- desktop_drop (from `Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos`)
- device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`)
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
- flutter_inappwebview (from `Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- gal (from `Flutter/ephemeral/.symlinks/plugins/gal/darwin`)
- pasteboard (from `Flutter/ephemeral/.symlinks/plugins/pasteboard/macos`)
@ -44,6 +49,7 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- FMDB
- OrderedSet
EXTERNAL SOURCES:
desktop_drop:
@ -52,6 +58,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos
file_selector_macos:
:path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos
flutter_inappwebview:
:path: Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview/macos
FlutterMacOS:
:path: Flutter/ephemeral
gal:
@ -73,9 +81,11 @@ SPEC CHECKSUMS:
desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898
device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f
file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9
flutter_inappwebview: 62e949df616a9f6e1b0366326381f208c7fcad37
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
pasteboard: 9b69dba6fedbb04866be632205d532fe2f6b1d99
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7

@ -2,8 +2,11 @@
All notable changes to this project will be documented in this file.
## 0.6.12
* The `FlutterQuillLocalizations.delegate` is no longer a requirement.
## 0.6.11
* Support [Flutter 3.16](https://medium.com/flutter/whats-new-in-flutter-3-16-dba6cb1015d1)
* **Breaking Change** Support [Flutter 3.16](https://medium.com/flutter/whats-new-in-flutter-3-16-dba6cb1015d1), please upgrade to the latest stable version of flutter in order to use this update
## 0.6.10
* Update deprecated members from `flutter_quill`

@ -1,3 +1,5 @@
// ignore_for_file: unused_import
library flutter_quill_extensions;
import 'package:flutter/foundation.dart' show kIsWeb;
@ -86,8 +88,6 @@ class FlutterQuillEmbeds {
const QuillEditorImageEmbedConfigurations(),
QuillEditorVideoEmbedConfigurations? videoEmbedConfigurations =
const QuillEditorVideoEmbedConfigurations(),
QuillEditorWebViewEmbedConfigurations? webViewEmbedConfigurations =
const QuillEditorWebViewEmbedConfigurations(),
}) {
if (kIsWeb) {
throw UnsupportedError(
@ -104,10 +104,6 @@ class FlutterQuillEmbeds {
QuillEditorVideoEmbedBuilder(
configurations: videoEmbedConfigurations,
),
if (webViewEmbedConfigurations != null)
QuillEditorWebViewEmbedBuilder(
configurations: webViewEmbedConfigurations,
)
];
}

@ -1,5 +1,6 @@
import 'package:flutter_quill/flutter_quill.dart';
// ignore: unused_import
import '../../presentation/embeds/editor/webview.dart';
import '../utils/quill_image_utils.dart';
@ -13,24 +14,24 @@ extension QuillControllerExt on QuillController {
/// Insert webview embed block, it requires [initialUrl] to load
/// the initial page
void insertWebViewBlock({
required String initialUrl,
}) {
final block = BlockEmbed.custom(
QuillEditorWebViewBlockEmbed(
initialUrl,
),
);
// void insertWebViewBlock({
// required String initialUrl,
// }) {
// final block = BlockEmbed.custom(
// QuillEditorWebViewBlockEmbed(
// initialUrl,
// ),
// );
this
..skipRequestKeyboard = true
..replaceText(
index,
length,
block,
null,
);
}
// this
// ..skipRequestKeyboard = true
// ..replaceText(
// index,
// length,
// block,
// null,
// );
// }
/// Insert image embed block, it requires the [imageSource]
///

@ -121,13 +121,15 @@ class QuillEditorImageEmbedBuilder extends EmbedBuilder {
builder: (_) {
return QuillProvider.value(
value: context.requireQuillProvider,
child: ImageOptionsMenu(
controller: controller,
configurations: configurations,
imageSource: imageSource,
imageSize: imageSize,
isReadOnly: readOnly,
imageSaverService: imageSaverService,
child: FlutterQuillLocalizationsWidget(
child: ImageOptionsMenu(
controller: controller,
configurations: configurations,
imageSource: imageSource,
imageSize: imageSize,
isReadOnly: readOnly,
imageSaverService: imageSaverService,
),
),
);
},

@ -2,7 +2,14 @@ import 'package:flutter/cupertino.dart' show showCupertinoModalPopup;
import 'package:flutter/material.dart';
import 'package:flutter_quill/extensions.dart' show isMobile;
import 'package:flutter_quill/flutter_quill.dart'
show ImageUrl, QuillController, StyleAttribute, getEmbedNode;
show
FlutterQuillLocalizationsWidget,
ImageUrl,
QuillController,
QuillProvider,
QuillProviderExt,
StyleAttribute,
getEmbedNode;
import 'package:flutter_quill/translations.dart';
import '../../../../logic/models/config/shared_configurations.dart';
@ -47,33 +54,38 @@ class ImageOptionsMenu extends StatelessWidget {
Navigator.pop(context);
showCupertinoModalPopup<void>(
context: context,
builder: (context) {
final screenSize = MediaQuery.sizeOf(context);
return ImageResizer(
onImageResize: (width, height) {
final res = getEmbedNode(
controller,
controller.selection.start,
);
builder: (modalContext) {
final screenSize = MediaQuery.sizeOf(modalContext);
return QuillProvider.value(
value: context.requireQuillProvider,
child: FlutterQuillLocalizationsWidget(
child: ImageResizer(
onImageResize: (width, height) {
final res = getEmbedNode(
controller,
controller.selection.start,
);
final attr = replaceStyleStringWithSize(
getImageStyleString(controller),
width: width,
height: height,
isMobile: isMobile(supportWeb: false),
);
controller
..skipRequestKeyboard = true
..formatText(
res.offset,
1,
StyleAttribute(attr),
);
},
imageWidth: imageSize.width,
imageHeight: imageSize.height,
maxWidth: screenSize.width,
maxHeight: screenSize.height,
final attr = replaceStyleStringWithSize(
getImageStyleString(controller),
width: width,
height: height,
isMobile: isMobile(supportWeb: false),
);
controller
..skipRequestKeyboard = true
..formatText(
res.offset,
1,
StyleAttribute(attr),
);
},
imageWidth: imageSize.width,
imageHeight: imageSize.height,
maxWidth: screenSize.width,
maxHeight: screenSize.height,
),
),
);
},
);

@ -1,58 +1,58 @@
import 'dart:convert' show jsonDecode, jsonEncode;
import 'package:flutter/widgets.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:meta/meta.dart' show experimental;
import '../../models/config/editor/webview.dart';
@experimental
class QuillEditorWebViewBlockEmbed extends CustomBlockEmbed {
const QuillEditorWebViewBlockEmbed(
String value,
) : super(webViewType, value);
factory QuillEditorWebViewBlockEmbed.fromDocument(Document document) =>
QuillEditorWebViewBlockEmbed(jsonEncode(document.toDelta().toJson()));
static const String webViewType = 'webview';
Document get document => Document.fromJson(jsonDecode(data));
}
@experimental
class QuillEditorWebViewEmbedBuilder extends EmbedBuilder {
const QuillEditorWebViewEmbedBuilder({
required this.configurations,
});
@override
bool get expanded => false;
final QuillEditorWebViewEmbedConfigurations configurations;
@override
Widget build(
BuildContext context,
QuillController controller,
Embed node,
bool readOnly,
bool inline,
TextStyle textStyle,
) {
final url = node.value.data as String;
return SizedBox(
width: double.infinity,
height: 200,
child: InAppWebView(
initialUrlRequest: URLRequest(
url: Uri.parse(url),
),
),
);
}
@override
String get key => 'webview';
}
// import 'dart:convert' show jsonDecode, jsonEncode;
// import 'package:flutter/widgets.dart';
// import 'package:flutter_inappwebview/flutter_inappwebview.dart';
// import 'package:flutter_quill/flutter_quill.dart';
// import 'package:meta/meta.dart' show experimental;
// import '../../models/config/editor/webview.dart';
// @experimental
// class QuillEditorWebViewBlockEmbed extends CustomBlockEmbed {
// const QuillEditorWebViewBlockEmbed(
// String value,
// ) : super(webViewType, value);
// factory QuillEditorWebViewBlockEmbed.fromDocument(Document document) =>
// QuillEditorWebViewBlockEmbed(jsonEncode(document.toDelta().toJson()));
// static const String webViewType = 'webview';
// Document get document => Document.fromJson(jsonDecode(data));
// }
// @experimental
// class QuillEditorWebViewEmbedBuilder extends EmbedBuilder {
// const QuillEditorWebViewEmbedBuilder({
// required this.configurations,
// });
// @override
// bool get expanded => false;
// final QuillEditorWebViewEmbedConfigurations configurations;
// @override
// Widget build(
// BuildContext context,
// QuillController controller,
// Embed node,
// bool readOnly,
// bool inline,
// TextStyle textStyle,
// ) {
// final url = node.value.data as String;
// return SizedBox(
// width: double.infinity,
// height: 200,
// child: InAppWebView(
// initialUrlRequest: URLRequest(
// url: Uri.parse(url),
// ),
// ),
// );
// }
// @override
// String get key => 'webview';
// }

@ -38,8 +38,7 @@ dependencies:
# Plugins
video_player: ^2.8.1
youtube_player_flutter: ^8.1.2
flutter_inappwebview: ^5.8.0
youtube_player_flutter: ^9.0.0-beta.0
gal: ^2.1.3
image_picker: ^1.0.4
url_launcher: ^6.2.1

@ -1,9 +1,10 @@
library flutter_quill;
export 'src/extensions/quill_provider.dart';
export 'src/l10n/widgets/localizations.dart';
export 'src/models/config/quill_configurations.dart';
export 'src/models/config/raw_editor/configurations.dart';
export 'src/models/config/toolbar/base_configurations.dart';
export 'src/models/config/toolbar/base_toolbar_configurations.dart';
export 'src/models/documents/attribute.dart';
export 'src/models/documents/document.dart';
export 'src/models/documents/nodes/block.dart';

@ -104,6 +104,24 @@ extension QuillProviderExt on BuildContext {
return QuillToolbarProvider.of(this)?.toolbarConfigurations;
}
/// return [QuillBaseToolbarConfigurations] as not null . Since the quill
/// toolbar configurations is in the [QuillBaseToolbarProvider]
/// then we need to get the
/// provider widget first and then we will return toolbar configurations
/// throw exception if [QuillBaseToolbarProvider] is not in the widget tree
QuillBaseToolbarConfigurations get requireQuillBaseToolbarConfigurations {
return QuillBaseToolbarProvider.ofNotNull(this).toolbarConfigurations;
}
/// return nullable [QuillBaseToolbarConfigurations]. Since the quill
/// toolbar configurations is in the [QuillBaseToolbarProvider]
/// then we need to get the
/// provider widget first and then we will return toolbar configurations
/// don't throw exception if [QuillBaseToolbarProvider] is not in the widget tree
QuillBaseToolbarConfigurations? get quillBaseToolbarConfigurations {
return QuillBaseToolbarProvider.of(this)?.toolbarConfigurations;
}
/// return nullable [QuillToolbarBaseButtonOptions]. Since the quill
/// toolbar base button options is in the [QuillProvider] then we need to
/// get the provider widget first and then we will return base button
@ -117,7 +135,11 @@ extension QuillProviderExt on BuildContext {
/// get the provider widget first and then we will return base button
/// throw exception if [QuillProvider] is not in the widget tree
QuillToolbarBaseButtonOptions get requireQuillToolbarBaseButtonOptions {
return requireQuillToolbarConfigurations.buttonOptions.base;
return quillToolbarConfigurations?.buttonOptions.base ??
quillBaseToolbarConfigurations?.buttonOptions.base ??
(throw ArgumentError(
"The buttonOptions is required and it's required",
));
}
/// return nullable [QuillToolbarBaseButtonOptions]. Since the quill

@ -4,8 +4,8 @@ import 'package:flutter/foundation.dart' show immutable;
import '../../../flutter_quill.dart';
export './editor/configurations.dart';
export './shared_configurations.dart';
export './toolbar/configurations.dart';
export 'quill_shared_configurations.dart';
export 'toolbar/toolbar_configurations.dart';
@immutable
class QuillConfigurations extends Equatable {

@ -3,8 +3,8 @@ import 'package:flutter/material.dart' show Color, Colors, Locale;
import '../themes/quill_dialog_theme.dart';
import './editor/configurations.dart' show QuillEditorConfigurations;
import './toolbar/configurations.dart' show QuillToolbarConfigurations;
import 'others/animations.dart';
import 'toolbar/toolbar_configurations.dart' show QuillToolbarConfigurations;
export './others/animations.dart';

@ -0,0 +1,33 @@
import 'package:flutter/widgets.dart'
show Axis, WrapAlignment, WrapCrossAlignment, immutable;
import '../../../widgets/toolbar/base_toolbar.dart';
import 'toolbar_shared_configurations.dart';
@immutable
class QuillBaseToolbarConfigurations extends QuillSharedToolbarProperties {
const QuillBaseToolbarConfigurations({
required this.childrenBuilder,
super.axis = Axis.horizontal,
super.toolbarSize = kDefaultIconSize * 2,
super.toolbarSectionSpacing = kToolbarSectionSpacing,
super.toolbarIconAlignment = WrapAlignment.center,
super.toolbarIconCrossAlignment = WrapCrossAlignment.center,
super.color,
super.customButtons = const [],
super.sectionDividerColor,
super.sectionDividerSpace,
super.linkDialogAction,
super.multiRowsDisplay = true,
super.decoration,
/// Note this only used when you using the quill toolbar buttons like
/// `QuillToolbarHistoryButton` inside it
super.buttonOptions = const QuillToolbarButtonOptions(),
});
final QuillBaseToolbarChildrenBuilder childrenBuilder;
@override
List<Object?> get props => [];
}

@ -1,7 +1,7 @@
import 'package:flutter/widgets.dart' show Color;
import '../../../../widgets/controller.dart';
import './../../shared_configurations.dart' show QuillSharedConfigurations;
import '../../quill_shared_configurations.dart' show QuillSharedConfigurations;
import 'base.dart';
class QuillToolbarColorButtonExtraOptions

@ -1,10 +1,9 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;
import 'package:flutter/widgets.dart'
show Axis, Color, Decoration, Widget, WrapAlignment, WrapCrossAlignment;
show Axis, Widget, WrapAlignment, WrapCrossAlignment;
import '../../../widgets/embeds.dart';
import '../../structs/link_dialog_action.dart';
import '../../themes/quill_dialog_theme.dart';
import '../../themes/quill_icon_theme.dart';
import 'buttons/base.dart';
@ -21,6 +20,7 @@ import 'buttons/select_alignment.dart';
import 'buttons/select_header_style.dart';
import 'buttons/toggle_check_list.dart';
import 'buttons/toggle_style.dart';
import 'toolbar_shared_configurations.dart';
export './../../../widgets/toolbar/buttons/search/search_dialog.dart';
export './buttons/base.dart';
@ -52,14 +52,13 @@ const double kToolbarSectionSpacing = 4;
/// The configurations for the toolbar widget of flutter quill
@immutable
class QuillToolbarConfigurations extends Equatable {
class QuillToolbarConfigurations extends QuillSharedToolbarProperties {
const QuillToolbarConfigurations({
this.toolbarSectionSpacing = kToolbarSectionSpacing,
this.toolbarIconAlignment = WrapAlignment.center,
this.toolbarIconCrossAlignment = WrapCrossAlignment.center,
this.buttonOptions = const QuillToolbarButtonOptions(),
this.multiRowsDisplay = true,
this.fontFamilyValues,
super.toolbarSectionSpacing = kToolbarSectionSpacing,
super.toolbarIconAlignment = WrapAlignment.center,
super.toolbarIconCrossAlignment = WrapCrossAlignment.center,
super.buttonOptions = const QuillToolbarButtonOptions(),
super.multiRowsDisplay = true,
this.fontSizesValues,
this.showDividers = true,
this.showFontFamily = true,
@ -92,22 +91,22 @@ class QuillToolbarConfigurations extends Equatable {
this.showSearchButton = true,
this.showSubscript = true,
this.showSuperscript = true,
this.customButtons = const [],
super.customButtons = const [],
/// The decoration to use for the toolbar.
this.decoration,
super.decoration,
/// Toolbar items to display for controls of embed blocks
this.embedButtons,
this.linkDialogAction,
super.linkDialogAction,
///The theme to use for the icons in the toolbar, uses type [QuillIconTheme]
// this.iconTheme,
this.dialogTheme,
this.axis = Axis.horizontal,
this.color,
this.sectionDividerColor,
this.sectionDividerSpace,
super.axis = Axis.horizontal,
super.color,
super.sectionDividerColor,
super.sectionDividerSpace,
this.spacerWidget,
/// By default it will calculated based on the [globalIconSize] from
@ -115,12 +114,13 @@ class QuillToolbarConfigurations extends Equatable {
/// You can change it but the the change only apply if
/// the [multiRowsDisplay] is false, if [multiRowsDisplay] then the value
/// will be [kDefaultIconSize] * 2
double? toolbarSize,
super.toolbarSize,
}) : _toolbarSize = toolbarSize;
final double? _toolbarSize;
/// The toolbar size, by default it will be `baseButtonOptions.iconSize * 2`
@override
double get toolbarSize {
final alternativeToolbarSize = _toolbarSize;
if (alternativeToolbarSize != null) {
@ -129,10 +129,6 @@ class QuillToolbarConfigurations extends Equatable {
return buttonOptions.base.globalIconSize * 2;
}
/// If you want change spesefic buttons or all of them
/// then you came to the right place
final QuillToolbarButtonOptions buttonOptions;
/// A widget that will placed between each button in the toolbar
/// can be used as a spacer
/// it will not used before the first button
@ -141,23 +137,6 @@ class QuillToolbarConfigurations extends Equatable {
/// Default value will be [SizedBox.shrink()]
/// some widgets like the header styles will be considered as one widget
final Widget? spacerWidget;
final bool multiRowsDisplay;
/// By default it will be
/// ```
/// {
/// 'Sans Serif': 'sans-serif',
/// 'Serif': 'serif',
/// 'Monospace': 'monospace',
/// 'Ibarra Real Nova': 'ibarra-real-nova',
/// 'SquarePeg': 'square-peg',
/// 'Nunito': 'nunito',
/// 'Pacifico': 'pacifico',
/// 'Roboto Mono': 'roboto-mono',
/// 'Clear'.loc: 'Clear'
/// };
/// ```
final Map<String, String>? fontFamilyValues;
/// By default it will be
/// ```
@ -170,17 +149,6 @@ class QuillToolbarConfigurations extends Equatable {
/// ```
final Map<String, String>? fontSizesValues;
/// Toolbar axis
/// it will apply only for [QuillToolbar.basic]
/// we will update that logic soon
final Axis axis;
// Overrides the action in the _LinkDialog widget
final LinkDialogAction? linkDialogAction;
final double toolbarSectionSpacing;
final WrapAlignment toolbarIconAlignment;
final WrapCrossAlignment toolbarIconCrossAlignment;
final bool showDividers;
final bool showFontFamily;
final bool showFontSize;
@ -212,10 +180,6 @@ class QuillToolbarConfigurations extends Equatable {
final bool showSearchButton;
final bool showSubscript;
final bool showSuperscript;
final List<QuillToolbarCustomButtonOptions> customButtons;
/// The decoration to use for the toolbar.
final Decoration? decoration;
/// Toolbar items to display for controls of embed blocks
final List<EmbedButtonBuilder>? embedButtons;
@ -227,20 +191,10 @@ class QuillToolbarConfigurations extends Equatable {
///shown when embedding an image, for example
final QuillDialogTheme? dialogTheme;
/// The color of the toolbar
final Color? color;
/// The color of the toolbar section divider
final Color? sectionDividerColor;
/// The space occupied by toolbar divider
final double? sectionDividerSpace;
@override
List<Object?> get props => [
buttonOptions,
multiRowsDisplay,
fontFamilyValues,
fontSizesValues,
toolbarSize,
axis,

@ -1,16 +1,14 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/widgets.dart'
show Axis, Color, Decoration, WrapAlignment, WrapCrossAlignment, immutable;
show Axis, Color, Decoration, WrapAlignment, WrapCrossAlignment;
import '../../../widgets/toolbar/base_toolbar.dart';
import '../../structs/link_dialog_action.dart';
@immutable
class QuillBaseToolbarConfigurations extends Equatable {
const QuillBaseToolbarConfigurations({
required this.childrenBuilder,
abstract class QuillSharedToolbarProperties extends Equatable {
const QuillSharedToolbarProperties({
this.toolbarSize,
this.axis = Axis.horizontal,
this.toolbarSize = kDefaultIconSize * 2,
this.toolbarSectionSpacing = kToolbarSectionSpacing,
this.toolbarIconAlignment = WrapAlignment.center,
this.toolbarIconCrossAlignment = WrapCrossAlignment.center,
@ -21,14 +19,13 @@ class QuillBaseToolbarConfigurations extends Equatable {
this.linkDialogAction,
this.multiRowsDisplay = true,
this.decoration,
this.buttonOptions = const QuillToolbarButtonOptions(),
});
final QuillBaseToolbarChildrenBuilder childrenBuilder;
final Axis axis;
final double toolbarSectionSpacing;
final WrapAlignment toolbarIconAlignment;
final WrapCrossAlignment toolbarIconCrossAlignment;
final double toolbarSize;
final double? toolbarSize;
// Overrides the action in the _LinkDialog widget
final LinkDialogAction? linkDialogAction;
@ -57,6 +54,7 @@ class QuillBaseToolbarConfigurations extends Equatable {
/// The decoration to use for the toolbar.
final Decoration? decoration;
@override
List<Object?> get props => [];
/// If you want change spesefic buttons or all of them
/// then you came to the right place
final QuillToolbarButtonOptions buttonOptions;
}

@ -109,24 +109,6 @@ class Attribute<T> extends Equatable {
static final ScriptAttribute script = ScriptAttribute(null);
@Deprecated('This property is no logner used in flutter_quill')
static const String mobileWidth = 'mobileWidth';
@Deprecated('This property is no logner used in flutter_quill')
static const String mobileHeight = 'mobileHeight';
@Deprecated('This property is no logner used in flutter_quill')
static const String mobileMargin = 'mobileMargin';
@Deprecated('This property is no logner used in flutter_quill')
static const String mobileAlignment = 'mobileAlignment';
@Deprecated("Will be removed as it doesn't confirm to Quill js")
static const String alignment = 'alignment';
@Deprecated("Will be removed as it doesn't confirm to Quill js")
static const String margin = 'margin';
static const ImageAttribute image = ImageAttribute(null);
static const VideoAttribute video = VideoAttribute(null);

@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import '../models/documents/attribute.dart';
Map<String, String> parseKeyValuePairs(String s, Set<String> targetKeys) {
final result = <String, String>{};
final pairs = s.split(';');
@ -19,42 +17,6 @@ Map<String, String> parseKeyValuePairs(String s, Set<String> targetKeys) {
return result;
}
@Deprecated('This function is no longer used in flutter_quill')
String replaceStyleStringWithSize(
String cssStyle, {
required double width,
required double height,
required bool isMobile,
}) {
final result = <String, String>{};
final pairs = cssStyle.split(';');
for (final pair in pairs) {
final index = pair.indexOf(':');
if (index < 0) {
continue;
}
final key = pair.substring(0, index).trim();
result[key] = pair.substring(index + 1).trim();
}
if (isMobile) {
result['mobileWidth'] = width.toString();
result['mobileHeight'] = height.toString();
} else {
result[Attribute.width.key] = width.toString();
result[Attribute.height.key] = height.toString();
}
final sb = StringBuffer();
for (final pair in result.entries) {
sb
..write(pair.key)
..write(': ')
..write(pair.value)
..write('; ');
}
return sb.toString();
}
/// Get flutter [Alignment] value by [cssAlignment]
Alignment getAlignment(String? cssAlignment) {
const defaultAlignment = Alignment.center;

@ -8,14 +8,23 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import '../../../flutter_quill.dart';
import '../../extensions/quill_provider.dart';
import '../../l10n/widgets/localizations.dart';
import '../../models/config/editor/configurations.dart';
import '../../models/config/raw_editor/configurations.dart';
import '../../models/documents/document.dart';
import '../../models/documents/nodes/container.dart' as container_node;
import '../../models/documents/nodes/leaf.dart';
import '../../models/structs/offset_value.dart';
import '../../utils/platform.dart';
import '../box.dart';
import '../cursor.dart';
import '../delegate.dart';
import '../embeds.dart';
import '../float_cursor.dart';
import '../raw_editor/raw_editor.dart';
import '../text_selection.dart';
import '../utils/provider.dart';
import 'editor_builder.dart';
/// Base interface for the editor state which defines contract used by

@ -3,11 +3,11 @@ import 'package:flutter/material.dart';
import '../../../flutter_quill.dart'
show QuillBaseToolbarProvider, defaultToolbarSize;
import '../../l10n/widgets/localizations.dart';
import '../../models/config/toolbar/base_configurations.dart';
import '../../models/config/toolbar/base_toolbar_configurations.dart';
import 'buttons/arrow_indicated_list.dart';
export '../../models/config/toolbar/buttons/base.dart';
export '../../models/config/toolbar/configurations.dart';
export '../../models/config/toolbar/toolbar_configurations.dart';
export 'buttons/clear_format.dart';
export 'buttons/color/color.dart';
export 'buttons/custom_button.dart';

@ -86,8 +86,8 @@ class QuillToolbarFontFamilyButtonState
}
Map<String, String> get rawItemsMap {
// context.requireQuillToolbarConfigurations.buttonOptions;
final rawItemsMap = options.rawItemsMap ??
context.requireQuillToolbarConfigurations.fontFamilyValues ??
{
'Sans Serif': 'sans-serif',
'Serif': 'serif',

@ -87,7 +87,11 @@ class QuillToolbarSelectHeaderStyleButtonsState
}
Axis get axis {
return options.axis ?? context.requireQuillToolbarConfigurations.axis;
return options.axis ??
context.quillToolbarConfigurations?.axis ??
context.quillBaseToolbarConfigurations?.axis ??
(throw ArgumentError(
'There is no default value for the Axis of the toolbar'));
}
void _sharedOnPressed(Attribute attribute) {

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import '../../extensions/quill_provider.dart';
import '../../l10n/extensions/localizations.dart';
import '../../models/config/toolbar/base_configurations.dart';
import '../../models/config/toolbar/base_toolbar_configurations.dart';
import '../../models/documents/attribute.dart';
import '../utils/provider.dart';
import 'base_toolbar.dart';

@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart'
show BuildContext, InheritedWidget, Widget;
import '../../models/config/quill_configurations.dart';
import '../../models/config/toolbar/base_configurations.dart';
import '../../models/config/toolbar/base_toolbar_configurations.dart';
class QuillProvider extends InheritedWidget {
const QuillProvider({

@ -1,6 +1,6 @@
name: flutter_quill
description: A rich text editor built for the modern Android, iOS, web and desktop platforms. It is the WYSIWYG editor and a Quill component for Flutter.
version: 8.5.6
version: 8.6.0
homepage: https://1o24bbs.com/c/bulletjournal/108
repository: https://github.com/singerdmx/flutter-quill

Loading…
Cancel
Save