android - Flutter,如何将 SliverAppbar 上的领先和动作移动到底部
问题描述
我正在制作这样的笔记应用程序:
如您所见,我的标题在前导和操作图标下方,但我想让它像这样反转:
我怎样才能做到这一点?这是我的代码:
SliverAppBar(
leading: Icon(
Icons.menu,
color: Colors.black,
),
actions: const [
Icon(Icons.search, color: Colors.black),
SizedBox(width: 8),
Icon(Icons.more_vert, color: Colors.black),
SizedBox(width: 14),
],
elevation: 2,
pinned: true,
floating: true,
backgroundColor: kLightBGColor,
expandedHeight: 150,
flexibleSpace: FlexibleSpaceBar(
title: Text(
'My Notes',
style: TextStyle(
color: Colors.grey.shade900,
fontWeight: FontWeight.w400,
),
),
centerTitle: true,
),
),
解决方案
The best I could do was use a second SliverAppBar
on top of the first, with some adjustments to both of their parameters. You may want to further customize to your preference:
CustomScrollView(
slivers: [
SliverAppBar(
elevation: 0,
pinned: true,
floating: true,
backgroundColor: Colors.grey,
expandedHeight: 80,
flexibleSpace: FlexibleSpaceBar(
title: Text(
'My Notes',
style: TextStyle(
color: Colors.grey.shade900,
fontWeight: FontWeight.w400,
),
),
centerTitle: true,
),
),
SliverAppBar(
leading: Icon(
Icons.menu,
color: Colors.black,
),
actions: const [
Icon(Icons.search, color: Colors.black),
SizedBox(width: 8),
Icon(Icons.more_vert, color: Colors.black),
SizedBox(width: 14),
],
pinned: true,
backgroundColor: Colors.grey,
expandedHeight: 45,
collapsedHeight: 45,
toolbarHeight: 20,
),
],
...
),
推荐阅读
- python-3.x - 带有文本和 xlsx 文件的 HttpResponse
- html - HTML5 音频 - 进度条/播放栏不适用于 OGG 音频文件/206 部分内容问题
- rubymine - 在 RubyMine 中查找项目文件不起作用
- python - Python中的函数运行两次但只使用一次,在其他问题/答案中没有找到解决方案
- mysql - TypeORM - 使用左连接、子查询和 windows 函数的查询构建器
- c# - WinForms:使用 c# 添加控件
- python - 熊猫无法读取文件
- python - 元组概念:TypeError:“NoneType”对象不可迭代
- python - 在 PyQt5 上调整 PaintWidgets 的大小
- jsp - 如何在java服务器上实现jsonp