feat: custom appbar

This commit is contained in:
efrilm
2025-08-16 00:39:09 +07:00
parent d334bb8f17
commit d73cd1a574
16 changed files with 207 additions and 1062 deletions
@@ -2,7 +2,7 @@ import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import '../../../common/theme/theme.dart';
import 'widgets/appbar.dart';
import '../../components/appbar/appbar.dart';
import 'widgets/ingredient_tile.dart';
import 'widgets/product_tile.dart';
import 'widgets/stat_card.dart';
@@ -64,10 +64,8 @@ class _InventoryPageState extends State<InventoryPage>
with TickerProviderStateMixin {
late AnimationController _fadeAnimationController;
late AnimationController _slideAnimationController;
late AnimationController _rotationAnimationController;
late Animation<double> _fadeAnimation;
late Animation<Offset> _slideAnimation;
late Animation<double> rotationAnimation;
late TabController _tabController;
final List<ProductItem> productItems = [
@@ -188,10 +186,6 @@ class _InventoryPageState extends State<InventoryPage>
duration: const Duration(milliseconds: 800),
vsync: this,
);
_rotationAnimationController = AnimationController(
duration: const Duration(seconds: 20),
vsync: this,
);
_fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(
@@ -208,21 +202,14 @@ class _InventoryPageState extends State<InventoryPage>
),
);
rotationAnimation = Tween<double>(
begin: 0.0,
end: 2 * 3.14159,
).animate(_rotationAnimationController);
_fadeAnimationController.forward();
_slideAnimationController.forward();
_rotationAnimationController.repeat();
}
@override
void dispose() {
_fadeAnimationController.dispose();
_slideAnimationController.dispose();
_rotationAnimationController.dispose();
_tabController.dispose();
super.dispose();
}
@@ -356,7 +343,7 @@ class _InventoryPageState extends State<InventoryPage>
pinned: true,
elevation: 0,
backgroundColor: AppColor.primary,
flexibleSpace: InventoryAppBar(rotationAnimation: rotationAnimation),
flexibleSpace: CustomAppBar(title: 'Inventaris'),
);
}
@@ -1,96 +0,0 @@
import 'package:flutter/material.dart';
import '../../../../common/theme/theme.dart';
class InventoryAppBar extends StatelessWidget {
const InventoryAppBar({super.key, required this.rotationAnimation});
final Animation<double> rotationAnimation;
@override
Widget build(BuildContext context) {
return FlexibleSpaceBar(
titlePadding: const EdgeInsets.only(left: 50, bottom: 16),
title: Text(
'Inventaris',
style: AppStyle.xl.copyWith(
color: AppColor.textWhite,
fontWeight: FontWeight.w600,
),
),
background: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: AppColor.primaryGradient,
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Stack(
children: [
Positioned(
right: -20,
top: -20,
child: AnimatedBuilder(
animation: rotationAnimation,
builder: (context, child) {
return Transform.rotate(
angle: rotationAnimation.value,
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.textWhite.withOpacity(0.1),
),
),
);
},
),
),
Positioned(
left: -30,
bottom: -30,
child: AnimatedBuilder(
animation: rotationAnimation,
builder: (context, child) {
return Transform.rotate(
angle: -rotationAnimation.value * 0.5,
child: Container(
width: 80,
height: 80,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.textWhite.withOpacity(0.05),
),
),
);
},
),
),
Positioned(
right: 80,
bottom: 30,
child: AnimatedBuilder(
animation: rotationAnimation,
builder: (context, child) {
return Transform.rotate(
angle: -rotationAnimation.value * 0.2,
child: Container(
width: 40,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: AppColor.textWhite.withOpacity(0.08),
),
),
);
},
),
),
],
),
),
);
}
}