diff --git a/lib/models/model_rec_video_item.dart b/lib/models/model_rec_video_item.dart index f857c70f..bd42fd82 100644 --- a/lib/models/model_rec_video_item.dart +++ b/lib/models/model_rec_video_item.dart @@ -77,14 +77,14 @@ class Stat { this.danmu, }); @HiveField(0) - int? view; + String? view; @HiveField(1) int? like; @HiveField(2) int? danmu; Stat.fromJson(Map json) { - view = json["view"]; + view = Utils.numFormat(json["view"]); like = json["like"]; danmu = json['danmaku']; } diff --git a/lib/models/model_rec_video_item.g.dart b/lib/models/model_rec_video_item.g.dart index 99f096c2..1de6ab03 100644 --- a/lib/models/model_rec_video_item.g.dart +++ b/lib/models/model_rec_video_item.g.dart @@ -87,7 +87,7 @@ class StatAdapter extends TypeAdapter { for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), }; return Stat( - view: fields[0] as int?, + view: fields[0] as String?, like: fields[1] as int?, danmu: fields[2] as int?, ); diff --git a/lib/pages/dynamics/widgets/rich_node_panel.dart b/lib/pages/dynamics/widgets/rich_node_panel.dart index 8b7dcd69..8f744dd5 100644 --- a/lib/pages/dynamics/widgets/rich_node_panel.dart +++ b/lib/pages/dynamics/widgets/rich_node_panel.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart'; +import 'package:pilipala/http/search.dart'; // 富文本 InlineSpan richNode(item, context) { @@ -191,6 +193,39 @@ InlineSpan richNode(item, context) { ), ); } + // 投稿 + if (i.type == 'RICH_TEXT_NODE_TYPE_BV') { + spanChilds.add( + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Icon( + Icons.play_circle_outline_outlined, + size: 16, + color: Theme.of(context).colorScheme.primary, + ), + ), + ); + spanChilds.add( + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: GestureDetector( + onTap: () async { + try { + int cid = await SearchHttp.ab2c(bvid: i.rid); + Get.toNamed('/video?bvid=${i.rid}&cid=$cid', + arguments: {'pic': null, 'heroTag': i.rid}); + } catch (err) { + SmartDialog.showToast(err.toString()); + } + }, + child: Text( + '${i.text} ', + style: authorStyle, + ), + ), + ), + ); + } } // if (contentType == 'major' && // item.modules.moduleDynamic.major.opus.pics.isNotEmpty) {