这是Grailed应用程序中标题的一个示例,左上角有一个标题,当页面向下滚动时,标题显示在顶部中间:

enter image description here

这就是我目前的情况:

class AccountPageHeader extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SliverAppBar(
      backgroundColor: kMainBG,
      expandedHeight: 90,
      toolbarHeight: 50,
      pinned: true,
      elevation: 0,
      automaticallyImplyLeading: false,
      flexibleSpace: FlexibleSpaceBar(
        centerTitle: false,
        title: Text(
          "Account",
          style: TextStyle(color: Colors.white, fontWeight: FontWeight.w800),
        ),
        titlePadding: EdgeInsets.all(kDefaultPadding),
      ),
      actions: [],
    );
  }
}

我的标题在一个灵活的空间里,当我在页面上向下滚动时,它会在左上角有一种过渡.

如果有人能告诉我如何在Grailed示例中实现应用程序栏,我将不胜感激!蒂娅!

推荐答案

我们可以用CupertinoSliverNavigationBar来获得这种效果.

CupertinoSliverNavigationBar(
  largeTitle: Text("Account"),
),

Flutter相关问答推荐

创建多个具有适当填充和对齐的按钮的最佳方法

从底部开始固定,然后使其可拖曳Flutter

Flutter :在后台实现振动

如何使用flutter_local_notification包处理通知操作?

框中的Flutter 适配图像

Ffltter Firebase向用户添加公司

即使小部件比Flutter 中的屏幕更宽,也始终显示滚动条

Flutter:如何在现有布局之上显示圆角布局?

Flutter:为什么我的 listTile colored颜色 被容器 colored颜色 覆盖了?

如何为文本主题设置多种 colored颜色 ?

如何在 Flutter 中使用 drawLine() 和 drawCircle() 绘制等距离的 4 条线

如何对齐卡片小部件中的图标按钮?

statefulWidget 无法进行所需更改的问题

如何限制用户每 24 小时执行的操作数?

如何制作两个显示相关内容且可编辑的文本字段?

我几乎每次都将 Stateless Widget 与 BLoC 一起使用.我错了吗?

我收到这个错误我无法解决

Android Studio 模拟器屏幕闪烁

Flutter 平台通道将多数据传递给 windows 功能

如何从我的Flutter 项目中删除错误?