diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index 3f1f2c71..4f4c29bc 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -1,4 +1,3 @@ -import 'package:flutter/gestures.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get.dart'; @@ -103,13 +102,10 @@ class _VideoInfoState extends State with TickerProviderStateMixin { late double sheetHeight; late final bool loadingStatus; // 加载状态 - late final int viewCount; // 观看 - late final int danmakuCount; // 弹幕 - late final String pubDate; // 发布日期 - late final owner; - late final follower; - late final followStatus; + late final dynamic owner; + late final dynamic follower; + late final dynamic followStatus; @override void initState() { @@ -121,16 +117,6 @@ class _VideoInfoState extends State with TickerProviderStateMixin { sheetHeight = localCache.get('sheetHeight'); loadingStatus = widget.loadingStatus; - viewCount = !loadingStatus - ? widget.videoDetail!.stat!.view - : videoItem['stat'].view; - danmakuCount = !loadingStatus - ? widget.videoDetail!.stat!.danmaku - : videoItem['stat'].danmaku; - pubDate = Utils.dateFormat( - !loadingStatus ? widget.videoDetail!.pubdate : videoItem['pubdate'], - formatType: 'detail'); - owner = loadingStatus ? videoItem['owner'] : widget.videoDetail!.owner; follower = loadingStatus ? '-' @@ -235,14 +221,31 @@ class _VideoInfoState extends State with TickerProviderStateMixin { child: Row( children: [ StatView( - theme: 'gray', view: viewCount, size: 'medium'), + theme: 'gray', + view: !widget.loadingStatus + ? widget.videoDetail!.stat!.view + : videoItem['stat'].view, + size: 'medium', + ), const SizedBox(width: 10), StatDanMu( - theme: 'gray', danmu: danmakuCount, size: 'medium'), + theme: 'gray', + danmu: !widget.loadingStatus + ? widget.videoDetail!.stat!.danmaku + : videoItem['stat'].danmaku, + size: 'medium', + ), const SizedBox(width: 10), Text( - pubDate, - style: TextStyle(fontSize: 12, color: outline), + Utils.dateFormat( + !widget.loadingStatus + ? widget.videoDetail!.pubdate + : videoItem['pubdate'], + formatType: 'detail'), + style: TextStyle( + fontSize: 12, + color: t.colorScheme.outline, + ), ), ], ), diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 0b3effb4..548acbce 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:ui'; import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart'; import 'package:get/get.dart'; @@ -281,43 +280,66 @@ class _VideoDetailPageState extends State onlyOneScrollInBody: true, body: Container( color: Theme.of(context).colorScheme.background, - child: Expanded( - child: TabBarView( - controller: videoDetailController.tabCtr, - children: [ - Builder( - builder: (context) { - return CustomScrollView( - key: const PageStorageKey('简介'), - slivers: [ - if (videoDetailController.videoType == - SearchType.video) ...[ - const VideoIntroPanel(), - ] else if (videoDetailController.videoType == - SearchType.media_bangumi) ...[ - const BangumiIntroPanel() - ], - if (videoDetailController.videoType == - SearchType.video) ...[ - SliverPersistentHeader( - floating: true, - pinned: true, - delegate: SliverHeaderDelegate( - height: 50, - child: const MenuRow(loadingStatus: false), - ), - ), - ], - const RelatedVideoPanel(), - ], - ); - }, + child: Column( + children: [ + Opacity( + opacity: 0, + child: SizedBox( + width: double.infinity, + height: 0, + child: Obx( + () => TabBar( + controller: videoDetailController.tabCtr, + dividerColor: Colors.transparent, + indicatorColor: + Theme.of(context).colorScheme.background, + tabs: videoDetailController.tabs + .map((String name) => Tab(text: name)) + .toList(), + ), + ), ), - VideoReplyPanel( - bvid: videoDetailController.bvid, - ) - ], - ), + ), + Expanded( + child: TabBarView( + controller: videoDetailController.tabCtr, + children: [ + Builder( + builder: (context) { + return CustomScrollView( + key: const PageStorageKey('简介'), + slivers: [ + if (videoDetailController.videoType == + SearchType.video) ...[ + const VideoIntroPanel(), + ] else if (videoDetailController.videoType == + SearchType.media_bangumi) ...[ + const BangumiIntroPanel() + ], + if (videoDetailController.videoType == + SearchType.video) ...[ + SliverPersistentHeader( + floating: true, + pinned: true, + delegate: SliverHeaderDelegate( + height: 50, + child: + const MenuRow(loadingStatus: false), + ), + ), + ], + const RelatedVideoPanel(), + ], + ); + }, + ), + VideoReplyPanel( + bvid: videoDetailController.bvid, + ) + ], + ), + ), + ], ), ), ),