Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mobile 颤振如何使用ListView水平和GridView垂直滚动屏幕_Mobile_Flutter_Flutter Layout - Fatal编程技术网

Mobile 颤振如何使用ListView水平和GridView垂直滚动屏幕

Mobile 颤振如何使用ListView水平和GridView垂直滚动屏幕,mobile,flutter,flutter-layout,Mobile,Flutter,Flutter Layout,我有一个像附加图像布局。我希望在同一屏幕和水平列表视图中显示流行/最新的项目,并在网格视图下显示完整的项目列表 ListView应该有水平滚动,但所有屏幕也可以垂直滚动。右侧的黑色条模拟滚动条(不需要,仅用于图示) 你可以在Google Play应用程序中看到这种行为,你可以水平滑动以查看类别中的更多项目,也可以垂直滚动以查看更多类别列表 我尝试了堆栈和列小部件,但没有任何效果。你知道如何构建这个布局吗 你可以使用条子,试试我做的这个例子: @override Widget

我有一个像附加图像布局。我希望在同一屏幕和水平列表视图中显示流行/最新的项目,并在网格视图下显示完整的项目列表

ListView应该有水平滚动,但所有屏幕也可以垂直滚动。右侧的黑色条模拟滚动条(不需要,仅用于图示)

你可以在Google Play应用程序中看到这种行为,你可以水平滑动以查看类别中的更多项目,也可以垂直滚动以查看更多类别列表

我尝试了堆栈和列小部件,但没有任何效果。你知道如何构建这个布局吗


你可以使用
条子,试试我做的这个例子:

    @override
      Widget build(BuildContext context) {
        return Scaffold(
            appBar: new AppBar(),
            body: CustomScrollView(
              slivers: [
                SliverToBoxAdapter(
                  child: SizedBox(
                    height: 100,
                    child: ListView.builder(
                        itemExtent: 150,
                        scrollDirection: Axis.horizontal,
                        itemBuilder: (context, index) => Container(
                              margin: EdgeInsets.all(5.0),
                              color: Colors.orangeAccent,
                            ),
                        itemCount: 20),
                  ),
                ),
                SliverGrid(
                  gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                    crossAxisCount: 2,
                    childAspectRatio: 1.5,
                  ),
                  delegate: SliverChildBuilderDelegate(
                    (context, index) => Container(
                          margin: EdgeInsets.all(5.0),
                          color: Colors.yellow,
                        ),
                  ),
                )
              ],
            ));
      }
此外,您还可以通过此链接了解更多关于银的信息: