Skip to content

Commit

Permalink
🚀 New version
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Aug 15, 2023
1 parent 42d7d21 commit 170b4b7
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 33 deletions.
2 changes: 1 addition & 1 deletion ci/version.code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.4.8
v1.4.9
10 changes: 4 additions & 6 deletions ci/version.info.txt
Original file line number Diff line number Diff line change
@@ -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
123 changes: 97 additions & 26 deletions lib/screens/components/comic_info_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -128,4 +138,65 @@ class ComicInfoCard extends StatelessWidget {
Container(width: 15),
];
}

List<TextSpan> titleProcess(String name, BuildContext context) {
RegExp regExp = RegExp(r"\[[^\]]+\]");
int start = 0;
List<TextSpan> result = [];
Iterable<Match> 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;
}
}

0 comments on commit 170b4b7

Please sign in to comment.