From 04fc2e2f9d28fb6d0488d961a789439554bd633b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Ho=C3=A0ng=20Sang?= Date: Fri, 25 Aug 2023 21:10:47 +0700 Subject: [PATCH 1/5] =?UTF-8?q?[Ho=C3=A0ng=20Sang]=20When=20the=20number?= =?UTF-8?q?=20list=20is=20too=20large,=20numbers=20will=20be=20lost=20(#13?= =?UTF-8?q?73)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/widgets/text_block.dart | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/src/widgets/text_block.dart b/lib/src/widgets/text_block.dart index 4adaac37..16bebeec 100644 --- a/lib/src/widgets/text_block.dart +++ b/lib/src/widgets/text_block.dart @@ -152,7 +152,7 @@ class EditableTextBlock extends StatelessWidget { onLaunchUrl: onLaunchUrl, customLinkPrefixes: customLinkPrefixes, ), - _getIndentWidth(context), + _getIndentWidth(context, count), _getSpacingForLine(line, index, count, defaultStyles), textDirection, textSelection, @@ -168,6 +168,20 @@ class EditableTextBlock extends StatelessWidget { return children.toList(growable: false); } + double _numberPointWidth(double fontSize, int count) { + final length = '$count'.length; + switch (length) { + case 1: + case 2: + return fontSize * 2; + default: + // 3 -> 2.5 + // 4 -> 3 + // 5 -> 3.5 + return fontSize * (length - (length - 2) / 2); + } + } + Widget? _buildLeading(BuildContext context, Line line, int index, Map indentLevelCounts, int count) { final defaultStyles = QuillStyles.getStyles(context, false)!; @@ -181,7 +195,7 @@ class EditableTextBlock extends StatelessWidget { count: count, style: defaultStyles.leading!.style, attrs: attrs, - width: fontSize * 2, + width: _numberPointWidth(fontSize, count), padding: fontSize / 2, ); } @@ -222,7 +236,7 @@ class EditableTextBlock extends StatelessWidget { count: count, style: defaultStyles.code!.style .copyWith(color: defaultStyles.code!.style.color!.withOpacity(0.4)), - width: fontSize * 2, + width: _numberPointWidth(fontSize, count), attrs: attrs, padding: fontSize, withDot: false, @@ -231,7 +245,7 @@ class EditableTextBlock extends StatelessWidget { return null; } - double _getIndentWidth(BuildContext context) { + double _getIndentWidth(BuildContext context, int count) { final defaultStyles = QuillStyles.getStyles(context, false)!; final fontSize = defaultStyles.paragraph?.style.fontSize ?? 16; final attrs = block.style.attributes; @@ -248,9 +262,13 @@ class EditableTextBlock extends StatelessWidget { var baseIndent = 0.0; - if (attrs.containsKey(Attribute.list.key) || - attrs.containsKey(Attribute.codeBlock.key)) { + if (attrs.containsKey(Attribute.list.key)) { baseIndent = fontSize * 2; + if (attrs[Attribute.list.key] == Attribute.ol) { + baseIndent = _numberPointWidth(fontSize, count); + } else if (attrs.containsKey(Attribute.codeBlock.key)) { + baseIndent = _numberPointWidth(fontSize, count); + } } return baseIndent + extraIndent; From 0a0b54dde8b2100ea36bb3e6ec779f3858a2bbe1 Mon Sep 17 00:00:00 2001 From: Egor Korshun <120365747+EgorK0rshun@users.noreply.github.com> Date: Fri, 25 Aug 2023 17:13:31 +0300 Subject: [PATCH 2/5] Fix bug with keepStyleOnNewLine for link (#1374) --- CHANGELOG.md | 3 +++ lib/src/widgets/controller.dart | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c60f2317..16fcb887 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [7.4.2] +- Fix bug with keepStyleOnNewLine for link. + # [7.4.1] - Fix toolbar dividers condition. diff --git a/lib/src/widgets/controller.dart b/lib/src/widgets/controller.dart index 16e919e8..b4127ff5 100644 --- a/lib/src/widgets/controller.dart +++ b/lib/src/widgets/controller.dart @@ -400,8 +400,10 @@ class QuillController extends ChangeNotifier { extentOffset: math.min(selection.extentOffset, end)); if (_keepStyleOnNewLine) { final style = getSelectionStyle(); - final notInlineStyle = style.attributes.values.where((s) => !s.isInline); - toggledStyle = style.removeAll(notInlineStyle.toSet()); + final ignoredStyles = style.attributes.values.where( + (s) => !s.isInline || s.key == Attribute.link.key, + ); + toggledStyle = style.removeAll(ignoredStyles.toSet()); } else { toggledStyle = Style(); } From 16ba7cbe1171f5c9750bec568148f17e8a0464ac Mon Sep 17 00:00:00 2001 From: Cheryl Date: Fri, 25 Aug 2023 08:50:14 -0700 Subject: [PATCH 3/5] Upgrade to 7.4.2 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9fda30c1..5a64f0bc 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.1 +version: 7.4.2 homepage: https://1o24bbs.com/c/bulletjournal/108 repository: https://github.com/singerdmx/flutter-quill From b64235c972072aa8f8abc0cb72d233c2b46767a0 Mon Sep 17 00:00:00 2001 From: liam-duan <93059008+liam-duan@users.noreply.github.com> Date: Sat, 26 Aug 2023 08:37:05 -0600 Subject: [PATCH 4/5] Fixed a space input error on iPad. (#1376) --- lib/src/models/documents/nodes/container.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/models/documents/nodes/container.dart b/lib/src/models/documents/nodes/container.dart index f868f43d..306d56bc 100644 --- a/lib/src/models/documents/nodes/container.dart +++ b/lib/src/models/documents/nodes/container.dart @@ -25,7 +25,7 @@ abstract class Container extends Node { int get childCount => _children.length; /// Returns the first child [Node]. - Node get first => _children.first; + Node? get first => isEmpty ? null : _children.first; /// Returns the last child [Node]. Node get last => _children.last; From 787c7a845facf13ea886f74c608cdbfd4bfd2b95 Mon Sep 17 00:00:00 2001 From: Cheryl Date: Sat, 26 Aug 2023 08:59:05 -0700 Subject: [PATCH 5/5] Upgrade to 7.4.3 --- CHANGELOG.md | 3 +++ pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16fcb887..f385bfbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [7.4.3] +- Fixed a space input error on iPad. + # [7.4.2] - Fix bug with keepStyleOnNewLine for link. diff --git a/pubspec.yaml b/pubspec.yaml index 5a64f0bc..f304237f 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.2 +version: 7.4.3 homepage: https://1o24bbs.com/c/bulletjournal/108 repository: https://github.com/singerdmx/flutter-quill