user-interface – Flutter – 容器onPressed?

前端之家收集整理的这篇文章主要介绍了user-interface – Flutter – 容器onPressed?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有这个容器:

new Container(
            width: 500.0,padding: new EdgeInsets.fromLTRB(20.0,40.0,20.0,40.0),color: Colors.green,child: new Column(
              children: [
                new Text("Ableitungen"),]
            ),),

用户点击Container时,我想要触发onPressed方法(例如,可以使用IconButtons来完成).如何使用容器实现此行为?

提前致谢

解决方法

我想你可以像这样使用GestureDetector小部件:

new GestureDetector(
        onTap: (){
          print("Container clicked");
        },child: new Container(
          width: 500.0,]
          ),)
    );

猜你在找的Flutter相关文章