mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 16:46:22 +08:00
58
lib/pages/video/widgets/app_bar.dart
Normal file
58
lib/pages/video/widgets/app_bar.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_status.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ScrollAppBar extends StatelessWidget {
|
||||
final double scrollVal;
|
||||
final Function callback;
|
||||
final PlayerStatus playerStatus;
|
||||
|
||||
const ScrollAppBar({
|
||||
super.key,
|
||||
required this.scrollVal,
|
||||
required this.callback,
|
||||
required this.playerStatus,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
final videoHeight = MediaQuery.sizeOf(context).width * 9 / 16;
|
||||
double scrollDistance = scrollVal;
|
||||
if (scrollVal > videoHeight - kToolbarHeight) {
|
||||
scrollDistance = videoHeight - kToolbarHeight;
|
||||
}
|
||||
return Positioned(
|
||||
top: -videoHeight + scrollDistance + kToolbarHeight + 0.5,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Opacity(
|
||||
opacity: scrollDistance / (videoHeight - kToolbarHeight),
|
||||
child: Container(
|
||||
height: statusBarHeight + kToolbarHeight,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
padding: EdgeInsets.only(top: statusBarHeight),
|
||||
child: AppBar(
|
||||
primary: false,
|
||||
centerTitle: true,
|
||||
title: TextButton(
|
||||
onPressed: () => callback(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.play_arrow_rounded),
|
||||
Text(
|
||||
playerStatus == PlayerStatus.paused
|
||||
? '继续播放'
|
||||
: playerStatus == PlayerStatus.completed
|
||||
? '重新播放'
|
||||
: '播放中',
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
2494
lib/pages/video/widgets/header_control.dart
Normal file
2494
lib/pages/video/widgets/header_control.dart
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user