You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/views/widgets/loaders/image_loader.dart

26 lines
830 B
Dart

3 years ago
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
3 years ago
class ImageLoader extends StatelessWidget {
final String url;
final BoxFit boxFit;
final Color color;
final Alignment alignment;
final double width;
final double height;
const ImageLoader({Key key, @required this.url, this.boxFit, this.color, this.alignment, this.width, this.height}) : super(key: key);
3 years ago
@override
Widget build(BuildContext context) {
return CachedNetworkImage(
imageUrl: url ?? "",
fit: boxFit ?? BoxFit.cover,
alignment: Alignment.center,
width: width,
height: height,
3 years ago
placeholder: (context, url) => const Center(child: CircularProgressIndicator()),
errorWidget: (context, url, error) => const Icon(Icons.broken_image_rounded),
);
}
}