import 'package:flutter/material.dart'; import 'package:hgmj/tools_base/widget/net_image_widget.dart'; ///用户头像 class HeaderWidget extends StatelessWidget { final String headPath; final double headWidth; final double headHeight; //true = 圆形并带一圈边框;false 时用 radius 做圆角 final bool isCircle; final double? radius; const HeaderWidget({ super.key, required this.headPath, required this.headWidth, required this.headHeight, this.isCircle = true, this.radius, }); @override Widget build(BuildContext context) { return Container( width: headWidth, height: headHeight, decoration: isCircle ? const BoxDecoration( border: Border.fromBorderSide(BorderSide(width: 4, color: Color.fromRGBO(253, 45, 85, 1))), shape: BoxShape.circle, ) : null, child: ClipRRect( borderRadius: BorderRadius.circular(isCircle ? headWidth : radius ?? 0), child: NetworkImageLoader( imageUrl: headPath, width: headWidth, height: headHeight, fit: BoxFit.fitWidth, ), ), ); } }