v1.3.0
lazy_load_scrollview
페이지의 하단에 도달했을 때 콜백을 트리거하는 ScrollView용 래퍼
434좋아요 1.8만30일 다운로드150Pub 점수
AndroidiOSWebmacOSWindowsLinux
지연 로딩을 가능하게 하는 Flutter ScrollView용 래퍼
{"sdk":"flutter"}{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A wrapper for a ScrollView that will enable lazy loading
Add lazy_load_scrollview dependency to your pubspec.yaml:
dependencies:
lazy_load_scrollview: 1.3.0
In your Dart code, import package:lazy_load_scrollview/lazy_load_scrollview.dart
Then you can wrap your ListView, GridView, RefreshIndicator etc with the LazyLoadScrollView.
Make sure you add an endOfPageListener which will receive the call when the bottom of the list has been reached.
import 'package:lazy_load_scrollview/lazy_load_scrollview.dart';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: LazyLoadScrollView(
onEndOfPage: () => loadMore(),
child: ListView.builder(
itemCount: data.length,
itemBuilder: (context, position) {
return Text("Position $position");
},
),
),
);
}
LazyLoadScrollView(
endOfPageListener: () => loadMore(), // The callback when reaching the end of the list
scrollOffset: 100 // Pixels from the bottom that should trigger a callback
child: Widget, // A subclass of `ScrollView`
);