From 7bb7159d485117a99c03e556f28045d2269bec32 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 20 Aug 2023 15:26:10 +0800 Subject: [PATCH] mod: history --- lib/models/user/history.dart | 2 +- lib/pages/history/view.dart | 3 +-- lib/pages/history/widgets/item.dart | 31 ++++++++++++++++------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/models/user/history.dart b/lib/models/user/history.dart index 19698aa9..669874b4 100644 --- a/lib/models/user/history.dart +++ b/lib/models/user/history.dart @@ -121,7 +121,7 @@ class HisListItem { viewAt = json['view_at']; progress = json['progress']; badge = json['badge']; - showTitle = json['show_title']; + showTitle = json['show_title'] == '' ? null : json['show_title']; duration = json['duration']; current = json['current']; total = json['total']; diff --git a/lib/pages/history/view.dart b/lib/pages/history/view.dart index 5791e45c..c0118819 100644 --- a/lib/pages/history/view.dart +++ b/lib/pages/history/view.dart @@ -102,8 +102,7 @@ class _HistoryPageState extends State { Map data = snapshot.data; if (data['status']) { return Obx( - () => _historyController.historyList.isNotEmpty && - !_historyController.isLoadingMore.value + () => _historyController.historyList.isNotEmpty ? SliverList( delegate: SliverChildBuilderDelegate( (context, index) { diff --git a/lib/pages/history/widgets/item.dart b/lib/pages/history/widgets/item.dart index e9c039a5..a368a978 100644 --- a/lib/pages/history/widgets/item.dart +++ b/lib/pages/history/widgets/item.dart @@ -37,20 +37,23 @@ class HistoryItem extends StatelessWidget { 'pageTitle': videoItem.title }, ); - } else if (videoItem.history.business == 'live' && - videoItem.liveStatus == 1) { - LiveItemModel liveItem = LiveItemModel.fromJson({ - 'face': videoItem.authorFace, - 'roomid': videoItem.history.oid, - 'pic': videoItem.cover, - 'title': videoItem.title, - 'uname': videoItem.authorName, - 'cover': videoItem.cover, - }); - Get.toNamed( - '/liveRoom?roomid=${videoItem.history.oid}', - arguments: {'liveItem': liveItem}, - ); + } else if (videoItem.history.business == 'live') { + if (videoItem.liveStatus == 1) { + LiveItemModel liveItem = LiveItemModel.fromJson({ + 'face': videoItem.authorFace, + 'roomid': videoItem.history.oid, + 'pic': videoItem.cover, + 'title': videoItem.title, + 'uname': videoItem.authorName, + 'cover': videoItem.cover, + }); + Get.toNamed( + '/liveRoom?roomid=${videoItem.history.oid}', + arguments: {'liveItem': liveItem}, + ); + } else { + SmartDialog.showToast('直播未开播'); + } } else if (videoItem.badge == '番剧' || videoItem.tagName.contains('动画')) { /// hack