🐛 Fix some issues
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/activity.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/pods/paging.dart';
|
||||
|
||||
final activityListProvider =
|
||||
AsyncNotifierProvider<ActivityListNotifier, List<SnTimelineEvent>>(
|
||||
ActivityListNotifier.new,
|
||||
);
|
||||
final activityListProvider = AsyncNotifierProvider.autoDispose(
|
||||
ActivityListNotifier.new,
|
||||
);
|
||||
|
||||
class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
||||
with
|
||||
@@ -28,8 +26,6 @@ class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
||||
if (cursor != null) 'cursor': cursor,
|
||||
'take': pageSize,
|
||||
if (currentFilter != null) 'filter': currentFilter,
|
||||
if (kDebugMode)
|
||||
'debugInclude': 'realms,publishers,articles,shuffledPosts',
|
||||
};
|
||||
|
||||
final response = await client.get(
|
||||
@@ -37,10 +33,9 @@ class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
||||
queryParameters: queryParameters,
|
||||
);
|
||||
|
||||
final List<SnTimelineEvent> items =
|
||||
(response.data as List)
|
||||
.map((e) => SnTimelineEvent.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
final List<SnTimelineEvent> items = (response.data as List)
|
||||
.map((e) => SnTimelineEvent.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
final hasMore = (items.firstOrNull?.type ?? 'empty') != 'empty';
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ class PaginationList<T> extends HookConsumerWidget {
|
||||
final data = ref.watch(provider);
|
||||
final noti = ref.watch(notifier);
|
||||
|
||||
// For sliver cases, avoid animation to prevent complex sliver issues
|
||||
if (isSliver) {
|
||||
// For slivers, return widgets directly without animation
|
||||
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
||||
final content = List<Widget>.generate(
|
||||
10,
|
||||
@@ -88,7 +88,7 @@ class PaginationList<T> extends HookConsumerWidget {
|
||||
: listView;
|
||||
}
|
||||
|
||||
// For non-slivers, use AnimatedSwitcher for smooth transitions
|
||||
// For non-sliver cases, use AnimatedSwitcher for smooth transitions
|
||||
Widget buildContent() {
|
||||
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
||||
final content = List<Widget>.generate(
|
||||
@@ -175,8 +175,8 @@ class PaginationWidget<T> extends HookConsumerWidget {
|
||||
final data = ref.watch(provider);
|
||||
final noti = ref.watch(notifier);
|
||||
|
||||
// For sliver cases, avoid animation to prevent complex sliver issues
|
||||
if (isSliver) {
|
||||
// For slivers, return widgets directly without animation
|
||||
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
||||
final content = List<Widget>.generate(
|
||||
10,
|
||||
@@ -215,7 +215,7 @@ class PaginationWidget<T> extends HookConsumerWidget {
|
||||
: content;
|
||||
}
|
||||
|
||||
// For non-slivers, use AnimatedSwitcher for smooth transitions
|
||||
// For non-sliver cases, use AnimatedSwitcher for smooth transitions
|
||||
Widget buildContent() {
|
||||
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
||||
final content = List<Widget>.generate(
|
||||
|
||||
Reference in New Issue
Block a user