2025-11-28 10:14:30 +05:30
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'signup_screen.dart';
|
|
|
|
|
import 'login_screen.dart';
|
2025-12-11 18:36:11 +05:30
|
|
|
import '../widgets/primary_button.dart';
|
2025-11-28 10:14:30 +05:30
|
|
|
|
2025-12-11 18:36:11 +05:30
|
|
|
class WelcomeScreen extends StatefulWidget {
|
2025-11-28 10:14:30 +05:30
|
|
|
const WelcomeScreen({super.key});
|
|
|
|
|
|
2025-12-11 18:36:11 +05:30
|
|
|
@override
|
|
|
|
|
State<WelcomeScreen> createState() => _WelcomeScreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _WelcomeScreenState extends State<WelcomeScreen>
|
|
|
|
|
with SingleTickerProviderStateMixin {
|
|
|
|
|
late AnimationController _controller;
|
|
|
|
|
late Animation<double> _fade;
|
|
|
|
|
late Animation<Offset> _slide;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
|
|
_controller = AnimationController(
|
|
|
|
|
vsync: this,
|
|
|
|
|
duration: const Duration(milliseconds: 900),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
_fade = CurvedAnimation(
|
|
|
|
|
parent: _controller,
|
|
|
|
|
curve: Curves.easeOut,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
_slide = Tween<Offset>(
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-28 10:14:30 +05:30
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2025-12-11 18:36:11 +05:30
|
|
|
final height = MediaQuery.of(context).size.height;
|
|
|
|
|
final width = MediaQuery.of(context).size.width;
|
|
|
|
|
|
2025-11-28 10:14:30 +05:30
|
|
|
return Scaffold(
|
2025-12-11 18:36:11 +05:30
|
|
|
backgroundColor: const Color(0xFFE8F0FF),
|
2025-11-28 10:14:30 +05:30
|
|
|
body: SafeArea(
|
|
|
|
|
child: Padding(
|
2025-12-11 18:36:11 +05:30
|
|
|
padding: EdgeInsets.symmetric(horizontal: width * 0.07),
|
2025-11-28 10:14:30 +05:30
|
|
|
child: Column(
|
2025-12-11 18:36:11 +05:30
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
2025-11-28 10:14:30 +05:30
|
|
|
children: [
|
2025-12-11 18:36:11 +05:30
|
|
|
/// 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
|
2025-11-28 10:14:30 +05:30
|
|
|
const Text(
|
|
|
|
|
"Register to access Kent Logistics services. After signup admin will review and approve your request. Approval may take up to 24 hours.",
|
2025-12-11 18:36:11 +05:30
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
height: 1.4,
|
|
|
|
|
color: Colors.black87,
|
|
|
|
|
),
|
2025-11-28 10:14:30 +05:30
|
|
|
),
|
2025-12-11 18:36:11 +05:30
|
|
|
|
|
|
|
|
SizedBox(height: height * 0.04),
|
|
|
|
|
|
|
|
|
|
/// 🌈 Create Account Button (Gradient)
|
|
|
|
|
PrimaryButton(
|
|
|
|
|
label: "Create Account",
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (_) => const SignupScreen()),
|
|
|
|
|
);
|
|
|
|
|
},
|
2025-11-28 10:14:30 +05:30
|
|
|
),
|
2025-12-11 18:36:11 +05:30
|
|
|
|
|
|
|
|
SizedBox(height: height * 0.015),
|
|
|
|
|
|
|
|
|
|
/// 🌈 Login Button (Gradient)
|
|
|
|
|
PrimaryButton(
|
|
|
|
|
label: "Login",
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(builder: (_) => const LoginScreen()),
|
|
|
|
|
);
|
|
|
|
|
},
|
2025-11-28 10:14:30 +05:30
|
|
|
),
|
2025-12-11 18:36:11 +05:30
|
|
|
|
|
|
|
|
SizedBox(height: height * 0.02),
|
2025-11-28 10:14:30 +05:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|