Skip to content

Commit

Permalink
fix(neon): Require a scrollKey for NeonListView
Browse files Browse the repository at this point in the history
Signed-off-by: jld3103 <[email protected]>
  • Loading branch information
provokateurin committed Oct 22, 2023
1 parent 504cace commit 362edce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/neon/neon/lib/src/widgets/list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class NeonListView extends StatelessWidget {
required this.error,
required this.onRefresh,
required final NullableIndexedWidgetBuilder itemBuilder,
required this.scrollKey,
final int? itemCount,
this.scrollKey,
this.topFixedChildren,
this.topScrollingChildren,
super.key,
Expand All @@ -23,7 +23,7 @@ class NeonListView extends StatelessWidget {
required this.error,
required this.onRefresh,
required this.sliver,
this.scrollKey,
required this.scrollKey,
this.topFixedChildren,
this.topScrollingChildren,
super.key,
Expand All @@ -32,7 +32,7 @@ class NeonListView extends StatelessWidget {
final bool isLoading;
final Object? error;
final RefreshCallback onRefresh;
final String? scrollKey;
final String scrollKey;
final List<Widget>? topFixedChildren;
final List<Widget>? topScrollingChildren;
final Widget sliver;
Expand All @@ -46,7 +46,7 @@ class NeonListView extends StatelessWidget {
key: refreshIndicatorKey,
onRefresh: onRefresh,
child: CustomScrollView(
key: scrollKey != null ? PageStorageKey<String>(scrollKey!) : null,
key: PageStorageKey<String>(scrollKey),
primary: true,
slivers: [
if (topFixedChildren != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class NeonUnifiedSearchResults extends StatelessWidget {
final values = results.data?.entries.toList();

return NeonListView(
scrollKey: 'unified-search',
isLoading: results.isLoading,
error: results.error,
onRefresh: bloc.refresh,
Expand Down

0 comments on commit 362edce

Please sign in to comment.