From 1d5c7a5314f0d00a9508dca3087e37759d2ac480 Mon Sep 17 00:00:00 2001 From: Andy Trand Date: Mon, 29 Nov 2021 18:31:45 +0200 Subject: [PATCH 1/2] fix attributes compare (#486) --- lib/src/models/quill_delta.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/models/quill_delta.dart b/lib/src/models/quill_delta.dart index 47bbde2a..e4a11055 100644 --- a/lib/src/models/quill_delta.dart +++ b/lib/src/models/quill_delta.dart @@ -150,6 +150,11 @@ class Operation { /// Returns `true` if [other] operation has the same attributes as this one. bool hasSameAttributes(Operation other) { + // treat null and empty equal + if ((_attributes?.isEmpty ?? true) && + (other._attributes?.isEmpty ?? true)) { + return true; + } return _attributeEquality.equals(_attributes, other._attributes); } From 0c3fb6ff1a90bbb68f1f183a63e34f784ce657a6 Mon Sep 17 00:00:00 2001 From: Andriy Trubchanin Date: Mon, 29 Nov 2021 20:23:18 +0200 Subject: [PATCH 2/2] font size parsing fix --- lib/src/widgets/text_line.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/src/widgets/text_line.dart b/lib/src/widgets/text_line.dart index 0990e797..14546d11 100644 --- a/lib/src/widgets/text_line.dart +++ b/lib/src/widgets/text_line.dart @@ -230,7 +230,14 @@ class TextLine extends StatelessWidget { res = res.merge(defaultStyles.sizeHuge); break; default: - final fontSize = double.tryParse(size.value); + double? fontSize; + if (size.value is double) { + fontSize = size.value; + } else if (size.value is int) { + fontSize = size.value.toDouble(); + } else if (size.value is String) { + fontSize = double.tryParse(size.value); + } if (fontSize != null) { res = res.merge(TextStyle(fontSize: fontSize)); } else {