elCaribe app - customization and branding
This commit is contained in:
31
news-app/lib/ui/widgets/networkImage.dart
Normal file
31
news-app/lib/ui/widgets/networkImage.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:news/utils/uiUtils.dart';
|
||||
|
||||
class CustomNetworkImage extends StatelessWidget {
|
||||
final String networkImageUrl;
|
||||
final double? width, height;
|
||||
final BoxFit? fit;
|
||||
final bool? isVideo;
|
||||
final Widget? errorBuilder;
|
||||
|
||||
const CustomNetworkImage({super.key, required this.networkImageUrl, this.width, this.height, this.fit, this.isVideo, this.errorBuilder});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FadeInImage.assetNetwork(
|
||||
fadeInDuration: const Duration(milliseconds: 150),
|
||||
fadeOutCurve: Curves.bounceOut,
|
||||
image: networkImageUrl,
|
||||
width: width ?? 100,
|
||||
height: height ?? 100,
|
||||
fit: fit ?? BoxFit.cover,
|
||||
imageErrorBuilder: (context, error, stackTrace) {
|
||||
return Image.asset(UiUtils.getPlaceholderPngPath(), width: width ?? 100, height: height ?? 100);
|
||||
},
|
||||
placeholderErrorBuilder: (context, error, stackTrace) {
|
||||
return Image.asset(UiUtils.getPlaceholderPngPath(), width: width ?? 100, height: height ?? 100);
|
||||
},
|
||||
placeholderFit: fit ?? BoxFit.cover,
|
||||
placeholder: UiUtils.getPlaceholderPngPath());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user