123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- import 'package:flutter/material.dart';
- import 'package:flyinsono/lab/color/lab_colors.dart';
- import 'package:flyinsono/lab/components/lab_loading_wrapper.dart';
- import 'package:flyinsono/lab/mock_data/mock_rpc.dart';
- import 'package:flyinsono/lab/pages/lab_data/controller.dart';
- import 'package:flyinsono/lab/pages/lab_data/widgets/us_image_thumbnail.dart';
- import 'package:flyinsono/lab/style/lab_box_decoration.dart';
- import 'package:flyinsono/utils/datetime.dart';
- import 'package:get/get.dart';
- import 'package:fis_jsonrpc/rpc.dart';
- class USImagePool extends GetView<LabDataController> {
- const USImagePool({Key? key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return GetBuilder<LabDataController>(
- id: LabDataController.imageListId,
- builder: (context) {
- return Container(
- decoration: LabBoxDecoration.base,
- child: LabLoadingWrapper(
- decoration: LabBoxDecoration.base,
- loading: controller.isImageListLoading,
- child: Padding(
- padding: const EdgeInsets.all(5),
- child: GridView.builder(
- padding: const EdgeInsets.all(5),
- gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 6,
- crossAxisSpacing: 5,
- mainAxisSpacing: 5,
- childAspectRatio: 3 / 2,
- ),
- itemCount: controller.imageList.length,
- itemBuilder: (context, index) {
- var imageType =
- controller.imageList[index].vidDataInfo.imageType;
- var image = controller.imageList[index];
- bool isVideo = [
- SampleRemedicalFileDataTypeEnum.AnalysisVideo,
- SampleRemedicalFileDataTypeEnum.VinnoVidMovie,
- SampleRemedicalFileDataTypeEnum.ThirdVidMovie,
- SampleRemedicalFileDataTypeEnum.AnalysisVideo,
- ].contains(image.fileDataType) &&
- imageType != ImageType.URM_Result;
- return MouseRegion(
- cursor: SystemMouseCursors.click,
- child: GestureDetector(
- onTap: () {
- controller.clickImage(index);
- },
- child: USImageThumbnail(
- imageUrl:
- controller.imageList[index].vidDataInfo.coverUrl,
- description: ((index + 1).toString() +
- " " +
- controller.imageList[index].fileTypeName +
- " ${DataTimeUtils.convertToLocalString(controller.imageList[index].createTime)}"),
- labelBuilder: _buildLabel(
- controller.imageList[index].vidDataInfo.imageType,
- ),
- isVideo: isVideo,
- ),
- ),
- );
- },
- ),
- ),
- ),
- );
- },
- );
- }
- Widget? _buildLabel(ImageType imageType) {
- switch (imageType) {
- case ImageType.URM:
- return Text(
- 'URM',
- style: TextStyle(
- color: LabColors.green400,
- fontWeight: FontWeight.bold,
- fontSize: 12,
- ),
- );
- case ImageType.URM_Result:
- return Text(
- 'URM 分析结果',
- style: TextStyle(
- color: LabColors.green400,
- fontWeight: FontWeight.bold,
- fontSize: 12,
- ),
- );
- case ImageType.Measure_Result:
- return Text(
- '图像',
- style: TextStyle(
- color: LabColors.green400,
- fontWeight: FontWeight.bold,
- fontSize: 12,
- ),
- );
- case ImageType.Video:
- return Text(
- '视频',
- style: TextStyle(
- color: LabColors.green400,
- fontWeight: FontWeight.bold,
- fontSize: 12,
- ),
- );
- default:
- return null;
- }
- }
- }
|