You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aku_new_community/lib/widget/beeImageNetwork.dart

43 lines
1.2 KiB

3 years ago
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class BeeImageNetwork extends StatelessWidget {
final List<ImgModel>? imgs;
final List<String>? urls;
3 years ago
final double? width;
final double? height;
final BoxFit? fit;
3 years ago
const BeeImageNetwork(
{Key? key,
this.imgs,
this.width,
this.height,
this.urls,
this.fit = BoxFit.cover})
: assert(imgs != null || urls != null),
super(key: key);
3 years ago
@override
Widget build(BuildContext context) {
return FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SARSAPI.image(ImgModel.first(imgs)),
3 years ago
imageErrorBuilder: (context, obj, stackTrace) {
return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: width ?? 160.w,
height: height ?? 160.w,
fit: BoxFit.fill,
3 years ago
);
},
height: height ?? 160.w,
width: width ?? 160.w,
fit: fit,
3 years ago
);
}
}