EdsonBueno / infinite_scroll_pagination

Flutter package to help you lazily load and display pages of items as the user scrolls down your screen.

Home Page:https://pub.dev/packages/infinite_scroll_pagination

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplify grid appendix location

clragon opened this issue · comments

Instead of offering three different options, which I assume are often set to the exact same value like this:

    this.showNewPageProgressIndicatorAsGridChild = true,
    this.showNewPageErrorIndicatorAsGridChild = true,
    this.showNoMoreItemsIndicatorAsGridChild = true,

We could specify an Object as config:

@immutable
class GridAppendixLocation {
  static const GridAppendixLocation.asGridChild = GridAppendixLocation({
    showNewPageProgressIndicatorAsGridChild: true,
    showNewPageErrorIndicatorAsGridChild: true,
    showNoMoreItemsIndicatorAsGridChild: true,
  });
  
  static const GridAppendixLocation.afterItems = GridAppendixLocation({
    showNewPageProgressIndicatorAsGridChild: false,
    showNewPageErrorIndicatorAsGridChild: false,
    showNoMoreItemsIndicatorAsGridChild: false,
  });

  const GridAppendixLocation({
    required this.showNewPageProgressIndicatorAsGridChild,
    required this.showNewPageErrorIndicatorAsGridChild,
    required this.showNoMoreItemsIndicatorAsGridChild,
   });

   final showNewPageProgressIndicatorAsGridChild;
   final showNewPageErrorIndicatorAsGridChild;
   final showNoMoreItemsIndicatorAsGridChild;
}

this would allow us to write something like

  PagedGrid(
    appendixLocation: GridAppendixLocation.asGridChild,
  )

or

  PagedGrid(
    appendixLocation: GridAppendixLocation.afterItems,
  )

which is shorter and more concise but does not miss out on configurability.
It would also allow us to unify these parameters accross all Grids.
This would be a breaking change.

shelving this idea for now.