Flutter 패키지로 위젯이 화면 내 다른 위젯의 위치를 동적으로 따라갈 수 있게 해줍니다. 도구 설명, 플로팅 인디케이터 또는 타겟 위젯의 움직임을 추적하는 애니메이션 오버레이와 같은 상호작용 가능한 UI 요소를 만들기에 이상적입니다. 성능과 간편함을 고려해 설계되었으며, Android 및 iOS 플랫폼에서 원활하게 작동합니다. 패키지는 Flutter의 렌더링 파이프라인을 효율적으로 사용하여 거칠지 않은 부드러운 애니메이션을 보장합니다. 반응형 시각 피드백을 통해 사용자 경험을 향상시키고자 하는 개발자에게 완벽합니다.
사용 사례
동적 툴팁 만들기
콘텐츠를 추적하는 플로팅 액션 버튼 만들기
애니메이션 오버레이 설계
가이드 투어 구현
커서 또는 선택 경로 시각화
주요 기능
실시간 위젯 추적
부드러운 애니메이션 통합
크로스 플랫폼 호환성
최소한의 보일러플레이트
최소의 오버헤드로 효율적인 렌더링
적합한 대상
인터랙티브 요소를 찾는 UI/UX 디자이너
가이드된 온보딩 흐름을 구축하는 개발자
동적 시각 피드백이 필요한 앱
정교한 모바일 경험에 집중하는 팀
고려 사항
많은 추적 위젯이 있을 경우 성능에 영향을 미칠 수 있습니다
겹치는 것을 방지하기 위해 정확한 위치 조정이 필요합니다
정적 레이아웃에 적합하지 않습니다
저사양 기기에서 테스트 필요
경량 대상 위젯과 함께 사용하는 것이 가장 좋습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Getting Started
Select a widget that you want to follow and wrap it with a Leader widget. Give the Leader
widget a LeaderLink, to share with Followers.
Add a widget that you want to follow your Leader, and wrap it with a Follower widget.
// Follower appears 20px above the Leader.Follower.withOffset(
link: _leaderLink,
offset: constOffset(0, -20),
leaderAnchor: Alignment.topCenter,
followerAnchor: Alignment.bottomCenter,
child: YourFollowerWidget(),
);
Follower's can position themselves with a constant distance from a Leader using .withOffset(),
as shown above. Or, Follower's can choose their exact location on every frame by using
.withAligner().
// Follower appears where the aligner says it should.Follower.withAligner(
link: _leaderLink,
aligner: _aligner,
child: YourFollowerWidget(),
);
To constrain where your Follower is allowed to appear, pass a boundary to your Follower.
// Follower is constrained by the given boundary.Follower.withAligner(
link: _leaderLink,
aligner: _aligner,
boundary: _boundary,
child: YourFollowerWidget(),
);
Building multiple widgets without layouts
Building follower widgets is a bit unusual with Flutter. Typically, whenever we build multiple
widgets in Flutter, we place them in a layout container, such as Column, Row, or Stack.
But follower widgets don't respect ancestor layout rules. That's the whole point.
follow_the_leader introduces a new container widget, which builds children, but doesn't attempt
to apply any particular layout rules. The primary purpose of this widget is to make it clear to
readers that you aren't trying to layout the children.
The BuildInOrder widget builds each child widget in the order that it's provided. This fact is
important because Leader widgets must be built before their Followers. But BuildInOrder does
not impose any Offset on its children. BuildInOrder passes its parent's constraints down to the
children.