diff --git a/CHANGELOG.md b/CHANGELOG.md index ef29553..2715a79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.3.3 +* bugfix: correct printing of unicode/emoji chars + +## 0.3.2 +* bugfix: avoid an exception when adding a new `TextItem` + ## 0.3.1 * Added null safety diff --git a/lib/circular_text/widget.dart b/lib/circular_text/widget.dart index d8a7f31..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()); } @@ -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; } diff --git a/pubspec.yaml b/pubspec.yaml index ee3daeb..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.1 +version: 0.3.3 homepage: https://github.com/faob-dev/flutter_circular_text environment: