Add premium logo zoom/scale-down splash entrance on app load

This commit is contained in:
Sridhar R 2026-06-10 14:14:11 +05:30
parent 45a3e381c0
commit ac1294a150
1 changed files with 115 additions and 39 deletions

View File

@ -12,9 +12,11 @@ class WelcomeScreen extends StatefulWidget {
class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProviderStateMixin { class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProviderStateMixin {
late AnimationController _controller; late AnimationController _controller;
late Animation<double> _fadeAnimation; late Animation<double> _splashScaleAnimation;
late Animation<double> _logoScaleAnimation; late Animation<double> _splashLogoOpacityAnimation;
late Animation<double> _logoRotateAnimation; late Animation<double> _splashContainerOpacityAnimation;
late Animation<double> _contentFadeAnimation;
late Animation<Offset> _contentSlideAnimation;
double _btnScale = 1.0; double _btnScale = 1.0;
@override @override
@ -22,25 +24,49 @@ class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProvider
super.initState(); super.initState();
_controller = AnimationController( _controller = AnimationController(
vsync: this, vsync: this,
duration: const Duration(milliseconds: 900), duration: const Duration(milliseconds: 1400),
); );
_fadeAnimation = CurvedAnimation( // 1. Splash Logo Zoom/Scale-down (from 3.0 to 1.0)
parent: _controller, _splashScaleAnimation = Tween<double>(begin: 3.0, end: 1.0).animate(
curve: Curves.easeIn,
);
_logoScaleAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation( CurvedAnimation(
parent: _controller, parent: _controller,
curve: const Interval(0.2, 0.8, curve: Curves.elasticOut), curve: const Interval(0.0, 0.45, curve: Curves.easeOutBack),
), ),
); );
_logoRotateAnimation = Tween<double>(begin: -0.1, end: 0.0).animate( // 2. Splash Logo Fade-in as it scales down
_splashLogoOpacityAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation( CurvedAnimation(
parent: _controller, parent: _controller,
curve: const Interval(0.2, 0.8, curve: Curves.easeOutBack), curve: const Interval(0.0, 0.35, curve: Curves.easeIn),
),
);
// 3. Splash Container Fade-out
_splashContainerOpacityAnimation = Tween<double>(begin: 1.0, end: 0.0).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.45, 0.6, curve: Curves.easeOut),
),
);
// 4. Welcome Content Fade-in
_contentFadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.55, 1.0, curve: Curves.easeIn),
),
);
// 5. Welcome Content Slide-up
_contentSlideAnimation = Tween<Offset>(
begin: const Offset(0.0, 0.05),
end: Offset.zero,
).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.55, 1.0, curve: Curves.easeOutCubic),
), ),
); );
@ -59,8 +85,64 @@ class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProvider
final isMobile = context.isMobile; final isMobile = context.isMobile;
return Scaffold( return Scaffold(
body: FadeTransition( body: AnimatedBuilder(
opacity: _fadeAnimation, animation: _controller,
builder: (context, child) {
final showSplash = _controller.value < 0.6;
return Stack(
children: [
// Main Welcome Content
Opacity(
opacity: _contentFadeAnimation.value,
child: SlideTransition(
position: _contentSlideAnimation,
child: IgnorePointer(
ignoring: showSplash,
child: child,
),
),
),
// Splash Overlay (Centered Logo scaling down)
if (showSplash)
Opacity(
opacity: _splashContainerOpacityAnimation.value,
child: Container(
color: Colors.white,
alignment: Alignment.center,
child: ScaleTransition(
scale: _splashScaleAnimation,
child: Opacity(
opacity: _splashLogoOpacityAnimation.value,
child: Container(
width: 140,
height: 140,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(32),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.08),
blurRadius: 24,
offset: const Offset(0, 8),
)
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(32),
child: Image.asset(
'assets/logo/pozo_logo.jpg',
fit: BoxFit.cover,
),
),
),
),
),
),
),
],
);
},
child: SafeArea( child: SafeArea(
child: Column( child: Column(
children: [ children: [
@ -198,30 +280,24 @@ class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProvider
} }
Widget _buildLogo(ThemeData theme) { Widget _buildLogo(ThemeData theme) {
return ScaleTransition( return Container(
scale: _logoScaleAnimation, width: 80,
child: RotationTransition( height: 80,
turns: _logoRotateAnimation, decoration: BoxDecoration(
child: Container( borderRadius: BorderRadius.circular(20),
width: 80, boxShadow: [
height: 80, BoxShadow(
decoration: BoxDecoration( color: Colors.black.withOpacity(0.12),
borderRadius: BorderRadius.circular(20), blurRadius: 20,
boxShadow: [ offset: const Offset(0, 6),
BoxShadow( )
color: Colors.black.withOpacity(0.12), ],
blurRadius: 20, ),
offset: const Offset(0, 6), child: ClipRRect(
) borderRadius: BorderRadius.circular(20),
], child: Image.asset(
), 'assets/logo/pozo_logo.jpg',
child: ClipRRect( fit: BoxFit.cover,
borderRadius: BorderRadius.circular(20),
child: Image.asset(
'assets/logo/pozo_logo.jpg',
fit: BoxFit.cover,
),
),
), ),
), ),
); );