How to fill data right to left in Flutter gridview
Asked Answered
P

1

7

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 enter image description here

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.

Paramnesia answered 10/3, 2019 at 18:26 Comment(0)
J
20

use Directionality widget

Directionality(
          textDirection: TextDirection.rtl,
          child: productGrid()
Jackinthebox answered 10/3, 2019 at 18:51 Comment(1)
Thank you for your help, it works perfectly. Could you please explain how do the text direction works for filling direction of gridParamnesia

© 2022 - 2024 — McMap. All rights reserved.