簡體   English   中英

如何在顫振中改變切屑的形狀

[英]How to change the shape of chip in flutter

我正在嘗試創建一個類似於下圖所示的形狀。

在此處輸入圖片說明

我打算使用Chips來實現相同的目的。 但是,芯片的所有四個側面都具有圓形邊界。 有什么辦法可以覆蓋它,並在左側具有矩形角,在右側具有圓角。

您可以使用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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM