我的应用程序栏上有两个图标,单击保存保存图标消失,批准图标将弹出,它工作正常,但通过较大屏幕上的应用程序栏图标根据下图进行剪切。这是我的代码
appBar: PreferredSize(
preferredSize: Size.fromHeight(70.0),
child: AppBar(
elevation: 10,
automaticallyImplyLeading: false,
backgroundColor: Colors.red,
title: Text('Edit',style:
TextStyle(fontSize: MediaQuery.of(context).size.width*0.1),
),
actions: <Widget>[
isVisibile
? Container(
height: 50,
width: 50,
child: Padding(
padding: EdgeInsets.only(right:MediaQuery.of(context).size.width*0.3),
child: IconButton(
icon: Icon(
Icons.save,
color: Colors.white,
size: MediaQuery.of(context).size.width*0.1,
),
onPressed: () {
},
),
),
)
: Container(),
isInvisible
? Padding(
padding: EdgeInsets.only(right:MediaQuery.of(context).size.width*0.05,bottom: MediaQuery.of(context).size.height*0.05),
child: IconButton(
icon: Icon(
Icons.done,
color: Colors.white,
size: MediaQuery.of(context).size.width*0.1,
),
onPressed: () async {
// approve
},
),
)
: Container(),
],
//),
),
),
那么我怎样才能使图标响应谢谢
最佳答案
将您的 AppBar 小部件作为 Container
的子级,并将边距设置为 EdgeInset.all(4)
。这应该可行。
尝试以下代码:
appBar: PreferredSize(
preferredSize: Size.fromHeight(70.0),
child: Container(
padding: EdgeInset.all(4), // you can change this value to 8
child:AppBar(
...
关于Flutter AppBar 图标在所有屏幕上均不响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63532719/