简体   繁体   English

如何在颤振中创建这个弹出菜单小部件

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

I need help in creating this type of popup window or popup menu in flutter.我需要帮助在颤振中创建这种类型的弹出窗口或弹出菜单。 In which i will use ExpansionTile to show countries and cities.我将在其中使用 ExpansionTile 显示国家和城市。 popup menu弹出菜单

You have to take 'ExpensionTile' in a container like below code:您必须将“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]),
                  ),
                ],
            ),

And call this method:并调用此方法:

    _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