mirrored_repositories/pokedex/lib/features/splash/presentation/ui
import 'package:flutter/material.dart';

///This is the splash screen that shows when the app is launched
class SplashScreen extends StatefulWidget {
  const SplashScreen({super.key});

  @override
  State<SplashScreen> createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {
  @override
  void initState() {
    super.initState();
    redirect();
  }

  //redirect user to the home screen after 2 seconds
  void redirect() {
    Future.delayed(
      const Duration(milliseconds: 2000),
      () => Navigator.pushReplacementNamed(context, '/home'),
    );
  }

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(
        child: CircularProgressIndicator(),
      ),
    );
  }
}
