A sliver is a portion of a scrollable area that you can define to behave in a special way. You can use slivers to achieve custom scrolling effects, such as elastic scrolling.
슬라이버는 특별한 방식으로 작동하도록 정의할 수 있는 스크롤 가능한 영역의 일부입니다. 슬라이버를 사용하여 탄력적 스크롤과 같은 사용자 지정 스크롤 효과를 얻을 수 있습니다.
flutter - Using Slivers to achieve fancy scrolling
SliverAppBar(
expandedHeight: 200.0,
floating: false,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
title: const Text('Sliver Demo'),
background: Image.network(
'https://picsum.photos/600/600',
fit: BoxFit.cover,
),
),
),
SliverPersistentHeader(
pinned: true,
delegate: _SliverAppBarDelegate(
minHeight: 60.0,
maxHeight: 60.0,
child: Container(
color: Colors.lightBlue,
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: const Text(
'고정 헤더',
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
),
),
),
),
),
SliverPadding(
padding: const EdgeInsets.all(8.0),
sliver: SliverGrid(
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200.0,
mainAxisSpacing: 10.0,
crossAxisSpacing: 10.0,
childAspectRatio: 1.0,
),
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Container(
alignment: Alignment.center,
color
: Colors.teal[100 * ((index % 8) + 1)],
child: Text('그리드 아이템 ${index + 1}'),
);
},
childCount: 12,
),
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return ListTile(
leading: CircleAvatar(
backgroundColor: Colors.blue,
child: Text('${index + 1}'),
),
title: Text('리스트 아이템 ${index + 1}'),
);
},
childCount: 20,
),
),
SliverFillRemaining(
hasScrollBody: false,
child: Container(
color: Colors.grey[200],
alignment: Alignment.center,
child: const Text(
'모든 콘텐츠가 표시되었습니다.',
style: TextStyle(fontSize: 18.0),
),
),
),