首页 > 解决方案 > 如何添加容器小部件?我可以点击并得到答案

问题描述

我想将此容器保留为一个按钮,我可以单击它。

Container(

        margin: const EdgeInsets.all(15.0),
        padding: const EdgeInsets.all(3.0),
        decoration: BoxDecoration(
        border: Border.all(color: Colors.blueAccent)
        ),
        child: Text("AAAAAA"),
      )

标签: flutterdart

解决方案


用墨水瓶包裹它,

InkWell(
   onTap:(){},//call your function here 
   child: Container(
        margin: const EdgeInsets.all(15.0),
        padding: const EdgeInsets.all(3.0),
        decoration: BoxDecoration(
        border: Border.all(color: Colors.blueAccent)
        ),
        child: Text("AAAAAA"),
      ),
),

推荐阅读