🐛 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:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/activity.dart';
|
import 'package:island/models/activity.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
import 'package:island/pods/paging.dart';
|
import 'package:island/pods/paging.dart';
|
||||||
|
|
||||||
final activityListProvider =
|
final activityListProvider = AsyncNotifierProvider.autoDispose(
|
||||||
AsyncNotifierProvider<ActivityListNotifier, List<SnTimelineEvent>>(
|
ActivityListNotifier.new,
|
||||||
ActivityListNotifier.new,
|
);
|
||||||
);
|
|
||||||
|
|
||||||
class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
||||||
with
|
with
|
||||||
@@ -28,8 +26,6 @@ class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
|||||||
if (cursor != null) 'cursor': cursor,
|
if (cursor != null) 'cursor': cursor,
|
||||||
'take': pageSize,
|
'take': pageSize,
|
||||||
if (currentFilter != null) 'filter': currentFilter,
|
if (currentFilter != null) 'filter': currentFilter,
|
||||||
if (kDebugMode)
|
|
||||||
'debugInclude': 'realms,publishers,articles,shuffledPosts',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
@@ -37,10 +33,9 @@ class ActivityListNotifier extends AsyncNotifier<List<SnTimelineEvent>>
|
|||||||
queryParameters: queryParameters,
|
queryParameters: queryParameters,
|
||||||
);
|
);
|
||||||
|
|
||||||
final List<SnTimelineEvent> items =
|
final List<SnTimelineEvent> items = (response.data as List)
|
||||||
(response.data as List)
|
.map((e) => SnTimelineEvent.fromJson(e as Map<String, dynamic>))
|
||||||
.map((e) => SnTimelineEvent.fromJson(e as Map<String, dynamic>))
|
.toList();
|
||||||
.toList();
|
|
||||||
|
|
||||||
final hasMore = (items.firstOrNull?.type ?? 'empty') != 'empty';
|
final hasMore = (items.firstOrNull?.type ?? 'empty') != 'empty';
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ class PaginationList<T> extends HookConsumerWidget {
|
|||||||
final data = ref.watch(provider);
|
final data = ref.watch(provider);
|
||||||
final noti = ref.watch(notifier);
|
final noti = ref.watch(notifier);
|
||||||
|
|
||||||
|
// For sliver cases, avoid animation to prevent complex sliver issues
|
||||||
if (isSliver) {
|
if (isSliver) {
|
||||||
// For slivers, return widgets directly without animation
|
|
||||||
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
||||||
final content = List<Widget>.generate(
|
final content = List<Widget>.generate(
|
||||||
10,
|
10,
|
||||||
@@ -88,7 +88,7 @@ class PaginationList<T> extends HookConsumerWidget {
|
|||||||
: listView;
|
: listView;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For non-slivers, use AnimatedSwitcher for smooth transitions
|
// For non-sliver cases, use AnimatedSwitcher for smooth transitions
|
||||||
Widget buildContent() {
|
Widget buildContent() {
|
||||||
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
||||||
final content = List<Widget>.generate(
|
final content = List<Widget>.generate(
|
||||||
@@ -175,8 +175,8 @@ class PaginationWidget<T> extends HookConsumerWidget {
|
|||||||
final data = ref.watch(provider);
|
final data = ref.watch(provider);
|
||||||
final noti = ref.watch(notifier);
|
final noti = ref.watch(notifier);
|
||||||
|
|
||||||
|
// For sliver cases, avoid animation to prevent complex sliver issues
|
||||||
if (isSliver) {
|
if (isSliver) {
|
||||||
// For slivers, return widgets directly without animation
|
|
||||||
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
||||||
final content = List<Widget>.generate(
|
final content = List<Widget>.generate(
|
||||||
10,
|
10,
|
||||||
@@ -215,7 +215,7 @@ class PaginationWidget<T> extends HookConsumerWidget {
|
|||||||
: content;
|
: content;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For non-slivers, use AnimatedSwitcher for smooth transitions
|
// For non-sliver cases, use AnimatedSwitcher for smooth transitions
|
||||||
Widget buildContent() {
|
Widget buildContent() {
|
||||||
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
if ((data.isLoading || noti.isLoading) && data.value?.isEmpty == true) {
|
||||||
final content = List<Widget>.generate(
|
final content = List<Widget>.generate(
|
||||||
|
|||||||
16
pubspec.yaml
16
pubspec.yaml
@@ -84,8 +84,8 @@ dependencies:
|
|||||||
firebase_core: ^4.2.1
|
firebase_core: ^4.2.1
|
||||||
web_socket_channel: ^3.0.3
|
web_socket_channel: ^3.0.3
|
||||||
material_symbols_icons: ^4.2892.0
|
material_symbols_icons: ^4.2892.0
|
||||||
drift: ^2.29.0
|
drift: ^2.30.0
|
||||||
drift_flutter: ^0.2.7
|
drift_flutter: ^0.2.8
|
||||||
path: ^1.9.1
|
path: ^1.9.1
|
||||||
collection: ^1.19.1
|
collection: ^1.19.1
|
||||||
markdown_editor_plus: ^0.2.15
|
markdown_editor_plus: ^0.2.15
|
||||||
@@ -154,11 +154,11 @@ dependencies:
|
|||||||
dart_ipc: ^1.0.1
|
dart_ipc: ^1.0.1
|
||||||
pretty_diff_text: ^2.1.0
|
pretty_diff_text: ^2.1.0
|
||||||
window_manager: ^0.5.1
|
window_manager: ^0.5.1
|
||||||
talker: ^5.1.3
|
talker: ^5.1.4
|
||||||
talker_flutter: ^5.1.3
|
talker_flutter: ^5.1.4
|
||||||
talker_logger: ^5.1.3
|
talker_logger: ^5.1.4
|
||||||
talker_dio_logger: ^5.1.3
|
talker_dio_logger: ^5.1.4
|
||||||
talker_riverpod_logger: ^5.1.3
|
talker_riverpod_logger: ^5.1.4
|
||||||
syncfusion_flutter_pdfviewer: ^31.1.21
|
syncfusion_flutter_pdfviewer: ^31.1.21
|
||||||
swipe_to: ^1.0.6
|
swipe_to: ^1.0.6
|
||||||
fl_heatmap: ^0.4.6
|
fl_heatmap: ^0.4.6
|
||||||
@@ -188,7 +188,7 @@ dev_dependencies:
|
|||||||
riverpod_generator: ^3.0.3
|
riverpod_generator: ^3.0.3
|
||||||
custom_lint: ^0.8.1
|
custom_lint: ^0.8.1
|
||||||
riverpod_lint: ^3.0.3
|
riverpod_lint: ^3.0.3
|
||||||
drift_dev: ^2.29.0
|
drift_dev: ^2.30.0
|
||||||
flutter_launcher_icons: ^0.14.4
|
flutter_launcher_icons: ^0.14.4
|
||||||
msix: ^3.16.12
|
msix: ^3.16.12
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user