【发布时间】:2020-11-02 19:15:06
【问题描述】:
我在 Flutter 中创建了以下 RaisedButton:
问题是,当您按住按钮大约 1 秒钟时,按钮的 highlightElevation 会触发,此时我的图像显示在按钮的左侧,但是当我删除图像时,它会按预期工作。 有没有办法在保留图像的同时解决这个问题?
这是我的代码:
Widget systems(String systemName, String systemTitle, Image img) {
return Center(child:
Container( width:width-20,height:110,child:
Column( children: <Widget>[
SizedBox(height: 10),
RaisedButton( elevation: 10,splashColor: Colors.transparent,highlightElevation: 0, shape:
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
),
color: Colors.white,
onPressed: () {},
child: Padding(
padding: EdgeInsets.only(left:0,top:15,bottom:15),
child: Row(children: [
img,Container(width:width-120,child:
Align(
alignment: Alignment.center,
child: Column(
children: [
Text(systemName, style: TextStyle(fontSize: 18)),
],
),
),)
])))
])));
}
PS:我在另一个小部件的 for 循环中调用了这个小部件 9 次,当我将循环次数减少到 5 或更低时,按钮也可以正常工作。
【问题讨论】: