发现页面
This commit is contained in:
30
lib/views/moments/index/widgets/moment_avatar.dart
Normal file
30
lib/views/moments/index/widgets/moment_avatar.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:chat/configs/app_colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MomentAvatar extends StatelessWidget {
|
||||
final String imageUrl;
|
||||
const MomentAvatar({Key? key, String? imageUrl})
|
||||
: imageUrl = imageUrl ?? '',
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 40,
|
||||
height: 40,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||
color: AppColors.white,
|
||||
image: imageUrl.isNotEmpty
|
||||
? DecorationImage(
|
||||
image: CachedNetworkImageProvider(imageUrl),
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user