0

发光就像整个屏幕是一个列表。有什么方法可以将发光放在应用栏下方?(编辑:不失appbar的浮动效果)

<code>**</code>在此处输入图片描述<code>**</code>

CustomScrollView(
      slivers: <Widget>[
        SliverAppBar(
          title: Text('Home Scree'),
          floating: true,
          leading: Icon(Icons.alarm),
        ),
        SliverList(
          delegate: SliverChildBuilderDelegate(
            (ctx, i) {
              return Column(
                children: <Widget>[
                  ProductCard(),
                  Divider(
                    height: 0,
                    thickness: 1,
                  ),
                ],
              );
            },
            childCount: 10,
          ),
        ),
      ],
    ),
4

1 回答 1

0

也许你可以尝试使用NestedScrollView,像这样:

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: NestedScrollView(
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return [SliverAppBar(
            leading: Icon(Icons.alarm),
            title: Text('Home Scree'),
            expandedHeight: kToolbarHeight,
            floating: true,
          )];
        },
        body: ListView.builder(
          padding: EdgeInsets.zero,
            itemCount: 10,
            itemBuilder: (context, index) {
              return Column(
                children: <Widget>[
                  ProductCard(),
                  Divider(
                    height: 0,
                    thickness: 1,
                  ),
                ],
              );
            }),
      ),
    );
  }
于 2020-03-18T03:27:17.920 回答