簡體   English   中英

如何在顫振中創建這個彈出菜單小部件

[英]how to create this popu menu widget in flutter

我需要幫助在顫振中創建這種類型的彈出窗口或彈出菜單。 我將在其中使用 ExpansionTile 顯示國家和城市。 彈出菜單

您必須將“ExpensionTile”放入如下代碼的容器中:

  ExpansionTile(
                title: new Text(vehicles[0].title, style: new TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, fontStyle: FontStyle.normal, color: Colors.black),),
                children: <Widget>[
                  new Column(
                    children: _buildExpandableContent(vehicles[0]),
                  ),
                ],
            ),

並調用此方法:

    _buildExpandableContent(Vehicle vehicle) {
    List<Widget> columnContent = [];

    for (String content in vehicle.contents)
      columnContent.add(
          new Container(
            height: 50,
            child: Row(
              children: <Widget>[
                Container(
                    padding: EdgeInsets.only(left: 40, top: 0),
                    child: new Image.asset('assets/images/demo.png', scale: 1.5,),
                  ),
                  Container(
                    padding: EdgeInsets.only(left: 20, top: 0),
                    child: new Text(content, style: new TextStyle(fontSize: 14.0, fontStyle: FontStyle.normal, color: Color(0Xff004FBA), fontWeight: FontWeight.bold),),
                  ),
                  Container(
                    padding: EdgeInsets.only(left: 140, top: 0, bottom: 10),
                    child: new Text(content, style: new TextStyle(fontSize: 12.0, fontStyle: FontStyle.normal, color: Color(0Xff767676), fontWeight: FontWeight.normal,),),
                  )
              ],
            ),
          )
      );

    return columnContent;
  }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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