import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:hello_wallpaper/generated/assets.dart';
import 'package:hello_wallpaper/modules/splash_screen/splash_screen_controller.dart';
import 'package:hello_wallpaper/res/values/strings.dart';

class SplashScreenView extends StatelessWidget {
  SplashScreenView({super.key});

  final controller = Get.find<SplashScreenController>();

  @override
  Widget build(BuildContext context) {
    Get.find<SplashScreenController>();
    return Scaffold(
      body: Stack(
        children: [
          _buildIconName(),
          _buildProgress(),
        ],
      ),
    );
  }

  Widget _buildIconName() {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Image.asset(
            Assets.iconIconApp,
            width: 96.w,
            height: 96.w,
          ),
          SizedBox(height: 20.h),
          Text(
            appName,
            style: TextStyle(
              color: Colors.white,
              fontSize: 22.sp,
              fontWeight: FontWeight.w600,
            ),
          ),
        ],
      ),
    );
  }

  Widget _buildProgress() {
    return Container(
      alignment: Alignment.center,
      margin: const EdgeInsets.only(bottom: 60).h,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          SizedBox(
            width: 0.5.sw,
            child: LinearProgressIndicator(
              backgroundColor: Colors.white,
              valueColor: const AlwaysStoppedAnimation<Color>(Colors.grey),
              borderRadius: BorderRadius.circular(8).r,
            ),
          ),
          SizedBox(height: 14.h),
          Text(
            'Resource Loading...',
            style: TextStyle(
              color: Colors.white,
              fontSize: 12.sp,
            ),
          ),
        ],
      ),
    );
  }
}
