반응형 Flutter 꿀팁1 [Flutter 꿀팁] 특정 위젯 위치로 스크롤 이동하는 방법 - Scrollable.ensureVisible Flutter로 개발을 하다 보면 특정 이벤트 발생 시(예를 들어 버튼 클릭), 특정 위젯의 위치로 스크롤을 이동시켜야 하는 경우가 생긴다. 이때 유용한 메서드가 Scrollable.ensureVisible 이다. 사용법 사용법은 간단하다. GlobalKey를 선언 1에서 선언한 GlobalKey를 이동하길 원하는 위젯의 Key로 등록 Scrollable.ensureVisible의 첫 번째 파라미터로 위에서 선언된 GlobalKey의 currentContext를 넘기며 메서드를 실행 Scrollable.ensureVisible( globalKey.currentContext!, duration: const Duration(milliseconds: 500), curve: Curves.ease, ); 위와 같.. 2023. 4. 12. 이전 1 다음 반응형