Flutter web - 水平 singlechildscrollview 不能用鼠标滚轮滚动

时间:2021-06-02 09:01:46

标签: flutter listview flutter-web singlechildscrollview

我想在 Flutter web 中使用鼠标滚轮水平滚动 SingleChildScrollView(),但 SingleChildScrollView() 位于 ListView() 内,当我尝试使用鼠标滚轮滚动它时,它会滚动 ListView()。

这是我的代码

      child: ListView(
        children: [
            Container(
            width: 420.0,
            child: Row(
              children: [
                Expanded(
                  child: Text(
                    'Popular Search',
                  ),
                ),
                Expanded(
                  flex: 3,
                  child: SingleChildScrollView(
                    scrollDirection: Axis.horizontal,
                    child: Row(
                      children: categoriesList.map((e) {
                        return Container(
                          decoration: BoxDecoration(
                            borderRadius:
                                BorderRadius.all(Radius.circular(12.0)),
                            color: Colors.white,
                          ),
                          child: Text(
                            e,
                            style: TextStyle(
                              fontSize: 13.0,
                            ),
                          ),
                        );
                      }).toList(),
                    ),
                  ),
                )
              ],
            ),
          ),
        ],
      ),

0 个答案:

没有答案