【发布时间】:2020-04-02 05:46:25
【问题描述】:
这是我的折叠工具栏的构建方法:-
@override
Widget build(BuildContext context) {
return SafeArea(
child: CustomScrollView(
controller: controller,
slivers: <Widget>[
SliverAppBar(
pinned: true,
expandedHeight: appBarHeight,
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios,
color: Colors.black,
),
onPressed: () => null,
),
floating: true,
flexibleSpace: FlexibleSpaceBar(
titlePadding: EdgeInsets.only(left:leftV , bottom:bottomV ),
title: Text(
"Title ",
style: TextStyle(
color: Colors.black,
fontSize: 16.0,
),
),
),
),
SliverList(delegate:
SliverChildBuilderDelegate((BuildContext context, int index) {
return ListTile(title: Text("Flutter / $index"));
}))
],
),
);
}
根据文档,我得到了删除填充的解决方案:-
/// 默认情况下该属性的值为 ///
EdgeInsetsDirectional.only(start: 72, bottom: 16)如果标题是 /// 不居中,EdgeInsetsDirectional.only(start 0, bottom: 16)否则。 final EdgeInsetsGeometry titlePadding;
但我得到的输出是:-
当应用栏完全折叠时,我想将标题居中。
问题也已在 github 中提交check here.
【问题讨论】:
标签: flutter android-collapsingtoolbarlayout flutter-sliver