update remove animation

This commit is contained in:
efrilm
2026-05-12 14:48:53 +07:00
parent 411d1274bd
commit 86d581f5ea
12 changed files with 439 additions and 477 deletions
+80 -152
View File
@@ -1,76 +1,21 @@
import 'package:flutter/material.dart';
import 'dart:math' as math;
import '../../../../common/theme/theme.dart';
import '../../../common/painter/wave_painter.dart';
import '../../../common/theme/theme.dart';
class CustomAppBar extends StatefulWidget {
class CustomAppBar extends StatelessWidget {
final String title;
final bool isBack;
const CustomAppBar({super.key, required this.title, this.isBack = true});
@override
State<CustomAppBar> createState() => _CustomAppBarState();
}
class _CustomAppBarState extends State<CustomAppBar>
with TickerProviderStateMixin {
late AnimationController _particleController;
late AnimationController _waveController;
late AnimationController _breathController;
late Animation<double> _particleAnimation;
late Animation<double> _waveAnimation;
late Animation<double> _breathAnimation;
@override
void initState() {
super.initState();
_particleController = AnimationController(
duration: const Duration(seconds: 8),
vsync: this,
)..repeat();
_waveController = AnimationController(
duration: const Duration(seconds: 6),
vsync: this,
)..repeat();
_breathController = AnimationController(
duration: const Duration(seconds: 4),
vsync: this,
)..repeat(reverse: true);
_particleAnimation = Tween<double>(
begin: 0.0,
end: 2 * math.pi,
).animate(_particleController);
_waveAnimation = Tween<double>(
begin: 0.0,
end: 2 * math.pi,
).animate(_waveController);
_breathAnimation = Tween<double>(begin: 0.8, end: 1.2).animate(
CurvedAnimation(parent: _breathController, curve: Curves.easeInOut),
);
}
@override
void dispose() {
_particleController.dispose();
_waveController.dispose();
_breathController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return FlexibleSpaceBar(
titlePadding: EdgeInsets.only(left: widget.isBack ? 50 : 20, bottom: 16),
titlePadding: EdgeInsets.only(left: isBack ? 50 : 20, bottom: 16),
title: Text(
widget.title,
title,
style: AppStyle.xl.copyWith(
color: AppColor.textWhite,
fontSize: 18,
@@ -85,105 +30,88 @@ class _CustomAppBarState extends State<CustomAppBar>
end: Alignment.bottomCenter,
),
),
child: AnimatedBuilder(
animation: Listenable.merge([
_particleController,
_waveController,
_breathController,
]),
builder: (context, child) {
return Stack(
children: [
// Animated background elements
_buildAnimatedBackground(context),
],
);
},
),
),
);
}
Widget _buildAnimatedBackground(BuildContext context) {
final size = MediaQuery.of(context).size;
return Stack(
children: [
// Floating particles with orbital motion
...List.generate(8, (index) {
final double radius = 40 + (index * 15);
final double angle = _particleAnimation.value + (index * 0.8);
final double centerX = size.width * 0.7;
final double centerY = 60;
return Positioned(
left: centerX + math.cos(angle) * radius - 3,
top: centerY + math.sin(angle) * (radius * 0.5) - 3,
child: Transform.scale(
scale: _breathAnimation.value * 0.5,
child: Stack(
children: [
// Static decorative circles (right side)
Positioned(
top: -20,
right: -30,
child: Container(
width: 4 + (index % 3),
height: 4 + (index % 3),
width: 120,
height: 120,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.textWhite.withOpacity(0.6),
boxShadow: [
BoxShadow(
color: AppColor.textWhite.withOpacity(0.3),
blurRadius: 6,
spreadRadius: 1,
),
color: AppColor.textWhite.withOpacity(0.08),
),
),
),
Positioned(
top: 30,
right: 20,
child: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.textWhite.withOpacity(0.05),
),
),
),
// Static decorative circles (left side)
Positioned(
top: 10,
left: -20,
child: Container(
width: 80,
height: 80,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.textWhite.withOpacity(0.04),
),
),
),
// Static sparkle icons
...List.generate(4, (index) {
return Positioned(
left: (index * 90.0) % size.width,
top: 20 + (index * 25.0),
child: Icon(
Icons.auto_awesome,
size: 10 + (index % 3) * 3,
color: AppColor.textWhite.withOpacity(0.2),
),
);
}),
// Wave pattern (static)
Positioned.fill(
child: CustomPaint(
painter: WavePainter(
animation: 0.0,
color: AppColor.textWhite.withOpacity(0.1),
),
),
),
// Gradient overlay for depth
Container(
decoration: BoxDecoration(
gradient: RadialGradient(
center: const Alignment(0.3, -0.2),
radius: 1.2,
colors: [
Colors.transparent,
AppColor.primaryGradient.first.withOpacity(0.1),
Colors.transparent,
],
),
),
),
);
}),
// Wave patterns
Positioned.fill(
child: CustomPaint(
painter: WavePainter(
animation: _waveAnimation.value,
color: AppColor.textWhite.withOpacity(0.1),
),
),
],
),
// Sparkle effects
...List.generate(4, (index) {
return Positioned(
left: (index * 90.0) % size.width,
top: 20 + (index * 25.0),
child: Transform.rotate(
angle: _particleAnimation.value * 2 + index,
child: Transform.scale(
scale: math.sin(_particleAnimation.value + index) * 0.5 + 1,
child: Icon(
Icons.auto_awesome,
size: 10 + (index % 3) * 3,
color: AppColor.textWhite.withOpacity(0.4),
),
),
),
);
}),
// Gradient overlay for depth
Container(
decoration: BoxDecoration(
gradient: RadialGradient(
center: const Alignment(0.3, -0.2),
radius: 1.2,
colors: [
Colors.transparent,
AppColor.primaryGradient.first.withOpacity(0.1),
Colors.transparent,
],
),
),
),
],
),
);
}
}