EdsonBueno / infinite_scroll_pagination

Flutter package to help you lazily load and display pages of items as the user scrolls down your screen.
https://pub.dev/packages/infinite_scroll_pagination
MIT License
605 stars 201 forks source link

Simplify grid appendix location #289

Closed clragon closed 4 months ago

clragon commented 9 months ago

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.

clragon commented 4 months ago

shelving this idea for now.