gridded_pageview 0.1.0 copy "gridded_pageview: ^0.1.0" to clipboard
gridded_pageview: ^0.1.0 copied to clipboard

A simple widget that displays children in a grid and multiple pages.

gridded_pageview #

A simple flutter widget based on code used multiple private projects. Pass a list of similar sized widgets to the GriddedPageView and set a preferred size to display them in a combination of GridView and PageView. GriddedPageView distrubutes its children over these pages depending on the available size.

This widget uses page_indicator.

Demo GriddedPageView

Usage #

Example (see example main.dart):

GriddedPageView(
  controller: _controller,
  preferredChildWidth: 160,
  preferredChildHeight: 160,
  children: List<Widget>.generate(20, (int index) {
    return Container(
      color: Color((Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0),
    );
  }),
  // overlapIndicator: false,
);

GriddedPageView accepts the following arguments:

  • controller (required): a PageController
  • children (required): a List of Widgets
  • minChildWidth (required): the minimum width of each child. Used to calculate how many columns can fit on a page
  • minChildHeight(required): the minimum height of each child. Used to calculate how many rows can fit on a page
  • onPageChanged: a callback used to report a page change
  • onPageAmountChanged: a callback used to report a change in the amount of pages
  • showIndicator: whether to show the page indicator (true by default)
  • overLapIndicator: whether the page indicator should overlap the children (true by default)
  • pagePadding: padding around the page content (GridView)
  • indicatorPadding: padding around the page indicator
  • indicatorColor: color of the page indicator
  • indicatorSelectorColor: color of the current page indicator

Contributing #

Feel free to ask questions, report issues, fork and create pull requests.

I will not maintain this actively beyond my specific needs, so don't expect me to implement new features.

7
likes
120
pub points
59%
popularity

Publisher

unverified uploader

A simple widget that displays children in a grid and multiple pages.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, page_indicator

More

Packages that depend on gridded_pageview