Skip to content

Commit

Permalink
Merge pull request #28 from TatsuUkraine/release-2.0.1
Browse files Browse the repository at this point in the history
Release 2.0.1
  • Loading branch information
TatsuUkraine authored Jul 2, 2020
2 parents 4afc395 + a601fb4 commit 93adb25
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [2.0.1] - 2020-07-02

**Bug fixes**
- fixed constraint exceptions
- fixed min size calculation when content smaller than header

## [2.0.0] - 2020-07-02

**Features**
Expand Down
20 changes: 16 additions & 4 deletions lib/render.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,19 @@ class StickyListItemRenderObject<I> extends RenderStack {
final BoxConstraints constraints = this.constraints;
final RenderBox header = _headerBox;

double constraintWidth = constraints.minWidth;
double constraintHeight = constraints.minHeight;

final BoxConstraints containerConstraints = constraints.loosen();

header.layout(containerConstraints, parentUsesSize: true);

size = _layoutContent(containerConstraints, header.size);
final Size containerSize = _layoutContent(containerConstraints, header.size);

size = Size(
max(constraintWidth, containerSize.width),
max(constraintHeight, containerSize.height)
);

assert(size.width == constraints.constrainWidth(size.width));
assert(size.height == constraints.constrainHeight(size.height));
Expand Down Expand Up @@ -421,7 +429,7 @@ class StickyListItemRenderObject<I> extends RenderStack {

return Size(
contentSize.width + headerSize.width,
contentSize.height
max(contentSize.height, headerSize.height)
);
}

Expand Down Expand Up @@ -455,15 +463,19 @@ class StickyListItemRenderObject<I> extends RenderStack {
final Size contentSize = content.size;

return Size(
contentSize.width,
max(contentSize.width, headerSize.width),
contentSize.height + headerSize.height
);
}
}

content.layout(constraints, parentUsesSize: true);
final Size contentSize = content.size;

return content.size;
return Size(
max(contentSize.width, headerSize.width),
max(contentSize.height, headerSize.height),
);
}

static AlignmentGeometry _headerAlignment(ScrollableState scrollable, HeaderMainAxisAlignment mainAxisAlignment, HeaderCrossAxisAlignment crossAxisAlignment) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: >-
Can be customized or with config options or with override.
version: 2.0.0
version: 2.0.1
homepage: https://github.com/TatsuUkraine/flutter_sticky_infinite_list
repository: https://github.com/TatsuUkraine/flutter_sticky_infinite_list
issue_tracker: https://github.com/TatsuUkraine/flutter_sticky_infinite_list/issues
Expand Down

0 comments on commit 93adb25

Please sign in to comment.