mod: 视频播放器重构 - 基本功能

This commit is contained in:
guozhigq
2023-07-30 22:44:18 +08:00
parent ca12be5373
commit 636ff2b9ad
31 changed files with 1583 additions and 390 deletions

View File

@ -0,0 +1,57 @@
import 'package:flutter/material.dart';
class AppBarAni extends StatelessWidget implements PreferredSizeWidget {
const AppBarAni({
required this.child,
required this.controller,
required this.visible,
this.position,
Key? key,
}) : super(key: key);
final PreferredSizeWidget child;
final AnimationController controller;
final bool visible;
final String? position;
@override
Size get preferredSize => child.preferredSize;
@override
Widget build(BuildContext context) {
visible ? controller.reverse() : controller.forward();
return SlideTransition(
position: Tween<Offset>(
begin: Offset.zero,
end: Offset(0, position! == 'top' ? -1 : 1),
).animate(CurvedAnimation(
parent: controller,
curve: Curves.linear,
)),
child: Container(
decoration: BoxDecoration(
gradient: position! == 'top'
? const LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: <Color>[
Colors.transparent,
Colors.black54,
],
tileMode: TileMode.mirror,
)
: const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: <Color>[
Colors.transparent,
Colors.black54,
],
tileMode: TileMode.mirror,
),
),
child: child,
),
);
}
}