如何在 flutter 的同一页面上添加其他组件到 gridview

How to add other components additional to gridview on same page in flutter

...
            if (snapshot.data == null) {
              return Container(
                  child: Center(
                child: Text("Loading..."),
              ));
            } else {
              return GridView.builder(
                  itemCount: snapshot.data.length,
                  gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                      crossAxisCount: 3),
                  itemBuilder: (context, index) => Card(
                          child: GridTile(
                        child: Center(
                          child: Text(snapshot.data[index].service_type),
                        ),
                      )));
            }
...

执行这段代码后,结果如下,

在此,我需要在网格顶部添加一个图像组件。请帮助我实现这一目标。下图是预期结果设计。

在大列表上使用 shrinkWrap 是一种不好的做法,当你想要在它上面或下面的东西时,你应该用扩展包裹你的 GridView/ListView,也不要像那样嵌套滚动视图。您应该改用 CustomScrollView 或 NestedScrollView。他们在文档中所说的。

Shrink wrapping the content of the scroll view is significantly more expensive than expanding to the maximum allowed size because the content can expand and contract during scrolling, which means the size of the scroll view needs to be recomputed whenever the scroll position changes.