login-page/lib/splash_page.dart
2025-05-17 11:13:16 +03:00

55 lines
1.5 KiB
Dart

import 'dart:async';
import 'package:flutter/material.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) {
// Navigate to the login page (which is now potentially under '/login' or '/')
// Based on main.dart, '/' is LoginSignupPage, so that's fine.
Navigator.pushReplacementNamed(context, '/');
}
});
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold(
backgroundColor: theme.colorScheme.background,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'images/logo.png', // Ensure this path is correct as per your project
height: 120,
width: 200,
fit: BoxFit.contain,
),
const SizedBox(height: 24),
Text(
'Amazons',
style: theme.textTheme.displayMedium?.copyWith(
color: theme.primaryColor,
),
),
const SizedBox(height: 16),
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(theme.primaryColor),
),
],
),
),
);
}
}