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/bee_avatar_widget.dart

47 lines
1.3 KiB

import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class BeeAvatarWidget extends StatelessWidget {
final List<ImgModel>? imgs;
final List<String>? urls;
final double? width;
final double? height;
final BoxFit? fit;
const BeeAvatarWidget(
{Key? key,
this.imgs,
this.width,
this.height,
this.urls,
this.fit = BoxFit.cover})
: assert(imgs != null || urls != null),
super(key: key);
@override
Widget build(BuildContext context) {
return ClipOval(
child: FadeInImage.assetNetwork(
placeholder: Assets.images.placeholder.path,
image: imgs == null
? SAASAPI.image(urls!.isEmpty ? '' : urls!.first)
: SAASAPI.image(ImgModel.first(imgs)),
imageErrorBuilder: (context, obj, stackTrace) {
return Image.asset(
Assets.newIcon.avatarPlaceholder.path,
width: width ?? 128.w,
height: height ?? 128.w,
fit: fit,
);
},
height: height ?? 128.w,
width: width ?? 128.w,
fit: fit,
),
);
}
}