import 'package:flutter/material.dart'; import 'signup_screen.dart'; import 'login_screen.dart'; import '../widgets/primary_button.dart'; class WelcomeScreen extends StatefulWidget { const WelcomeScreen({super.key}); @override State createState() => _WelcomeScreenState(); } class _WelcomeScreenState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _fade; late Animation _slide; @override void initState() { super.initState(); _controller = AnimationController( vsync: this, duration: const Duration(milliseconds: 900), ); _fade = CurvedAnimation( parent: _controller, curve: Curves.easeOut, ); _slide = Tween( begin: const Offset(0, -0.2), end: Offset.zero, ).animate( CurvedAnimation( parent: _controller, curve: Curves.easeInOutBack, ), ); _controller.forward(); _controller.addStatusListener((status) { if (status == AnimationStatus.completed) { _controller.repeat(reverse: false); } }); } @override void dispose() { _controller.dispose(); super.dispose(); } Widget _shinyWelcomeText() { return AnimatedBuilder( animation: _controller, builder: (context, child) { double shineX = _controller.value % 1; return Stack( alignment: Alignment.center, children: [ Text( "Welcome", textAlign: TextAlign.center, style: TextStyle( fontSize: 42, fontWeight: FontWeight.bold, color: Colors.indigo.shade700, letterSpacing: 1.2, ), ), Positioned.fill( child: IgnorePointer( child: ShaderMask( blendMode: BlendMode.srcATop, shaderCallback: (rect) { final pos = shineX * rect.width; return LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, stops: [ (pos - 50) / rect.width, pos / rect.width, (pos + 50) / rect.width, ], colors: [ Colors.transparent, Colors.blueAccent, Colors.transparent, ], ).createShader(rect); }, child: Text( "Welcome", textAlign: TextAlign.center, style: TextStyle( fontSize: 42, fontWeight: FontWeight.bold, color: Colors.indigo.shade900, letterSpacing: 1.2, ), ), ), ), ), ], ); }, ); } @override Widget build(BuildContext context) { final height = MediaQuery.of(context).size.height; final width = MediaQuery.of(context).size.width; return Scaffold( backgroundColor: const Color(0xFFE8F0FF), body: SafeArea( child: Padding( padding: EdgeInsets.symmetric(horizontal: width * 0.07), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ /// Animated Welcome text SlideTransition( position: _slide, child: _shinyWelcomeText(), ), SizedBox(height: height * 0.01), /// LOGO SECTION Image.asset( 'assets/Images/K.png', height: height * 0.28, ), SizedBox(height: height * 0.015), /// Description Text const Text( "Register to access Kent Logistics services. After signup admin will review and approve your request. Approval may take up to 24 hours.", textAlign: TextAlign.center, style: TextStyle( fontSize: 15, height: 1.4, color: Colors.black87, ), ), SizedBox(height: height * 0.04), /// 🌈 Create Account Button (Gradient) PrimaryButton( label: "Create Account", onTap: () { Navigator.push( context, MaterialPageRoute(builder: (_) => const SignupScreen()), ); }, ), SizedBox(height: height * 0.015), /// 🌈 Login Button (Gradient) PrimaryButton( label: "Login", onTap: () { Navigator.push( context, MaterialPageRoute(builder: (_) => const LoginScreen()), ); }, ), SizedBox(height: height * 0.02), ], ), ), ), ); } }