v0.5.0scroll_pos
스크롤 컨트롤러에 스크린 기준으로 항목 위치를 정의하기 위한 몇 가지 추가 기능을 제공합니다.
74좋아요 20만30일 다운로드160Pub 점수
AndroidiOSWebmacOSWindowsLinux
스크롤 컨트롤러에 스크린 기준으로 항목 위치를 정의하기 위한 몇 가지 추가 기능을 제공합니다.
{"sdk":"flutter"}{"sdk":"flutter"}^1.0.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Provides some additional functions to ScrollController to define item position relative to the screen.
A live version is available here.
scrollpos_demo
Note: this works on condition that all items have the same height !
// Create a ScrollPosController (don't forget to set and update itemCount !)
final controller = ScrollPosController(itemCount: itemCount);
// Assign the controller to a scrollable item (like an ListView)
ListView(
controller: controller,
children: [
...
];
);
// Control the controller
TextButton(
child: Text('To item'),
onPressed: () {
setState(() {
controller.scrollToItem(index);
});
},
);
void scrollTop({bool? animate}) : Go to the first itemvoid scrollBottom({bool? animate}) : Go to the last itemvoid scrollToItem(int index, {bool? animate, bool center = false}) : Makes the item visible on the screen