From 406ab30dba0a50e9621204b0f7afe92dedf14fc3 Mon Sep 17 00:00:00 2001 From: Vaibhav Surve Date: Mon, 8 Dec 2025 13:07:15 +0530 Subject: [PATCH] made chnages in splash screen --- lib/view/splash_screen.dart | 89 ++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 6 deletions(-) diff --git a/lib/view/splash_screen.dart b/lib/view/splash_screen.dart index 79484b3..8789490 100644 --- a/lib/view/splash_screen.dart +++ b/lib/view/splash_screen.dart @@ -28,6 +28,9 @@ class _SplashScreenState extends State late Animation _scaleAnimation; // Animation for logo and text fade-in late Animation _opacityAnimation; + + // Animation for the gradient shimmer effect (moves from -1.0 to 2.0) + late Animation _shimmerAnimation; @override void initState() { @@ -39,7 +42,7 @@ class _SplashScreenState extends State vsync: this, ); - // Initial scale-in: from 0.0 to 1.0 (happens in the first 40% of the duration) + // Initial scale-in: from 0.5 to 1.0 (happens in the first 40% of the duration) _scaleAnimation = Tween(begin: 0.5, end: 1.0).animate( CurvedAnimation( parent: _controller, @@ -55,8 +58,17 @@ class _SplashScreenState extends State curve: const Interval(0.0, 0.5, curve: Curves.easeIn), ), ); + + // Shimmer/Gradient Animation: Moves the gradient horizontally from left to right + _shimmerAnimation = Tween(begin: -1.0, end: 2.0).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 1.0, curve: Curves.linear), + ), + ); - // Floating effect: from 0.0 to 1.0 (loops repeatedly after initial animations) + + // Floating effect: from -8.0 to 8.0 (loops repeatedly after initial animations) _floatAnimation = Tween(begin: -8.0, end: 8.0).animate( CurvedAnimation( parent: _controller, @@ -66,10 +78,10 @@ class _SplashScreenState extends State // Start the complex animation sequence _controller.forward().then((_) { - // After the initial scale/fade, switch to repeating the float animation + // After the initial scale/fade, switch to repeating the float and shimmer animation if (mounted) { _controller.repeat( - min: 0.4, // Start repeat from the float interval + min: 0.4, // Keep repeat range for float animation max: 1.0, reverse: true, ); @@ -82,6 +94,64 @@ class _SplashScreenState extends State _controller.dispose(); super.dispose(); } + + // Widget for the multi-colored text with shimmering effect only on '.com' + Widget _buildAnimatedDomainText() { + const textStyle = TextStyle( + fontSize: 22, + fontWeight: FontWeight.bold, + fontFamily: 'Roboto', // Use a clear, modern font + ); + + // The Shimmer Effect: AnimatedBuilder rebuilds the widget as the shimmerAnimation updates + return AnimatedBuilder( + animation: _shimmerAnimation, + builder: (context, child) { + // Define the silver gradient + final shimmerGradient = LinearGradient( + colors: const [ + Colors.grey, // Starting dull color + Colors.white, // Brightest 'shimmer' highlight + Colors.grey, // Ending dull color + ], + stops: const [0.3, 0.5, 0.7], // Position of colors + // The begin/end points move based on the animation value + begin: Alignment(_shimmerAnimation.value - 1.0, 0.0), // Start from left + end: Alignment(_shimmerAnimation.value, 0.0), // End to right + ); + + // The Text Content: RichText allows for different styles within one text block + return RichText( + text: TextSpan( + style: textStyle.copyWith(color: Colors.black), // Base style + children: [ + // 'On' - Blue color + TextSpan( + text: 'On', + style: TextStyle(color: Colors.blueAccent.shade700), + ), + // 'FieldWork' - Green color + TextSpan( + text: 'FieldWork', + style: TextStyle(color: Colors.green.shade700), + ), + // '.com' - The part that uses the animated gradient + TextSpan( + text: '.com', + style: textStyle.copyWith( + // Use a Paint()..shader to apply the gradient to the text color + // The Rect size (150.0 x 50.0) must be large enough to cover the '.com' text + foreground: Paint()..shader = shimmerGradient.createShader( + const Rect.fromLTWH(0.0, 0.0, 150.0, 50.0), + ), + ), + ), + ], + ), + ); + }, + ); + } // A simple, modern custom progress indicator Widget _buildProgressIndicator() { @@ -98,7 +168,6 @@ class _SplashScreenState extends State Widget build(BuildContext context) { return Scaffold( backgroundColor: widget.backgroundColor, - // Full screen display, no SafeArea needed for a full bleed splash body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -127,6 +196,14 @@ class _SplashScreenState extends State const SizedBox(height: 30), + // **Corrected: Animated Domain Text with specific colors and only '.com' shimmering** + FadeTransition( + opacity: _opacityAnimation, + child: _buildAnimatedDomainText(), + ), + + const SizedBox(height: 10), // Small space between new text and message + // Text Message (Fades in slightly after logo) if (widget.message != null) FadeTransition( @@ -152,4 +229,4 @@ class _SplashScreenState extends State ), ); } -} +} \ No newline at end of file