无法将容器放置在可滚动的 sliverlist 中的堆栈中

unable to place container iside a stack inside scrollable sliverlist

无法将容器放入可滚动银名单内的堆栈中。 我的密码是

SliverList(
            delegate: SliverChildListDelegate([
          Stack(
            children: [
              Container(
                decoration: BoxDecoration(
                    image: DecorationImage(
                        fit: BoxFit.cover,
                        image: NetworkImage(
                            'https://idsb.tmgrup.com.tr/ly/uploads/images/2020/05/13/35552.jpeg'))),
                height: createSize(347, context),
                width: createSize(375, context),
              ),
              Align(
                alignment: Alignment.bottomCenter,
                child: Container(
                  color: Colors.blue,
                  height: createSize(307, context),
                ),
              ),
            ],
          )
        ])

I want a scrollable ui like this

将您的 SliverList 放入 CustomScrollView 中,如下所示:

return CustomScrollView(
  slivers: [
    SliverList(
        delegate: SliverChildListDelegate([
      Stack(
        children: [
          Container(
            decoration: BoxDecoration(
                image: DecorationImage(
                    fit: BoxFit.cover,
                    image: NetworkImage(
                        'https://idsb.tmgrup.com.tr/ly/uploads/images/2020/05/13/35552.jpeg'))),
            height: createSize(347, context),
            width: createSize(375, context),
          ),
          Align(
            alignment: Alignment.bottomCenter,
            child: Container(
              color: Colors.blue,
              height: createSize(307, context),
            ),
          ),
        ],
      )
    ]),
    ),
  ],
);

向容器添加边距解决了我的问题

 CustomScrollView(
              slivers: [
                appbar(context),
                SliverList(
                  delegate: SliverChildListDelegate(
                    [
                      Stack(
                        children: [
                          Container(
                            decoration: BoxDecoration(
                                image: DecorationImage(
                                    fit: BoxFit.cover,
                                    image: NetworkImage(
                                        'https://idsb.tmgrup.com.tr/ly/uploads/images/2020/05/13/35552.jpeg'))),
                            height: createSize(347, context, fromHeight: true),
                            width: createSize(375, context),
                          ),
                          Container( margin: EdgeInsets.only(
                                top: createSize(320, context, fromHeight: true)),)