50 lines
1 KiB
Dart
50 lines
1 KiB
Dart
import "dart:async";
|
|
import "package:flutter/material.dart";
|
|
|
|
import "../app/app_router.dart";
|
|
|
|
class SplashScreen extends StatefulWidget {
|
|
const SplashScreen({super.key});
|
|
|
|
@override
|
|
State<SplashScreen> createState() => _SplashScreenState();
|
|
}
|
|
|
|
class _SplashScreenState extends State<SplashScreen> {
|
|
Timer? _timer;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
// ~3.5x longer than 1200ms
|
|
_timer = Timer(const Duration(milliseconds: 2400), () {
|
|
if (!mounted) return;
|
|
Navigator.of(context).pushReplacementNamed(AppRoutes.restaurantSelect);
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_timer?.cancel();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const Scaffold(
|
|
backgroundColor: Colors.black,
|
|
body: Center(
|
|
child: Text(
|
|
"PAYFRIT",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 38,
|
|
fontWeight: FontWeight.w800,
|
|
letterSpacing: 3,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|