如何在Flutter网格视图中从右到左填充数据

6

我正在尝试从右到左填充网格视图数据,因为应用程序是阿拉伯语并且所有内容都是从右往左排列的。

以下是我的需求 enter image description here

我正在使用 Stream builder 来填充数据和以下 Gridview 小部件

 Widget productGrid(List<Product> products) => GridView.count(
        crossAxisCount: 3,
        reverse: true,

        controller: _scrollController,
        padding: EdgeInsets.all(4.0),
        childAspectRatio: 8.0 / 14,
        children: products
            .map(
              (product) => MyBookList(item: product),
            )
            .toList(),
      );

请问我是否可以水平翻转填充方向,就像使用reverse参数时垂直地从下到上填充一样。 谢谢。

1个回答

18

使用 Directionality 小部件

Directionality(
          textDirection: TextDirection.rtl,
          child: productGrid()

2
谢谢您的帮助,它完美地运行了。您能否解释一下如何使用文本方向来填充网格的方向? - Abdullah

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接