import 'package:fis_ui/index.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flyinsono/architecture/define.dart';

///图像待选框
class ImageDisplayBox extends FStatelessWidget {
  ImageDisplayBox({
    Key? key,
    required this.url,
    this.width,
    this.height,
  }) : super(key: key);

  final String url;
  final double? width;
  final double? height;

  @override
  FWidget build(BuildContext context) {
    return FContainer(
      alignment: Alignment.center,
      width: width,
      height: height,
      // margin: EdgeInsets.all(5.w),
      decoration: BoxDecoration(
        color: kIsMobile ? Colors.grey.shade100 : Colors.grey.shade300,
        border: Border.all(
          color: kIsMobile ? Colors.grey.shade300 : Colors.grey,
          width: .5,
        ),
        borderRadius: BorderRadius.circular(4.w),
      ),
      // TODO: FWidget -Melon: FadeInImage
      child: QuickFWidget(
        FadeInImage.assetNetwork(
          placeholder: "assets/images/img_loading.gif",
          image: url,
          fit: BoxFit.contain,
        ),
      ),
    );
  }
}
