mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
add rating
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:intl/intl.dart';
|
|||||||
import '../api/gallery.dart';
|
import '../api/gallery.dart';
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
import '../utils/filesize.dart';
|
import '../utils/filesize.dart';
|
||||||
|
import 'rate.dart';
|
||||||
import 'tags.dart';
|
import 'tags.dart';
|
||||||
import 'thumbnail.dart';
|
import 'thumbnail.dart';
|
||||||
|
|
||||||
@@ -112,6 +113,17 @@ class GalleryInfoDesktop extends StatelessWidget {
|
|||||||
gData.meta.gid.toString(),
|
gData.meta.gid.toString(),
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
),
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 60,
|
||||||
|
child: Text("${i18n.rating}${i18n.colon}",
|
||||||
|
style: TextStyle(
|
||||||
|
color: cs.primary,
|
||||||
|
fontSize: 12))),
|
||||||
|
Rate(gData.meta.rating),
|
||||||
|
],
|
||||||
|
)
|
||||||
])),
|
])),
|
||||||
const VerticalDivider(indent: 10, endIndent: 10),
|
const VerticalDivider(indent: 10, endIndent: 10),
|
||||||
Expanded(child: TagsPanel(gData.tags)),
|
Expanded(child: TagsPanel(gData.tags)),
|
||||||
|
|||||||
26
lib/components/rate.dart
Normal file
26
lib/components/rate.dart
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class Rate extends StatelessWidget {
|
||||||
|
const Rate(this.rate, {Key? key}) : super(key: key);
|
||||||
|
final double rate;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final cs = Theme.of(context).colorScheme;
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
for (var i = 1; i < 6; i++)
|
||||||
|
Icon(
|
||||||
|
i <= rate + 0.25
|
||||||
|
? Icons.star
|
||||||
|
: i > rate + 0.75
|
||||||
|
? Icons.star_border
|
||||||
|
: Icons.star_half,
|
||||||
|
color: cs.primary,
|
||||||
|
size: 12,
|
||||||
|
),
|
||||||
|
Text(" $rate", style: TextStyle(color: cs.secondary, fontSize: 12)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,8 +17,9 @@ class ScrollParent extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
if (controller.offset + value.overscroll >=
|
if (controller.offset + value.overscroll >=
|
||||||
controller.position.maxScrollExtent) {
|
controller.position.maxScrollExtent) {
|
||||||
if (controller.offset != controller.position.maxScrollExtent)
|
if (controller.offset != controller.position.maxScrollExtent) {
|
||||||
controller.jumpTo(controller.position.maxScrollExtent);
|
controller.jumpTo(controller.position.maxScrollExtent);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
controller.jumpTo(controller.offset + value.overscroll);
|
controller.jumpTo(controller.offset + value.overscroll);
|
||||||
|
|||||||
@@ -84,5 +84,6 @@
|
|||||||
"exportAd": "Export pages which marked as ads",
|
"exportAd": "Export pages which marked as ads",
|
||||||
"maxZipFilenameLength": "Maximum length of filenames in Zip files",
|
"maxZipFilenameLength": "Maximum length of filenames in Zip files",
|
||||||
"downloadComplete": "Download completed.",
|
"downloadComplete": "Download completed.",
|
||||||
"downloadZipFailed": "Failed to download ZIP file."
|
"downloadZipFailed": "Failed to download ZIP file.",
|
||||||
|
"rating": "Rating"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,5 +84,6 @@
|
|||||||
"exportAd": "导出标记为广告的页面",
|
"exportAd": "导出标记为广告的页面",
|
||||||
"maxZipFilenameLength": "Zip文件中文件名的最大长度",
|
"maxZipFilenameLength": "Zip文件中文件名的最大长度",
|
||||||
"downloadComplete": "下载完毕。",
|
"downloadComplete": "下载完毕。",
|
||||||
"downloadZipFailed": "Zip文件下载失败。"
|
"downloadZipFailed": "Zip文件下载失败。",
|
||||||
|
"rating": "评分"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user