show pages, ai, r18, r18g

This commit is contained in:
wgh19
2024-05-16 12:22:33 +08:00
parent ae0be5a97d
commit efd5683529
2 changed files with 84 additions and 1 deletions

View File

@@ -65,6 +65,74 @@ class _IllustWidgetState extends State<IllustWidget> {
),
),
)),
if(widget.illust.images.length > 1)
Positioned(
top: 12,
left: 12,
child: Container(
width: 28,
height: 20,
decoration: BoxDecoration(
color: FluentTheme.of(context).cardColor,
borderRadius: BorderRadius.circular(4),
border: Border.all(color: ColorScheme.of(context).outlineVariant, width: 0.6),
),
child: Center(
child: Text("${widget.illust.images.length}P",
style: const TextStyle(fontSize: 12),),
)),
),
if(widget.illust.isAi)
Positioned(
bottom: 12,
left: 12,
child: Container(
width: 28,
height: 20,
decoration: BoxDecoration(
color: ColorScheme.of(context).errorContainer.withOpacity(0.8),
borderRadius: BorderRadius.circular(4),
border: Border.all(color: ColorScheme.of(context).outlineVariant, width: 0.6),
),
child: const Center(
child: Text("AI",
style: TextStyle(fontSize: 12),),
)),
),
if(widget.illust.isR18)
Positioned(
bottom: 12,
right: 12,
child: Container(
width: 28,
height: 20,
decoration: BoxDecoration(
color: ColorScheme.of(context).errorContainer,
borderRadius: BorderRadius.circular(4),
border: Border.all(color: ColorScheme.of(context).outlineVariant, width: 0.6),
),
child: const Center(
child: Text("R18",
style: TextStyle(fontSize: 12),),
)),
),
if(widget.illust.isR18G)
Positioned(
bottom: 12,
right: 12,
child: Container(
width: 28,
height: 20,
decoration: BoxDecoration(
color: ColorScheme.of(context).errorContainer,
borderRadius: BorderRadius.circular(4),
border: Border.all(color: ColorScheme.of(context).outlineVariant, width: 0.6),
),
child: const Center(
child: Text("R18G",
style: TextStyle(fontSize: 12),),
)),
),
Positioned(
top: 16,
right: 16,

View File

@@ -142,6 +142,17 @@ class Tag {
String toString() {
return "$name${translatedName == null ? "" : "($translatedName)"}";
}
@override
bool operator ==(Object other) {
if (other is Tag) {
return name == other.name;
}
return false;
}
@override
int get hashCode => name.hashCode;
}
class IllustImage {
@@ -171,6 +182,10 @@ class Illust {
bool isBookmarked;
final bool isAi;
bool get isR18 => tags.contains(const Tag("R-18", null));
bool get isR18G => tags.contains(const Tag("R-18G", null));
Illust.fromJson(Map<String, dynamic> json)
: id = json['id'],
title = json['title'],
@@ -211,7 +226,7 @@ class Illust {
totalView = json['total_view'],
totalBookmarks = json['total_bookmarks'],
isBookmarked = json['is_bookmarked'],
isAi = json['is_ai'] != 1;
isAi = json['illust_ai_type'] == 2;
}
class TrendingTag {