import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../cubit/inspection_history_state.dart';
import 'inspection_record_item.dart';

class InspectionRecordList extends StatelessWidget {
  final List<InspectionRecord> records;

  const InspectionRecordList({
    super.key,
    required this.records,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(
          '巡检历史 (${records.length})',
          style: TextStyle(
            fontSize: 28.sp,
            fontWeight: FontWeight.bold,
            color: const Color.fromRGBO(10, 13, 20, 1.0),
          ),
        ),
        SizedBox(height: 16.h),
        ListView.separated(
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          itemCount: records.length,
          separatorBuilder: (context, index) => SizedBox(height: 16.h),
          itemBuilder: (context, index) {
            return InspectionRecordItem(
              record: records[index],
            );
          },
        ),
      ],
    );
  }
}
