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..183a213 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>(