diff --git a/ci/version.code.txt b/ci/version.code.txt index e98f499..3684352 100644 --- a/ci/version.code.txt +++ b/ci/version.code.txt @@ -1 +1 @@ -v1.4.8 \ No newline at end of file +v1.4.9 \ No newline at end of file diff --git a/ci/version.info.txt b/ci/version.info.txt index 23e21ed..62726c3 100644 --- a/ci/version.info.txt +++ b/ci/version.info.txt @@ -1,7 +1,5 @@ -v1.4.8 +v1.4.9 -- [x] ✨ Download comic link to online -- [x] ♻️ Display comic title at future page -- [x] ♻️ Choose pro servers -- [x] ✨ Export *.cbz into zip -- [x] 🐛 Fix export zip entries unix permission +- [x] ✨ Display actors +- [x] ♻️ Hidden comment's html tags +- [x] ✨ Search from title diff --git a/lib/screens/components/comic_info_card.dart b/lib/screens/components/comic_info_card.dart index b56007f..e617772 100644 --- a/lib/screens/components/comic_info_card.dart +++ b/lib/screens/components/comic_info_card.dart @@ -51,32 +51,42 @@ class ComicInfoCard extends StatelessWidget { children: [ ...link ? [ - Text.rich(TextSpan(children: [ - TextSpan( - text: comic.name, - style: titleStyle, - recognizer: LongPressGestureRecognizer() - ..onLongPress = () { - confirmCopy(context, comic.name); - }, - ), - ...currentDisplayJmcode() - ? [ - TextSpan( - text: " (JM${comic.id})", - style: TextStyle( - fontSize: 13, - color: Colors.orange.shade700, - ), - recognizer: LongPressGestureRecognizer() - ..onLongPress = () { - confirmCopy(context, "JM${comic.id}"); - }, - ), - ] - : [], - ])), - ] + Text.rich(TextSpan(children: [ + true + ? TextSpan( + style: titleStyle, + children: titleProcess(comic.name, context), + recognizer: LongPressGestureRecognizer() + ..onLongPress = () { + confirmCopy(context, comic.name); + }, + ) + : TextSpan( + text: comic.name, + style: titleStyle, + children: [], + recognizer: LongPressGestureRecognizer() + ..onLongPress = () { + confirmCopy(context, comic.name); + }, + ), + ...currentDisplayJmcode() + ? [ + TextSpan( + text: " (JM${comic.id})", + style: TextStyle( + fontSize: 13, + color: Colors.orange.shade700, + ), + recognizer: LongPressGestureRecognizer() + ..onLongPress = () { + confirmCopy(context, "JM${comic.id}"); + }, + ), + ] + : [], + ])), + ] : [Text(comic.name, style: titleStyle)], Container(height: 4), link @@ -128,4 +138,65 @@ class ComicInfoCard extends StatelessWidget { Container(width: 15), ]; } + + List titleProcess(String name, BuildContext context) { + RegExp regExp = RegExp(r"\[[^\]]+\]"); + int start = 0; + List result = []; + Iterable matches = regExp.allMatches(name); + for (Match match in matches) { + // ======= + // if (match.start > start) { + // result.add(TextSpan(text: name.substring(start, match.start))); + // } + // result.add(TextSpan( + // text: name.substring(match.start, match.end), + // style: const TextStyle( + // color: Colors.blue, + // decoration: TextDecoration.underline, + // ), + // recognizer: TapGestureRecognizer() + // ..onTap = () { + // Navigator.of(context).push(MaterialPageRoute( + // builder: (BuildContext context) { + // return ComicSearchScreen( + // initKeywords: name.substring(match.start + 1, match.end - 1), + // ); + // }, + // )); + // }, + // )); + // start = match.end; + // ======= + if (match.start > start) { + result.add(TextSpan(text: name.substring(start, match.start + 1))); + } + result.add(TextSpan( + text: name.substring(match.start + 1, match.end - 1), + style: TextStyle( + // 30%蓝色 叠加本该有的颜色 + color: Color.alphaBlend(Colors.blue.withOpacity(0.3), + Theme.of(context).textTheme.bodyText1!.color!), + ), + recognizer: TapGestureRecognizer() + ..onTap = () { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) { + return ComicSearchScreen( + initKeywords: name.substring(match.start + 1, match.end - 1), + ); + }, + )); + }, + )); + if (match.start > start) { + result.add(TextSpan(text: name.substring(match.end - 1, match.end))); + } + start = match.end; + } + if (start < name.length) { + result.add(TextSpan(text: name.substring(start))); + } + return result; + } }