[英]How to change the shape of chip in flutter
您可以使用Chip小部件的shape屬性。 在該屬性中,您可以傳遞RoundedRectangleBorder()並在RoundedRectangleBorder()內部提及borderRadius。 還有其他ShapeBorder,例如BeveledRectangleBorder(),StadiumBorder(),OutlineInputBorder(),ContinuousRectangleBorder()等。
下面使用RoundedRectangleBorder()給出代碼:
Chip(
backgroundColor: Color(0xFFE1E4F3),
padding: const EdgeInsets.symmetric(vertical: 15,horizontal: 5),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topRight: Radius.circular(20),bottomRight: Radius.circular(20))),
label: Text("Custom Chip Shape",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xFF3649AE)
),
)
);
希望這可以幫助你!!
我必須將芯片放入容器中,然后匹配背景色。
new Container(
decoration: new BoxDecoration(
color: Colors.blue.shade100,
borderRadius: new BorderRadius.only(
topRight: Radius.circular(30.0), bottomRight: Radius.circular(30.0)),
border: new Border.all(color: Color.fromRGBO(0, 0, 0, 0.0)),
),
child: new Chip(
label: new Text('Order Created',
style: new TextStyle(fontSize: 20.0, color: Colors.blueGrey)),
),
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.