Skip to content

Commit

Permalink
Add FunctionalAligner
Browse files Browse the repository at this point in the history
  • Loading branch information
angelosilvestre committed Nov 16, 2023
1 parent 79367c2 commit a6ca79f
Showing 1 changed file 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

0 comments on commit a6ca79f

Please sign in to comment.