made chnages in splash screen
This commit is contained in:
parent
18cb0068e6
commit
406ab30dba
@ -28,6 +28,9 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
late Animation<double> _scaleAnimation;
|
||||
// Animation for logo and text fade-in
|
||||
late Animation<double> _opacityAnimation;
|
||||
|
||||
// Animation for the gradient shimmer effect (moves from -1.0 to 2.0)
|
||||
late Animation<double> _shimmerAnimation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -39,7 +42,7 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
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<double>(begin: 0.5, end: 1.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
@ -55,8 +58,17 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
curve: const Interval(0.0, 0.5, curve: Curves.easeIn),
|
||||
),
|
||||
);
|
||||
|
||||
// Shimmer/Gradient Animation: Moves the gradient horizontally from left to right
|
||||
_shimmerAnimation = Tween<double>(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<double>(begin: -8.0, end: 8.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
@ -66,10 +78,10 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
|
||||
// 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<SplashScreen>
|
||||
_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: <TextSpan>[
|
||||
// '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<SplashScreen>
|
||||
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<SplashScreen>
|
||||
|
||||
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<SplashScreen>
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user