flutterdartgridviewpagination

How to enable paging in Flutter GridView?


I'm new to dart and I know this might be simple. But, I was not able to find a simple answer on, How do I enable paging in Flutter's GridView. I'm from a swift background where this can be achieved by just one line. collectionView.isPagingEnabled = true. Similarly how can I achieve this in dart?


Solution

  • Use PageView instead of GridView. Refer following code.

    new PageView.builder(
      scrollDirection: Axis.horizontal,
      itemCount: item.length,
      itemBuilder: (context, i) {
        return new Container();
      }
    )