From 5f72a0d804eed7cfb8b9aa44ab2a321d6185e97c Mon Sep 17 00:00:00 2001 From: git-xiaocao Date: Thu, 14 Jul 2022 01:51:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AE=A9=E7=83=AD=E9=87=8D=E8=BD=BD?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=88=B7=E6=96=B0list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/loading_more_list.dart | 19 ++++++++++++------- lib/src/loading_more_sliver_list.dart | 13 ++++++++++--- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/lib/src/loading_more_list.dart b/lib/src/loading_more_list.dart index a801ee6..fbf9feb 100644 --- a/lib/src/loading_more_list.dart +++ b/lib/src/loading_more_list.dart @@ -4,15 +4,20 @@ import 'package:loading_more_list/src/glow_notification_widget.dart'; import 'package:loading_more_list/src/list_config/list_config.dart'; import 'package:loading_more_list_library/loading_more_list_library.dart'; -//loading more for listview and gridview -class LoadingMoreList extends StatelessWidget { +class LoadingMoreList extends StatefulWidget { + final ListConfig listConfig; + final NotificationListenerCallback? onScrollNotification; const LoadingMoreList(this.listConfig, {Key? key, this.onScrollNotification}) : super(key: key); - final ListConfig listConfig; - /// Called when a ScrollNotification of the appropriate type arrives at this - /// location in the tree. - final NotificationListenerCallback? onScrollNotification; + @override + State> createState() => _LoadingMoreListState(); +} + +class _LoadingMoreListState extends State> { + + late final listConfig = widget.listConfig; + late final onScrollNotification = widget.onScrollNotification; @override Widget build(BuildContext context) { @@ -55,4 +60,4 @@ class LoadingMoreList extends StatelessWidget { } return false; } -} +} \ No newline at end of file diff --git a/lib/src/loading_more_sliver_list.dart b/lib/src/loading_more_sliver_list.dart index d95f918..61d38ef 100644 --- a/lib/src/loading_more_sliver_list.dart +++ b/lib/src/loading_more_sliver_list.dart @@ -5,11 +5,18 @@ import 'package:loading_more_list/src/list_config/sliver_list_config.dart'; import 'package:loading_more_list_library/loading_more_list_library.dart'; //loading more for sliverlist and sliverGrid -class LoadingMoreSliverList extends StatelessWidget { - const LoadingMoreSliverList(this.sliverListConfig, {Key? key}) - : super(key: key); +class LoadingMoreSliverList extends StatefulWidget { final SliverListConfig sliverListConfig; + const LoadingMoreSliverList({this.sliverListConfig, Key? key}) : super(key: key); + + @override + State> createState() => _LoadingMoreSliverListState(); +} + +class _LoadingMoreSliverListState extends State> { + late final sliverListConfig = widget.sliverListConfig; + @override Widget build(BuildContext context) { return StreamBuilder>( From 54a6157748d1fcab79a72d0c9fb37baac9b81741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8D=89?= Date: Thu, 14 Jul 2022 02:28:14 +0800 Subject: [PATCH 2/2] Update loading_more_sliver_list.dart --- lib/src/loading_more_sliver_list.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/loading_more_sliver_list.dart b/lib/src/loading_more_sliver_list.dart index 61d38ef..183a213 100644 --- a/lib/src/loading_more_sliver_list.dart +++ b/lib/src/loading_more_sliver_list.dart @@ -8,7 +8,7 @@ import 'package:loading_more_list_library/loading_more_list_library.dart'; class LoadingMoreSliverList extends StatefulWidget { final SliverListConfig sliverListConfig; - const LoadingMoreSliverList({this.sliverListConfig, Key? key}) : super(key: key); + const LoadingMoreSliverList(this.sliverListConfig, {Key? key}) : super(key: key); @override State> createState() => _LoadingMoreSliverListState();