|
|
@@ -14,6 +14,9 @@ import 'bloc/cashed_image_bloc.dart'
|
|
|
CashedImageState,
|
|
|
GetStartImageEvent;
|
|
|
|
|
|
+typedef ImageWidgetBuilder =
|
|
|
+ Widget Function(BuildContext context, ImageProvider imageProvider);
|
|
|
+
|
|
|
class CachedNetworkImageWidget extends StatelessWidget {
|
|
|
final String imageUrl;
|
|
|
final int count;
|
|
|
@@ -26,6 +29,7 @@ class CachedNetworkImageWidget extends StatelessWidget {
|
|
|
final Map<String, String>? httpHeaders;
|
|
|
final String? cacheKey;
|
|
|
final Widget? loadwidget;
|
|
|
+ final ImageWidgetBuilder imagebulder;
|
|
|
|
|
|
const CachedNetworkImageWidget({
|
|
|
super.key,
|
|
|
@@ -40,6 +44,7 @@ class CachedNetworkImageWidget extends StatelessWidget {
|
|
|
this.cached = true,
|
|
|
this.loadwidget = const CircularProgressIndicator(),
|
|
|
this.httpHeaders,
|
|
|
+ required this.imagebulder,
|
|
|
});
|
|
|
|
|
|
@override
|
|
|
@@ -67,12 +72,8 @@ class CachedNetworkImageWidget extends StatelessWidget {
|
|
|
}
|
|
|
|
|
|
if (state is CashedImageGetState) {
|
|
|
- return Image.memory(
|
|
|
- state.bytes,
|
|
|
- fit: fit,
|
|
|
- width: width,
|
|
|
- height: height,
|
|
|
- );
|
|
|
+ ImageProvider imageProvider = MemoryImage(state.bytes);
|
|
|
+ return imagebulder(context, imageProvider);
|
|
|
}
|
|
|
return SizedBox(
|
|
|
width: width,
|