Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Compose
- textfield
- Navigation
- Button
- Coroutines
- scroll
- LifeCycle
- 앱
- appbar
- livedata
- 앱바
- Dialog
- TEST
- CustomScrollView
- tabbar
- Kotlin
- activity
- binding
- Flutter
- viewmodel
- intent
- 안드로이드
- android
- DART
- textview
- ScrollView
- 계측
- data
- drift
- 테스트
Archives
- Today
- Total
목록Offset (1)
Study Record
[Flutter] 실시간 스크롤 offset 알아보기
✍ 실시간 스크롤 offset 알아보기 사용자가 스크롤 위젯을 스크롤할 때마다 얼마큼 스크롤 됐는지 알고 싶을 때가 있다. 이럴 때 ScrollController 를 사용하여 리스너를 추가해 주면 된다. 스크롤 위젯은 controller 인자가 있는 위젯이면 가능하다. (ex. ListView, GridView, CustomScrollView 등) 원하는 스크롤 뷰의 controller 인자에 미리 선언한 scrollController 를 넣고 addListener 함수로 리스너 함수를 선언해 주면 scrollController.offset 값으로 현재 스크롤 값을 알 수 있다. 위젯이 사라지기 전에 removeListener 와 dispose 를 해주는 것도 하면 안전하게 ScrollController..
Flutter/widget_scrollView
2023. 3. 16. 21:44