import 'dart:io';

import 'package:drifter/pages/main_screen/main_screen_widget.dart';
import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class Splash extends StatefulWidget {
  const Splash({super.key});

  @override
  State<Splash> createState() => _SplashState();
}

class _SplashState extends State<Splash> {
  @override
  void initState() {
    super.initState();
    Future.delayed(const Duration(seconds: 3), () {
      Navigator.pushReplacement(context,
          MaterialPageRoute(builder: (context) => const MainScreenWidget()));
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.background,
      body: Center(
          child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          const SizedBox(
            height: 300,
          ),
          Image.asset(
            'assets/images/logo/drifter_vector.png',
            height: 111,
            width: 93,
          ),
          const SizedBox(
            height: 250,
          ),
          if (Platform.isAndroid)
            const CircularProgressIndicator(
              color: AppColors.mainAccent,
            )
          else
            const CupertinoActivityIndicator(
              radius: 20,
            )
        ],
      )),
    );
  }
}
