Skip to content

Commit

Permalink
🐛 欠落していた条件分岐の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Aosanori committed May 30, 2024
1 parent 6351747 commit c7415f9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/cores/core/lib/src/ui/util/common_paging_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class CommonPagingView<N extends PagingAsyncNotifier<D, T>,
required bool hasError,
required bool isLoading,
}) {
if (!data.hasMore) {
return const SizedBox.shrink();
}

if (hasError && isLoading) {
return const Center(
child: Padding(
Expand All @@ -78,16 +82,19 @@ class CommonPagingView<N extends PagingAsyncNotifier<D, T>,
),
);
}

if (hasError && !isLoading) {
return _EndItemWhenError(
onPressed: () async => ref.read(_provider.notifier).loadNext(),
);
}

if (!hasError) {
return _EndItem(
onScrollEnd: () async => ref.read(_provider.notifier).loadNext(),
);
}

return const SizedBox.shrink();
}

Expand Down Expand Up @@ -239,8 +246,7 @@ class _EndItemWhenError extends StatelessWidget {
Flexible(
flex: 3,
child: Center(
child:
ElevatedButton(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: const StadiumBorder(),
),
Expand Down

0 comments on commit c7415f9

Please sign in to comment.