Files
PiliPlus/lib/common/widgets/appbar.dart
bggRGjQaUbCoE 59910e275e chore: code clean up
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2024-11-10 11:06:49 +08:00

33 lines
776 B
Dart

import 'package:flutter/material.dart';
class AppBarWidget extends StatelessWidget implements PreferredSizeWidget {
const AppBarWidget({
required this.child,
required this.controller,
required this.visible,
super.key,
});
final PreferredSizeWidget child;
final AnimationController controller;
final bool visible;
@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: const Offset(0, -1),
).animate(CurvedAnimation(
parent: controller,
curve: Curves.easeInOutBack,
)),
child: child,
);
}
}