Skip to content

Commit

Permalink
Add FunctionalAligner (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
angelosilvestre authored Nov 23, 2023
1 parent 79367c2 commit 8cffc3f
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/src/follower.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ class StaticOffsetAligner implements FollowerAligner {
}
}

/// A [FollowerAligner] that delegates to a callback function.
class FunctionalAligner implements FollowerAligner {
FunctionalAligner({
required this.delegate,
});

/// Called to determine the position of the [Follower].
final FollowerAlignment Function(Rect globalLeaderRect, Size followerSize) delegate;

@override
FollowerAlignment align(Rect globalLeaderRect, Size followerSize) {
return delegate(globalLeaderRect, followerSize);
}
}

class FollowerAlignment {
const FollowerAlignment({
required this.leaderAnchor,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test_goldens/goldens/follower_restricts-to-boundary_top-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8cffc3f

Please sign in to comment.