title: SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent" in Flutter
body: <p>My whole application perfectly work in Emulator and Moto-G5S but i found error to load data in SliverGrid View in Samsung Galaxy A6+. 
  My Error was "The maxPaintExtent is less than the paintExtent, The maxPaintExtent is 177.5, but the paintExtent is 612.0. By definition, a sliver can't paint more than the maximum that it can paint!"</p>
  
  <p>I tried different SliverGrid gridDelegate like,        maxCrossAxisExtent: 300.0, mainAxisSpacing: 5.0, crossAxisSpacing: 5.0, childAspectRatio: 1.0 but still i'm not getting fix it.
  How anc i set maxPaintExtent?
  Thanks in advance.</p>
  
  <p>series.dart</p>
  
  <pre><code>class SeriesScreen extends StatefulWidget {
    SeriesScreen({Key key}) : super(key: key);
  
    @override
    _SeriesScreenState createState() =&gt; new _SeriesScreenState();
  }
  
  class _SeriesScreenState extends State&lt;SeriesScreen&gt; {
    bool isHomeDataLoading;
  
    @override
    void initState() {
      super.initState();
      isHomeDataLoading = false;
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        backgroundColor: Colors.white,
        appBar: ComComp.getAppBar(COLORS.SERIES_THEME_COLOR, STRING_NAME.SERIES_MOVIE),
        body: CustomScrollView(
          shrinkWrap: false,
          slivers: &lt;Widget&gt;[
            makeHeader(STRING_NAME.MOVIE),
            Container(
              child: FutureBuilder(
                  future: Services.getMovies(),
                  initialData: [],
                  builder: (context, snapshot) {
                    //if (snapshot.connectionState == ConnectionState.done) {
                      return ComComp.sliverGridMovies(snapshot, movieGridClicked);
                    //} else {
                    //  ComComp.circularProgress(COLORS.SERIES_THEME_COLOR);
                   // }
                  }),
            ),
  
            makeHeader(STRING_NAME.SERIES),
            Container(
              child: FutureBuilder(
                  future: Services.getSeries(),
                  initialData: [],
                  builder: (context, snapshot) {
                    //if (snapshot.connectionState == ConnectionState.done) {
                      return ComComp.sliverGridSeries(snapshot, seriesGridClicked);
                    //} else {
                    //  ComComp.circularProgress(COLORS.SERIES_THEME_COLOR);
                    //}
                  }),
            ),
          ],
        ),
      );
    }
  
    setLoading(bool loading) {
      setState(() {
        isHomeDataLoading = loading;
      });
    }
  
    fetch() {setLoading(true);}
  }
  
  SliverPersistentHeader makeHeader(String headerText) {
    return SliverPersistentHeader(
      pinned: true,
      delegate: _SliverAppBarDelegate(
        minHeight: 60.0,
        maxHeight: 130.0,
        child: Container(
          //color: COLORS.COMPLY,
            color: COLORS.CRAFT_THEME_COLOR,
            child: Center(
              child: Text(headerText,
                style: TextStyle(
                    fontFamily: 'Chewy', fontWeight: FontWeight.w500,
                    color: Colors.white, fontSize: 32, letterSpacing: 2.0),
              ),
            )
        ),
      ),
    );
  }
  
  
  
  class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
    _SliverAppBarDelegate({
      @required this.minHeight,
      @required this.maxHeight,
      @required this.child,
    });
  
    final double minHeight;
    final double maxHeight;
    final Widget child;
    @override
    double get minExtent =&gt; minHeight;
    @override
    double get maxExtent =&gt; math.max(maxHeight, minHeight);
    @override
    Widget build(
        BuildContext context,
        double shrinkOffset,
        bool overlapsContent)
    {
      return SizedBox.expand(child: child);
    }
    @override
    bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
      return maxHeight != oldDelegate.maxHeight;
    }
  }
  
  movieGridClicked(BuildContext context, CellModel model) {
    // Grid Click
        Navigator.push(context,
            MaterialPageRoute(
                builder: (context) =&gt; VideoPlayerScreen(model.title, model.url)));
    //SnackBar Msg:
    //Scaffold.of(context).showSnackBar(new SnackBar(content: Text(model.title),));
  }
  
  seriesGridClicked(BuildContext context, SeriesModel model) {
    // Grid Click
        Navigator.push(context,
            MaterialPageRoute(
                builder: (context) =&gt; EpisodeScreen(model.id.toString(), model.title)));
    //SnackBar Msg:
    //Scaffold.of(context).showSnackBar(new SnackBar(content: Text(model.title),));
  }
  </code></pre>
  
  <p>comcomp.dart</p>
  
  <pre><code>static SliverGrid sliverGridMovies (AsyncSnapshot snapshot, Function gridClicked){
      var values = snapshot.data;
  
      return SliverGrid(
        delegate: SliverChildBuilderDelegate(
              (BuildContext context, int index) {
            return GestureDetector(
              child: Cell(COLORS.SERIES_THEME_COLOR, values[index]),
              onTap: () =&gt; gridClicked(context, values[index]),
            );
          },
          childCount: values == null ? 0 : values.length,
        ),
        gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
          maxCrossAxisExtent: 300.0,
          mainAxisSpacing: 5.0,
          crossAxisSpacing: 5.0,
          childAspectRatio: 1.0,
        ),
      );
    }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>I/flutter (21918): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═══
  I/flutter (21918): The following assertion was thrown during performLayout():
  I/flutter (21918): SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
  I/flutter (21918): The maxPaintExtent is 177.5, but the paintExtent is 612.0. By definition, a sliver can't paint more
  I/flutter (21918): than the maximum that it can paint!
  I/flutter (21918): The RenderSliver that returned the offending geometry was:
  I/flutter (21918):   RenderSliverGrid#7ddfe relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT
  I/flutter (21918):   creator: SliverGrid ← FutureBuilder&lt;List&lt;dynamic&gt;&gt; ← Container ← Viewport ←
  I/flutter (21918):   IgnorePointer-[GlobalKey#8bde6] ← Semantics ← Listener ← _GestureSemantics ←
  I/flutter (21918):   RawGestureDetector-[LabeledGlobalKey&lt;RawGestureDetectorState&gt;#55565] ← Listener ← _ScrollableScope
  I/flutter (21918):   ← _ScrollSemantics-[GlobalKey#062a8] ← ⋯
  I/flutter (21918):   parentData: paintOffset=Offset(0.0, 0.0) (can use size)
  I/flutter (21918):   constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward,
  I/flutter (21918):   ScrollDirection.forward, scrollOffset: 379.7, remainingPaintExtent: 612.0, overlap: 60.0,
  I/flutter (21918):   crossAxisExtent: 360.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 612.0,
  I/flutter (21918):   remainingCacheExtent: 1112.0 cacheOrigin: -250.0 )
  I/flutter (21918):   geometry: SliverGeometry(scrollExtent: 177.5, paintExtent: 612.0, maxPaintExtent: 177.5,
  I/flutter (21918):   hasVisualOverflow: true, cacheExtent: 1112.0)
  I/flutter (21918):   currently live children: 0 to 1
  
  I/flutter (21918)════════════════════════════════════════════════════
  I/flutter (21918): Another exception was thrown: SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
  I/chatty  (21918): uid=10250(com.globaltoons.globaltoons_mobile) 1.ui identical 1 line
  I/flutter (21918): Another exception was thrown: SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
  D/ViewRootImpl@93b5099[MainActivity](21918): ViewPostIme pointer 0
  D/ViewRootImpl@93b5099[MainActivity](21918): ViewPostIme pointer 1
  D/ViewRootImpl@93b5099[MainActivity](21918): ViewPostIme pointer 0
  </code></pre>