dart 滚动时Appbar应重叠

5cnsuln7  于 2023-04-09  发布在  其他
关注(0)|答案(1)|浏览(115)

我想实现以下行为,当我开始滚动的应用程序栏应该去后面的内容.
有人SliverAppbar工作,但由于它在_SliverAppbarDelegate中有minExtent,它缩小了我不想要的Appbar的大小。
https://gifyu.com/image/Sdh84

Stack(
            children: [
              Positioned.fill(
                top: 0,
                child: Align(
                  alignment: Alignment.topCenter,
                  child: SizedBox(
                    height: kToolbarHeight + context.padding.top,
                    child: CustomAppBar(
                      title: TranslationConstants.dashboard,
                      hasDrawer: true,
                      onLeadingTap: () => setState(() {
                        print("Leading");
                        zoomControllerIconChanger = true;
                        if (drawerController.toggle != null) {
                          drawerController.toggle!();
                        }
                      }),
                    ),
                  ),
                ),
              ),
              Positioned.fill(
                top: kToolbarHeight + context.padding.top,
                child: ListView.builder(
                  padding: EdgeInsets.zero,
                  itemCount: 100,
                  itemBuilder: (ctx, index) {
                    return ListTile(
                        title: Text('ELEMENT $topPosition -> $index'));
                  },
                ),
              ),
            ],
          ),
    ```
    Here is my code
elcex8rz

elcex8rz1#

您可以使用ListView.builders的填充,而不是提供top: kToolbarHeight + context.padding.top

Positioned.fill(
  child: ListView.builder(
    padding: EdgeInsets.only(
        top: // this one 
        ),
    itemCount: 100,

相关问题