100 lines
2.7 KiB
Dart
100 lines
2.7 KiB
Dart
import 'dart:ui';
|
|
import 'package:flutter/material.dart';
|
|
import '../theme/app_theme.dart';
|
|
|
|
class AmbientMeshBackground extends StatefulWidget {
|
|
final bool isDark;
|
|
const AmbientMeshBackground({super.key, required this.isDark});
|
|
|
|
@override
|
|
State<AmbientMeshBackground> createState() => _AmbientMeshBackgroundState();
|
|
}
|
|
|
|
class _AmbientMeshBackgroundState extends State<AmbientMeshBackground>
|
|
with SingleTickerProviderStateMixin {
|
|
late AnimationController _controller;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_controller = AnimationController(
|
|
vsync: this,
|
|
duration: const Duration(seconds: 10),
|
|
)..repeat(reverse: true);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (widget.isDark) {
|
|
return Container(color: const Color(0xFF050505));
|
|
}
|
|
|
|
return Stack(
|
|
children: [
|
|
Container(color: AppTheme.bgLight),
|
|
AnimatedBuilder(
|
|
animation: _controller,
|
|
builder: (context, child) {
|
|
return Positioned(
|
|
top: -100 + (_controller.value * 50),
|
|
left: -100 + (_controller.value * 20),
|
|
child: Container(
|
|
width: 400,
|
|
height: 400,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: AppTheme.blob1.withOpacity(0.4),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
AnimatedBuilder(
|
|
animation: _controller,
|
|
builder: (context, child) {
|
|
return Positioned(
|
|
bottom: 100 - (_controller.value * 80),
|
|
right: -50 - (_controller.value * 30),
|
|
child: Container(
|
|
width: 350,
|
|
height: 350,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: AppTheme.blob2.withOpacity(0.4),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
AnimatedBuilder(
|
|
animation: _controller,
|
|
builder: (context, child) {
|
|
return Positioned(
|
|
top: 300,
|
|
right: 50 + (_controller.value * 40),
|
|
child: Container(
|
|
width: 200,
|
|
height: 200,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: AppTheme.blob3.withOpacity(0.3),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
BackdropFilter(
|
|
filter: ImageFilter.blur(sigmaX: 60, sigmaY: 60),
|
|
child: Container(color: Colors.white.withOpacity(0.3)),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|