일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 파이썬
- valorant api dart
- flutter android 폴더
- 롤 api dart
- riot api dart
- flutter statefulwidget
- keychain error
- 롤토체스 api dart
- lol api dart
- Architectural overview
- widget
- 발로란트 api dart
- flutter
- flutter bloc
- AnimationController
- swift 동시성
- tft api dart
- dart new
- dart
- PlatformException(sign_in_failed
- flutter widget
- leetcode dart
- dart new 키워드
- swift concurrency
- flutter ios 폴더
- 파이썬 부동소수점
- dart.dev
- com.google.GIDSignIn
- generate parentheses dart
- docker overview
- Today
- Total
Coaspe
Flutter - CustomScollView 본문
Slivers를 이용한 커스텀 스크롤 effect를 생성하는 ScrollView 입니다.
CustomScrollView는 lists, grids expanding headers 같은 slivers들을 직접적으로 스크롤 effects에 사용 할 수 있게 해줍니다. 예를 들어 list, grid 가 따라오는 확장되는 app bar를 포함하는 scroll view를 만들고 싶다면 SliverAppBar, SliverList, and SliverGrid를 사용하세요.
이러한 Slivers에 있는 Widgets들은 반드시 RenderSliver 객체를 생성해야 합니다.
시작 스크롤 offset을 조절하고 싶다면, controller에 ScrollController.initialScrollOffset 속성을 추가하세요.
Accessibility
CustomScrollView는 Talkback/VoiceOver를 스크롤 상태가 변할 때 유저에게 알려주는 용도로 사용 할 수 있게 해줍니다. 예를 들어, 안드로이드에서 "23개 중 1 ~ 10개를 보고 있습니다."와 같은 표시(announcement)가 나올 것 입니다. 이런 표시를 만들고 싶다면, scroll view는 세개의 정보가 필요합니다.
1. 첫번째 볼 수 있는 자식의 인덱스
2. 자식들의 수
3. 볼 수 있는 자식들의 수
마지막 정보는 framework에 의해 정확하게 계산 될 수 있습니다. 그러나 첫번째와 두번째는 반드시 제공되어야 합니다. 대부분의 higher-level 스크롤 할 수 있는 위젯들은 이 정보를 자동으로 제공합니다. 예를 들어, ListView 는 각각의 자식 위젯을 시맨틱 인덱스로 자동적으로 제공하고 자식 수를 리스트의 길이로 설정합니다.
볼 수 있는 인덱스들을 결정하기 위해, scroll view는 생성된 각각의 스크롤 할 수 있는 아이템의 의미와 시맨틱 인덱스가 연관 될 수 있는 방법이 필요합니다. 이런 작업은 자식 위젯들을 IndexedSemantics로 감싸면 가능합니다.
이런 시맨틱 인덱스는 스크롤 할 수 있는 위젯 안에 있는 위젯의 인덱스와 같을 필요는 없습니다. 왜냐하면 몇몇 위젯들은 시맨틱 정보와 관련이 없을 수도 있기 때문입니다. ListView.separated를 생각해봅시다. 다른 모든 위젯은 시맨틱 정보가 없는 구분자 입니다. 이런 경우에 오직 홀수번째 위젯들만 시맨틱 인덱스를 가집니다. 게다가, 자식들의 수는 위젯들의 반이 될 것입니다. (ListView.separated 생성자는 이것을 자동으로 처리합니다;)
볼 수 있는 자식들의 수는 생성자 파라미터인 semanticChildCount로 제공 될 수 있습니다. 이 값은 반드시 IndexedSemantics로 감싸진 위젯들의 수와 같아야합니다.
See also:
- SliverList, which is a sliver that displays linear list of children.
- SliverFixedExtentList, which is a more efficient sliver that displays linear list of children that have the same extent along the scroll axis.
- SliverGrid, which is a sliver that displays a 2D array of children.
- SliverPadding, which is a sliver that adds blank space around another sliver.
- SliverAppBar, which is a sliver that displays a header that can expand and float as the scroll view scrolls.
- ScrollNotification and NotificationListener, which can be used to watch the scroll position without using a ScrollController.
- IndexedSemantics, which allows annotating child lists with an index for scroll announcements.
상속구조
생성자
Key? key,
Axis scrollDirection = Axis.vertical,
bool reverse = false,
ScrollController? controller, # scroll view가 스크롤되는 위치를 제어하는 데 사용할 수 있는 객체
bool? primary, # 부모 PrimaryScrollController 와 연결된 primary scroll view인지 여부
ScrollPhysics? physics, # 유저의 입력에 scroll view가 어떻게 반응 하는지 결정
ScrollBehavior? scrollBehavior, # 위젯 각각에 적용될 ScrollBehavior
bool shrinkWrap = false, # scrollDirection에서 scroll view의 범위를 보려는 내용에 따라 결정할지 여부
Key? center, # GrowthDirection.forward 의 첫번째 자식이 증가하는 방향
double anchor = 0.0, # scroll offset
double? cacheExtent, # 뷰포트는 볼 수 있는 영역의 앞과 뒤에 유저가 스크롤하면 보이게 될 아이템을 캐쉬하기 위한 공간이 있습니다.
List<Widget> slivers = const <Widget>[],
int? semanticChildCount,
DragStartBehavior dragStartBehavior = DragStartBehavior.start, # drag가 시작되는 행동을 어떻게 다룰 것인지 결정
ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual # 이 ScrollView가 어떻게 키보드를 자동적으로 접을 것인지 결정
String? restorationId, # 스크롤 할 수 있는 위젯의 스크롤 offset을 저장하고 복구하는 데 사용되는 ID
Clip clipBehavior = Clip.hardEdge # 요소들이 이 옵션에 의해 클립 됩니다.
})
'Flutter > API' 카테고리의 다른 글
Flutter - CupertinoButton (0) | 2023.02.17 |
---|---|
Flutter - CupertinoSliverNavigationBar (0) | 2023.02.17 |
Flutter - Hero (0) | 2023.02.17 |
Flutter - SafeArea (0) | 2023.02.17 |
Flutter - IndexedStack (0) | 2023.02.17 |