♻️ Refactor riverpod pagination loading

This commit is contained in:
2025-05-15 23:29:37 +08:00
parent 2759c009ad
commit dfd216b84b
28 changed files with 1018 additions and 360 deletions

View File

@ -29,7 +29,7 @@ Future<SnPublisher> publisher(Ref ref, String uname) async {
@riverpod
Future<List<SnAccountBadge>> publisherBadges(Ref ref, String pubName) async {
final pub = await ref.watch(publisherProvider(pubName).future);
if (pub.publisherType != 0) return [];
if (pub.type != 0) return [];
final apiClient = ref.watch(apiClientProvider);
final resp = await apiClient.get("/accounts/${pub.name}/badges");
return List<SnAccountBadge>.from(
@ -177,7 +177,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
).fontSize(14).opacity(0.85),
],
),
if (data.publisherType == 0)
if (data.type == 0)
AccountStatusWidget(
uname: name,
padding: EdgeInsets.zero,

View File

@ -145,7 +145,7 @@ class _PublisherProviderElement
String get uname => (origin as PublisherProvider).uname;
}
String _$publisherBadgesHash() => r'69a5bbc9e1528da65ae8b1e5e6c4f57c3dcf4071';
String _$publisherBadgesHash() => r'b26d8804ddc9734c453bdf76af0a9336f166542c';
/// See also [publisherBadges].
@ProviderFor(publisherBadges)