微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 在Scroll Flutter上隐藏Appbar?

Whatsapp Home Screen

考虑这个图像.你可以看到它有一个appbar,appbar有Tabbed按钮.
我试图为appbar设置动画,使其隐藏在scrollup上,只留下Tab Buttons显示并滚动显示appbar apears.请帮帮我.对不起英语不好而不是美国人我也不是英语

解决方法:

如果我理解正确,下面的代码应该在TabBar保持可见时使应用栏隐藏在滚动状态:

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,
    ),
  ),
);

enter image description here

来自this post的例子.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐