diff --git a/.github/ISSUE_TEMPLATE/issue-template.md b/.github/ISSUE_TEMPLATE/issue-template.md
index b4f552c8..c8a389aa 100644
--- a/.github/ISSUE_TEMPLATE/issue-template.md
+++ b/.github/ISSUE_TEMPLATE/issue-template.md
@@ -11,7 +11,15 @@ My issue is about [Web]
My issue is about [Mobile]
My issue is about [Desktop]
-I have tried running `example` directory successfully before creating an issue here.
+I have tried running `example` directory successfully before creating an issue here.
Please note that we are using latest flutter version in stable channel on branch master. If you are using beta or master channel, or you are not using latest flutter version in stable channel, you may experience error.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000..555a1e40
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,44 @@
+# Pull Request
+
+## Description
+
+Provide a brief description of your changes.
+
+## Issues
+
+
+Closes #IssueNumber
+(Replace "IssueNumber" with the actual issue number you are addressing.)
+
+## Improvements
+
+
+
+- Improve code readability
+- Improve peformance
+
+## Features
+
+
+
+- Add a new feature
+- Allow to custmize the widgets
+
+
+
+## Additional notes
+
+
+## Suggestions
+
+
+## Checklist
+
+
+
+- [ ] I have added/updated relevant documentation
+- [ ] I have tested these changes locally.
+- [ ] I have followed the code style and guidelines.
+- [ ] I have updated `CHANGELOG.md` with my changes in the next section
+- [ ] I have run "dart format ." on the project
+- [ ] I have run `flutter test` and `flutter analyze` and it passed successfully
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 037eb159..7200ae2e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,15 @@
-# [7.4.14]
+# [7.4.16]
+
+- Update documentation and README.md
+
+# [7.4.15]
- Custom style attrbuites for platforms other than mobile (alignment, margin, width, height)
-- Improve performance by reducing the number of widgets rebuilt by listening to media query for only the needed things, for example instead of using `MediaQuery.of(context).size`, now we are using `MediaQuery.sizeOf(context)`
- Bug fixes and other improvemenets
+
+# [7.4.14]
+
+- Improve performance by reducing the number of widgets rebuilt by listening to media query for only the needed things, for example instead of using `MediaQuery.of(context).size`, now we are using `MediaQuery.sizeOf(context)`
- Add MediaButton for picking the images only since the video one is not ready
- A new feature which allows customizing the text selection in quill editor which is useful for custom theme design system for custom app widget
diff --git a/README.md b/README.md
index 19ba97fa..2c3cfdff 100644
--- a/README.md
+++ b/README.md
@@ -232,11 +232,21 @@ QuillToolbar.basic(
> [!WARNING]
>
-> This package uses [`gal`](https://github.com/natsuk4ze/) to save images.
+> If you are using [flutter_quill_extensions](https://pub.dev/packages/flutter_quill_extensions) package to add support for images, videos and more
+> The extensions package require additional configurations:
+>
+> 1. We are using [`gal`](https://github.com/natsuk4ze/) plugin to save images.
> For this to work, you need to add the appropriate permissions
> to your `Info.plist` and `AndroidManifest.xml` files.
->
> See to add the needed lines.
+>
+> 2. We also use [`image_picker`](https://pub.dev/packages/image_picker) plugin for picking images so please make sure follow the instructions
+>
+> 3. For loading the image from the internet we need internet permission
+> 1. For Android, you need to add some permissions in `AndroidManifest.xml`, Please follow this [link](https://developer.android.com/training/basics/network-ops/connecting) for more info, the internet permission included by default only for debugging so you need to follow this link to add it in the release version too. you should allow loading images and videos only for the `https` protocol but if you want http too then you need to configure your android application to accept `http` in the release mode, follow this [link](https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted) for more info.
+> 2. for macOS you also need to include a key in your `Info.plist`, please follow this [link](https://stackoverflow.com/a/61201081/18519412) to add the required configurations
+>
+> The extensions package also use [image_picker](https://pub.dev/packages/image_picker) which also require some configurations, follow this [link](https://pub.dev/packages/image_picker#installation). It's needed for Android, iOS, macOS, we must inform you that you can't pick photo using camera in desktop so make sure to handle that if you plan on add support for desktop, this might changed in the future and for more info follow this [link](https://pub.dev/packages/image_picker#windows-macos-and-linux)
### Custom Size Image for Mobile
@@ -253,6 +263,21 @@ Define `mobileWidth`, `mobileHeight`, `mobileMargin`, `mobileAlignment` as follo
}
```
+### Custom Size Image for other platforms (excluding web)
+
+Define `width`, `height`, `margin`, `alignment` as follows:
+
+```dart
+{
+ "insert": {
+ "image": "https://user-images.githubusercontent.com/122956/72955931-ccc07900-3d52-11ea-89b1-d468a6e2aa2b.png"
+ },
+ "attributes":{
+ "style":"width: 50; height: 50; margin: 10; alignment: topLeft"
+ }
+}
+```
+
### Custom Embed Blocks
Sometimes you want to add some custom content inside your text, custom widgets inside of them. An example is adding notes to the text, or anything custom that you want to add in your text editor.
diff --git a/flutter_quill_extensions/CHANGELOG.md b/flutter_quill_extensions/CHANGELOG.md
index a6155cb5..67c40380 100644
--- a/flutter_quill_extensions/CHANGELOG.md
+++ b/flutter_quill_extensions/CHANGELOG.md
@@ -1,4 +1,5 @@
## 0.5.1
+
- Provide a way to use custom image provider for the image widgets
- Provide a way to handle different errors in image widgets
- Two bug fixes related to pick the image and capture it using the camera
@@ -12,42 +13,49 @@
- Add new custom style attrbuite for desktop and other platforms
## 0.5.0
+
- Migrated from `gallery_saver` to `gal` for saving images
- Added callbacks for greater control of editing images
## 0.4.1
+
- Updated dependencies to support image_picker 1.0
## 0.4.0
+
- Fix backspace around images [PR #1309](https://github.com/singerdmx/flutter-quill/pull/1309)
- Feat/link regexp [PR #1329](https://github.com/singerdmx/flutter-quill/pull/1329)
## 0.3.4
-* Resolve deprecated method use in the `video_player` package
+
+- Resolve deprecated method use in the `video_player` package
## 0.3.3
-* Fix a prototype bug which was bring by [PR #1230](https://github.com/singerdmx/flutter-quill/pull/1230#issuecomment-1560597099)
+
+- Fix a prototype bug which was bring by [PR #1230](https://github.com/singerdmx/flutter-quill/pull/1230#issuecomment-1560597099)
## 0.3.2
-* Updated dependencies to support intl 0.18
+
+- Updated dependencies to support intl 0.18
## 0.3.1
-* Image embedding tweaks
- * Add MediaButton which is intened to superseed the ImageButton and VideoButton. Only image selection is working.
- * Implement image insert for web (image as base64)
+
+- Image embedding tweaks
+ - Add MediaButton which is intened to superseed the ImageButton and VideoButton. Only image selection is working.
+ - Implement image insert for web (image as base64)
## 0.3.0
-* Added support for adding custom tooltips to toolbar buttons
+- Added support for adding custom tooltips to toolbar buttons
## 0.2.0
-* Allow widgets to override widget span properties [b7951b0](https://github.com/singerdmx/flutter-quill/commit/b7951b02c9086ea42e7aad6d78e6c9b0297562e5)
-* Remove tuples [3e9452e](https://github.com/singerdmx/flutter-quill/commit/3e9452e675e8734ff50364c5f7b5d34088d5ff05)
-* Remove transparent color of ImageVideoUtils dialog [74544bd](https://github.com/singerdmx/flutter-quill/commit/74544bd945a9d212ca1e8d6b3053dbecee22b720)
-* Migrate to `youtube_player_flutter` from `youtube_player_flutter_quill`
-* Updates to forumla button [5228f38](https://github.com/singerdmx/flutter-quill/commit/5228f389ba6f37d61d445cfe138c19fcf8766d71)
+- Allow widgets to override widget span properties [b7951b0](https://github.com/singerdmx/flutter-quill/commit/b7951b02c9086ea42e7aad6d78e6c9b0297562e5)
+- Remove tuples [3e9452e](https://github.com/singerdmx/flutter-quill/commit/3e9452e675e8734ff50364c5f7b5d34088d5ff05)
+- Remove transparent color of ImageVideoUtils dialog [74544bd](https://github.com/singerdmx/flutter-quill/commit/74544bd945a9d212ca1e8d6b3053dbecee22b720)
+- Migrate to `youtube_player_flutter` from `youtube_player_flutter_quill`
+- Updates to forumla button [5228f38](https://github.com/singerdmx/flutter-quill/commit/5228f389ba6f37d61d445cfe138c19fcf8766d71)
## 0.1.0
-* Initial release
+- Initial release
diff --git a/flutter_quill_extensions/lib/embeds/toolbar/image_button.dart b/flutter_quill_extensions/lib/embeds/toolbar/image_button.dart
index 2cc4781a..55420518 100644
--- a/flutter_quill_extensions/lib/embeds/toolbar/image_button.dart
+++ b/flutter_quill_extensions/lib/embeds/toolbar/image_button.dart
@@ -66,7 +66,7 @@ class ImageButton extends StatelessWidget {
Future _onPressedHandler(BuildContext context) async {
final onImagePickCallbackRef = onImagePickCallback;
if (onImagePickCallbackRef == null) {
- _typeLink(context);
+ await _typeLink(context);
return;
}
final selector =
@@ -80,7 +80,7 @@ class ImageButton extends StatelessWidget {
_pickImage(context);
break;
case MediaPickSetting.Link:
- _typeLink(context);
+ await _typeLink(context);
break;
case MediaPickSetting.Camera:
await ImageVideoUtils.handleImageButtonTap(
@@ -116,14 +116,15 @@ class ImageButton extends StatelessWidget {
webImagePickImpl: webImagePickImpl,
);
- void _typeLink(BuildContext context) {
- showDialog(
+ Future _typeLink(BuildContext context) async {
+ final value = await showDialog(
context: context,
builder: (_) => LinkDialog(
dialogTheme: dialogTheme,
linkRegExp: linkRegExp,
),
- ).then(_linkSubmitted);
+ );
+ _linkSubmitted(value);
}
void _linkSubmitted(String? value) {
diff --git a/flutter_quill_extensions/lib/embeds/toolbar/media_button.dart b/flutter_quill_extensions/lib/embeds/toolbar/media_button.dart
index efc05632..135f4536 100644
--- a/flutter_quill_extensions/lib/embeds/toolbar/media_button.dart
+++ b/flutter_quill_extensions/lib/embeds/toolbar/media_button.dart
@@ -39,6 +39,7 @@ class MediaButton extends StatelessWidget {
this.galleryButtonText,
this.linkButtonText,
this.autovalidateMode = AutovalidateMode.disabled,
+ this.dialogBarrierColor = Colors.black54,
Key? key,
this.validationMessage,
}) : assert(type == QuillMediaType.image,
@@ -55,6 +56,7 @@ class MediaButton extends StatelessWidget {
final String? tooltip;
final MediaFilePicker mediaFilePicker;
final MediaPickedCallback? onMediaPickedCallback;
+ final Color dialogBarrierColor;
/// The margin between child widgets in the dialog.
final double childrenSpacing;
@@ -344,10 +346,8 @@ class _MediaLinkDialogState extends State {
void _submitLink() => Navigator.pop(context, _linkController.text);
String? _validateLink(String? value) {
- // TODO: Use [AutoFormatMultipleLinksRule.oneLineRegExp]
- // in the next update
if ((value?.isEmpty ?? false) ||
- !AutoFormatMultipleLinksRule.linkRegExp.hasMatch(value!)) {
+ !AutoFormatMultipleLinksRule.oneLineRegExp.hasMatch(value!)) {
return widget.validationMessage ?? 'That is not a valid URL';
}
diff --git a/flutter_quill_extensions/lib/embeds/toolbar/video_button.dart b/flutter_quill_extensions/lib/embeds/toolbar/video_button.dart
index eb31f28d..3f0a0226 100644
--- a/flutter_quill_extensions/lib/embeds/toolbar/video_button.dart
+++ b/flutter_quill_extensions/lib/embeds/toolbar/video_button.dart
@@ -74,11 +74,11 @@ class VideoButton extends StatelessWidget {
if (source == MediaPickSetting.Gallery) {
_pickVideo(context);
} else {
- _typeLink(context);
+ await _typeLink(context);
}
}
} else {
- _typeLink(context);
+ await _typeLink(context);
}
}
@@ -91,11 +91,12 @@ class VideoButton extends StatelessWidget {
webVideoPickImpl: webVideoPickImpl,
);
- void _typeLink(BuildContext context) {
- showDialog(
+ Future _typeLink(BuildContext context) async {
+ final value = await showDialog(
context: context,
builder: (_) => LinkDialog(dialogTheme: dialogTheme),
- ).then(_linkSubmitted);
+ );
+ _linkSubmitted(value);
}
void _linkSubmitted(String? value) {
diff --git a/flutter_quill_extensions/pubspec.yaml b/flutter_quill_extensions/pubspec.yaml
index 59995c59..7ec60cf0 100644
--- a/flutter_quill_extensions/pubspec.yaml
+++ b/flutter_quill_extensions/pubspec.yaml
@@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter
- flutter_quill: ^7.4.14
+ flutter_quill: ^7.4.15
# In case you are working on changes for both libraries,
# flutter_quill:
# path: ~/development/playground/framework_based/flutter/flutter-quill
diff --git a/lib/src/utils/platform.dart b/lib/src/utils/platform.dart
index 9bd5debb..77db9517 100644
--- a/lib/src/utils/platform.dart
+++ b/lib/src/utils/platform.dart
@@ -2,14 +2,18 @@ import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart'
show kIsWeb, TargetPlatform, defaultTargetPlatform;
+bool isWeb() {
+ return kIsWeb;
+}
+
bool isMobile([TargetPlatform? targetPlatform]) {
- if (kIsWeb) return false;
+ if (isWeb()) return false;
targetPlatform ??= defaultTargetPlatform;
return {TargetPlatform.iOS, TargetPlatform.android}.contains(targetPlatform);
}
bool isDesktop([TargetPlatform? targetPlatform]) {
- if (kIsWeb) return false;
+ if (isWeb()) return false;
targetPlatform ??= defaultTargetPlatform;
return {TargetPlatform.macOS, TargetPlatform.linux, TargetPlatform.windows}
.contains(targetPlatform);
@@ -21,7 +25,7 @@ bool isKeyboardOS([TargetPlatform? targetPlatform]) {
}
bool isAppleOS([TargetPlatform? targetPlatform]) {
- if (kIsWeb) return false;
+ if (isWeb()) return false;
targetPlatform ??= defaultTargetPlatform;
return {
TargetPlatform.macOS,
@@ -30,7 +34,7 @@ bool isAppleOS([TargetPlatform? targetPlatform]) {
}
bool isMacOS([TargetPlatform? targetPlatform]) {
- if (kIsWeb) return false;
+ if (isWeb()) return false;
targetPlatform ??= defaultTargetPlatform;
return TargetPlatform.macOS == targetPlatform;
}
diff --git a/lib/src/widgets/editor.dart b/lib/src/widgets/editor.dart
index 23a58eb4..690fbd5d 100644
--- a/lib/src/widgets/editor.dart
+++ b/lib/src/widgets/editor.dart
@@ -583,7 +583,7 @@ class QuillEditorState extends State
: child,
);
- if (kIsWeb) {
+ if (isWeb()) {
// Intercept RawKeyEvent on Web to prevent it from propagating to parents
// that might interfere with the editor key behavior, such as
// SingleChildScrollView. Thanks to @wliumelb for the workaround.
@@ -633,7 +633,13 @@ class QuillEditorState extends State
bool get selectionEnabled => widget.enableInteractiveSelection;
void _requestKeyboard() {
- _editorKey.currentState!.requestKeyboard();
+ final editorCurrentState = _editorKey.currentState;
+ if (editorCurrentState == null) {
+ throw ArgumentError.notNull(
+ 'To request keyboard the editor key must not be null',
+ );
+ }
+ editorCurrentState.requestKeyboard();
}
}
@@ -1068,7 +1074,9 @@ class RenderEditor extends RenderEditableContainerBox
localSelection(baseChild.container, textSelection, true);
var basePoint = baseChild.getBaseEndpointForSelection(baseSelection);
basePoint = TextSelectionPoint(
- basePoint.point + baseParentData.offset, basePoint.direction);
+ basePoint.point + baseParentData.offset,
+ basePoint.direction,
+ );
final extentNode = _container.queryChild(textSelection.end, false).node;
RenderEditableBox? extentChild = baseChild;
@@ -1086,7 +1094,9 @@ class RenderEditor extends RenderEditableContainerBox
var extentPoint =
extentChild.getExtentEndpointForSelection(extentSelection);
extentPoint = TextSelectionPoint(
- extentPoint.point + extentParentData.offset, extentPoint.direction);
+ extentPoint.point + extentParentData.offset,
+ extentPoint.direction,
+ );
return [basePoint, extentPoint];
}
@@ -1757,13 +1767,13 @@ class RenderEditableContainerBox extends RenderBox
EditableContainerParentData>,
RenderBoxContainerDefaultsMixin {
- RenderEditableContainerBox(
- {required container_node.Container container,
- required this.textDirection,
- required this.scrollBottomInset,
- required EdgeInsetsGeometry padding,
- List? children})
- : assert(padding.isNonNegative),
+ RenderEditableContainerBox({
+ required container_node.Container container,
+ required this.textDirection,
+ required this.scrollBottomInset,
+ required EdgeInsetsGeometry padding,
+ List? children,
+ }) : assert(padding.isNonNegative),
_container = container,
_padding = padding {
addAll(children);
diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart
index 4b1288b7..71229eef 100644
--- a/lib/src/widgets/raw_editor.dart
+++ b/lib/src/widgets/raw_editor.dart
@@ -1,17 +1,28 @@
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
+import 'dart:async' show StreamSubscription;
+import 'dart:convert' show jsonDecode;
+import 'dart:io' show Platform;
import 'dart:math' as math;
import 'dart:ui' as ui hide TextStyle;
import 'package:collection/collection.dart';
-import 'package:flutter/foundation.dart';
+import 'package:flutter/foundation.dart' show defaultTargetPlatform;
import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
-import 'package:flutter/scheduler.dart';
-import 'package:flutter/services.dart';
-import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
-import 'package:pasteboard/pasteboard.dart';
+import 'package:flutter/rendering.dart'
+ show RenderAbstractViewport, ViewportOffset;
+import 'package:flutter/scheduler.dart' show SchedulerBinding;
+import 'package:flutter/services.dart'
+ show
+ LogicalKeyboardKey,
+ Uint8List,
+ RawKeyDownEvent,
+ HardwareKeyboard,
+ Clipboard,
+ ClipboardData,
+ TextLayoutMetrics,
+ TextInputControl;
+import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'
+ show KeyboardVisibilityController;
+import 'package:pasteboard/pasteboard.dart' show Pasteboard;
import '../models/documents/attribute.dart';
import '../models/documents/document.dart';
@@ -423,7 +434,7 @@ class RawEditorState extends EditorState
// in the web browser, but we do unfocus for all other kinds of events.
switch (event.kind) {
case ui.PointerDeviceKind.touch:
- if (kIsWeb) {
+ if (isWeb()) {
widget.focusNode.unfocus();
}
break;
@@ -838,7 +849,9 @@ class RawEditorState extends EditorState
}
void _handleSelectionChanged(
- TextSelection selection, SelectionChangedCause cause) {
+ TextSelection selection,
+ SelectionChangedCause cause,
+ ) {
final oldSelection = controller.selection;
controller.updateSelection(selection, ChangeSource.LOCAL);
@@ -1034,15 +1047,17 @@ class RawEditorState extends EditorState
return const VerticalSpacing(0, 0);
}
+ void _didChangeTextEditingValueListener() {
+ _didChangeTextEditingValue(controller.ignoreFocusOnTextChange);
+ }
+
@override
void initState() {
super.initState();
_clipboardStatus.addListener(_onChangedClipboardStatus);
- controller.addListener(() {
- _didChangeTextEditingValue(controller.ignoreFocusOnTextChange);
- });
+ controller.addListener(_didChangeTextEditingValueListener);
_scrollController = widget.scrollController;
_scrollController.addListener(_updateSelectionOverlayForScroll);
@@ -1059,7 +1074,7 @@ class RawEditorState extends EditorState
if (isKeyboardOS()) {
_keyboardVisible = true;
- } else if (!kIsWeb && Platform.environment.containsKey('FLUTTER_TEST')) {
+ } else if (!isWeb() && Platform.environment.containsKey('FLUTTER_TEST')) {
// treat tests like a keyboard OS
_keyboardVisible = true;
} else {
@@ -1189,7 +1204,7 @@ class RawEditorState extends EditorState
assert(!hasConnection);
_selectionOverlay?.dispose();
_selectionOverlay = null;
- controller.removeListener(_didChangeTextEditingValue);
+ controller.removeListener(_didChangeTextEditingValueListener);
widget.focusNode.removeListener(_handleFocusChanged);
_cursorCont.dispose();
_clipboardStatus
@@ -1208,13 +1223,17 @@ class RawEditorState extends EditorState
/// state being in sync with the controller know they may be
/// operating on stale data.
void _markNeedsBuild() {
+ if (_dirty) {
+ // No need to rebuilt if it already darty
+ return;
+ }
setState(() {
_dirty = true;
});
}
void _didChangeTextEditingValue([bool ignoreFocus = false]) {
- if (kIsWeb) {
+ if (isWeb()) {
_onChangeTextEditingValue(ignoreFocus);
if (!ignoreFocus) {
requestKeyboard();
@@ -1394,6 +1413,8 @@ class RawEditorState extends EditorState
@override
void requestKeyboard() {
if (controller.skipRequestKeyboard) {
+ // TODO: There is a bug, requestKeyboard is being called 2-4 times!
+ // and that just by one simple change
controller.skipRequestKeyboard = false;
return;
}
@@ -1402,7 +1423,10 @@ class RawEditorState extends EditorState
openConnectionIfNeeded();
if (!keyboardAlreadyShown) {
/// delay 500 milliseconds for waiting keyboard show up
- Future.delayed(const Duration(milliseconds: 500), _showCaretOnScreen);
+ Future.delayed(
+ const Duration(milliseconds: 500),
+ _showCaretOnScreen,
+ );
} else {
_showCaretOnScreen();
}
@@ -1421,7 +1445,7 @@ class RawEditorState extends EditorState
// toolbar: copy, paste, select, cut. It might also provide additional
// functionality depending on the browser (such as translate). Due to this
// we should not show a Flutter toolbar for the editable text elements.
- if (kIsWeb) {
+ if (isWeb()) {
return false;
}
@@ -1769,7 +1793,9 @@ class RawEditorState extends EditorState
@override
void didChangeInputControl(
- TextInputControl? oldControl, TextInputControl? newControl) {
+ TextInputControl? oldControl,
+ TextInputControl? newControl,
+ ) {
// TODO: implement didChangeInputControl
}
@@ -1830,26 +1856,29 @@ class _Editor extends MultiChildRenderObjectWidget {
@override
RenderEditor createRenderObject(BuildContext context) {
return RenderEditor(
- offset: offset,
- document: document,
- textDirection: textDirection,
- hasFocus: hasFocus,
- scrollable: scrollable,
- selection: selection,
- startHandleLayerLink: startHandleLayerLink,
- endHandleLayerLink: endHandleLayerLink,
- onSelectionChanged: onSelectionChanged,
- onSelectionCompleted: onSelectionCompleted,
- cursorController: cursorController,
- padding: padding,
- maxContentWidth: maxContentWidth,
- scrollBottomInset: scrollBottomInset,
- floatingCursorDisabled: floatingCursorDisabled);
+ offset: offset,
+ document: document,
+ textDirection: textDirection,
+ hasFocus: hasFocus,
+ scrollable: scrollable,
+ selection: selection,
+ startHandleLayerLink: startHandleLayerLink,
+ endHandleLayerLink: endHandleLayerLink,
+ onSelectionChanged: onSelectionChanged,
+ onSelectionCompleted: onSelectionCompleted,
+ cursorController: cursorController,
+ padding: padding,
+ maxContentWidth: maxContentWidth,
+ scrollBottomInset: scrollBottomInset,
+ floatingCursorDisabled: floatingCursorDisabled,
+ );
}
@override
void updateRenderObject(
- BuildContext context, covariant RenderEditor renderObject) {
+ BuildContext context,
+ covariant RenderEditor renderObject,
+ ) {
renderObject
..offset = offset
..document = document
diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart
index 305b5a47..2ea62fe6 100644
--- a/lib/src/widgets/toolbar.dart
+++ b/lib/src/widgets/toolbar.dart
@@ -577,8 +577,11 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
),
if (customButtons.isNotEmpty)
if (showDividers)
- QuillDivider(axis,
- color: sectionDividerColor, space: sectionDividerSpace),
+ QuillDivider(
+ axis,
+ color: sectionDividerColor,
+ space: sectionDividerSpace,
+ ),
for (final customButton in customButtons)
if (customButton.child != null) ...[
InkWell(
@@ -617,6 +620,10 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
/// is given.
final Color? color;
+ // We will add this in the next major release and not now
+ /// The barrier color of the shown dialogs
+ // final Color dialogbarrierColor;
+
/// The locale to use for the editor toolbar, defaults to system locale
/// More https://github.com/singerdmx/flutter-quill#translation
final Locale? locale;
diff --git a/lib/src/widgets/toolbar/color_button.dart b/lib/src/widgets/toolbar/color_button.dart
index 41a57734..4be77c67 100644
--- a/lib/src/widgets/toolbar/color_button.dart
+++ b/lib/src/widgets/toolbar/color_button.dart
@@ -22,6 +22,7 @@ class ColorButton extends StatefulWidget {
this.iconTheme,
this.afterButtonPressed,
this.tooltip,
+ this.dialogBarrierColor = Colors.black54,
Key? key,
}) : super(key: key);
@@ -32,6 +33,7 @@ class ColorButton extends StatefulWidget {
final QuillIconTheme? iconTheme;
final VoidCallback? afterButtonPressed;
final String? tooltip;
+ final Color dialogBarrierColor;
@override
_ColorButtonState createState() => _ColorButtonState();
@@ -159,6 +161,7 @@ class _ColorButtonState extends State {
showDialog(
context: context,
+ barrierColor: widget.dialogBarrierColor,
builder: (context) => StatefulBuilder(builder: (context, dlgSetState) {
return AlertDialog(
title: Text('Select Color'.i18n),
diff --git a/lib/src/widgets/toolbar/link_style_button.dart b/lib/src/widgets/toolbar/link_style_button.dart
index 2e1d2374..48232599 100644
--- a/lib/src/widgets/toolbar/link_style_button.dart
+++ b/lib/src/widgets/toolbar/link_style_button.dart
@@ -21,6 +21,7 @@ class LinkStyleButton extends StatefulWidget {
this.tooltip,
this.linkRegExp,
this.linkDialogAction,
+ this.dialogBarrierColor = Colors.black54,
Key? key,
}) : super(key: key);
@@ -33,6 +34,7 @@ class LinkStyleButton extends StatefulWidget {
final String? tooltip;
final RegExp? linkRegExp;
final LinkDialogAction? linkDialogAction;
+ final Color dialogBarrierColor;
@override
_LinkStyleButtonState createState() => _LinkStyleButtonState();
@@ -95,6 +97,7 @@ class _LinkStyleButtonState extends State {
void _openLinkDialog(BuildContext context) {
showDialog<_TextLink>(
context: context,
+ barrierColor: widget.dialogBarrierColor,
builder: (ctx) {
final link = _getLinkAttributeValue();
final index = widget.controller.selection.start;
diff --git a/lib/src/widgets/toolbar/link_style_button2.dart b/lib/src/widgets/toolbar/link_style_button2.dart
index 895a08f6..9e3de80e 100644
--- a/lib/src/widgets/toolbar/link_style_button2.dart
+++ b/lib/src/widgets/toolbar/link_style_button2.dart
@@ -30,6 +30,7 @@ class LinkStyleButton2 extends StatefulWidget {
this.autovalidateMode = AutovalidateMode.disabled,
this.validationMessage,
this.buttonSize,
+ this.dialogBarrierColor = Colors.black54,
Key? key,
}) : assert(addLinkLabel == null || addLinkLabel.length > 0),
assert(editLinkLabel == null || editLinkLabel.length > 0),
@@ -66,6 +67,8 @@ class LinkStyleButton2 extends StatefulWidget {
/// The size of dialog buttons.
final Size? buttonSize;
+ final Color dialogBarrierColor;
+
@override
State createState() => _LinkStyleButton2State();
}
@@ -124,6 +127,7 @@ class _LinkStyleButton2State extends State {
final textLink = await showDialog(
context: context,
+ barrierColor: widget.dialogBarrierColor,
builder: (_) => LinkStyleDialog(
dialogTheme: widget.dialogTheme,
text: initialTextLink.text,
diff --git a/lib/src/widgets/toolbar/search_button.dart b/lib/src/widgets/toolbar/search_button.dart
index fc0dc79f..0a490420 100644
--- a/lib/src/widgets/toolbar/search_button.dart
+++ b/lib/src/widgets/toolbar/search_button.dart
@@ -13,6 +13,7 @@ class SearchButton extends StatelessWidget {
this.iconSize = kDefaultIconSize,
this.fillColor,
this.iconTheme,
+ this.dialogBarrierColor = Colors.black54,
this.dialogTheme,
this.afterButtonPressed,
this.tooltip,
@@ -24,6 +25,7 @@ class SearchButton extends StatelessWidget {
final QuillController controller;
final Color? fillColor;
+ final Color dialogBarrierColor;
final QuillIconTheme? iconTheme;
final QuillDialogTheme? dialogTheme;
@@ -52,12 +54,19 @@ class SearchButton extends StatelessWidget {
}
Future _onPressedHandler(BuildContext context) async {
- await showDialog(
+ final value = await showDialog(
+ barrierColor: dialogBarrierColor,
context: context,
builder: (_) => SearchDialog(
- controller: controller, dialogTheme: dialogTheme, text: ''),
- ).then(_searchSubmitted);
+ controller: controller,
+ dialogTheme: dialogTheme,
+ text: '',
+ ),
+ );
+ _searchSubmitted(value);
}
- void _searchSubmitted(String? value) {}
+ void _searchSubmitted(String? value) {
+ // If we are doing nothing here then why we care about the result??
+ }
}
diff --git a/lib/src/widgets/toolbar/toggle_check_list_button.dart b/lib/src/widgets/toolbar/toggle_check_list_button.dart
index 6912916b..60821e60 100644
--- a/lib/src/widgets/toolbar/toggle_check_list_button.dart
+++ b/lib/src/widgets/toolbar/toggle_check_list_button.dart
@@ -111,8 +111,15 @@ class _ToggleCheckListButtonState extends State {
}
void _toggleAttribute() {
- widget.controller.formatSelection(_isToggled!
- ? Attribute.clone(Attribute.unchecked, null)
- : Attribute.unchecked);
+ // By default don't show the keybaord request as it's quite annoying
+ // We will provide the option to control this in the next major update
+ // See https://github.com/singerdmx/flutter-quill/issues/1440
+ widget.controller
+ ..skipRequestKeyboard = true
+ ..formatSelection(
+ _isToggled!
+ ? Attribute.clone(Attribute.unchecked, null)
+ : Attribute.unchecked,
+ );
}
}
diff --git a/pubspec.yaml b/pubspec.yaml
index b023f6d7..59faa2bb 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -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: 7.4.15
+version: 7.4.16
homepage: https://1o24bbs.com/c/bulletjournal/108
repository: https://github.com/singerdmx/flutter-quill