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

class RoomBottomButtons extends StatelessWidget {
  final VoidCallback? onPowerOn;
  final VoidCallback? onPowerOff;
  final VoidCallback? onDeviceControl;
  final bool isProcessing;

  const RoomBottomButtons({
    super.key,
    this.onPowerOn,
    this.onPowerOff,
    this.onDeviceControl,
    this.isProcessing = false,
  });

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Expanded(
          child: GestureDetector(
            onTap: (onPowerOn != null && !isProcessing) ? onPowerOn : null,
            child: Container(
              height: 88.h,
              decoration: BoxDecoration(
                color: (onPowerOn != null && !isProcessing)
                    ? const Color.fromRGBO(66, 165, 245, 1.0)
                    : const Color.fromRGBO(204, 204, 204, 1),
                borderRadius: BorderRadius.circular(20.r),
              ),
              child: Center(
                child: Text(
                  '送电',
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 32.sp,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
            ),
          ),
        ),
        SizedBox(width: 12.w),
        Expanded(
          child: GestureDetector(
            onTap: (onPowerOff != null && !isProcessing) ? onPowerOff : null,
            child: Container(
              height: 88.h,
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(20.r),
                border: Border.all(
                  color: (onPowerOff != null && !isProcessing)
                      ? const Color.fromRGBO(66, 165, 245, 1.0)
                      : const Color.fromRGBO(204, 204, 204, 1),
                  width: 2.w,
                ),
              ),
              child: Center(
                child: Text(
                  '断电',
                  style: TextStyle(
                    color: (onPowerOff != null && !isProcessing)
                        ? const Color.fromRGBO(66, 165, 245, 1.0)
                        : const Color.fromRGBO(100, 116, 139, 1),
                    fontSize: 32.sp,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
            ),
          ),
        ),
        SizedBox(width: 12.w),
        Expanded(
          child: GestureDetector(
            onTap: onDeviceControl,
            child: Container(
              height: 88.h,
              decoration: BoxDecoration(
                color: const Color.fromRGBO(200, 208, 220, 1.0),
                borderRadius: BorderRadius.circular(20.r),
              ),
              child: Center(
                child: Text(
                  '设备控制',
                  style: TextStyle(
                    color: const Color.fromRGBO(100, 116, 139, 1.0),
                    fontSize: 32.sp,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
            ),
          ),
        ),
      ],
    );
  }
}
