Initial commit: 91dj android client dev_1.0.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jydj/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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user