class _ContactCell extends StatelessWidget {
const _ContactCell({
required this.name,
this.avatarUrl,
this.assetName,
}) : assert((avatarUrl != null || assetName != null), '至少一张图片');
final String name;
final String? avatarUrl;
final String? assetName;
@override
Widget build(BuildContext context) {
return Container(
height: 60,
color: Colors.white,
child: Stack(
children: [
Row(
children: [
Row(
children: [
const SizedBox(
width: 12,
),
avatarUrl != null
? Container(
width: 48,
height: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
image: DecorationImage(
image: NetworkImage(avatarUrl!),
),
),
)
: Container(),
assetName != null
? Container(
width: 48,
height: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
image: DecorationImage(
image: AssetImage(assetName!),
),
),
)
: Container(),
const SizedBox(
width: 12,
),
Text(
name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
],
),
],
),
Positioned(
left: 50,
bottom: 0,
child: Container(
height: 1,
color: Colors.grey,
),
),
],
),
);
}
}