diff --git a/lib/pages/dynamics/widgets/up_panel.dart b/lib/pages/dynamics/widgets/up_panel.dart index bd4d42f55..36a54ba66 100644 --- a/lib/pages/dynamics/widgets/up_panel.dart +++ b/lib/pages/dynamics/widgets/up_panel.dart @@ -20,29 +20,28 @@ class UpPanel extends StatefulWidget { } class _UpPanelState extends State { - late final isTop = - widget.dynamicsController.upPanelPosition == UpPanelPosition.top; + late final controller = widget.dynamicsController; + late final isTop = controller.upPanelPosition == UpPanelPosition.top; @override Widget build(BuildContext context) { - final accountService = widget.dynamicsController.accountService; + final accountService = controller.accountService; if (!accountService.isLogin.value) { return const SizedBox.shrink(); } final theme = Theme.of(context); - final upData = widget.dynamicsController.upData.value; + final upData = controller.upData.value; final List? upList = upData.upList; final List? liveList = upData.liveUsers?.items; return CustomScrollView( scrollDirection: isTop ? Axis.horizontal : Axis.vertical, physics: const AlwaysScrollableScrollPhysics(), - controller: widget.dynamicsController.scrollController, + controller: controller.scrollController, slivers: [ SliverToBoxAdapter( child: InkWell( onTap: () => setState(() { - widget.dynamicsController.showLiveItems = - !widget.dynamicsController.showLiveItems; + controller.showLiveItems = !controller.showLiveItems; }), onLongPress: () => Get.to(const LiveFollowPage()), child: Container( @@ -65,7 +64,7 @@ class _UpPanelState extends State { WidgetSpan( alignment: PlaceholderAlignment.middle, child: Icon( - widget.dynamicsController.showLiveItems + controller.showLiveItems ? Icons.expand_less : Icons.expand_more, size: 12, @@ -76,7 +75,7 @@ class _UpPanelState extends State { WidgetSpan( alignment: PlaceholderAlignment.middle, child: Icon( - widget.dynamicsController.showLiveItems + controller.showLiveItems ? Icons.keyboard_arrow_right : Icons.keyboard_arrow_left, color: theme.colorScheme.primary, @@ -89,8 +88,7 @@ class _UpPanelState extends State { ), ), ), - if (widget.dynamicsController.showLiveItems && - liveList?.isNotEmpty == true) + if (controller.showLiveItems && liveList?.isNotEmpty == true) SliverList.builder( itemCount: liveList!.length, itemBuilder: (context, index) { @@ -125,7 +123,7 @@ class _UpPanelState extends State { } void _onSelect(UserItem data) { - widget.dynamicsController + controller ..currentMid = data.mid ..onSelectUp(data.mid); @@ -135,10 +133,9 @@ class _UpPanelState extends State { } Widget upItemBuild(ThemeData theme, UserItem data) { - bool isCurrent = - widget.dynamicsController.currentMid == data.mid || - widget.dynamicsController.currentMid == -1; + final currentMid = controller.currentMid; final isLive = data is LiveUserItem; + bool isCurrent = isLive || currentMid == data.mid || currentMid == -1; return SizedBox( height: 76, width: isTop ? 70 : null, @@ -153,7 +150,7 @@ class _UpPanelState extends State { Get.toNamed('/liveRoom?roomid=${data.roomId}'); } }, - onDoubleTap: data is LiveUserItem ? () => _onSelect(data) : null, + onDoubleTap: isLive ? () => _onSelect(data) : null, onLongPress: data.mid == -1 ? null : () => Get.toNamed('/member?mid=${data.mid}'), @@ -192,9 +189,7 @@ class _UpPanelState extends State { label: isLive ? const Text(' Live ') : null, textColor: theme.colorScheme.onSecondaryContainer, alignment: AlignmentDirectional.topStart, - isLabelVisible: - isLive || - (data is UpItem && (data.hasUpdate ?? false)), + isLabelVisible: isLive || (data.hasUpdate ?? false), backgroundColor: isLive ? theme.colorScheme.secondaryContainer.withValues( alpha: 0.75, @@ -212,7 +207,7 @@ class _UpPanelState extends State { maxLines: 2, textAlign: TextAlign.center, style: TextStyle( - color: widget.dynamicsController.currentMid == data.mid + color: currentMid == data.mid ? theme.colorScheme.primary : theme.colorScheme.outline, height: 1.1, diff --git a/lib/pages/search/view.dart b/lib/pages/search/view.dart index c9a34f63e..b4a3fd673 100644 --- a/lib/pages/search/view.dart +++ b/lib/pages/search/view.dart @@ -56,7 +56,7 @@ class _SearchPageState extends State { ), IconButton( tooltip: '搜索', - onPressed: () => _searchController.submit(), + onPressed: _searchController.submit, icon: const Icon(Icons.search, size: 22), ), const SizedBox(width: 10), diff --git a/lib/pages/video/introduction/ugc/view.dart b/lib/pages/video/introduction/ugc/view.dart index 48b7d7056..f9e3f3703 100644 --- a/lib/pages/video/introduction/ugc/view.dart +++ b/lib/pages/video/introduction/ugc/view.dart @@ -528,7 +528,7 @@ class _VideoIntroPanelState extends State selectStatus: videoIntroController.hasLike.value, semanticsLabel: '点赞', text: !isLoading - ? NumUtil.numFormat(videoDetail.stat!.like!) + ? NumUtil.numFormat(videoDetail.stat!.like) : null, needAnim: true, hasTriple: @@ -566,7 +566,7 @@ class _VideoIntroPanelState extends State selectStatus: videoIntroController.hasCoin, semanticsLabel: '投币', text: !isLoading - ? NumUtil.numFormat(videoDetail.stat!.coin!) + ? NumUtil.numFormat(videoDetail.stat!.coin) : null, needAnim: true, ), @@ -584,7 +584,7 @@ class _VideoIntroPanelState extends State selectStatus: videoIntroController.hasFav.value, semanticsLabel: '收藏', text: !isLoading - ? NumUtil.numFormat(videoDetail.stat!.favorite!) + ? NumUtil.numFormat(videoDetail.stat!.favorite) : null, needAnim: true, ), diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index e2c361404..44c4c5d00 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -472,10 +472,10 @@ class PlPlayerController { enableHeart = false; } - if (Platform.isAndroid) { + if (Platform.isAndroid && autoPiP) { Utils.channel.setMethodCallHandler((call) async { if (call.method == 'onUserLeaveHint') { - if (autoPiP && playerStatus.status.value == PlayerStatus.playing) { + if (playerStatus.status.value == PlayerStatus.playing) { enterPip(); } } diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 91b7e84eb..edbd728cb 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -317,6 +317,7 @@ class _PLVideoPlayerState extends State /// 时间进度 BottomControlType.time: Column( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, children: [ // 播放时间 Obx(() {