transparent_pointer
히트 테스팅을 제어하기 위해 TransparentPointer를 제공합니다
spkersten/flutter_transparent_pointer open-source repository details.
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
TransparentPointer is a widget that is invisible for its parent to hit testing, but still allows its subtree to receive pointer events. This is useful to allow a gesture detector that is visually behind another widget to still receive pointer events, while at the same time allowing that other widget to receive those events as well.
In this example, a drag can be started anywhere in the widget, including on top of the text button, even though the button is visually in front of the background gesture detector. At the same time, the button is tappable.
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onVerticalDragStart: (_) => print("Background drag started"),
),
Positioned(
top: 60,
left: 60,
height: 60,
width: 60,
child: TransparentPointer(
child: TextButton(
child: Text("Tap me"),
onPressed: () => print("You tapped me"),
),
),
),
],
);
}
}
의존성 목록 2 개
{"sdk":"flutter"}{"sdk":"flutter"}사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗