Files
谢宇宁andClaude Opus 5.5 2d26ea8f90 Initial commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 10:38:11 +07:00

47 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hjsq/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,
),
),
);
}
}