createAssetImage method
Widget
createAssetImage(
- String url, {
- double? width,
- double? height,
- BoxShape? boxShape,
- BoxFit fit = BoxFit.cover,
- BorderRadiusGeometry borderRadius = BorderRadius.zero,
- AnimationController? controller,
extend的assets图里面有闪烁
Implementation
Widget createAssetImage(String url, {double? width, double? height, BoxShape? boxShape, BoxFit fit = BoxFit.cover, BorderRadiusGeometry borderRadius = BorderRadius.zero, AnimationController? controller}) {
if (url.isEmpty) return const SizedBox();
debugPrint("====================${url}===============`");
//指定外包的两种方式
// return Image.asset(url,
// fit: BoxFit.cover, package: 'flutter_gallery_assets');
// return Image.asset('packages/flutter_gallery_assets/'+url,
// fit: BoxFit.cover, );
return ClipRRect(
borderRadius: borderRadius,
// asset形式的extend_image会闪烁,所以用原生哦
child: Image.asset(
url,
width: width,
height: height,
fit: fit,
),
);
}