mod: appear继续/重新播放

This commit is contained in:
guozhigq
2023-08-06 23:07:13 +08:00
parent d059a439fb
commit ee78b550e5
2 changed files with 17 additions and 5 deletions

View File

@ -82,6 +82,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
_futureBuilderFuture = videoDetailController.queryVideoUrl(); _futureBuilderFuture = videoDetailController.queryVideoUrl();
} }
// 继续播放或重新播放
void continuePlay() async { void continuePlay() async {
await _extendNestCtr.animateTo(0, await _extendNestCtr.animateTo(0,
duration: const Duration(milliseconds: 500), curve: Curves.easeInOut); duration: const Duration(milliseconds: 500), curve: Curves.easeInOut);
@ -103,6 +104,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
if (videoDetailController.timer!.isActive) { if (videoDetailController.timer!.isActive) {
videoDetailController.timer!.cancel(); videoDetailController.timer!.cancel();
} }
plPlayerController!.pause();
super.didPushNext(); super.didPushNext();
} }
@ -368,8 +370,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
builder: ((context, snapshot) { builder: ((context, snapshot) {
return ScrollAppBar( return ScrollAppBar(
snapshot.data!.toDouble(), snapshot.data!.toDouble(),
() {}, () => continuePlay(),
playerStatus != PlayerStatus.playing, playerStatus,
null, null,
); );
}), }),

View File

@ -1,9 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pilipala/plugin/pl_player/index.dart';
class ScrollAppBar extends StatelessWidget { class ScrollAppBar extends StatelessWidget {
final double scrollVal; final double scrollVal;
final Function callback; final Function callback;
final bool playerStatus; final PlayerStatus playerStatus;
const ScrollAppBar( const ScrollAppBar(
this.scrollVal, this.scrollVal,
@ -33,9 +34,18 @@ class ScrollAppBar extends StatelessWidget {
centerTitle: true, centerTitle: true,
title: TextButton( title: TextButton(
onPressed: () => callback(), onPressed: () => callback(),
child: const Row( child: Row(
mainAxisSize: MainAxisSize.min, 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: [ actions: [