ente/lib/ui/circular_network_image_widget.dart

37 lines
985 B
Dart
Raw Normal View History

2020-07-17 18:29:02 +00:00
import 'package:cached_network_image/cached_network_image.dart';
2020-04-05 14:00:44 +00:00
import 'package:flutter/material.dart';
2020-07-17 18:29:02 +00:00
import 'package:photos/ui/loading_widget.dart';
2020-04-05 14:00:44 +00:00
class CircularNetworkImageWidget extends StatelessWidget {
final String _url;
final double _size;
const CircularNetworkImageWidget(String url, double size, {Key key})
: this._url = url,
this._size = size,
super(key: key);
@override
Widget build(BuildContext context) {
2020-07-17 18:29:02 +00:00
return CachedNetworkImage(
imageUrl: _url,
imageBuilder: (context, imageProvider) => Container(
2020-04-05 14:00:44 +00:00
width: _size,
height: _size,
margin: const EdgeInsets.only(right: 8),
2020-07-17 18:29:02 +00:00
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: imageProvider,
fit: BoxFit.contain,
),
),
),
placeholder: (context, url) => Container(
width: _size,
child: loadWidget,
),
2020-07-17 18:29:02 +00:00
);
2020-04-05 14:00:44 +00:00
}
}