import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart';

class HomeDeviceWidget extends StatefulWidget {
  final String roomName;
  final List deviceStatusList;

  const HomeDeviceWidget({
    super.key,
    required this.roomName,
    required this.deviceStatusList,
  });

  @override
  State<HomeDeviceWidget> createState() => _HomeDeviceWidgetState();
}

class _HomeDeviceWidgetState extends State<HomeDeviceWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      decoration: BoxDecoration(),
      child: Column(
        mainAxisSize: MainAxisSize.max,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Padding(
            padding: EdgeInsetsDirectional.fromSTEB(16.rpx, 0.rpx, 0.rpx, 35.rpx),
            child: Text(
              widget.roomName,
              maxLines: 2,
              style: TextStyle(
                color: Color(0xFFFBFDFF),
                fontSize: 30.rpx,
                letterSpacing: 0.0.rpx,
              ),
            ),
          ),
          Column(
            mainAxisSize: MainAxisSize.max,
            children: widget.deviceStatusList
                .map((deviceStatus) => HomeDeviceStausWidget(deviceStatus: deviceStatus))
                .toList()
                .divide(SizedBox(height: 30.rpx)),
          ),
        ],
      ),
    );
  }
}
