Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #248

Merged
merged 7 commits into from
Sep 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change signature of didChangeBoundaryConstraints
fujidaiti committed Sep 20, 2024
commit 2f69aaf0fcd11d9e59920040e08d3d9320ff2ac4
5 changes: 2 additions & 3 deletions lib/src/foundation/sheet_activity.dart
Original file line number Diff line number Diff line change
@@ -66,10 +66,9 @@ abstract class SheetActivity<T extends SheetExtent> {

void didChangeViewportDimensions(Size? oldSize, EdgeInsets? oldInsets) {}

// TODO: Change `double?`s to `Extent?`s.
void didChangeBoundaryConstraints(
double? oldMinPixels,
double? oldMaxPixels,
Extent? oldMinExtent,
Extent? oldMaxExtent,
) {}

/// Called when all relevant metrics of the sheet are finalized
12 changes: 3 additions & 9 deletions lib/src/foundation/sheet_extent.dart
Original file line number Diff line number Diff line change
@@ -268,15 +268,9 @@ abstract class SheetExtent extends ChangeNotifier
@mustCallSuper
void applyNewContentSize(Size contentSize) {
if (metrics.maybeContentSize != contentSize) {
final oldMaxPixels = metrics.maybeMaxPixels;
final oldMinPixels = metrics.maybeMinPixels;
_oldContentSize = metrics.maybeContentSize;
_updateMetrics(contentSize: contentSize);
activity.didChangeContentSize(_oldContentSize);
if (oldMinPixels != metrics.minPixels ||
oldMaxPixels != metrics.maxPixels) {
activity.didChangeBoundaryConstraints(oldMinPixels, oldMaxPixels);
}
}
}

@@ -297,10 +291,10 @@ abstract class SheetExtent extends ChangeNotifier
@mustCallSuper
void applyNewBoundaryConstraints(Extent minExtent, Extent maxExtent) {
if (minExtent != this.minExtent || maxExtent != this.maxExtent) {
final oldMinExtent = metrics.maybeMinExtent;
final oldMaxExtent = metrics.maybeMaxExtent;
_updateMetrics(minExtent: minExtent, maxExtent: maxExtent);
final oldMinPixels = metrics.maybeMinPixels;
final oldMaxPixels = metrics.maybeMaxPixels;
activity.didChangeBoundaryConstraints(oldMinPixels, oldMaxPixels);
activity.didChangeBoundaryConstraints(oldMinExtent, oldMaxExtent);
}
}