简体   繁体   English

如何在flutter中实现whatsapp移动滚动效果

[英]How to implement a whatsapp mobile scroll effect in flutter

I am trying to implement the scrolling effect on the home screen on whatsap on iphone, where the search bar disappears first while scrolling the the rest of the scrolling takes place.我正在尝试在 iPhone 上的 whatsap 上的主屏幕上实现滚动效果,其中搜索栏首先消失,同时滚动其余的滚动发生。 Any idea on how to implement it ?关于如何实施它的任何想法?

You can try using the SliverAppBar with a CustomScrollView .您可以尝试将SliverAppBarCustomScrollView一起使用。

return Scaffold(
  //1
  body: CustomScrollView(
    slivers: <Widget>[
      //2
      SliverAppBar(
        expandedHeight: 250.0,
        flexibleSpace: FlexibleSpaceBar(
          title: Text('Goa', textScaleFactor: 1),
          background: Image.asset(
            'assets/images/beach.png',
            fit: BoxFit.fill,
          ),
        ),
      ),
      //3
      SliverList(
        delegate: SliverChildBuilderDelegate(
          (_, int index) {
            return ListTile(
              leading: Container(
                  padding: EdgeInsets.all(8),
                  width: 100,
                  child: Placeholder()),
              title: Text('Place ${index + 1}', textScaleFactor: 2),
            );
          },
          childCount: 20,
        ),
      ),
    ],
  ),
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM