dart - 从 FlexibleSpace 标题中删除默认填充
问题描述
代码:
CustomScrollView(
slivers: <Widget>[
SliverAppBar(
expandedHeight: 200.0,
flexibleSpace: FlexibleSpaceBar(
title: Container(color: Colors.red, child: Text("Flexible title")),
background: Image.asset("assets/chocolate.jpg", fit: BoxFit.cover),
),
),
SliverList(delegate: SliverChildListDelegate(_buildChildren())),
],
);
为什么标题中有默认填充。我曾经Container
带来对比度,以便可以轻松看到边缘。即使我尝试使用centerTitle: false
它也没有改变任何东西。
解决方案
您现在可以titlePadding
像这样使用该属性:
flexibleSpace: FlexibleSpaceBar(
title: Text('Home'),
titlePadding: EdgeInsetsDirectional.only(
start: 0.0,
bottom: 16.0,
),
),
推荐阅读
- node.js - 确定 Javascript (NodeJS) 代码是否在 REPL 中运行
- php - 允许用户使用他们自己的自定义域访问他们在我的网站上的页面
- unity3d - 游戏中的 Unity 2D Sprites 像素不完美
- c - fopen() 无法返回变量
- python-3.x - Python - 如何使用 gmail 在 Python 中发送带有附件的电子邮件?
- javascript - 在 Gsheet 按钮中运行 python 脚本
- types - 如何在没有赋值的情况下注释 rust 变量的数据类型?
- python - Python Split 只取 3 个数组
- python - 通过继承访问时类方法不返回值
- grep - Same key, different values: nested dicts of dicts