Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

add lastUpdate timestamp display in plugin shop

AoEiuV02033de39940151
diff --git a/lib/modules/plugin/plugin_http_module.dart b/lib/modules/plugin/plugin_http_module.dart
index 17a82a8b..bdb8cb34 100644
--- a/lib/modules/plugin/plugin_http_module.dart
+++ b/lib/modules/plugin/plugin_http_module.dart
@@ -3,12 +3,14 @@ class PluginHTTPItem {
String version;
bool useNativePlayer;
String author;
+ int lastUpdate;
PluginHTTPItem({
required this.name,
required this.version,
required this.useNativePlayer,
required this.author,
+ required this.lastUpdate,
});
factory PluginHTTPItem.fromJson(Map<String, dynamic> json) {
@@ -17,6 +19,7 @@ class PluginHTTPItem {
version: json['version'],
useNativePlayer: json['useNativePlayer'],
author: json['author'],
+ lastUpdate: json['lastUpdate'] ?? 0,
);
}
-}
\ No newline at end of file
+}
diff --git a/lib/pages/plugin_editor/plugin_shop_page.dart b/lib/pages/plugin_editor/plugin_shop_page.dart
index 461d9ed9..1041ec5c 100644
--- a/lib/pages/plugin_editor/plugin_shop_page.dart
+++ b/lib/pages/plugin_editor/plugin_shop_page.dart
@@ -67,39 +67,51 @@ class _PluginShopPageState extends State<PluginShopPage> {
),
],
),
- subtitle: Row(
+ subtitle: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Container(
- padding: const EdgeInsets.symmetric(
- horizontal: 8.0, vertical: 1.0),
- decoration: BoxDecoration(
- color: Theme.of(context).colorScheme.secondary,
- borderRadius: BorderRadius.circular(16.0),
- ),
- child: Text(
- pluginsController.pluginHTTPList[index].version,
- style: TextStyle(
- color: Theme.of(context).colorScheme.surface),
- ),
- ),
- const SizedBox(
- width: 5,
+ Row(
+ children: [
+ Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 8.0, vertical: 1.0),
+ decoration: BoxDecoration(
+ color: Theme.of(context).colorScheme.secondary,
+ borderRadius: BorderRadius.circular(16.0),
+ ),
+ child: Text(
+ pluginsController.pluginHTTPList[index].version,
+ style: TextStyle(
+ color: Theme.of(context).colorScheme.surface),
+ ),
+ ),
+ const SizedBox(width: 5),
+ Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 8.0, vertical: 1.0),
+ decoration: BoxDecoration(
+ color: Theme.of(context).colorScheme.primary,
+ borderRadius: BorderRadius.circular(16.0),
+ ),
+ child: Text(
+ pluginsController
+ .pluginHTTPList[index].useNativePlayer
+ ? "native"
+ : "webview",
+ style: TextStyle(
+ color: Theme.of(context).colorScheme.surface),
+ ),
+ ),
+ ],
),
- Container(
- padding: const EdgeInsets.symmetric(
- horizontal: 8.0, vertical: 1.0),
- decoration: BoxDecoration(
- color: Theme.of(context).colorScheme.primary,
- borderRadius: BorderRadius.circular(16.0),
+ if (pluginsController.pluginHTTPList[index].lastUpdate >
+ 0) ...[
+ const SizedBox(height: 4),
+ Text(
+ '更新时间: ${DateTime.fromMillisecondsSinceEpoch(pluginsController.pluginHTTPList[index].lastUpdate).toString().split('.')[0]}',
+ style: const TextStyle(color: Colors.grey),
),
- child: Text(
- pluginsController.pluginHTTPList[index].useNativePlayer
- ? "native"
- : "webview",
- style: TextStyle(
- color: Theme.of(context).colorScheme.surface),
- ),
- ),
+ ],
],
),
trailing: TextButton(
@@ -112,11 +124,10 @@ class _PluginShopPageState extends State<PluginShopPage> {
pluginsController.pluginHTTPList[index].name);
if (res == 0) {
KazumiDialog.showToast(message: '导入成功');
- setState(() {
-
- });
+ setState(() {});
} else if (res == 1) {
- KazumiDialog.showToast(message: 'kazumi版本过低, 此规则不兼容当前版本');
+ KazumiDialog.showToast(
+ message: 'kazumi版本过低, 此规则不兼容当前版本');
} else if (res == 2) {
KazumiDialog.showToast(message: '导入规则失败');
}
@@ -129,11 +140,10 @@ class _PluginShopPageState extends State<PluginShopPage> {
pluginsController.pluginHTTPList[index].name);
if (res == 0) {
KazumiDialog.showToast(message: '更新成功');
- setState(() {
-
- });
+ setState(() {});
} else if (res == 1) {
- KazumiDialog.showToast(message: 'kazumi版本过低, 此规则不兼容当前版本');
+ KazumiDialog.showToast(
+ message: 'kazumi版本过低, 此规则不兼容当前版本');
} else if (res == 2) {
KazumiDialog.showToast(message: '更新规则失败');
}