首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在颤振中使用preferredSize制作响应性应用程序条有问题

在颤振中使用preferredSize制作响应性应用程序条有问题
EN

Stack Overflow用户
提问于 2022-08-21 11:12:50
回答 1查看 85关注 0票数 0

我在两个不同的设备上运行了y代码,但是获得响应的appBar高度有问题。我想使响应appBar使用首选的尺寸颤振。如何利用颤振中的首选尺寸使appBar具有响应高度?拜托,我是新来的。示例代码 appBar: AppBar( backgroundColor: Colors.white,

代码语言:javascript
复制
        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,
                          )),
                        )
                      ],
                    )),
EN

回答 1

Stack Overflow用户

发布于 2022-08-21 11:36:49

你可以像这样设定高度

代码语言:javascript
复制
appBar: PreferredSize(
          preferredSize: Size.fromHeight(50.0),
          child: AppBar(
            // ...
          )
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73433863

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档