import 'dart:async';

import 'package:cheminova/screens/authentication/login_screen.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';

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

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

class _SplashScreenState extends State<SplashScreen> {
  @override
  void initState() {
    super.initState();
    Timer(const Duration(seconds: 2), () {
      Get.offAll(() => const LoginScreen());
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
            margin: EdgeInsets.fromLTRB(
                Get.width * 0.07, 0, Get.width * 0.07, Get.height * 0.01),
            child: Container(
              decoration: const BoxDecoration(
                image: DecorationImage(
                  fit: BoxFit.fill,
                  image: AssetImage(
                    'assets/images/px_cheminova_svg.png',
                  ),
                ),
              ),
              child: SizedBox(
                width: Get.width * 0.8,
                height: Get.height * 0.05,
              ),
            ),
          ),
          Container(
            margin: EdgeInsets.only(bottom: Get.height * 0.1),
            child: Text(
              'HELPING YOU GROW',
              style: GoogleFonts.getFont(
                'Roboto',
                fontWeight: FontWeight.w500,
                fontSize: Get.textScaleFactor * 20,
                height: 1.3,
                color: const Color(0xFF000000),
              ),
            ),
          ),
          Container(
            margin: EdgeInsets.only(bottom: Get.height * 0.15),
            child: Container(
              decoration: const BoxDecoration(
                image: DecorationImage(
                  fit: BoxFit.cover,
                  image: AssetImage(
                    'assets/images/plant_png_barter_new_sales_ims_barter_trade_exchange_network_33.png',
                  ),
                ),
              ),
              child: SizedBox(
                width: Get.width * 0.8,
                height: Get.height * 0.4,
              ),
            ),
          ),
          Container(
            margin: EdgeInsets.only(bottom: Get.height * 0.03),
            child: Text(
              'Powered By',
              style: GoogleFonts.getFont(
                'Roboto',
                fontWeight: FontWeight.w500,
                fontSize: Get.textScaleFactor * 12,
                color: const Color(0xFF000000),
              ),
            ),
          ),
          SizedBox(
            height: Get.height * 0.03,
            child: Text(
              'codeology.solutions',
              style: GoogleFonts.getFont(
                'Roboto',
                fontWeight: FontWeight.w500,
                fontSize: Get.textScaleFactor * 14,
                height: 1.8,
                color: const Color(0xFF000000),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
