【发布时间】:2019-05-01 16:18:35
【问题描述】:
我正在尝试使用 SliverAppBar。手机设备上的布局很好。但是,我用iPad测试布局时,AppBar的高度似乎没有变化,并且无法正常显示标题文字。
当我折叠 AppBar 时:
我也尝试将底部属性添加到 SliverAppBar,但它也不起作用。
bottom: PreferredSize(
preferredSize: Size.fromHeight(60.0),
child: Text(''),
),
结果如下:
标题文本仍然受到不可见高度的限制。
我的代码:
new SliverAppBar(
expandedHeight: Adapt.px(220.0),
floating: false,
elevation: 0.0,
pinned: true,
primary: true,
centerTitle: true,
title: Text("TITLE",
style: TextStyle(
color: Colors.white,
fontSize: Adapt.px(45.0),
fontFamily: "pinfon",
fontWeight: FontWeight.w900,
letterSpacing: 1.0)),
backgroundColor: Colors.black45,
brightness: Brightness.dark,
bottom: PreferredSize(
preferredSize: Size.fromHeight(60.0),
child: Text(''),
),
flexibleSpace: new FlexibleSpaceBar(
background: Opacity(
opacity: 0.5,
child: new Stack(
fit: StackFit.expand,
children: <Widget>[
new Image.asset(
"assets/images/back.jpg",
fit: BoxFit.fitWidth,
),
],
),
),
),
),
【问题讨论】:
-
你为 sliverappbar 写了什么代码?你用过 expandedHeight:。能否请您也上传您的代码。
-
是的,我用过expandHeight,代码上传了。