From fcf334837118c246c8587d243515f485193dd461 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Sat, 5 Apr 2025 20:28:44 +0800 Subject: [PATCH] fix: add special dm Signed-off-by: bggRGjQaUbCoE --- lib/pages/danmaku/view.dart | 16 +++++++++------- pubspec.lock | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/pages/danmaku/view.dart b/lib/pages/danmaku/view.dart index 3ba93ff13..e851d8550 100644 --- a/lib/pages/danmaku/view.dart +++ b/lib/pages/danmaku/view.dart @@ -105,13 +105,15 @@ class _PlDanmakuState extends State { if (currentDanmakuList != null) { for (DanmakuElem e in currentDanmakuList) { if (e.mode == 7) { - _controller!.addDanmaku( - SpecialDanmakuContentItem.fromList( - DmUtils.decimalToColor(e.color), - e.fontsize.toDouble(), - jsonDecode(e.content), - ), - ); + try { + _controller!.addDanmaku( + SpecialDanmakuContentItem.fromList( + DmUtils.decimalToColor(e.color), + e.fontsize.toDouble(), + jsonDecode(e.content.replaceAll('\n', '\\n')), + ), + ); + } catch (_) {} } else { _controller!.addDanmaku( DanmakuContentItem( diff --git a/pubspec.lock b/pubspec.lock index ae5d264ca..6cb9db649 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -252,7 +252,7 @@ packages: description: path: "." ref: main - resolved-ref: "233f3e2581cbe2dd4867effbd0c512ef6b340599" + resolved-ref: a9c804a0d1fc8f408c833a159b1395ecb8a55215 url: "https://github.com/bggRGjQaUbCoE/canvas_danmaku.git" source: git version: "0.2.6"