我在两个不同的设备上运行了y代码,但是获得响应的appBar高度有问题。我想使响应appBar使用首选的尺寸颤振。如何利用颤振中的首选尺寸使appBar具有响应高度?拜托,我是新来的。示例代码 appBar: AppBar( backgroundColor: Colors.white,
bottom: PreferredSize(
preferredSize: Size.fromHeight(155.0.h),
child: Container(
width: double.infinity,
child: Stack(
clipBehavior: Clip.none,
children: [
Image.asset('assets/topBackground.png'),
Positioned(
left: 8.w,
top: 20.h,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15),
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(
Icons.menu,
color: Colors.white,
),
CircleAvatar(
child: Image.asset("assets/Emmanuel_Jerry.png"),
),
],
),
),
),
Positioned(
top: 50.h,
left: 10.w,
child: Column(
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
),
Text(
"Emmanuel Jerry",
style: GoogleFonts.poppins(
textStyle: TextStyle(
color: Colors.white,
fontSize: 20.sp,
)),
),
Text(
"HI Welcome back",
style: GoogleFonts.poppins(
textStyle: TextStyle(
color: Colors.white,
fontSize: 14.sp,
)),
)
],
)),发布于 2022-08-21 11:36:49
你可以像这样设定高度
appBar: PreferredSize(
preferredSize: Size.fromHeight(50.0),
child: AppBar(
// ...
)https://stackoverflow.com/questions/73433863
复制相似问题