Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

让热重载时不刷新list #43 #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions lib/src/loading_more_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> extends StatelessWidget {
class LoadingMoreList<T> extends StatefulWidget {
final ListConfig<T> listConfig;
final NotificationListenerCallback<ScrollNotification>? onScrollNotification;
const LoadingMoreList(this.listConfig, {Key? key, this.onScrollNotification})
: super(key: key);
final ListConfig<T> listConfig;

/// Called when a ScrollNotification of the appropriate type arrives at this
/// location in the tree.
final NotificationListenerCallback<ScrollNotification>? onScrollNotification;
@override
State<LoadingMoreList<T>> createState() => _LoadingMoreListState();
}

class _LoadingMoreListState<T> extends State<LoadingMoreList<T>> {

late final listConfig = widget.listConfig;
late final onScrollNotification = widget.onScrollNotification;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -55,4 +60,4 @@ class LoadingMoreList<T> extends StatelessWidget {
}
return false;
}
}
}
13 changes: 10 additions & 3 deletions lib/src/loading_more_sliver_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> extends StatelessWidget {
const LoadingMoreSliverList(this.sliverListConfig, {Key? key})
: super(key: key);
class LoadingMoreSliverList<T> extends StatefulWidget {
final SliverListConfig<T> sliverListConfig;

const LoadingMoreSliverList(this.sliverListConfig, {Key? key}) : super(key: key);

@override
State<LoadingMoreSliverList<T>> createState() => _LoadingMoreSliverListState();
}

class _LoadingMoreSliverListState<T> extends State<LoadingMoreSliverList<T>> {
late final sliverListConfig = widget.sliverListConfig;

@override
Widget build(BuildContext context) {
return StreamBuilder<LoadingMoreBase<T>>(
Expand Down