73 lines
1.7 KiB
Dart
73 lines
1.7 KiB
Dart
import 'package:citycards_partner_flutter/core/app_router.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'dart:async';
|
|
|
|
class SplashScreen extends StatefulWidget {
|
|
const SplashScreen({super.key});
|
|
|
|
@override
|
|
State<SplashScreen> createState() => _SplashScreenState();
|
|
}
|
|
|
|
class _SplashScreenState extends State<SplashScreen>
|
|
with SingleTickerProviderStateMixin {
|
|
late AnimationController _controller;
|
|
late Animation<double> _fadeAnimation;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
_controller = AnimationController(
|
|
vsync: this,
|
|
duration: const Duration(seconds: 2),
|
|
);
|
|
|
|
_fadeAnimation = CurvedAnimation(
|
|
parent: _controller,
|
|
curve: Curves.easeInOut,
|
|
);
|
|
|
|
_controller.forward();
|
|
Timer(const Duration(seconds: 3), () {
|
|
Navigator.pushReplacementNamed(context, AppRouter.onboarding);
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
/// 🌄 Background Image
|
|
Image.asset(
|
|
"assets/splash/bg.png", // your full-screen background
|
|
fit: BoxFit.cover,
|
|
),
|
|
|
|
/// 🏙️ Logo Fade-in
|
|
FadeTransition(
|
|
opacity: _fadeAnimation,
|
|
child: Align(
|
|
alignment: Alignment.topCenter,
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(top: 213), // 👈 adjust height here
|
|
child: Image.asset(
|
|
"assets/splash/logo.png",scale: 4,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|