import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_translate/generated/assets.dart';
import 'package:flutter_translate/pages/launch/launch_controller.dart';
import 'package:get/get.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          _buildImageBg(),
          _buildProgress(),
        ],
      ),
    );
  }

  Widget _buildImageBg() {
    return Image.asset(
      Assets.imagesLaunchImage,
      width: 1.sw,
      height: 1.sh,
      fit: BoxFit.cover,
    );
  }

  Widget _buildProgress() {
    return Container(
      alignment: Alignment.center,
      margin: const EdgeInsets.only(bottom: 60).h,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          SizedBox(
            width: 0.6.sw,
            child: Obx(() {
              return LinearProgressIndicator(
                value: controller.currentProcess.value / controller.timeTotal,
                valueColor: const AlwaysStoppedAnimation<Color>(Color(0xffA2EDEE)),
                backgroundColor: const Color(0xffA2EDEE).withOpacity(0.2),
                borderRadius: BorderRadius.circular(8).r,
                minHeight: 6.h,
              );
            }),
          ),
          SizedBox(height: 10.h),
          Text(
            'Resource Loading...',
            style: TextStyle(
              color: Colors.black,
              fontSize: 12.sp,
              fontWeight: FontWeight.w500,
            ),
          ),
        ],
      ),
    );
  }
}
