From 7fd63a08498f009c415216127e9399180d45cb15 Mon Sep 17 00:00:00 2001 From: Thomas Faust Date: Fri, 18 Mar 2022 17:43:41 +0100 Subject: [PATCH 1/3] check array access index - avoid exception --- lib/circular_text/widget.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/circular_text/widget.dart b/lib/circular_text/widget.dart index d8a7f31..1a5f8db 100644 --- a/lib/circular_text/widget.dart +++ b/lib/circular_text/widget.dart @@ -151,7 +151,7 @@ class _CircularTextPainter extends CustomPainter { bool isTextItemsChanged() { bool isChanged = false; for (int i = 0; i < children.length; i++) { - if (children[i].isChanged(oldDelegate.children[i])) { + if (i >= oldDelegate.children.length || children[i].isChanged(oldDelegate.children[i])) { isChanged = true; break; } From ea07dc0d805c84e36655a4f23c7bf63681293313 Mon Sep 17 00:00:00 2001 From: Thomas Faust Date: Fri, 18 Mar 2022 17:52:39 +0100 Subject: [PATCH 2/3] update version and changelog --- CHANGELOG.md | 3 +++ pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef29553..b7555a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.3.2 +* bugfix: avoid an exception when adding a new `TextItem` + ## 0.3.1 * Added null safety diff --git a/pubspec.yaml b/pubspec.yaml index ee3daeb..c30f433 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_circular_text description: Flutter package which places text in a curved circular path. -version: 0.3.1 +version: 0.3.2 homepage: https://github.com/faob-dev/flutter_circular_text environment: From 68cbd117875f2967847bf82c7940a6ae7d75b137 Mon Sep 17 00:00:00 2001 From: Thomas Faust Date: Tue, 29 Mar 2022 16:47:47 +0200 Subject: [PATCH 3/3] correct printing of unicode/emoji chars --- CHANGELOG.md | 3 +++ lib/circular_text/widget.dart | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7555a8..2715a79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.3.3 +* bugfix: correct printing of unicode/emoji chars + ## 0.3.2 * bugfix: avoid an exception when adding a new `TextItem` diff --git a/lib/circular_text/widget.dart b/lib/circular_text/widget.dart index 1a5f8db..121e443 100644 --- a/lib/circular_text/widget.dart +++ b/lib/circular_text/widget.dart @@ -70,9 +70,9 @@ class _CircularTextPainter extends CustomPainter { canvas.save(); List _charPainters = []; Text text = textItem.text; - for (final char in text.data!.split("")) { + for (final int rune in text.data!.runes) { _charPainters.add(TextPainter( - text: TextSpan(text: char, style: text.style), + text: TextSpan(text: String.fromCharCode(rune), style: text.style), textDirection: textDirection) ..layout()); } diff --git a/pubspec.yaml b/pubspec.yaml index c30f433..6169597 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_circular_text description: Flutter package which places text in a curved circular path. -version: 0.3.2 +version: 0.3.3 homepage: https://github.com/faob-dev/flutter_circular_text environment: