import 'package:flutter/material.dart';
import '../splash/widgets/countdown.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../home/index.dart';

class SplashScreen extends StatefulWidget {
  const SplashScreen({Key? key}) : super(key: key);

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

class _SplashScreen extends State<SplashScreen> {
  handleOnFinish() {
    Get.off(Home());
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
      decoration: const BoxDecoration(
        image: DecorationImage(
            image: AssetImage("images/splash.png"),
            fit: BoxFit.cover,
            alignment: Alignment.topCenter),
      ),
      child: Stack(
        children: [
          Positioned(
            right: 15.w,
            top: 50.h,
            child: countdown(3, handleOnFinish),
          ),
          Positioned(
            bottom: 0,
            child: Container(
              width: 375.w,
              height: 60.w,
              child: Center(
                child: Image.asset(
                  'images/logo.png',
                  width: 218.w,
                  height: 50.w,
                ),
              ),
            ),
          ),
        ],
      ),
    ));
  }
}
