import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class TaskTotalBlock extends StatelessWidget {
  final int highAlarmCount;
  final int mediumAlarmCount;
  final int onlineDeviceCount;

  const TaskTotalBlock({
    super.key,
    required this.highAlarmCount,
    required this.mediumAlarmCount,
    required this.onlineDeviceCount,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      child: Flex(
        direction: Axis.horizontal,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Expanded(
            child: Container(
              margin: EdgeInsets.only(right: 10.w),
              height: 120.h,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(16.r),
                color: Colors.white,
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Text(
                    '$highAlarmCount',
                    style: TextStyle(
                      fontSize: 48.sp,
                      fontWeight: FontWeight.bold,
                      color: const Color.fromRGBO(255, 77, 79, 1.0),
                    ),
                  ),
                  Transform.translate(
                    offset: Offset(0, -8.h),
                    child: Text(
                      '高警待处理',
                      style: TextStyle(
                        fontSize: 24.sp,
                        color: const Color.fromRGBO(100, 116, 139, 1.0),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
          Expanded(
            child: Container(
              margin: EdgeInsets.symmetric(horizontal: 10.w),
              height: 120.h,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(16.r),
                color: Colors.white,
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    '$mediumAlarmCount',
                    style: TextStyle(
                      fontSize: 48.sp,
                      fontWeight: FontWeight.bold,
                      color: const Color.fromRGBO(100, 116, 139, 1.0),
                    ),
                  ),
                  Transform.translate(
                    offset: Offset(0, -8.h),
                    child: Text(
                      '中警待处理',
                      style: TextStyle(
                        fontSize: 24.sp,
                        color: const Color.fromRGBO(100, 116, 139, 1.0),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
          Expanded(
            child: Container(
              margin: EdgeInsets.only(left: 10.w),
              height: 120.h,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(16.r),
                color: Colors.white,
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    '$onlineDeviceCount',
                    style: TextStyle(
                      fontSize: 48.sp,
                      fontWeight: FontWeight.bold,
                      color: const Color.fromRGBO(34, 197, 94, 1.0),
                    ),
                  ),
                  Transform.translate(
                    offset: Offset(0, -8.h),
                    child: Text(
                      '设备在线',
                      style: TextStyle(
                        fontSize: 24.sp,
                        color: const Color.fromRGBO(100, 116, 139, 1.0),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}