Flutter-Bounty-Hunters / follow_the_leader

MIT License
13 stars 5 forks source link

Point at Leader automatically, and repaint Follower child when Leader moves (Resolves #15) #16

Closed matthew-carroll closed 1 year ago

matthew-carroll commented 1 year ago

Point at Leader automatically, and repaint Follower child when Leader moves (Resolves #15)

Reworks the example app so that it uses Overlords new LeaderMenuFocalPoint to orient the menu arrow towards the Leader. The example app is no longer responsible for tracking the Leader's global offset and reporting it to the popover menu.

The LeaderLink now notifies listeners whenever the Leader's size or offset changes. Follower widgets now have a boolean property called repaintWhenLeaderChanges. When that property is true, the Follower will mark the child widget as needing to repaint whenever the LeaderLink changes. This change is needed because Followers such as menus with arrows need to paint based on the Leader location, and moving the Leader won't necessary rebuild a Follower. Therefore, the Follower needs an opportunity to repaint outside the standard widget tree rebuild process.