import 'package:cims_apps/application/assets/path_assets.dart';
import 'package:cims_apps/application/component/image/image_view.dart';
import 'package:cims_apps/core/route/route.dart';
import 'package:cims_apps/core/utils/size_config.dart';
import 'package:cims_apps/features/dashboard/dashboard_public/view/dashboard_public_view.dart';
import 'package:flutter/material.dart';

class SplashScreen extends StatefulWidget {
  static const routeName = '/SplashScreen';
  const SplashScreen({Key? key}) : super(key: key);

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

class _SplashScreenState extends State<SplashScreen> {
  @override
  void initState() {
    Future.delayed(const Duration(seconds: 3)).then(
      (value) => routePush(context, page: const DashboardPublicView()),
    );
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    final color = Theme.of(context).colorScheme;

    return Scaffold(
      backgroundColor: color.primary,
      body: Stack(
        children: [
          Align(
              alignment: Alignment.topRight,
              child: ImageView(
                image: PathAssets.iconSplashRight,
                width: SizeConfig.width * .25,
              )),
          Center(
            child: ImageView(
              image: PathAssets.imgSplashLogo,
              width: SizeConfig.width * .6,
            ),
          ),
          Align(
              alignment: Alignment.bottomLeft,
              child: ImageView(
                image: PathAssets.iconSplashLeft,
                width: SizeConfig.width * .25,
              )),
        ],
      ),
    );
  }
}
