隐藏滚动条上的Appbar? [英] Hide Appbar on Scroll Flutter?

查看:99
本文介绍了隐藏滚动条上的Appbar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑此图片.如您所见,它具有一个应用程序栏,而该应用程序栏具有选项卡式"按钮. 我正在尝试对应用栏进行动画处理,以使其在向上滚动时隐藏,并且仅显示选项卡按钮",而在向上滚动时不显示应用栏.请帮帮我.对不起,英语不好,不是美国人,我也不是英语

Consider this image. As you can see it has an appbar and the appbar has Tabbed buttons. Am trying to animate the appbar so that it hides on scrollup and leaves only the Tab Buttons showing and on scrollup the appbar apears. Please help me out. Sorry for bad english and not American neither am I English

推荐答案

如果我对您的理解正确,以下代码应可使应用程序栏在滚动时隐藏,而TabBar仍可见:

If I understood you correctly, following code should make the app bar hide on scroll while TabBar remains visible:

new Scaffold(
  body: new NestedScrollView(
    controller: _scrollViewController,
    headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
      return <Widget>[
        new SliverAppBar(
          title: new Text(widget.title),
          pinned: true,
          floating: true,
          forceElevated: innerBoxIsScrolled,
          bottom: new TabBar(
            tabs: <Tab>[
              new Tab(text: "STATISTICS"),
              new Tab(text: "HISTORY"),
            ],
            controller: _tabController,
          ),
        ),
      ];
    },
    body: new TabBarView(
      children: <Widget>[
        new StatisticsPage(),
        new HistoryPage(),
      ],
      controller: _tabController,
    ),
  ),
);

示例来自此帖子.

这篇关于隐藏滚动条上的Appbar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆