Flutter ListView在RotatedBox内错误的滚动手势方向(不是滚动方向)

时间:2018-12-18 08:07:40

标签: listview dart flutter

我当前正在Flutter中实现ListView,将ListView放在RotatedBox内时会发生问题,当旋转时,滚动方向和轴不会在语义上进行更新:

例如,这是一个纯LTR水平列表视图:

ListView.builder(
  scrollDirection: Axis.horizontal,
  itemExtent: 320,
  itemCount: _categories.length,
  itemBuilder: (BuildContext context, int index) {
    return CategoryWidget(_categories[index]);
  },
)

如果放置在旋转180度的RotatedBox内,则我希望滚动方向也会更新,但它保持与未旋转相同,使其与手势方向相反:

RotatedBox(
  quarterTurns: 2,
  child: ListView.builder(
    scrollDirection: Axis.horizontal,
    itemExtent: 320,
    itemCount: _categories.length,
    itemBuilder: (BuildContext context, int index) {
      return CategoryWidget(_categories[index]);
    },
  )
)

在其他情况下(例如也使用Transform.rotate()),此问题仍然存在。

图片:For your information, the bottom list scrolling is natural, but the top list which is rotated 180deg, is not natural

0 个答案:

没有答案