CustomScrollView
는 physics:
라는 property를 이용해,
ListView의 scroll물리를 설정할 수 있습니다.
앱 제작에는 다음 두 가지 물리가 사용되었습니다.
CustomScrollView(
physics: BouncingScrollPhysics(), //튕겨나가며, 배경이 늘어남
slivers: <Widget>[
SliverAppBar(
pinned: true,
. . .
CustomScrollView(
physics: RangeMaintainingScrollPhysics(), //전체 길이만큼만 움직여짐
slivers: <Widget>[
SliverAppBar(
pinned: true,
. . .
RangeMaintainingScrollPhysics 에서는
ListView가 끝단에 다다를 때 Glow가 발생했습니다.
Glow는 scrollBehavior:
에 속하는 요소로,
해당 property를 새로 정의해 Glow를 없앨 수 있었습니다.
class NoBehavior extends ScrollBehavior {
Widget buildViewportChrome(
BuildContext context, Widget child, AxisDirection axisDirection) {
return child;
}
}
CustomScrollView(
physics: RangeMaintainingScrollPhysics(),
controller: _scrollController,
scrollBehavior: NoBehavior(), //behavior 적용
slivers: <Widget>[
SliverAppBar(
pinned: true,
. . .
전체 소스는 git페이지에서 조회할 수 있습니다.
Page 소스코드: Git: ISHNN032/toss_clone/ . . . /homepage.dart
전체 소스코드: Git: ISHNN032/toss_clone