Flutter 如何用颤振中的条子制作动画切换器

Flutter 如何用颤振中的条子制作动画切换器,flutter,dart,flutter-layout,flutter-animation,Flutter,Dart,Flutter Layout,Flutter Animation,因此,我有一个带有SliverAppBar(floating:true,snap:true)和SliverPersistentHeader(pinted:true)SliverList的自定义滚动视图 我试图做的是单击标题中的一个按钮,然后在SliverPersistentHeade和SliverList占据的空间中弹出一个小部件。我试着把它们放在一个nestedScrollView中,并将SliverPersistentHeader和SliverList嵌套在另一个scrollView中,但由

因此,我有一个带有
SliverAppBar(floating:true,snap:true)
SliverPersistentHeader(pinted:true)
SliverList的自定义滚动视图

我试图做的是单击标题中的一个按钮,然后在
SliverPersistentHeade
SliverList
占据的空间中弹出一个小部件。我试着把它们放在一个
nestedScrollView
中,并将
SliverPersistentHeader
SliverList
嵌套在另一个scrollView中,但由于
SliverAppBar
SliverPersistentHeader
不在一起,当它(
SliverAppBar
)捕捉并关闭时,会弄乱预期的效果

为什么我需要这样做:我想用appBar中的元素执行一些动画,因为两个页面之间的下部过渡类似于

问题

  • 将persistantHeader放在第一页
  • 保持捕捉浮动appbar功能
  • 下部过渡
注意:答案不需要依赖于条子。实现这一目标的一种可能的方法就行了

目前我的代码大致如下

CustomScrollView(
        physics: BouncingScrollPhysics(),
        slivers: [
          SliverAppBar(
            backgroundColor: Colors.white,
            floating: true,
            snap: true,
            titleSpacing: 0,
            elevation: 4,
            title: Row(
              children: [
                Expanded(
                  child: Container(
                    padding: EdgeInsets.only(top: 10, bottom: 10, left: 10),
                    child: Container(color: Colors.grey),
                    ),
                  ),
                ),
                Container(
                  child: LeadingButton(
                    color: lightShadeColor,
                    icon: Icons.qr_code_scanner_rounded,
                    iconColor: darkColor,
                    size: 37, // btnShadow: false
                  ),
                ),
              ],
            ),
          ),
          SliverPersistentHeader(
                  delegate: PersistentHeader(
                    widget: Row(
                      // Format this to meet your need
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: <Widget>[
                        
                        Container(
                          padding: EdgeInsets.all(10),
                          child: Text('data'),
                        )
                      ],
                    ),
                  ),
                  pinned: true,
                ),
          SliverList(
            delegate: SliverChildBuilderDelegate((context, index) {
              return ListTile(
                title: Text('index $index'),
              );
            }),
          )
        ],
      ),
CustomScrollView(
物理:弹跳CrollPhysics(),
条子:[
滑杆(
背景颜色:Colors.white,
浮动:是的,
是的,
标题间距:0,
标高:4,
标题:世界其他地区(
儿童:[
扩大(
子:容器(
填充:仅限边集(顶部:10,底部:10,左侧:10),
子:容器(颜色:颜色。灰色),
),
),
),
容器(
儿童:引导按钮(
颜色:lightShadeColor,
图标:Icons.qr\u码\u扫描器\u四舍五入,
iconColor:darkColor,
大小:37,//btnShadow:false
),
),
],
),
),
滑冰机(
代表:PersistentHeader(
窗口小部件:行(
//格式化此文件以满足您的需要
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
容器(
填充:边缘设置。全部(10),
子项:文本(“数据”),
)
],
),
),
对,,
),
银表(
委托:SliverChildBuilderDelegate((上下文,索引){
返回列表块(
标题:文本(“索引$index”),
);
}),
)
],
),

我也希望看到解决方案。但也许我们只需要深入研究源代码,自己寻找解决方案。我也希望看到一个解决方案。但也许我们只需要深入研究源代码,自己寻找解决方案。