import 'package:flutter/material.dart';

import '../../../../../customWidget/ItemWidgetFactory.dart';
import '../../../../../customWidget/full_screen_video_page.dart';
import '../../../../../customWidget/single_image_viewer.dart';
import '../../../../../tools/tools.dart';

class DangerAcceptanceFinish extends StatefulWidget {
  const DangerAcceptanceFinish({super.key});

  @override
  State<DangerAcceptanceFinish> createState() => _DangerAcceptanceFinishState();
}

class _DangerAcceptanceFinishState extends State<DangerAcceptanceFinish> {
  final List<String> imgUrls = [
    "https://pic.rmb.bdstatic.com/bjh/news/100b8b78cbd136ede03249d9f3b3f5c42221.jpeg",
    "https://pic.rmb.bdstatic.com/bjh/news/100b8b78cbd136ede03249d9f3b3f5c42221.jpeg",
  ];

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 0),
      child: DecoratedBox(
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(5),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            // 标题
            ListItemFactory.createBuildSimpleSection("验收信息"),
            const Divider(height: 1),

            // 修复信息 summary 区域
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 12),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  ListItemFactory.createColumnTextItem(
                    topText: "验收描述",
                    bottomText: "这是一段整改描述",
                  ),
                  ListItemFactory.createRowSpaceBetweenItem(
                    leftText: "是否合格",
                    rightText: "--",
                  ),
                  const Divider(height: 10),
                  ListItemFactory.createRowSpaceBetweenItem(
                    leftText: "验收部门",
                    rightText: "部门",
                  ),
                  const Divider(height: 10),
                  ListItemFactory.createRowSpaceBetweenItem(
                    leftText: "验收部门负责人",
                    rightText: "韩双",
                  ),
                  const Divider(height: 10),
                  ListItemFactory.createRowSpaceBetweenItem(
                    leftText: "验收时间",
                    rightText: "2020-01-01",
                  ),
                  ListItemFactory.createTextImageItem(
                    text: "验收图片",
                    imageUrls: imgUrls,
                    onImageTapped: (index) {
                      present(
                        SingleImageViewer(imageUrl: imgUrls[index]),
                        context,
                      );
                    },
                  ),
                  ListItemFactory.createTextVideoItem(
                    text: "验收视频",
                    videoUrl: "https://www.w3school.com.cn/i/movie.mp4",
                    onVideoTapped: () {
                      showDialog(
                        context: context,
                        barrierColor: Colors.black54,
                        builder: (_) => VideoPlayerPopup(videoUrl: "https://www.w3school.com.cn/i/movie.mp4"),
                      );
                    }
                  ),
                  SizedBox(height: 20),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
