import 'package:farmer_client/pages/splash/widgets/countdown.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.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() {
    print(99999);

    // Get.off(Home());
    Get.toNamed("/addressList");
  }

  @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,
                    ),
                  ),
                ),
              ),
            ],
          ),
        ));
  }
}