From aae64dd6be357e84559eaeb03d069bfae218f300 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 9 Dec 2024 09:50:00 +0800 Subject: [PATCH 1/3] opt: player control textStyle --- .../video/detail/widgets/header_control.dart | 18 ++++---------- lib/plugin/pl_player/view.dart | 24 ++++--------------- 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index 718cdac6..165fda90 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -1080,10 +1080,7 @@ class _HeaderControlState extends State { if (videoIntroController.isShowOnlineTotal) Text( '${videoIntroController.total.value}人正在看', - style: const TextStyle( - color: Colors.white, - fontSize: 12, - ), + style: textStyle, ), const Spacer(), Expanded( @@ -1094,18 +1091,12 @@ class _HeaderControlState extends State { builder: (context, snapshot) { if (snapshot.hasData) { String currentTime = _formatTime(snapshot.data!); - return Text( - currentTime, - style: const TextStyle(fontSize: 12), - ); + return Text(currentTime, style: textStyle); } else if (snapshot.connectionState == ConnectionState.waiting) { // 如果Stream还未发出数据,先显示初始获取的时间 String currentTime = _formatTime(initialTime); - return Text( - currentTime, - style: const TextStyle(fontSize: 12), - ); + return Text(currentTime, style: textStyle); } else { return const SizedBox(); } @@ -1156,7 +1147,8 @@ class _HeaderControlState extends State { () => Marquee( text: videoIntroController.videoDetail.value.title ?? '', - style: const TextStyle(fontSize: 16), + style: const TextStyle( + fontSize: 16, color: Colors.white), scrollAxis: Axis.horizontal, crossAxisAlignment: CrossAxisAlignment.center, blankSpace: constraints.maxWidth, diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 0790d10a..01a1b65f 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -292,10 +292,7 @@ class _PLVideoPlayerState extends State style: ButtonStyle( padding: MaterialStateProperty.all(EdgeInsets.zero), ), - child: const Text( - '选集', - style: TextStyle(color: Colors.white, fontSize: 13), - ), + child: const Text('选集', style: textStyle), ), ), @@ -310,14 +307,7 @@ class _PLVideoPlayerState extends State padding: MaterialStateProperty.all(EdgeInsets.zero), ), child: Obx( - () => Text( - _.videoFitDEsc.value, - style: const TextStyle( - color: Colors.white, - fontSize: 12, - fontWeight: FontWeight.bold, - ), - ), + () => Text(_.videoFitDEsc.value, style: textStyle), ), ), ), @@ -339,10 +329,7 @@ class _PLVideoPlayerState extends State height: 40, padding: const EdgeInsets.only(left: 20), value: speed, - child: Text( - '${speed}x', - style: textStyle.copyWith(fontWeight: FontWeight.bold), - ), + child: Text('${speed}x', style: textStyle), ); }).toList(); }, @@ -352,10 +339,7 @@ class _PLVideoPlayerState extends State alignment: Alignment.center, margin: const EdgeInsets.only(right: 4), child: Obx( - () => Text( - '${_.playbackSpeed.toString()}x', - style: textStyle.copyWith(fontWeight: FontWeight.bold), - ), + () => Text('${_.playbackSpeed.toString()}x', style: textStyle), ), ), ), From 51e963c52cbc25f831fb184a15f0ceb6d529df2e Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 9 Dec 2024 22:54:17 +0800 Subject: [PATCH 2/3] opt: player fullScreenCb --- lib/plugin/pl_player/view.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 0790d10a..86522a68 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -734,6 +734,7 @@ class _PLVideoPlayerState extends State lastFullScreenToggleTime = DateTime.now(); // 下滑退出全屏 await widget.controller.triggerFullScreen(status: flag); + widget.fullScreenCb?.call(flag); } _distance.value = 0.0; } else if (dy < _distance.value && @@ -743,6 +744,7 @@ class _PLVideoPlayerState extends State lastFullScreenToggleTime = DateTime.now(); // 上滑进入全屏 await widget.controller.triggerFullScreen(status: !flag); + widget.fullScreenCb?.call(!flag); } _distance.value = 0.0; } From 43bc545363d1965680f81c55a3ebb4bbe05466ad Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 9 Dec 2024 23:38:39 +0800 Subject: [PATCH 3/3] opt: live follow --- lib/pages/live/view.dart | 63 ++++++++++++++++----------- lib/pages/live_follow/controller.dart | 5 ++- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/lib/pages/live/view.dart b/lib/pages/live/view.dart index eac705c7..40608b22 100644 --- a/lib/pages/live/view.dart +++ b/lib/pages/live/view.dart @@ -194,26 +194,31 @@ class _LivePageState extends State ), ), ), - InkWell( - onTap: () { - Get.toNamed('/liveFollowing'); - }, - highlightColor: Colors.transparent, - splashColor: Colors.transparent, - child: Row( - children: [ - Text( - '查看更多', - style: TextStyle( - fontSize: 14, - color: Theme.of(context).colorScheme.outline, - ), + Obx( + () => Visibility( + visible: _liveController.liveFollowingCount.value > 0, + child: InkWell( + onTap: () { + Get.toNamed('/liveFollowing'); + }, + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + child: Row( + children: [ + Text( + '查看更多', + style: TextStyle( + fontSize: 14, + color: Theme.of(context).colorScheme.outline, + ), + ), + Icon( + Icons.chevron_right, + color: Theme.of(context).colorScheme.outline, + ), + ], ), - Icon( - Icons.chevron_right, - color: Theme.of(context).colorScheme.outline, - ), - ], + ), ), ), ], @@ -222,19 +227,18 @@ class _LivePageState extends State future: _futureBuilderFuture2, builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.data == null) { - return const SizedBox(); - } Map? data = snapshot.data; - if (data?['status']) { + if (data != null && data['status']) { RxList list = _liveController.liveFollowingList; - return LiveFollowingListView(list: list); + return list.isNotEmpty + ? LiveFollowingListView(list: list) + : const Center(child: Text('没有人在直播')); } else { return SizedBox( height: 80, child: Center( child: Text( - data?['msg'] ?? '', + data?['msg'] ?? '请求异常', style: TextStyle( color: Theme.of(context).colorScheme.outline, fontSize: 12, @@ -283,6 +287,15 @@ class LiveFollowingListView extends StatelessWidget { }, ); }, + onLongPress: () { + Get.toNamed( + '/member?mid=${list[index].uid}', + arguments: { + 'face': list[index].face, + 'heroTag': list[index].uid.toString(), + }, + ); + }, child: Container( width: 54, height: 54, diff --git a/lib/pages/live_follow/controller.dart b/lib/pages/live_follow/controller.dart index 049da1f6..c581a7d8 100644 --- a/lib/pages/live_follow/controller.dart +++ b/lib/pages/live_follow/controller.dart @@ -9,7 +9,7 @@ class LiveFollowController extends GetxController { RxInt crossAxisCount = 2.obs; Box setting = GStorage.setting; int _currentPage = 1; - RxInt liveFollowingCount = 0.obs; + RxString liveFollowingCount = '- '.obs; RxList liveFollowingList = [].obs; @@ -28,10 +28,11 @@ class LiveFollowController extends GetxController { if (res['status']) { if (type == 'init') { liveFollowingList.value = res['data'].list; - liveFollowingCount.value = res['data'].liveCount; + liveFollowingCount.value = res['data'].liveCount.toString(); } else if (type == 'onLoad') { liveFollowingList.addAll(res['data'].list); } + liveFollowingList.removeWhere((e) => e.liveStatus != 1); _currentPage += 1; } else { SmartDialog.showToast(res['msg']);