import 'package:flutter/material.dart'; import '../../../../shared/theme/app_theme.dart'; /// En-tête de la page de connexion avec logo et animation class LoginHeader extends StatefulWidget { final VoidCallback? onAnimationComplete; const LoginHeader({ super.key, this.onAnimationComplete, }); @override State createState() => _LoginHeaderState(); } class _LoginHeaderState extends State with TickerProviderStateMixin { late AnimationController _logoController; late AnimationController _textController; late Animation _logoScaleAnimation; late Animation _logoRotationAnimation; late Animation _textFadeAnimation; late Animation _textSlideAnimation; @override void initState() { super.initState(); _setupAnimations(); _startAnimations(); } void _setupAnimations() { _logoController = AnimationController( duration: const Duration(milliseconds: 1000), vsync: this, ); _textController = AnimationController( duration: const Duration(milliseconds: 800), vsync: this, ); _logoScaleAnimation = Tween( begin: 0.5, end: 1.0, ).animate(CurvedAnimation( parent: _logoController, curve: Curves.elasticOut, )); _logoRotationAnimation = Tween( begin: -0.1, end: 0.0, ).animate(CurvedAnimation( parent: _logoController, curve: Curves.easeOut, )); _textFadeAnimation = Tween( begin: 0.0, end: 1.0, ).animate(CurvedAnimation( parent: _textController, curve: Curves.easeOut, )); _textSlideAnimation = Tween( begin: const Offset(0, 0.5), end: Offset.zero, ).animate(CurvedAnimation( parent: _textController, curve: Curves.easeOut, )); } void _startAnimations() { _logoController.forward().then((_) { _textController.forward().then((_) { widget.onAnimationComplete?.call(); }); }); } @override void dispose() { _logoController.dispose(); _textController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Column( children: [ // Logo animé AnimatedBuilder( animation: _logoController, builder: (context, child) { return Transform.scale( scale: _logoScaleAnimation.value, child: Transform.rotate( angle: _logoRotationAnimation.value, child: _buildLogo(), ), ); }, ), const SizedBox(height: 32), // Texte animé AnimatedBuilder( animation: _textController, builder: (context, child) { return FadeTransition( opacity: _textFadeAnimation, child: SlideTransition( position: _textSlideAnimation, child: _buildWelcomeText(), ), ); }, ), ], ); } Widget _buildLogo() { return Container( width: 120, height: 120, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ AppTheme.primaryColor, AppTheme.secondaryColor, ], ), borderRadius: BorderRadius.circular(30), boxShadow: [ BoxShadow( color: AppTheme.primaryColor.withOpacity(0.3), blurRadius: 20, offset: const Offset(0, 10), ), ], ), child: Stack( alignment: Alignment.center, children: [ // Effet de brillance Container( width: 100, height: 100, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ Colors.white.withOpacity(0.2), Colors.transparent, ], ), borderRadius: BorderRadius.circular(25), ), ), // Icône ou texte du logo Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.group, size: 48, color: Colors.white, ), const SizedBox(height: 4), Text( 'UF', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, color: Colors.white, letterSpacing: 2, ), ), ], ), ], ), ); } Widget _buildWelcomeText() { return Column( children: [ // Titre principal ShaderMask( shaderCallback: (bounds) => LinearGradient( colors: [ AppTheme.primaryColor, AppTheme.secondaryColor, ], ).createShader(bounds), child: Text( 'UnionFlow', style: TextStyle( fontSize: 32, fontWeight: FontWeight.bold, color: Colors.white, letterSpacing: 1.2, ), ), ), const SizedBox(height: 8), // Sous-titre Text( 'Gestion d\'associations', style: TextStyle( fontSize: 16, color: AppTheme.textSecondary, fontWeight: FontWeight.w500, letterSpacing: 0.5, ), ), const SizedBox(height: 24), // Message de bienvenue Container( padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12), decoration: BoxDecoration( color: AppTheme.primaryColor.withOpacity(0.1), borderRadius: BorderRadius.circular(20), border: Border.all( color: AppTheme.primaryColor.withOpacity(0.2), width: 1, ), ), child: Text( 'Connectez-vous pour accéder à votre espace', textAlign: TextAlign.center, style: TextStyle( fontSize: 14, color: AppTheme.primaryColor, fontWeight: FontWeight.w500, ), ), ), ], ); } }