Created
May 13, 2020 13:00
-
-
Save letsar/cd2696b296f0cd49923785e587e40188 to your computer and use it in GitHub Desktop.
RenderSliverGap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RenderSliverGap extends RenderSliver { | |
RenderSliverGap({ | |
double mainAxisExtent, | |
}) : _mainAxisExtent = mainAxisExtent; | |
double get mainAxisExtent => _mainAxisExtent; | |
double _mainAxisExtent; | |
set mainAxisExtent(double value) { | |
if (_mainAxisExtent != value) { | |
_mainAxisExtent = value; | |
markNeedsLayout(); | |
} | |
} | |
@override | |
void performLayout() { | |
final double paintExtent = calculatePaintOffset( | |
constraints, | |
from: 0, | |
to: mainAxisExtent, | |
); | |
final double cacheExtent = calculateCacheOffset( | |
constraints, | |
from: 0, | |
to: mainAxisExtent, | |
); | |
assert(paintExtent.isFinite); | |
assert(paintExtent >= 0.0); | |
geometry = SliverGeometry( | |
scrollExtent: mainAxisExtent, | |
paintExtent: paintExtent, | |
cacheExtent: cacheExtent, | |
maxPaintExtent: mainAxisExtent, | |
hasVisualOverflow: mainAxisExtent > constraints.remainingPaintExtent || | |
constraints.scrollOffset > 0.0, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment