import 'package:fis_i18n/i18n.dart';
import 'package:fis_jsonrpc/rpc.dart';
import 'package:fis_lib_business_components/components/consultation_picture_component.dart';
import 'package:fis_ui/index.dart';
import 'package:flutter/material.dart';
import 'package:flyinsono/pages/remedical/report/report_edit/widgets/consultation_image_view.dart';
import 'package:flyinsono/pages/remedical/report/report_edit/widgets/quick_preview_plugin.dart';
import 'package:get/get.dart';

class ScreenshotImages extends FStatelessWidget {
  final List<ConsultationFileDTO> imageList;
  ScreenshotImages(this.imageList);
  @override
  FWidget build(BuildContext context) {
    return FContainer(
      margin: EdgeInsets.only(
        left: 20,
        top: 15,
      ),
      child: FWrap(
        spacing: 8.0, // 主轴(水平)方向间距
        runSpacing: 8.0, // 纵轴（垂直）方向间距
        direction: Axis.horizontal,
        alignment: WrapAlignment.start,
        children: List<FWidget>.generate(
          imageList.length,
          (i) {
            ConsultationFileDTO imageInfo = imageList[i];
            final image = FConsultationContentImage(
              consultationFileInfo: imageInfo,
              onDoubleTap: () {
                //router.back();
                Get.to(
                  () => ConsultationImagePage(imageInfo),
                );
              },
              onTap: () {},
              serialNo: i + 1,
              contentWidth: kIsMobile ? 280 : 300,
              description:
                  " ${i18nBook.realTimeConsultation.uploader.t} ${imageList[i].creatorName ?? ''} ",
              plugin: kIsMobile
                  ? null
                  : FQuickPreviewPlugin(
                      imageUrl: imageInfo.coverImageUrl ?? '',
                      vidUrl: imageInfo.sourceUrl ?? '',
                      child: FIcon(
                        Icons.zoom_in,
                        color: Colors.white,
                        size: 32,
                      ),
                    ),
            );
            return image;
          },
        ),
      ),
    );
  }
}
