From ee78b550e5284dd04a48a9c0f2d9ce511df4a0ad Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 6 Aug 2023 23:07:13 +0800 Subject: [PATCH] =?UTF-8?q?mod:=20appear=E7=BB=A7=E7=BB=AD/=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 6 ++++-- lib/pages/video/detail/widgets/app_bar.dart | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index cf74d5aa..f1c38b80 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -82,6 +82,7 @@ class _VideoDetailPageState extends State _futureBuilderFuture = videoDetailController.queryVideoUrl(); } + // 继续播放或重新播放 void continuePlay() async { await _extendNestCtr.animateTo(0, duration: const Duration(milliseconds: 500), curve: Curves.easeInOut); @@ -103,6 +104,7 @@ class _VideoDetailPageState extends State if (videoDetailController.timer!.isActive) { videoDetailController.timer!.cancel(); } + plPlayerController!.pause(); super.didPushNext(); } @@ -368,8 +370,8 @@ class _VideoDetailPageState extends State builder: ((context, snapshot) { return ScrollAppBar( snapshot.data!.toDouble(), - () {}, - playerStatus != PlayerStatus.playing, + () => continuePlay(), + playerStatus, null, ); }), diff --git a/lib/pages/video/detail/widgets/app_bar.dart b/lib/pages/video/detail/widgets/app_bar.dart index d070fdd7..e21b4799 100644 --- a/lib/pages/video/detail/widgets/app_bar.dart +++ b/lib/pages/video/detail/widgets/app_bar.dart @@ -1,9 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:pilipala/plugin/pl_player/index.dart'; class ScrollAppBar extends StatelessWidget { final double scrollVal; final Function callback; - final bool playerStatus; + final PlayerStatus playerStatus; const ScrollAppBar( this.scrollVal, @@ -33,9 +34,18 @@ class ScrollAppBar extends StatelessWidget { centerTitle: true, title: TextButton( onPressed: () => callback(), - child: const Row( + child: Row( mainAxisSize: MainAxisSize.min, - children: [Icon(Icons.play_arrow_rounded), Text('继续播放')], + children: [ + const Icon(Icons.play_arrow_rounded), + Text( + playerStatus == PlayerStatus.paused + ? '继续播放' + : playerStatus == PlayerStatus.completed + ? '重新播放' + : '播放中', + ) + ], ), ), actions: [