circular_profile_avatar
CircularProfileAvatar 是一个 Flutter 包,它允许开发者实现带有边框、叠加层、首字母缩写和许多其他出色功能的圆形头像,从而简化开发者的工作。它是 Flutter 的 CircleAvatar 组件的替代方案。
![]()
安装
将此添加到您的 package 的 pubspec.yaml 文件中
dependencies:
circular_profile_avatar: ^0.1.4
并运行
flutter packages get
用法
CircularProfileAvatar(
radius: 100, // sets radius, default 50.0
backgroundColor: Colors.green, // sets background color, default Colors.white
borderWidth: 10, // sets border, default 0.0
initialsText: Text(
"AD",
style: TextStyle(fontSize: 40, color: Colors.white),
), // sets initials text, set your own style, default Text('')
borderColor: Colors.brown, // sets border color, default Colors.white
elevation: 5.0, // sets elevation (shadow of the profile picture), default value is 0.0
foregroundColor: Colors.brown.withOpacity(0.5), //sets foreground colour, it works if showInitialTextAbovePicture = true , default Colors.transparent
onTap: () {
print('adil');
}, // sets on tap
showInitialTextAbovePicture: true, // setting it true will show initials text above profile picture, default false
imagePath:
'https://avatars0.githubusercontent.com/u/8264639?s=460&v=4'), //sets image path, it should be a URL string. default value is empty string, if path is empty it will display only initials
)
如果这个项目帮助你减少开发时间,你可以请我喝杯咖啡 :)
GitHub
https://github.com/ch-muhammad-adil/flutter-circular_profile_avatar