TKK_E32221292/Aplikasi Android/lib/features/splash/splash_page.dart

41 lines
1015 B
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_application_1/features/auth/login_page.dart';
import 'package:flutter_application_1/shared/widgets/brand_logo.dart';
class SplashPage extends StatefulWidget {
const SplashPage({super.key});
@override
State<SplashPage> createState() => _SplashPageState();
}
class _SplashPageState extends State<SplashPage> {
@override
void initState() {
super.initState();
Timer(const Duration(seconds: 3), () {
if (!mounted) return;
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (_) => const LoginPage()),
);
});
}
@override
Widget build(BuildContext context) {
final double screenWidth = MediaQuery.of(context).size.width;
final double logoWidth = screenWidth * 0.48;
return Scaffold(
body: SafeArea(
child: Center(
child: BrandLogo(
width: logoWidth.clamp(180.0, 240.0),
),
),
),
);
}
}