♻️ Rebuilt fetching state machine
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
@@ -28,10 +30,23 @@ final socialCreditHistoryNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||
);
|
||||
|
||||
class SocialCreditHistoryNotifier
|
||||
extends AsyncNotifier<List<SnSocialCreditRecord>>
|
||||
extends AsyncNotifier<PaginationState<SnSocialCreditRecord>>
|
||||
with AsyncPaginationController<SnSocialCreditRecord> {
|
||||
static const int pageSize = 20;
|
||||
|
||||
@override
|
||||
FutureOr<PaginationState<SnSocialCreditRecord>> build() async {
|
||||
final items = await fetch();
|
||||
return PaginationState(
|
||||
items: items,
|
||||
isLoading: false,
|
||||
isReloading: false,
|
||||
totalCount: totalCount,
|
||||
hasMore: hasMore,
|
||||
cursor: cursor,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<SnSocialCreditRecord>> fetch() async {
|
||||
final client = ref.read(apiClientProvider);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
@@ -14,14 +16,30 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:island/widgets/paging/pagination_list.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
final levelingHistoryNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||
LevelingHistoryNotifier.new,
|
||||
);
|
||||
final levelingHistoryNotifierProvider =
|
||||
AsyncNotifierProvider.autoDispose<
|
||||
LevelingHistoryNotifier,
|
||||
PaginationState<SnExperienceRecord>
|
||||
>(LevelingHistoryNotifier.new);
|
||||
|
||||
class LevelingHistoryNotifier extends AsyncNotifier<List<SnExperienceRecord>>
|
||||
class LevelingHistoryNotifier
|
||||
extends AsyncNotifier<PaginationState<SnExperienceRecord>>
|
||||
with AsyncPaginationController<SnExperienceRecord> {
|
||||
static const int pageSize = 20;
|
||||
|
||||
@override
|
||||
FutureOr<PaginationState<SnExperienceRecord>> build() async {
|
||||
final items = await fetch();
|
||||
return PaginationState(
|
||||
items: items,
|
||||
isLoading: false,
|
||||
isReloading: false,
|
||||
totalCount: totalCount,
|
||||
hasMore: hasMore,
|
||||
cursor: cursor,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<SnExperienceRecord>> fetch() async {
|
||||
final client = ref.read(apiClientProvider);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -29,12 +31,28 @@ Future<List<SnRelationship>> sentFriendRequest(Ref ref) async {
|
||||
.toList();
|
||||
}
|
||||
|
||||
final relationshipListNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||
RelationshipListNotifier.new,
|
||||
);
|
||||
final relationshipListNotifierProvider =
|
||||
AsyncNotifierProvider.autoDispose<
|
||||
RelationshipListNotifier,
|
||||
PaginationState<SnRelationship>
|
||||
>(RelationshipListNotifier.new);
|
||||
|
||||
class RelationshipListNotifier extends AsyncNotifier<List<SnRelationship>>
|
||||
class RelationshipListNotifier
|
||||
extends AsyncNotifier<PaginationState<SnRelationship>>
|
||||
with AsyncPaginationController<SnRelationship> {
|
||||
@override
|
||||
FutureOr<PaginationState<SnRelationship>> build() async {
|
||||
final items = await fetch();
|
||||
return PaginationState(
|
||||
items: items,
|
||||
isLoading: false,
|
||||
isReloading: false,
|
||||
totalCount: totalCount,
|
||||
hasMore: hasMore,
|
||||
cursor: cursor,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<SnRelationship>> fetch() async {
|
||||
final client = ref.read(apiClientProvider);
|
||||
|
||||
Reference in New Issue
Block a user