属性
- radius: 100, // 半径 radius 不能与minRadius 和maxRadius共存,minRadius和maxRadius二者可以一起存在
- minRadius: 50,// 最小半径
- maxRadius: 150,// 最大半径
- backgroundColor: Colors.black12,// 背景色 优先级比backgroundImage低
- backgroundImage: AssetImage("images/avatar3.jpg"),// 背景图片 在child下方
- foregroundColor: Colors.orange[200],// 前景色 在child上方
- child: Text('sss',style: TextStyle(fontSize: 25),),//内部显示的widget
image.png
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 10,horizontal: 50),//指定水平(left right)或垂直方向(top,bottom)的值
child: CircleAvatar(
radius: 100, // 半径
// minRadius: 50,// 最小半径
// maxRadius: 150,// 最大半径
backgroundColor: Colors.black12,// 背景色
backgroundImage: AssetImage("images/avatar3.jpg"),// 背景图片
foregroundColor: Colors.orange[200],// 前景色
child: Text('sss',style: TextStyle(fontSize: 25),),//内部显示的widget
),
),
),
);
}
}
网友评论