import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';

class DeviceStatusInfoWidget extends StatelessWidget {
  final String title; // 标题，如“在床”
  final String iconAsset; // SVG 路径，如 'assets/icons/bed.svg'
  final String value; // 显示内容，如“在离床”
  ThemeController themeController = Get.find();

  DeviceStatusInfoWidget({
    super.key,
    required this.title,
    required this.iconAsset,
    required this.value,
  });

  @override
  Widget build(BuildContext context) {
    return ClickableContainer(
      // backgroundColor: themeController.currentColor.sc5,
      backgroundColor: stringToColor("#242835").withOpacity(0.8),
      highlightColor: themeController.currentColor.sc21,
      borderRadius: AppConstants().normal_container_radius,
      padding: EdgeInsets.zero,
      onTap: () {
        print('点击了 $title 模块');
      },
      child: Container(
        width: MediaQuery.sizeOf(context).width * 0.32,
        constraints: BoxConstraints(
          minWidth: 201.rpx,
          minHeight: 182.rpx,
        ),
        child: Padding(
          padding:
              EdgeInsetsDirectional.fromSTEB(20.rpx, 29.rpx, 20.rpx, 39.rpx),
          child: Column(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.start,
            children: [
              Row(
                mainAxisSize: MainAxisSize.max,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  SvgPicture.asset(
                    iconAsset,
                    width: 38.rpx,
                    height: 38.rpx,
                    // colorFilter: ColorFilter.mode(
                    //   FlutterFlowTheme.of(context).primaryText,
                    //   BlendMode.srcIn,
                    // ),
                  ),
                  Text(
                    value,
                    style: TextStyle(
                      fontFamily: 'Inter',
                      fontSize: 48.rpx,
                      letterSpacing: 0.0,
                      color: themeController.currentColor.sc3,
                    ),
                  ),
                ]
                    .divide(SizedBox(width: 18.rpx))
                    .addToStart(SizedBox(width: 31.rpx)),
              ),
              Text(
                title,
                style: TextStyle(
                  fontFamily: 'Inter',
                  fontSize: 30.rpx,
                  letterSpacing: 0.0,
                  color: themeController.currentColor.sc4,
                ),
              ),
            ].divide(SizedBox(height: 39.rpx)),
          ),
        ),
      ),
    );
  }
}
