FLUTTER ECOSYSTEM

WinXaito/scroll_pos

스크롤 컨트롤러에 스크린 기준으로 항목 위치를 정의하기 위한 몇 가지 추가 기능을 제공합니다.

scroll_pos 프로젝트 이미지
Stars
11
Forks
0
최근 푸시(UTC)
2024. 5. 28.
프로젝트 상태
활성
Kevin Vuilleumier GitHub avatar
GITHUB User

Kevin Vuilleumier ↗

언어C++DartCMakeHTMLCCSS

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^1.0.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

Scroll Position

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 !

Usage

// 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);
    });
  },
);

Main methods

  • void scrollTop({bool? animate}) : Go to the first item
  • void scrollBottom({bool? animate}) : Go to the last item
  • void scrollToItem(int index, {bool? animate, bool center = false}) : Makes the item visible on the screen