-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Beshoy Melika
committed
Jun 4, 2023
1 parent
080d664
commit d337a69
Showing
8 changed files
with
476 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:cached_network_image/cached_network_image.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class AppCachedNetworkImage extends StatelessWidget { | ||
final Widget? loadingWidget; | ||
final Widget? errorWidget; | ||
final double? height; | ||
final double? width; | ||
final BoxFit? fit; | ||
final double radius; | ||
final String imageUrl; | ||
|
||
const AppCachedNetworkImage({ | ||
super.key, | ||
required this.imageUrl, | ||
required this.radius, | ||
this.loadingWidget, | ||
this.errorWidget, | ||
this.fit, | ||
this.height, | ||
this.width, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ClipRRect( | ||
borderRadius: BorderRadius.all(Radius.circular(radius)), | ||
child: CachedNetworkImage( | ||
height: height, | ||
width: width, | ||
fit: fit, | ||
imageUrl: imageUrl, | ||
placeholder: (context, url) => | ||
loadingWidget ?? const Center(child: CircularProgressIndicator()), | ||
errorWidget: (context, url, error) => | ||
errorWidget ?? const Icon(Icons.error), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.