From 935073ce756ef21a8f07d2ec6d338742fff54a8b Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 22 Apr 2024 23:51:31 +0800 Subject: [PATCH 1/8] =?UTF-8?q?mod:=20=E8=A7=86=E9=A2=91=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E5=B8=83=E5=B1=80=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 335 +++++++++++++++---------------- 1 file changed, 166 insertions(+), 169 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 0152a2cb..f216fbcf 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -23,6 +23,7 @@ import 'package:pilipala/plugin/pl_player/index.dart'; import 'package:pilipala/plugin/pl_player/models/play_repeat.dart'; import 'package:pilipala/services/service_locator.dart'; import 'package:pilipala/utils/storage.dart'; +import 'package:status_bar_control/status_bar_control.dart'; import '../../../plugin/pl_player/models/bottom_control_type.dart'; import '../../../services/shutdown_timer_service.dart'; @@ -61,10 +62,12 @@ class _VideoDetailPageState extends State late bool autoPiP; late Floating floating; bool isShowing = true; + late double statusHeight; @override void initState() { super.initState(); + getStatusHeight(); heroTag = Get.arguments['heroTag']; vdCtr = Get.put(VideoDetailController(), tag: heroTag); vdCtr.sheetHeight.value = localCache.get('sheetHeight'); @@ -203,6 +206,10 @@ class _VideoDetailPageState extends State }); } + getStatusHeight() async { + statusHeight = await StatusBarControl.getHeight; + } + @override void dispose() { shutdownTimerService.handleWaitingFinished(); @@ -281,6 +288,143 @@ class _VideoDetailPageState extends State } } + /// 手动播放 + Widget handlePlayPanel() { + return Stack( + children: [ + GestureDetector( + onTap: handlePlay, + child: Image.network( + vdCtr.videoItem['pic'], + width: Get.width, + height: videoHeight, + fit: BoxFit.cover, // 适应方式根据需要调整 + ), + ), + buildCustomAppBar(), + Positioned( + right: 12, + bottom: 10, + child: GestureDetector( + onTap: handlePlay, + child: Image.asset( + 'assets/images/play.png', + width: 60, + height: 60, + ), + ), + ), + ], + ); + } + + /// tabbar + Widget tabbarBuild() { + return Container( + width: double.infinity, + height: 45, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 1, + color: Theme.of(context).dividerColor.withOpacity(0.1), + ), + ), + ), + child: Material( + child: Row( + children: [ + Expanded( + child: Obx( + () => TabBar( + padding: EdgeInsets.zero, + controller: vdCtr.tabCtr, + labelStyle: const TextStyle(fontSize: 13), + labelPadding: const EdgeInsets.symmetric(horizontal: 10.0), + dividerColor: Colors.transparent, + tabs: + vdCtr.tabs.map((String name) => Tab(text: name)).toList(), + ), + ), + ), + Flexible( + flex: 1, + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Obx(() => AnimatedOpacity( + opacity: playerStatus.value != PlayerStatus.playing + ? 1 + : 0, + duration: const Duration(milliseconds: 100), + child: const Icon( + Icons.drag_handle_rounded, + size: 20, + color: Colors.grey, + ), + )), + const SizedBox(width: 8), + SizedBox( + height: 32, + child: TextButton( + style: ButtonStyle( + padding: MaterialStateProperty.all(EdgeInsets.zero), + ), + onPressed: () => vdCtr.showShootDanmakuSheet(), + child: + const Text('发弹幕', style: TextStyle(fontSize: 12)), + ), + ), + SizedBox( + width: 38, + height: 38, + child: Obx( + () => !vdCtr.isShowCover.value + ? IconButton( + onPressed: () { + plPlayerController?.isOpenDanmu.value = + !(plPlayerController?.isOpenDanmu.value ?? + false); + }, + icon: !(plPlayerController?.isOpenDanmu.value ?? + false) + ? SvgPicture.asset( + 'assets/images/video/danmu_close.svg', + // ignore: deprecated_member_use + color: Theme.of(context) + .colorScheme + .outline, + ) + : SvgPicture.asset( + 'assets/images/video/danmu_open.svg', + // ignore: deprecated_member_use + color: Theme.of(context) + .colorScheme + .primary, + ), + ) + : IconButton( + icon: SvgPicture.asset( + 'assets/images/video/danmu_close.svg', + // ignore: deprecated_member_use + color: Theme.of(context).colorScheme.outline, + ), + onPressed: () {}, + ), + ), + ), + const SizedBox(width: 18), + ], + ), + ), + ), + ], + ), + ), + ); + } + @override Widget build(BuildContext context) { final sizeContext = MediaQuery.sizeOf(context); @@ -338,162 +482,13 @@ class _VideoDetailPageState extends State }, ); - /// tabbar - Widget tabbarBuild = Container( - width: double.infinity, - height: 45, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: Theme.of(context).dividerColor.withOpacity(0.1), - ), - ), - ), - child: Material( - child: Row( - children: [ - Flexible( - flex: 1, - child: Obx( - () => TabBar( - padding: EdgeInsets.zero, - controller: vdCtr.tabCtr, - labelStyle: const TextStyle(fontSize: 13), - labelPadding: - const EdgeInsets.symmetric(horizontal: 10.0), // 设置每个标签的宽度 - dividerColor: Colors.transparent, - tabs: vdCtr.tabs - .map( - (String name) => Tab(text: name), - ) - .toList(), - ), - ), - ), - Flexible( - flex: 1, - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Obx(() => AnimatedOpacity( - opacity: playerStatus.value != PlayerStatus.playing - ? 1 - : 0, - duration: const Duration(milliseconds: 100), - child: const Icon( - Icons.drag_handle_rounded, - size: 20, - color: Colors.grey, - ), - )), - const SizedBox(width: 8), - SizedBox( - height: 32, - child: TextButton( - style: ButtonStyle( - padding: MaterialStateProperty.all(EdgeInsets.zero), - ), - onPressed: () => vdCtr.showShootDanmakuSheet(), - child: - const Text('发弹幕', style: TextStyle(fontSize: 12)), - ), - ), - SizedBox( - width: 38, - height: 38, - child: Obx( - () => !vdCtr.isShowCover.value - ? IconButton( - onPressed: () { - plPlayerController?.isOpenDanmu.value = - !(plPlayerController - ?.isOpenDanmu.value ?? - false); - }, - icon: - !(plPlayerController?.isOpenDanmu.value ?? - false) - ? SvgPicture.asset( - 'assets/images/video/danmu_close.svg', - // ignore: deprecated_member_use - color: Theme.of(context) - .colorScheme - .outline, - ) - : SvgPicture.asset( - 'assets/images/video/danmu_open.svg', - // ignore: deprecated_member_use - color: Theme.of(context) - .colorScheme - .primary, - ), - ) - : IconButton( - icon: SvgPicture.asset( - 'assets/images/video/danmu_close.svg', - // ignore: deprecated_member_use - color: - Theme.of(context).colorScheme.outline, - ), - onPressed: () {}, - ), - ), - ), - const SizedBox(width: 18), - ], - ), - )), - ], - ), - ), - ); - - /// 手动播放 - Widget handlePlayPanel() { - return Stack( - children: [ - GestureDetector( - onTap: () { - handlePlay(); - }, - child: NetworkImgLayer( - type: 'emote', - src: vdCtr.videoItem['pic'], - width: Get.width, - height: videoHeight.value, - ), - ), - Positioned( - top: 0, - left: 0, - right: 0, - child: buildCustomAppBar(), - ), - Positioned( - right: 12, - bottom: 10, - child: IconButton( - tooltip: '播放', - onPressed: () => handlePlay(), - icon: Image.asset( - 'assets/images/play.png', - width: 60, - height: 60, - )), - ), - ], - ); - } - Widget childWhenDisabled = SafeArea( top: MediaQuery.of(context).orientation == Orientation.portrait && plPlayerController?.isFullScreen.value == true, bottom: MediaQuery.of(context).orientation == Orientation.portrait && plPlayerController?.isFullScreen.value == true, - left: false, //plPlayerController?.isFullScreen.value != true, - right: false, //plPlayerController?.isFullScreen.value != true, + left: false, + right: false, child: Stack( children: [ Scaffold( @@ -511,12 +506,22 @@ class _VideoDetailPageState extends State controller: _extendNestCtr, headerSliverBuilder: (BuildContext context2, bool innerBoxIsScrolled) { + final Orientation orientation = + MediaQuery.of(context).orientation; + final bool isFullScreen = + plPlayerController?.isFullScreen.value == true; + final double expandedHeight = + orientation == Orientation.landscape || isFullScreen + ? (MediaQuery.sizeOf(context).height - + (orientation == Orientation.landscape + ? 0 + : MediaQuery.of(context).padding.top)) + : videoHeight.value; return [ Obx( () { - if (MediaQuery.of(context).orientation == - Orientation.landscape || - plPlayerController?.isFullScreen.value == true) { + if (orientation == Orientation.landscape || + isFullScreen) { enterFullScreen(); } else { exitFullScreen(); @@ -528,15 +533,7 @@ class _VideoDetailPageState extends State elevation: 0, scrolledUnderElevation: 0, forceElevated: innerBoxIsScrolled, - expandedHeight: MediaQuery.of(context).orientation == - Orientation.landscape || - plPlayerController?.isFullScreen.value == true - ? (MediaQuery.sizeOf(context).height - - (MediaQuery.of(context).orientation == - Orientation.landscape - ? 0 - : MediaQuery.of(context).padding.top)) - : videoHeight.value, + expandedHeight: expandedHeight, backgroundColor: Colors.black, flexibleSpace: FlexibleSpaceBar( background: PopScope( @@ -556,13 +553,13 @@ class _VideoDetailPageState extends State child: LayoutBuilder( builder: (BuildContext context, BoxConstraints boxConstraints) { - // final double maxWidth = - // boxConstraints.maxWidth; - // final double maxHeight = - // boxConstraints.maxHeight; return Stack( children: [ - if (isShowing) videoPlayerPanel, + if (isShowing) + Padding( + padding: EdgeInsets.only(top: 0), + child: videoPlayerPanel, + ), /// 关闭自动播放时 手动播放 Obx( @@ -604,7 +601,7 @@ class _VideoDetailPageState extends State color: Theme.of(context).colorScheme.background, child: Column( children: [ - tabbarBuild, + tabbarBuild(), Expanded( child: TabBarView( controller: vdCtr.tabCtr, From aff39c291dc669158277301541cb98c9ed8ec0b0 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sat, 27 Apr 2024 22:17:10 +0800 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20=E5=90=88=E9=9B=86cover=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/pages_bottom_sheet.dart | 46 +++++++++++++++++++----------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/common/pages_bottom_sheet.dart b/lib/common/pages_bottom_sheet.dart index 54f14654..00233a07 100644 --- a/lib/common/pages_bottom_sheet.dart +++ b/lib/common/pages_bottom_sheet.dart @@ -45,25 +45,37 @@ class EpisodeBottomSheet { title = '第${episode.title}话 ${episode.longTitle!}'; break; } - return InkWell( - onTap: () { - SmartDialog.showToast('切换至「$title」'); - changeFucCall.call(episode, index); - }, - child: Padding( - padding: const EdgeInsets.only(left: 14, right: 14, top: 8, bottom: 8), - child: isFullScreen - ? Text( - title, - maxLines: 1, + return isFullScreen || episode?.cover == null + ? ListTile( + onTap: () { + SmartDialog.showToast('切换至「$title」'); + changeFucCall.call(episode, index); + }, + dense: false, + leading: isCurrentIndex + ? Image.asset( + 'assets/images/live.gif', + color: primary, + height: 12, + ) + : null, + title: Text(title, style: TextStyle( fontSize: 14, color: isCurrentIndex ? primary : onSurface, - ), - ) - : Row( + ))) + : InkWell( + onTap: () { + SmartDialog.showToast('切换至「$title」'); + changeFucCall.call(episode, index); + }, + child: Padding( + padding: + const EdgeInsets.only(left: 14, right: 14, top: 8, bottom: 8), + child: Row( children: [ - NetworkImgLayer(width: 130, height: 75, src: episode.cover), + NetworkImgLayer( + width: 130, height: 75, src: episode?.cover ?? ''), const SizedBox(width: 10), Expanded( child: Text( @@ -77,8 +89,8 @@ class EpisodeBottomSheet { ), ], ), - ), - ); + ), + ); } Widget buildTitle() { From 8a6b4f987f4aeabe91c0d2d98adc898be044521f Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 28 Apr 2024 22:03:19 +0800 Subject: [PATCH 3/8] revert: NavigationBar Color --- lib/main.dart | 59 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 3877685c..43bcf930 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -65,6 +65,20 @@ void main() async { }, ); + // 小白条、导航栏沉浸 + if (Platform.isAndroid) { + List versionParts = Platform.version.split('.'); + int androidVersion = int.parse(versionParts[0]); + if (androidVersion >= 29) { + SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + } + SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( + systemNavigationBarColor: Colors.transparent, + systemNavigationBarDividerColor: Colors.transparent, + statusBarColor: Colors.transparent, + )); + } + Data.init(); GlobalData(); PiliSchame.init(); @@ -130,26 +144,33 @@ class MyApp extends StatelessWidget { ); } - ThemeData themeData = ThemeData( - colorScheme: currentThemeValue == ThemeType.dark - ? darkColorScheme - : lightColorScheme, - ); + // ThemeData themeData = ThemeData( + // colorScheme: currentThemeValue == ThemeType.dark + // ? darkColorScheme + // : lightColorScheme, + // ); - // 小白条、导航栏沉浸 - SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); - SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( - systemNavigationBarColor: GlobalData().enableMYBar - ? const Color(0x00010000) - : themeData.canvasColor, - systemNavigationBarDividerColor: GlobalData().enableMYBar - ? const Color(0x00010000) - : themeData.canvasColor, - systemNavigationBarIconBrightness: currentThemeValue == ThemeType.dark - ? Brightness.light - : Brightness.dark, - statusBarColor: Colors.transparent, - )); + // // 小白条、导航栏沉浸 + // if (Platform.isAndroid) { + // List versionParts = Platform.version.split('.'); + // int androidVersion = int.parse(versionParts[0]); + // if (androidVersion >= 29) { + // SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + // } + // SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( + // systemNavigationBarColor: GlobalData().enableMYBar + // ? const Color(0x00010000) + // : themeData.canvasColor, + // systemNavigationBarDividerColor: GlobalData().enableMYBar + // ? const Color(0x00010000) + // : themeData.canvasColor, + // systemNavigationBarIconBrightness: + // currentThemeValue == ThemeType.dark + // ? Brightness.light + // : Brightness.dark, + // statusBarColor: Colors.transparent, + // )); + // } // 图片缓存 // PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20; From bc4fb0e0ae40cb9a77ebe18893f8a4cbd34071c5 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 28 Apr 2024 22:27:14 +0800 Subject: [PATCH 4/8] fix: videoDetail cover null --- lib/pages/video/detail/controller.dart | 27 ++++++++++--------- .../video/detail/introduction/controller.dart | 1 + lib/utils/app_scheme.dart | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index c6c4bef6..bb099255 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -115,20 +115,15 @@ class VideoDetailController extends GetxController super.onInit(); final Map argMap = Get.arguments; userInfo = userInfoCache.get('userInfoCache'); - var keys = argMap.keys.toList(); - if (keys.isNotEmpty) { - if (keys.contains('videoItem')) { - var args = argMap['videoItem']; - if (args.pic != null && args.pic != '') { - videoItem['pic'] = args.pic; - cover.value = args.pic; - } - } - if (keys.contains('pic')) { - videoItem['pic'] = argMap['pic']; - cover.value = argMap['pic']; - } + if (argMap.containsKey('videoItem')) { + var args = argMap['videoItem']; + updateCover(args.pic); } + + if (argMap.containsKey('pic')) { + updateCover(argMap['pic']); + } + tabCtr = TabController(length: 2, vsync: this); autoPlay.value = setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); @@ -551,4 +546,10 @@ class VideoDetailController extends GetxController }, ); } + + void updateCover(String? pic) { + if (pic != null && pic != '') { + cover.value = videoItem['pic'] = pic; + } + } } diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index b9a3ef93..2ced79f0 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -90,6 +90,7 @@ class VideoIntroController extends GetxController { final VideoDetailController videoDetailCtr = Get.find(tag: heroTag); videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}']; + videoDetailCtr.cover.value = result['data'].pic ?? ''; // 获取到粉丝数再返回 await queryUserStat(); } diff --git a/lib/utils/app_scheme.dart b/lib/utils/app_scheme.dart index 9009df6f..69fa717d 100644 --- a/lib/utils/app_scheme.dart +++ b/lib/utils/app_scheme.dart @@ -117,7 +117,7 @@ class PiliSchame { // ignore: always_specify_types (e) => Get.toNamed('/video?bvid=$bvid&cid=$cid', arguments: { - 'pic': null, + 'pic': '', 'heroTag': heroTag, }), ); From 811487bdd42f696b7ee56c4dd8c43fed2c787217 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 28 Apr 2024 23:03:33 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20=E9=87=8D=E5=9B=9E=E5=89=8D=E5=8F=B0?= =?UTF-8?q?=E5=BC=B9=E5=B9=95=E5=A0=86=E7=A7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 7f1d6039..199e6b88 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -38,7 +38,7 @@ class VideoDetailPage extends StatefulWidget { } class _VideoDetailPageState extends State - with TickerProviderStateMixin, RouteAware { + with TickerProviderStateMixin, RouteAware, WidgetsBindingObserver { late VideoDetailController vdCtr; PlPlayerController? plPlayerController; final ScrollController _extendNestCtr = ScrollController(); @@ -61,6 +61,8 @@ class _VideoDetailPageState extends State late bool autoPiP; late Floating floating; bool isShowing = true; + // 生命周期监听 + late final AppLifecycleListener _lifecycleListener; @override void initState() { @@ -96,6 +98,8 @@ class _VideoDetailPageState extends State floating = vdCtr.floating!; autoEnterPip(); } + WidgetsBinding.instance.addObserver(this); + lifecycleListener(); } // 获取视频资源,初始化播放器 @@ -219,6 +223,8 @@ class _VideoDetailPageState extends State floating.dispose(); } appbarStream.close(); + WidgetsBinding.instance.removeObserver(this); + _lifecycleListener.dispose(); super.dispose(); } @@ -281,6 +287,29 @@ class _VideoDetailPageState extends State } } + // 生命周期监听 + void lifecycleListener() { + _lifecycleListener = AppLifecycleListener( + // onResume: () => _handleTransition('resume'), + // 后台 + // onInactive: () => _handleTransition('inactive'), + // 在Android和iOS端不生效 + // onHide: () => _handleTransition('hide'), + onShow: () => _handleTransition('show'), + onPause: () => _handleTransition('pause'), + onRestart: () => _handleTransition('restart'), + onDetach: () => _handleTransition('detach'), + ); + } + + void _handleTransition(String name) { + switch (name) { + case 'show' || 'restart': + plPlayerController?.danmakuController?.clear(); + break; + } + } + @override Widget build(BuildContext context) { final sizeContext = MediaQuery.sizeOf(context); From 0bb26aa46757eec6b3e5855e2e90e5f0fe4d167b Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 29 Apr 2024 13:16:25 +0800 Subject: [PATCH 6/8] fix: videoDetail cover null --- lib/common/pages_bottom_sheet.dart | 2 +- lib/models/video_detail_res.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/common/pages_bottom_sheet.dart b/lib/common/pages_bottom_sheet.dart index 00233a07..2a56eb41 100644 --- a/lib/common/pages_bottom_sheet.dart +++ b/lib/common/pages_bottom_sheet.dart @@ -45,7 +45,7 @@ class EpisodeBottomSheet { title = '第${episode.title}话 ${episode.longTitle!}'; break; } - return isFullScreen || episode?.cover == null + return isFullScreen || episode?.cover == null || episode?.cover == '' ? ListTile( onTap: () { SmartDialog.showToast('切换至「$title」'); diff --git a/lib/models/video_detail_res.dart b/lib/models/video_detail_res.dart index b7b1b481..ae272375 100644 --- a/lib/models/video_detail_res.dart +++ b/lib/models/video_detail_res.dart @@ -412,8 +412,8 @@ class Part { dimension = json["dimension"] == null ? null : Dimension.fromJson(json["dimension"]); - firstFrame = json["first_frame"]; - cover = json["first_frame"]; + firstFrame = json["first_frame"] ?? ''; + cover = json["first_frame"] ?? ''; } Map toJson() { From 3c8a92209fa5b1725df883b9b9cc62a369708e76 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 29 Apr 2024 13:41:25 +0800 Subject: [PATCH 7/8] =?UTF-8?q?revert:=20=E8=AF=84=E8=AE=BA=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E4=BC=98=E5=85=88=E5=B1=95=E7=A4=BA=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/reply/widgets/reply_item.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index ecc2dd02..468d2541 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -427,7 +427,7 @@ class ReplyItemRow extends StatelessWidget { if (extraRow == 1) InkWell( // 一楼点击【共xx条回复】展开评论详情 - onTap: () => replyReply!(replyItem, null), + onTap: () => replyReply!(replyItem), child: Container( width: double.infinity, padding: const EdgeInsets.fromLTRB(8, 5, 8, 8), From bab0985e86f147087d8f0793ad5e9da08f67d0df Mon Sep 17 00:00:00 2001 From: guozhigq Date: Tue, 30 Apr 2024 15:49:00 +0800 Subject: [PATCH 8/8] =?UTF-8?q?mod:=20=E5=85=B3=E6=B3=A8=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/introduction/view.dart | 74 ++++++++----------- 1 file changed, 32 insertions(+), 42 deletions(-) diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index a7eae6d2..8a92e9be 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -134,7 +134,6 @@ class _VideoInfoState extends State with TickerProviderStateMixin { late double sheetHeight; late final dynamic owner; late final dynamic follower; - late final dynamic followStatus; late int mid; late String memberHeroTag; late bool enableAi; @@ -163,7 +162,6 @@ class _VideoInfoState extends State with TickerProviderStateMixin { owner = widget.videoDetail!.owner; follower = Utils.numFormat(videoIntroController.userStat['follower']); - followStatus = videoIntroController.followStatus; enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true); _expandableCtr = ExpandableController(initialExpanded: false); } @@ -434,47 +432,39 @@ class _VideoInfoState extends State with TickerProviderStateMixin { ), ), const Spacer(), - Obx(() => AnimatedOpacity( - opacity: - videoIntroController.followStatus.isEmpty ? 0 : 1, - duration: const Duration(milliseconds: 50), - child: SizedBox( - height: 32, - child: Obx( - () => videoIntroController.followStatus.isNotEmpty - ? TextButton( - onPressed: - videoIntroController.actionRelationMod, - style: TextButton.styleFrom( - padding: const EdgeInsets.only( - left: 8, right: 8), - foregroundColor: - followStatus['attribute'] != 0 - ? outline - : t.colorScheme.onPrimary, - backgroundColor: - followStatus['attribute'] != 0 - ? t.colorScheme.onInverseSurface - : t.colorScheme - .primary, // 设置按钮背景色 - ), - child: Text( - followStatus['attribute'] != 0 - ? '已关注' - : '关注', - style: TextStyle( - fontSize: t - .textTheme.labelMedium!.fontSize), - ), - ) - : ElevatedButton( - onPressed: - videoIntroController.actionRelationMod, - child: const Text('关注'), + Obx( + () { + final bool isFollowed = + videoIntroController.followStatus['attribute'] != 0; + return videoIntroController.followStatus.isEmpty + ? const SizedBox() + : SizedBox( + height: 32, + child: TextButton( + onPressed: + videoIntroController.actionRelationMod, + style: TextButton.styleFrom( + padding: const EdgeInsets.only( + left: 8, + right: 8, ), - ), - ), - )), + foregroundColor: isFollowed + ? outline + : t.colorScheme.onPrimary, + backgroundColor: isFollowed + ? t.colorScheme.onInverseSurface + : t.colorScheme.primary, // 设置按钮背景色 + ), + child: Text( + isFollowed ? '已关注' : '关注', + style: TextStyle( + fontSize: t.textTheme.labelMedium!.fontSize, + ), + ), + ), + ); + }, + ) ], ), ),