Issue 1:
I got an unexpected exceptions "Explosion" when switching my android virtual device from 4.7 WXGA to Nexus 6 (nothing fancy, just default configs). The screen causing the crash had a Gridview widget with gridDelegate SliverGridDelegateWithFixedCrossAxisCount, built with the .builder() constructor, since I am building a calendar with markers inside and it comes more handy to have a function creating the children.

From what I understood from the Exception Stacktrace it looks like a numeric issue when computing the children sizes: 440.8163265306122 is very, very, very close to 440.81632653061223, but yet bigger.

I/flutter ( 5159): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 5159): The following assertion was thrown during performLayout():
I/flutter ( 5159): SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
I/flutter ( 5159): The maxPaintExtent is 440.8163265306122, but the paintExtent is 440.81632653061223. Maybe you have
I/flutter ( 5159): fallen prey to floating point rounding errors, and should explicitly apply the min() or max()
I/flutter ( 5159): functions, or the clamp() method, to the paintExtent? By definition, a sliver can't paint more than
I/flutter ( 5159): the maximum that it can paint!
I/flutter ( 5159): The RenderSliver that returned the offending geometry was:
I/flutter ( 5159): RenderSliverGrid#c2075 relayoutBoundary=up20 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 5159): creator: SliverGrid ← ShrinkWrappingViewport ← _ScrollableScope ← IgnorePointer-[GlobalKey#45e4e]
I/flutter ( 5159): ← Listener ← _GestureSemantics ←
I/flutter ( 5159): RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#7ff23] ← RepaintBoundary ←
I/flutter ( 5159): CustomPaint ← RepaintBoundary ← NotificationListener<ScrollNotification> ←
I/flutter ( 5159): GlowingOverscrollIndicator ← ⋯
I/flutter ( 5159): parentData: layoutOffset=0.0 (can use size)
I/flutter ( 5159): constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle,
I/flutter ( 5159): scrollOffset: 0.0, remainingPaintExtent: Infinity, crossAxisExtent: 411.4, viewportMainAxisExtent:
I/flutter ( 5159): Infinity)
I/flutter ( 5159): geometry: SliverGeometry(scrollExtent: 440.8, paintExtent: 440.8, maxPaintExtent: 440.8,
I/flutter ( 5159): hasVisualOverflow: true, )
I/flutter ( 5159): currently live children: 0 to 41

the code experiencing the bug looks like::

Widget build(BuildContext context) {
return new Scaffold(
body: new Scrollbar(
child: new ListView(
controller: _scrollController,
shrinkWrap: true,
children: <Widget>[
***
new GridView.builder(
shrinkWrap: true,
controller: _scrollController,
itemCount: countDays(firstDay),
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7,
childAspectRatio: 4 / 5,
),
itemBuilder: calendarTileBuilder,
),

While changing childAspectRatio to 4.1/5 does not reproduce the bug.

Issue 2:
Steps to Reproduce

I have been trying to use the following Calendar widget: flutter_calendar

However, when expanding the calendar an assertion fails in SliverGeometry.

The error occurs when run on a Nexus 6 emulator.

Code to reproduce:

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_calendar/flutter_calendar.dart';

void main() {
runApp(new MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new CupertinoTabScaffold(
tabBar: new CupertinoTabBar(
items: <BottomNavigationBarItem>[
new BottomNavigationBarItem(
icon: const Icon(CupertinoIcons.home),
title: const Text("Calendar"),
),
new BottomNavigationBarItem(
icon: const Icon(CupertinoIcons.home),
title: const Text("Calendar"),
),
new BottomNavigationBarItem(
icon: const Icon(CupertinoIcons.home),
title: const Text("Calendar"),
),
new BottomNavigationBarItem(
icon: const Icon(CupertinoIcons.home),
title: const Text("Calendar"),
),
],
),
tabBuilder: (BuildContext context, int index) {
return new DefaultTextStyle(
style: const TextStyle(
fontFamily: '.SF UI Text',
fontSize: 17.0,
color: CupertinoColors.black,
),
child: new CupertinoTabView(
builder: (BuildContext context) {
return new CupertinoPageScaffold(
navigationBar: new CupertinoNavigationBar(
middle: const Text('Calendar'),
),
child: new Material(child: new Calendar(isExpandable: true)));
},
),
);
},
),
);
}
}

I have tracked it down to the GridView.count function. Modifying the childAspectRatio to 1.0 (instead of the 1.5 in the library) fixed the error.

To fix this issue (at-least) 2 things can be done.

The assertion could be changed to a proper floating point comparison or the doubles should be rounded after dividing by childAspectRatio.

Logs

[+22570 ms] I/flutter ( 5110): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
[ +4 ms] I/flutter ( 5110): The following assertion was thrown during performLayout():
[ ] I/flutter ( 5110): SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
[ ] I/flutter ( 5110): The maxPaintExtent is 235.10204081632654, but the paintExtent is 235.10204081632656. Maybe you have
[ ] I/flutter ( 5110): fallen prey to floating point rounding errors, and should explicitly apply the min() or max()
[ ] I/flutter ( 5110): functions, or the clamp() method, to the paintExtent? By definition, a sliver can't paint more than
[ ] I/flutter ( 5110): the maximum that it can paint!
[ ] I/flutter ( 5110): The RenderSliver that returned the offending geometry was:
[ ] I/flutter ( 5110): RenderSliverGrid#d09cf relayoutBoundary=up21 NEEDS-LAYOUT NEEDS-PAINT
[ ] I/flutter ( 5110): creator: SliverGrid ← SliverPadding ← ShrinkWrappingViewport ← _ScrollableScope ←
[ ] I/flutter ( 5110): IgnorePointer-[GlobalKey#abc6e] ← Semantics ← Listener ← _GestureSemantics ←
[ ] I/flutter ( 5110): RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#9015c] ←
[ ] I/flutter ( 5110): _ExcludableScrollSemantics-[GlobalKey#141ba] ← RepaintBoundary ← CustomPaint ← ⋯
[ ] I/flutter ( 5110): parentData: paintOffset=Offset(0.0, 0.0) (can use size)
[ ] I/flutter ( 5110): constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle,
[ ] I/flutter ( 5110): scrollOffset: 0.0, remainingPaintExtent: 587.4, crossAxisExtent: 411.4, crossAxisDirection:
[ ] I/flutter ( 5110): AxisDirection.right, viewportMainAxisExtent: 587.4)
[ ] I/flutter ( 5110): geometry: SliverGeometry(scrollExtent: 235.1, paintExtent: 235.1, maxPaintExtent: 235.1,
[ ] I/flutter ( 5110): hasVisualOverflow: true)
[ ] I/flutter ( 5110): currently live children: 0 to 41
[ +2 ms] I/flutter ( 5110): When the exception was thrown, this was the stack:
[ +4 ms] I/flutter ( 5110): #0 SliverGeometry.debugAssertIsValid.<anonymous closure>.verify (package:flutter/src/rendering/sliver.dart:542)
[ ] I/flutter ( 5110): #1 SliverGeometry.debugAssertIsValid.<anonymous closure> (package:flutter/src/rendering/sliver.dart:559)
[ ] I/flutter ( 5110): #2 SliverGeometry.debugAssertIsValid (package:flutter/src/rendering/sliver.dart:571)
[ ] I/flutter ( 5110): #3 RenderSliver.debugAssertDoesMeetConstraints (package:flutter/src/rendering/sliver.dart:925)
[ ] I/flutter ( 5110): #4 RenderObject.layout.<anonymous closure> (package:flutter/src/rendering/object.dart:1572)
[ ] I/flutter ( 5110): #5 RenderObject.layout (package:flutter/src/rendering/object.dart:1572)
[ ] I/flutter ( 5110): #6 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:182)
[ ] I/flutter ( 5110): #7 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #8 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:285)
[ ] I/flutter ( 5110): #9 RenderShrinkWrappingViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1335)
[ ] I/flutter ( 5110): #10 RenderShrinkWrappingViewport.performLayout (package:flutter/src/rendering/viewport.dart:1298)
[ ] I/flutter ( 5110): #11 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #12 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #13 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #14 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #15 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #16 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ +7 ms] I/flutter ( 5110): #17 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #18 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #19 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #20 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #21 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #22 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #23 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #24 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #25 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #26 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #27 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #28 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #29 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #30 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #31 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #32 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #33 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #34 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #35 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #36 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:509)
[ ] I/flutter ( 5110): #37 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #38 RenderAnimatedSize.performLayout (package:flutter/src/rendering/animated_size.dart:172)
[ ] I/flutter ( 5110): #39 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #40 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #41 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1141)
[ ] I/flutter ( 5110): #42 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #43 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:798)
[ ] I/flutter ( 5110): #44 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #45 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #46 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #47 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:107)
[ ] I/flutter ( 5110): #48 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1141)
[ ] I/flutter ( 5110): #49 RenderObject.layout (package:flutter/src/rendering/object.dart:1570)
[ ] I/flutter ( 5110): #50 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:509)
[ ] I/flutter ( 5110): #51 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1445)
[ ] I/flutter ( 5110): #52 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:709)
[ ] I/flutter ( 5110): #53 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:270)
[ ] I/flutter ( 5110): #54 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:622)
[ ] I/flutter ( 5110): #55 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208)
[ ] I/flutter ( 5110): #56 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990)
[ ] I/flutter ( 5110): #57 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930)
[ ] I/flutter ( 5110): #58 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842)
[ ] I/flutter ( 5110): #59 _invoke (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:120)
[ ] I/flutter ( 5110): #60 _drawFrame (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:109)
[ +1 ms] I/flutter ( 5110): The following RenderObject was being processed when the exception was fired:
[ ] I/flutter ( 5110): RenderSliverGrid#d09cf relayoutBoundary=up21 NEEDS-LAYOUT NEEDS-PAINT
[ ] I/flutter ( 5110): creator: SliverGrid ← SliverPadding ← ShrinkWrappingViewport ← _ScrollableScope ←
[ ] I/flutter ( 5110): IgnorePointer-[GlobalKey#abc6e] ← Semantics ← Listener ← _GestureSemantics ←
[ ] I/flutter ( 5110): RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#9015c] ←
[ ] I/flutter ( 5110): _ExcludableScrollSemantics-[GlobalKey#141ba] ← RepaintBoundary ← CustomPaint ← ⋯
[ ] I/flutter ( 5110): parentData: paintOffset=Offset(0.0, 0.0) (can use size)
[ ] I/flutter ( 5110): constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle,
[ ] I/flutter ( 5110): scrollOffset: 0.0, remainingPaintExtent: 587.4, crossAxisExtent: 411.4, crossAxisDirection:
[ ] I/flutter ( 5110): AxisDirection.right, viewportMainAxisExtent: 587.4)
[ ] I/flutter ( 5110): geometry: SliverGeometry(scrollExtent: 235.1, paintExtent: 235.1, maxPaintExtent: 235.1,
[ ] I/flutter ( 5110): hasVisualOverflow: true)
[ ] I/flutter ( 5110): currently live children: 0 to 41
[ ] I/flutter ( 5110): This RenderObject had the following descendants (showing up to depth 5):
[ ] I/flutter ( 5110): RenderRepaintBoundary#1c3d3 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderDecoratedBox#ccfc8 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderSemanticsGestureHandler#310bd NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPointerListener#f448b NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPositionedBox#3382f NEEDS-PAINT
[ ] I/flutter ( 5110): RenderRepaintBoundary#a469d NEEDS-PAINT
[ ] I/flutter ( 5110): RenderDecoratedBox#4a231 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderSemanticsGestureHandler#e018a NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPointerListener#64a4b NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPositionedBox#44799 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderRepaintBoundary#b4867 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderDecoratedBox#efe66 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderSemanticsGestureHandler#394a5 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPointerListener#46627 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPositionedBox#e9335 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderRepaintBoundary#01d08 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderDecoratedBox#1bc94 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderSemanticsGestureHandler#e8563 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPointerListener#3d490 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPositionedBox#22abe NEEDS-PAINT
[ ] I/flutter ( 5110): RenderRepaintBoundary#e8141 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderDecoratedBox#68b52 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderSemanticsGestureHandler#d5337 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPointerListener#59059 NEEDS-PAINT
[ ] I/flutter ( 5110): RenderPositionedBox#34a1e NEEDS-PAINT
[ ] I/flutter ( 5110): ...(descendants list truncated after 25 lines)
[ ] I/flutter ( 5110): ════════════════════════════════════════════════════════════════════════════════════════════════════
[ +1 ms] I/flutter ( 5110): Another exception was thrown: SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
[ ] I/flutter ( 5110): Another exception was thrown: SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
[ +24 ms] I/flutter ( 5110): Another exception was thrown: SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
[ ] I/flutter ( 5110): Another exception was thrown: SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
[ ] I/flutter ( 5110): Another exception was thrown: SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".
[ +231 ms] I/flutter ( 5110): Another exception was thrown: SliverGeometry is not valid: The "maxPaintExtent" is less than the "paintExtent".

Flutter Doctor

[✓] Flutter (Channel beta, v0.2.3, on Linux, locale en_US.UTF-8)
• Flutter version 0.2.3 at /home/julius/flutter
• Framework revision 5a58b36e36 (3 weeks ago), 2018-03-13 13:20:13 -0700
• Engine revision e61bb9ac3a
• Dart version 2.0.0-dev.35.flutter-290c576264

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /home/julius/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /usr/local/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
• All Android licenses accepted.

[✓] Android Studio (version 3.0)
• Android Studio at /usr/local/android-studio
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.2)
• IntelliJ at /home/julius/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/172.4343.14
• Flutter plugin version 21.2.2
• Dart plugin version 172.4343.25

[!] IntelliJ IDEA Ultimate Edition (version 2017.1)
• IntelliJ at /home/julius/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/171.4694.23
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.io/intellij-setup/#installing-the-plugins

[!] VS Code (version 1.16.1)
• VS Code at /usr/share/code
• Dart Code extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code

[✓] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (emulator)

! Doctor found issues in 2 categories.