How to fill data right to left in Flutter gridview

ぃ、小莉子 提交于 2021-02-04 16:39:30

问题


I am trying to fill Grid view data from right to left, as the application is in arabic and everything is RTL.

Here is what I want

I am using Stream builder to populate data and the following Gridview widget

 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(),
      );

Is there any way I can reverse the item filling direction Horizontally , like the reverse param made filling vertically bottom to top. Thank you.


回答1:


use Directionality widget

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


来源:https://stackoverflow.com/questions/55090930/how-to-fill-data-right-to-left-in-flutter-gridview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!