⚡ Prefer auto dispose riverpods
This commit is contained in:
@@ -14,7 +14,7 @@ Future<Map<String, dynamic>?> billingUsage(Ref ref) async {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
final indexedCloudFileListProvider = AsyncNotifierProvider(
|
final indexedCloudFileListProvider = AsyncNotifierProvider.autoDispose(
|
||||||
IndexedCloudFileListNotifier.new,
|
IndexedCloudFileListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -76,12 +76,12 @@ class IndexedCloudFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
|||||||
queryParameters: queryParameters,
|
queryParameters: queryParameters,
|
||||||
);
|
);
|
||||||
|
|
||||||
final List<String> folders =
|
final List<String> folders = (response.data['folders'] as List)
|
||||||
(response.data['folders'] as List).map((e) => e as String).toList();
|
.map((e) => e as String)
|
||||||
final List<SnCloudFileIndex> files =
|
.toList();
|
||||||
(response.data['files'] as List)
|
final List<SnCloudFileIndex> files = (response.data['files'] as List)
|
||||||
.map((e) => SnCloudFileIndex.fromJson(e as Map<String, dynamic>))
|
.map((e) => SnCloudFileIndex.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final List<FileListItem> items = [
|
final List<FileListItem> items = [
|
||||||
...folders.map((folderName) => FileListItem.folder(folderName)),
|
...folders.map((folderName) => FileListItem.folder(folderName)),
|
||||||
@@ -92,7 +92,7 @@ class IndexedCloudFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final unindexedFileListProvider = AsyncNotifierProvider(
|
final unindexedFileListProvider = AsyncNotifierProvider.autoDispose(
|
||||||
UnindexedFileListNotifier.new,
|
UnindexedFileListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -165,13 +165,13 @@ class UnindexedFileListNotifier extends AsyncNotifier<List<FileListItem>>
|
|||||||
|
|
||||||
totalCount = int.tryParse(response.headers.value('x-total') ?? '0') ?? 0;
|
totalCount = int.tryParse(response.headers.value('x-total') ?? '0') ?? 0;
|
||||||
|
|
||||||
final List<SnCloudFile> files =
|
final List<SnCloudFile> files = (response.data as List)
|
||||||
(response.data as List)
|
.map((e) => SnCloudFile.fromJson(e as Map<String, dynamic>))
|
||||||
.map((e) => SnCloudFile.fromJson(e as Map<String, dynamic>))
|
.toList();
|
||||||
.toList();
|
|
||||||
|
|
||||||
final List<FileListItem> items =
|
final List<FileListItem> items = files
|
||||||
files.map((file) => FileListItem.unindexedFile(file)).toList();
|
.map((file) => FileListItem.unindexedFile(file))
|
||||||
|
.toList();
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Future<double> socialCredits(Ref ref) async {
|
|||||||
return response.data?.toDouble() ?? 0.0;
|
return response.data?.toDouble() ?? 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final socialCreditHistoryNotifierProvider = AsyncNotifierProvider(
|
final socialCreditHistoryNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||||
SocialCreditHistoryNotifier.new,
|
SocialCreditHistoryNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -45,11 +45,10 @@ class SocialCreditHistoryNotifier
|
|||||||
|
|
||||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
|
|
||||||
final records =
|
final records = response.data
|
||||||
response.data
|
.map((json) => SnSocialCreditRecord.fromJson(json))
|
||||||
.map((json) => SnSocialCreditRecord.fromJson(json))
|
.cast<SnSocialCreditRecord>()
|
||||||
.cast<SnSocialCreditRecord>()
|
.toList();
|
||||||
.toList();
|
|
||||||
|
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
@@ -68,39 +67,36 @@ class SocialCreditsTab extends HookConsumerWidget {
|
|||||||
margin: const EdgeInsets.only(left: 16, right: 16, top: 8),
|
margin: const EdgeInsets.only(left: 16, right: 16, top: 8),
|
||||||
child: socialCredits
|
child: socialCredits
|
||||||
.when(
|
.when(
|
||||||
data:
|
data: (credits) => Stack(
|
||||||
(credits) => Stack(
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Text(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
credits < 100
|
||||||
children: [
|
? 'socialCreditsLevelPoor'.tr()
|
||||||
Text(
|
: credits < 150
|
||||||
credits < 100
|
? 'socialCreditsLevelNormal'.tr()
|
||||||
? 'socialCreditsLevelPoor'.tr()
|
: credits < 200
|
||||||
: credits < 150
|
? 'socialCreditsLevelGood'.tr()
|
||||||
? 'socialCreditsLevelNormal'.tr()
|
: 'socialCreditsLevelExcellent'.tr(),
|
||||||
: credits < 200
|
).tr().bold().fontSize(20),
|
||||||
? 'socialCreditsLevelGood'.tr()
|
Text('${credits.toStringAsFixed(2)} pts').fontSize(14),
|
||||||
: 'socialCreditsLevelExcellent'.tr(),
|
const Gap(8),
|
||||||
).tr().bold().fontSize(20),
|
LinearProgressIndicator(value: credits / 200),
|
||||||
Text(
|
|
||||||
'${credits.toStringAsFixed(2)} pts',
|
|
||||||
).fontSize(14),
|
|
||||||
const Gap(8),
|
|
||||||
LinearProgressIndicator(value: credits / 200),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
right: 0,
|
|
||||||
top: 0,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () {},
|
|
||||||
icon: const Icon(Symbols.info),
|
|
||||||
tooltip: 'socialCreditsDescription'.tr(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Positioned(
|
||||||
|
right: 0,
|
||||||
|
top: 0,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: const Icon(Symbols.info),
|
||||||
|
tooltip: 'socialCreditsDescription'.tr(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
error: (_, _) => Text('Error loading credits'),
|
error: (_, _) => Text('Error loading credits'),
|
||||||
loading: () => const LinearProgressIndicator(),
|
loading: () => const LinearProgressIndicator(),
|
||||||
)
|
)
|
||||||
@@ -119,15 +115,14 @@ class SocialCreditsTab extends HookConsumerWidget {
|
|||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
title: Text(
|
title: Text(
|
||||||
record.reason,
|
record.reason,
|
||||||
style:
|
style: isExpired
|
||||||
isExpired
|
? TextStyle(
|
||||||
? TextStyle(
|
decoration: TextDecoration.lineThrough,
|
||||||
decoration: TextDecoration.lineThrough,
|
color: Theme.of(
|
||||||
color: Theme.of(
|
context,
|
||||||
context,
|
).colorScheme.onSurface.withOpacity(0.8),
|
||||||
).colorScheme.onSurface.withOpacity(0.8),
|
)
|
||||||
)
|
: null,
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
subtitle: Row(
|
subtitle: Row(
|
||||||
spacing: 4,
|
spacing: 4,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
import 'package:island/widgets/paging/pagination_list.dart';
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
final levelingHistoryNotifierProvider = AsyncNotifierProvider(
|
final levelingHistoryNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||||
LevelingHistoryNotifier.new,
|
LevelingHistoryNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -35,11 +35,10 @@ class LevelingHistoryNotifier extends AsyncNotifier<List<SnExperienceRecord>>
|
|||||||
|
|
||||||
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
|
||||||
|
|
||||||
final List<SnExperienceRecord> records =
|
final List<SnExperienceRecord> records = response.data
|
||||||
response.data
|
.map((json) => SnExperienceRecord.fromJson(json))
|
||||||
.map((json) => SnExperienceRecord.fromJson(json))
|
.cast<SnExperienceRecord>()
|
||||||
.cast<SnExperienceRecord>()
|
.toList();
|
||||||
.toList();
|
|
||||||
|
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
@@ -162,8 +161,9 @@ class LevelingScreen extends HookConsumerWidget {
|
|||||||
stopIndicatorRadius: 0,
|
stopIndicatorRadius: 0,
|
||||||
trackGap: 0,
|
trackGap: 0,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
backgroundColor:
|
backgroundColor: Theme.of(
|
||||||
Theme.of(context).colorScheme.surfaceContainerHigh,
|
context,
|
||||||
|
).colorScheme.surfaceContainerHigh,
|
||||||
borderRadius: BorderRadius.circular(32),
|
borderRadius: BorderRadius.circular(32),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -186,38 +186,35 @@ class LevelingScreen extends HookConsumerWidget {
|
|||||||
notifier: levelingHistoryNotifierProvider.notifier,
|
notifier: levelingHistoryNotifierProvider.notifier,
|
||||||
isRefreshable: false,
|
isRefreshable: false,
|
||||||
isSliver: true,
|
isSliver: true,
|
||||||
itemBuilder:
|
itemBuilder: (context, idx, record) => ListTile(
|
||||||
(context, idx, record) => ListTile(
|
title: Column(
|
||||||
title: Column(
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
children: [
|
||||||
children: [
|
Text(record.reason),
|
||||||
Text(record.reason),
|
Row(
|
||||||
Row(
|
spacing: 4,
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
record.createdAt.formatRelative(context),
|
|
||||||
).fontSize(13),
|
|
||||||
Text('·').fontSize(13).bold(),
|
|
||||||
Text(record.createdAt.formatSystem()).fontSize(13),
|
|
||||||
],
|
|
||||||
).opacity(0.8),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
subtitle: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${record.delta > 0 ? '+' : ''}${record.delta} EXP',
|
record.createdAt.formatRelative(context),
|
||||||
),
|
).fontSize(13),
|
||||||
if (record.bonusMultiplier != 1.0)
|
Text('·').fontSize(13).bold(),
|
||||||
Text('x${record.bonusMultiplier}'),
|
Text(record.createdAt.formatSystem()).fontSize(13),
|
||||||
],
|
],
|
||||||
),
|
).opacity(0.8),
|
||||||
minTileHeight: 56,
|
],
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 4),
|
),
|
||||||
),
|
subtitle: Row(
|
||||||
|
spacing: 8,
|
||||||
|
children: [
|
||||||
|
Text('${record.delta > 0 ? '+' : ''}${record.delta} EXP'),
|
||||||
|
if (record.bonusMultiplier != 1.0)
|
||||||
|
Text('x${record.bonusMultiplier}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
minTileHeight: 56,
|
||||||
|
contentPadding: EdgeInsets.symmetric(horizontal: 4),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
SliverGap(20),
|
SliverGap(20),
|
||||||
@@ -249,11 +246,10 @@ class LevelStairsPainter extends CustomPainter {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(Canvas canvas, Size size) {
|
void paint(Canvas canvas, Size size) {
|
||||||
final paint =
|
final paint = Paint()
|
||||||
Paint()
|
..color = surfaceColor.withOpacity(0.2)
|
||||||
..color = surfaceColor.withOpacity(0.2)
|
..strokeWidth = 1.5
|
||||||
..strokeWidth = 1.5
|
..style = PaintingStyle.stroke;
|
||||||
..style = PaintingStyle.stroke;
|
|
||||||
|
|
||||||
// Draw connecting lines between stairs
|
// Draw connecting lines between stairs
|
||||||
for (int i = 0; i < totalLevels - 1; i++) {
|
for (int i = 0; i < totalLevels - 1; i++) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Future<List<SnRelationship>> sentFriendRequest(Ref ref) async {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
final relationshipListNotifierProvider = AsyncNotifierProvider(
|
final relationshipListNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||||
RelationshipListNotifier.new,
|
RelationshipListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -45,11 +45,10 @@ class RelationshipListNotifier extends AsyncNotifier<List<SnRelationship>>
|
|||||||
queryParameters: {'offset': fetchedCount.toString(), 'take': take},
|
queryParameters: {'offset': fetchedCount.toString(), 'take': take},
|
||||||
);
|
);
|
||||||
|
|
||||||
final List<SnRelationship> items =
|
final List<SnRelationship> items = (response.data as List)
|
||||||
(response.data as List)
|
.map((e) => SnRelationship.fromJson(e as Map<String, dynamic>))
|
||||||
.map((e) => SnRelationship.fromJson(e as Map<String, dynamic>))
|
.cast<SnRelationship>()
|
||||||
.cast<SnRelationship>()
|
.toList();
|
||||||
.toList();
|
|
||||||
|
|
||||||
totalCount = int.tryParse(response.headers['x-total']?.first ?? '') ?? 0;
|
totalCount = int.tryParse(response.headers['x-total']?.first ?? '') ?? 0;
|
||||||
|
|
||||||
@@ -83,8 +82,9 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final account =
|
final account = showRelatedAccount
|
||||||
showRelatedAccount ? relationship.related : relationship.account;
|
? relationship.related
|
||||||
|
: relationship.account;
|
||||||
final isPending =
|
final isPending =
|
||||||
relationship.status == 0 && relationship.relatedId == currentUserId;
|
relationship.status == 0 && relationship.relatedId == currentUserId;
|
||||||
final isWaiting =
|
final isWaiting =
|
||||||
@@ -138,64 +138,56 @@ class RelationshipListTile extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
subtitle: Text('@${account.name}'),
|
subtitle: Text('@${account.name}'),
|
||||||
trailing:
|
trailing: showActions
|
||||||
showActions
|
? Row(
|
||||||
? Row(
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: [
|
||||||
children: [
|
if (isPending && onAccept != null)
|
||||||
if (isPending && onAccept != null)
|
IconButton(
|
||||||
IconButton(
|
padding: EdgeInsets.zero,
|
||||||
padding: EdgeInsets.zero,
|
onPressed: submitting ? null : onAccept,
|
||||||
onPressed: submitting ? null : onAccept,
|
icon: const Icon(Symbols.check),
|
||||||
icon: const Icon(Symbols.check),
|
),
|
||||||
),
|
if (isPending && onDecline != null)
|
||||||
if (isPending && onDecline != null)
|
IconButton(
|
||||||
IconButton(
|
padding: EdgeInsets.zero,
|
||||||
padding: EdgeInsets.zero,
|
onPressed: submitting ? null : onDecline,
|
||||||
onPressed: submitting ? null : onDecline,
|
icon: const Icon(Symbols.close),
|
||||||
icon: const Icon(Symbols.close),
|
),
|
||||||
),
|
if (isWaiting && onCancel != null)
|
||||||
if (isWaiting && onCancel != null)
|
IconButton(
|
||||||
IconButton(
|
padding: EdgeInsets.zero,
|
||||||
padding: EdgeInsets.zero,
|
onPressed: submitting ? null : onCancel,
|
||||||
onPressed: submitting ? null : onCancel,
|
icon: const Icon(Symbols.close),
|
||||||
icon: const Icon(Symbols.close),
|
),
|
||||||
),
|
if (isEstablished && onUpdateStatus != null)
|
||||||
if (isEstablished && onUpdateStatus != null)
|
PopupMenuButton(
|
||||||
PopupMenuButton(
|
padding: EdgeInsets.zero,
|
||||||
padding: EdgeInsets.zero,
|
icon: const Icon(Symbols.more_vert),
|
||||||
icon: const Icon(Symbols.more_vert),
|
itemBuilder: (context) => [
|
||||||
itemBuilder:
|
if (relationship.status >= 100) // If friend
|
||||||
(context) => [
|
PopupMenuItem(
|
||||||
if (relationship.status >= 100) // If friend
|
child: ListTile(
|
||||||
PopupMenuItem(
|
leading: const Icon(Symbols.block),
|
||||||
child: ListTile(
|
title: Text('blockUser').tr(),
|
||||||
leading: const Icon(Symbols.block),
|
contentPadding: EdgeInsets.zero,
|
||||||
title: Text('blockUser').tr(),
|
),
|
||||||
contentPadding: EdgeInsets.zero,
|
onTap: () => onUpdateStatus?.call(relationship, -100),
|
||||||
),
|
)
|
||||||
onTap:
|
else if (relationship.status <= -100) // If blocked
|
||||||
() => onUpdateStatus?.call(
|
PopupMenuItem(
|
||||||
relationship,
|
child: ListTile(
|
||||||
-100,
|
leading: const Icon(Symbols.person_add),
|
||||||
),
|
title: Text('unblockUser').tr(),
|
||||||
)
|
contentPadding: EdgeInsets.zero,
|
||||||
else if (relationship.status <= -100) // If blocked
|
),
|
||||||
PopupMenuItem(
|
onTap: () => onUpdateStatus?.call(relationship, 100),
|
||||||
child: ListTile(
|
),
|
||||||
leading: const Icon(Symbols.person_add),
|
],
|
||||||
title: Text('unblockUser').tr(),
|
),
|
||||||
contentPadding: EdgeInsets.zero,
|
],
|
||||||
),
|
)
|
||||||
onTap:
|
: null,
|
||||||
() =>
|
|
||||||
onUpdateStatus?.call(relationship, 100),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -299,6 +291,7 @@ class RelationshipScreen extends HookConsumerWidget {
|
|||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PaginationList(
|
child: PaginationList(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
provider: relationshipListNotifierProvider,
|
provider: relationshipListNotifierProvider,
|
||||||
notifier: relationshipListNotifierProvider.notifier,
|
notifier: relationshipListNotifierProvider.notifier,
|
||||||
itemBuilder: (context, index, relationship) {
|
itemBuilder: (context, index, relationship) {
|
||||||
@@ -380,28 +373,26 @@ class _SentFriendRequestsSheet extends HookConsumerWidget {
|
|||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: requests.when(
|
child: requests.when(
|
||||||
data:
|
data: (items) => items.isEmpty
|
||||||
(items) =>
|
? Center(
|
||||||
items.isEmpty
|
child: Text(
|
||||||
? Center(
|
'friendSentRequestEmpty'.tr(),
|
||||||
child: Text(
|
textAlign: TextAlign.center,
|
||||||
'friendSentRequestEmpty'.tr(),
|
),
|
||||||
textAlign: TextAlign.center,
|
)
|
||||||
),
|
: ListView.builder(
|
||||||
)
|
shrinkWrap: true,
|
||||||
: ListView.builder(
|
itemCount: items.length,
|
||||||
shrinkWrap: true,
|
itemBuilder: (context, index) {
|
||||||
itemCount: items.length,
|
final request = items[index];
|
||||||
itemBuilder: (context, index) {
|
return RelationshipListTile(
|
||||||
final request = items[index];
|
relationship: request,
|
||||||
return RelationshipListTile(
|
onCancel: () => cancelRequest(request),
|
||||||
relationship: request,
|
currentUserId: user.value?.id,
|
||||||
onCancel: () => cancelRequest(request),
|
showRelatedAccount: true,
|
||||||
currentUserId: user.value?.id,
|
);
|
||||||
showRelatedAccount: true,
|
},
|
||||||
);
|
),
|
||||||
},
|
|
||||||
),
|
|
||||||
loading: () => const Center(child: CircularProgressIndicator()),
|
loading: () => const Center(child: CircularProgressIndicator()),
|
||||||
error: (error, stack) => Center(child: Text('Error: $error')),
|
error: (error, stack) => Center(child: Text('Error: $error')),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import 'package:island/widgets/app_scaffold.dart';
|
|||||||
import 'package:island/widgets/paging/pagination_list.dart';
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
|
|
||||||
final marketplaceWebFeedsNotifierProvider = AsyncNotifierProvider(
|
final marketplaceWebFeedsNotifierProvider = AsyncNotifierProvider.autoDispose(
|
||||||
MarketplaceWebFeedsNotifier.new,
|
MarketplaceWebFeedsNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class DiscoveryRealmsScreen extends HookConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
CustomScrollView(
|
CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverGap(80),
|
SliverGap(88),
|
||||||
SliverRealmList(
|
SliverRealmList(
|
||||||
query: currentQuery.value,
|
query: currentQuery.value,
|
||||||
key: ValueKey(currentQuery.value),
|
key: ValueKey(currentQuery.value),
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ class NotificationUnreadCountNotifier
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final notificationListProvider = AsyncNotifierProvider(
|
final notificationListProvider = AsyncNotifierProvider.autoDispose(
|
||||||
NotificationListNotifier.new,
|
NotificationListNotifier.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,8 @@ sealed class MarketplaceStickerQuery with _$MarketplaceStickerQuery {
|
|||||||
}) = _MarketplaceStickerQuery;
|
}) = _MarketplaceStickerQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
final marketplaceStickerPacksNotifierProvider = AsyncNotifierProvider(
|
final marketplaceStickerPacksNotifierProvider =
|
||||||
MarketplaceStickerPacksNotifier.new,
|
AsyncNotifierProvider.autoDispose(MarketplaceStickerPacksNotifier.new);
|
||||||
);
|
|
||||||
|
|
||||||
class MarketplaceStickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
|
class MarketplaceStickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
|
||||||
with
|
with
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gap/gap.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/realm.dart';
|
import 'package:island/models/realm.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';
|
||||||
import 'package:island/widgets/paging/pagination_list.dart';
|
import 'package:island/widgets/paging/pagination_list.dart';
|
||||||
import 'package:island/widgets/realm/realm_card.dart';
|
import 'package:island/widgets/realm/realm_list_tile.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
|
|
||||||
final realmListNotifierProvider = AsyncNotifierProvider.autoDispose
|
final realmListNotifierProvider = AsyncNotifierProvider.autoDispose
|
||||||
@@ -51,25 +50,12 @@ class SliverRealmList extends HookConsumerWidget {
|
|||||||
notifier: provider.notifier,
|
notifier: provider.notifier,
|
||||||
isSliver: true,
|
isSliver: true,
|
||||||
isRefreshable: false,
|
isRefreshable: false,
|
||||||
|
spacing: 8,
|
||||||
itemBuilder: (context, index, realm) {
|
itemBuilder: (context, index, realm) {
|
||||||
return Column(
|
return ConstrainedBox(
|
||||||
children: [
|
constraints: const BoxConstraints(maxWidth: 540),
|
||||||
Padding(
|
child: RealmListTile(realm: realm),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
).center();
|
||||||
child:
|
|
||||||
ConstrainedBox(
|
|
||||||
constraints: const BoxConstraints(maxWidth: 540),
|
|
||||||
child: RealmCard(realm: realm),
|
|
||||||
).center(),
|
|
||||||
),
|
|
||||||
if (index <
|
|
||||||
(ref.read(provider).value?.length ?? 0) -
|
|
||||||
1) // Add gap except for last item? Actually PaginationList handles loading indicator which might look like last item.
|
|
||||||
// Wait, ref.read(provider).value?.length might change.
|
|
||||||
// Simpler to just add bottom padding to all, or Gap.
|
|
||||||
const Gap(8),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user