Flutter 颤振AppBar图标在所有屏幕上都没有响应
我有两个图标在我的应用程序栏上点击保存图标disappers和批准图标将弹出它的作品很好,但由应用程序栏图标在更大的屏幕上削减,根据下图。这是麦可德Flutter 颤振AppBar图标在所有屏幕上都没有响应,flutter,flutter-layout,flutter-appbar,Flutter,Flutter Layout,Flutter Appbar,我有两个图标在我的应用程序栏上点击保存图标disappers和批准图标将弹出它的作品很好,但由应用程序栏图标在更大的屏幕上削减,根据下图。这是麦可德 appBar: PreferredSize( preferredSize: Size.fromHeight(70.0), child: AppBar( elevation: 10, automaticallyImplyLeading: false, backgroundColor: Co
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:PreferredSize(
首选尺寸:从高度开始的尺寸(70.0),
孩子:AppBar(
标高:10,
自动嵌入:false,
背景颜色:Colors.red,
标题:文本(“编辑”),样式:
TextStyle(fontSize:MediaQuery.of(context.size.width*0.1),
),
行动:[
可视性
?容器(
身高:50,
宽度:50,
孩子:填充(
填充:EdgeInsets.only(右:MediaQuery.of(context.size.width*0.3),
孩子:我的钮扣(
图标:图标(
图标。保存,
颜色:颜色,白色,
大小:MediaQuery.of(context).size.width*0.1,
),
已按下:(){
},
),
),
)
:Container(),
看得见
?填充物(
填充:EdgeInsets.only(右侧:MediaQuery.of(context).size.width*0.05,底部:MediaQuery.of(context).size.height*0.05),
孩子:我的钮扣(
图标:图标(
完成了,
颜色:颜色,白色,
大小:MediaQuery.of(context).size.width*0.1,
),
onPressed:()异步{
//批准
},
),
)
:Container(),
],
//),
),
),
这是我在大屏幕上的应用程序栏
这是我在小屏幕上的照片
因此,我如何使图标具有响应性呢?将您的AppBar小部件作为
容器
的子组件,并将边距设置为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(
...
Jay Dangar它工作有错误,我纠正了它,谢谢