Compare commits

..

17 Commits

Author SHA1 Message Date
fb51d2076f 🗑️ Remove pfp decoration test code 2025-12-10 23:12:02 +08:00
d8485954fa Profile decoration 2025-12-10 23:11:46 +08:00
d7746d14e4 🚀 Launch 3.5.0+151 2025-12-06 21:52:30 +08:00
648d5225f6 🐛 Ensure mobile site management request permission 2025-12-06 21:48:16 +08:00
9d4d0f2e48 🐛 Fix inconsistence alert 2025-12-06 21:44:43 +08:00
fe386163f4 💄 Optimize designs in developer hub 2025-12-06 21:39:50 +08:00
ac2cee10e5 💄 Hub now shows loading stautus of publishers / developers 2025-12-06 21:28:19 +08:00
9c370647dd 🐛 Fix some bugs in creator hub 2025-12-06 21:26:00 +08:00
7516e197fe 💄 Fix post replies skeleton inconststent 2025-12-06 21:15:32 +08:00
71c372ab6c Prefer auto dispose riverpods 2025-12-06 21:13:25 +08:00
25f23f7f93 🐛 Fix serval bugs during the changes 2025-12-06 21:05:29 +08:00
51853698b9 🐛 Fix serval bugs 2025-12-06 20:53:24 +08:00
39ed5393ab 💄 Dedicated notification skeleton 2025-12-06 20:49:54 +08:00
782b3f1b08 🐛 Fix article edit shows the post edit sheet 2025-12-06 20:45:47 +08:00
3ef2f13dd3 💄 Redesign the post tags and categories page 2025-12-06 20:40:28 +08:00
36b0f55a47 🐛 Fix inconsistent of margin in post silver list 2025-12-06 20:24:54 +08:00
bc7a6e865e 🐛 Fix some issues 2025-12-06 20:20:54 +08:00
55 changed files with 3498 additions and 3169 deletions

View File

@@ -12,6 +12,8 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29" /> android:maxSdkVersion="29" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

View File

@@ -618,6 +618,7 @@
"tagsHint": "Enter tags, separated by commas", "tagsHint": "Enter tags, separated by commas",
"categories": "Categories", "categories": "Categories",
"categoriesHint": "Enter categories, separated by commas", "categoriesHint": "Enter categories, separated by commas",
"categoriesAndTags": "Categories & Tags",
"chatNotJoined": "You have not joined this chat yet.", "chatNotJoined": "You have not joined this chat yet.",
"chatUnableJoin": "You can't join this chat due to it's access control settings.", "chatUnableJoin": "You can't join this chat due to it's access control settings.",
"chatJoin": "Join the Chat", "chatJoin": "Join the Chat",

View File

@@ -257,6 +257,8 @@ PODS:
- path_provider_foundation (0.0.1): - path_provider_foundation (0.0.1):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- permission_handler_apple (9.3.0):
- Flutter
- pointer_interceptor_ios (0.0.1): - pointer_interceptor_ios (0.0.1):
- Flutter - Flutter
- PromisesObjC (2.4.0) - PromisesObjC (2.4.0)
@@ -351,6 +353,7 @@ DEPENDENCIES:
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- pasteboard (from `.symlinks/plugins/pasteboard/ios`) - pasteboard (from `.symlinks/plugins/pasteboard/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/ios`) - pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/ios`)
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`) - protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`) - receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
@@ -458,6 +461,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/pasteboard/ios" :path: ".symlinks/plugins/pasteboard/ios"
path_provider_foundation: path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin" :path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
pointer_interceptor_ios: pointer_interceptor_ios:
:path: ".symlinks/plugins/pointer_interceptor_ios/ios" :path: ".symlinks/plugins/pointer_interceptor_ios/ios"
protocol_handler_ios: protocol_handler_ios:
@@ -539,6 +544,7 @@ SPEC CHECKSUMS:
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
pasteboard: 49088aeb6119d51f976a421db60d8e1ab079b63c pasteboard: 49088aeb6119d51f976a421db60d8e1ab079b63c
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880 path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
pointer_interceptor_ios: da06a662d5bfd329602b45b2ab41bc0fb5fdb0f0 pointer_interceptor_ios: da06a662d5bfd329602b45b2ab41bc0fb5fdb0f0
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851

View File

@@ -1 +0,0 @@

View File

@@ -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,10 +76,10 @@ 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();
@@ -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;
} }

View File

@@ -0,0 +1,52 @@
// Post Categories Notifier
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/models/post_category.dart';
import 'package:island/models/post_tag.dart';
import 'package:island/pods/network.dart';
import 'package:island/pods/paging.dart';
final postCategoriesProvider =
AsyncNotifierProvider.autoDispose<
PostCategoriesNotifier,
List<SnPostCategory>
>(PostCategoriesNotifier.new);
class PostCategoriesNotifier extends AsyncNotifier<List<SnPostCategory>>
with AsyncPaginationController<SnPostCategory> {
@override
Future<List<SnPostCategory>> fetch() async {
final client = ref.read(apiClientProvider);
final response = await client.get(
'/sphere/posts/categories',
queryParameters: {'offset': fetchedCount, 'take': 20, 'order': 'usage'},
);
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final data = response.data as List;
return data.map((json) => SnPostCategory.fromJson(json)).toList();
}
}
// Post Tags Notifier
final postTagsProvider =
AsyncNotifierProvider.autoDispose<PostTagsNotifier, List<SnPostTag>>(
PostTagsNotifier.new,
);
class PostTagsNotifier extends AsyncNotifier<List<SnPostTag>>
with AsyncPaginationController<SnPostTag> {
@override
Future<List<SnPostTag>> fetch() async {
final client = ref.read(apiClientProvider);
final response = await client.get(
'/sphere/posts/tags',
queryParameters: {'offset': fetchedCount, 'take': 20, 'order': 'usage'},
);
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final data = response.data as List;
return data.map((json) => SnPostTag.fromJson(json)).toList();
}
}

View File

@@ -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,8 +33,7 @@ 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();

View File

@@ -5,16 +5,14 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:island/models/webfeed.dart'; import 'package:island/models/webfeed.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
final webFeedListProvider = FutureProvider.family<List<SnWebFeed>, String>(( final webFeedListProvider = FutureProvider.autoDispose
ref, .family<List<SnWebFeed>, String>((ref, pubName) async {
pubName,
) async {
final client = ref.watch(apiClientProvider); final client = ref.watch(apiClientProvider);
final response = await client.get('/sphere/publishers/$pubName/feeds'); final response = await client.get('/sphere/publishers/$pubName/feeds');
return (response.data as List) return (response.data as List)
.map((json) => SnWebFeed.fromJson(json)) .map((json) => SnWebFeed.fromJson(json))
.toList(); .toList();
}); });
class WebFeedNotifier extends AsyncNotifier<SnWebFeed> { class WebFeedNotifier extends AsyncNotifier<SnWebFeed> {
final ({String pubName, String? feedId}) arg; final ({String pubName, String? feedId}) arg;
@@ -51,8 +49,7 @@ class WebFeedNotifier extends AsyncNotifier<SnWebFeed> {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);
final url = '/sphere/publishers/${feed.publisherId}/feeds'; final url = '/sphere/publishers/${feed.publisherId}/feeds';
final response = final response = feed.id.isEmpty
feed.id.isEmpty
? await client.post(url, data: feed.toJson()) ? await client.post(url, data: feed.toJson())
: await client.patch('$url/${feed.id}', data: feed.toJson()); : await client.patch('$url/${feed.id}', data: feed.toJson());

View File

@@ -105,8 +105,7 @@ final routerProvider = Provider<GoRouter>((ref) {
GoRoute( GoRoute(
name: 'articleCompose', name: 'articleCompose',
path: '/articles/compose', path: '/articles/compose',
builder: builder: (context, state) => ArticleComposeScreen(
(context, state) => ArticleComposeScreen(
initialState: state.extra as PostComposeInitialState?, initialState: state.extra as PostComposeInitialState?,
), ),
), ),
@@ -190,8 +189,7 @@ final routerProvider = Provider<GoRouter>((ref) {
GoRoute( GoRoute(
name: 'explore', name: 'explore',
path: '/', path: '/',
pageBuilder: pageBuilder: (context, state) => CustomTransitionPage(
(context, state) => CustomTransitionPage(
key: const ValueKey('explore'), key: const ValueKey('explore'),
child: const ExploreScreen(), child: const ExploreScreen(),
transitionsBuilder: _tabPagesTransitionBuilder, transitionsBuilder: _tabPagesTransitionBuilder,
@@ -220,11 +218,6 @@ final routerProvider = Provider<GoRouter>((ref) {
return PostCategoryDetailScreen(slug: slug, isCategory: true); return PostCategoryDetailScreen(slug: slug, isCategory: true);
}, },
), ),
GoRoute(
name: 'postTags',
path: '/posts/tags',
builder: (context, state) => const PostTagsListScreen(),
),
GoRoute( GoRoute(
name: 'postTagDetail', name: 'postTagDetail',
path: '/posts/tags/:slug', path: '/posts/tags/:slug',
@@ -260,8 +253,7 @@ final routerProvider = Provider<GoRouter>((ref) {
// Chat tab // Chat tab
ShellRoute( ShellRoute(
pageBuilder: pageBuilder: (context, state, child) => CustomTransitionPage(
(context, state, child) => CustomTransitionPage(
key: const ValueKey('chat'), key: const ValueKey('chat'),
child: ChatShellScreen(child: child), child: ChatShellScreen(child: child),
transitionsBuilder: _tabPagesTransitionBuilder, transitionsBuilder: _tabPagesTransitionBuilder,
@@ -303,8 +295,7 @@ final routerProvider = Provider<GoRouter>((ref) {
GoRoute( GoRoute(
name: 'realmList', name: 'realmList',
path: '/realms', path: '/realms',
pageBuilder: pageBuilder: (context, state) => CustomTransitionPage(
(context, state) => CustomTransitionPage(
key: const ValueKey('realms'), key: const ValueKey('realms'),
child: const RealmListScreen(), child: const RealmListScreen(),
transitionsBuilder: _tabPagesTransitionBuilder, transitionsBuilder: _tabPagesTransitionBuilder,
@@ -336,8 +327,7 @@ final routerProvider = Provider<GoRouter>((ref) {
// Account tab // Account tab
ShellRoute( ShellRoute(
pageBuilder: pageBuilder: (context, state, child) => CustomTransitionPage(
(context, state, child) => CustomTransitionPage(
key: const ValueKey('account'), key: const ValueKey('account'),
child: AccountShellScreen(child: child), child: AccountShellScreen(child: child),
transitionsBuilder: _tabPagesTransitionBuilder, transitionsBuilder: _tabPagesTransitionBuilder,
@@ -352,8 +342,8 @@ final routerProvider = Provider<GoRouter>((ref) {
GoRoute( GoRoute(
name: 'stickerMarketplace', name: 'stickerMarketplace',
path: '/stickers', path: '/stickers',
builder: builder: (context, state) =>
(context, state) => const MarketplaceStickersScreen(), const MarketplaceStickersScreen(),
routes: [ routes: [
GoRoute( GoRoute(
name: 'stickerPackDetail', name: 'stickerPackDetail',
@@ -368,8 +358,8 @@ final routerProvider = Provider<GoRouter>((ref) {
GoRoute( GoRoute(
name: 'webFeedMarketplace', name: 'webFeedMarketplace',
path: '/feeds', path: '/feeds',
builder: builder: (context, state) =>
(context, state) => const MarketplaceWebFeedsScreen(), const MarketplaceWebFeedsScreen(),
routes: [ routes: [
GoRoute( GoRoute(
name: 'webFeedDetail', name: 'webFeedDetail',
@@ -516,26 +506,22 @@ final routerProvider = Provider<GoRouter>((ref) {
GoRoute( GoRoute(
name: 'developerHub', name: 'developerHub',
path: '/developers', path: '/developers',
builder: builder: (context, state) => DeveloperHubScreen(
(context, state) => DeveloperHubScreen( initialPublisherName: state.uri.queryParameters['publisher'],
initialPublisherName:
state.uri.queryParameters['publisher'],
initialProjectId: state.uri.queryParameters['project'], initialProjectId: state.uri.queryParameters['project'],
), ),
routes: [ routes: [
GoRoute( GoRoute(
name: 'developerProjectNew', name: 'developerProjectNew',
path: ':name/projects/new', path: ':name/projects/new',
builder: builder: (context, state) => NewProjectScreen(
(context, state) => NewProjectScreen(
publisherName: state.pathParameters['name']!, publisherName: state.pathParameters['name']!,
), ),
), ),
GoRoute( GoRoute(
name: 'developerProjectEdit', name: 'developerProjectEdit',
path: ':name/projects/:id/edit', path: ':name/projects/:id/edit',
builder: builder: (context, state) => EditProjectScreen(
(context, state) => EditProjectScreen(
publisherName: state.pathParameters['name']!, publisherName: state.pathParameters['name']!,
id: state.pathParameters['id']!, id: state.pathParameters['id']!,
), ),
@@ -558,8 +544,7 @@ final routerProvider = Provider<GoRouter>((ref) {
GoRoute( GoRoute(
name: 'developerAppDetail', name: 'developerAppDetail',
path: 'apps/:appId', path: 'apps/:appId',
builder: builder: (context, state) => AppDetailScreen(
(context, state) => AppDetailScreen(
publisherName: state.pathParameters['name']!, publisherName: state.pathParameters['name']!,
projectId: state.pathParameters['projectId']!, projectId: state.pathParameters['projectId']!,
appId: state.pathParameters['appId']!, appId: state.pathParameters['appId']!,
@@ -568,8 +553,7 @@ final routerProvider = Provider<GoRouter>((ref) {
GoRoute( GoRoute(
name: 'developerBotDetail', name: 'developerBotDetail',
path: 'bots/:botId', path: 'bots/:botId',
builder: builder: (context, state) => BotDetailScreen(
(context, state) => BotDetailScreen(
publisherName: state.pathParameters['name']!, publisherName: state.pathParameters['name']!,
projectId: state.pathParameters['projectId']!, projectId: state.pathParameters['projectId']!,
botId: state.pathParameters['botId']!, botId: state.pathParameters['botId']!,

View File

@@ -331,8 +331,7 @@ class AccountScreen extends HookConsumerWidget {
if (availableWidth > totalMin) { if (availableWidth > totalMin) {
return Row( return Row(
spacing: 8, spacing: 8,
children: children: children
children
.map((child) => Expanded(child: child)) .map((child) => Expanded(child: child))
.toList(), .toList(),
).padding(horizontal: 12).height(48); ).padding(horizontal: 12).height(48);
@@ -341,8 +340,7 @@ class AccountScreen extends HookConsumerWidget {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Row( child: Row(
spacing: 8, spacing: 8,
children: children: children
children
.map( .map(
(child) => (child) =>
SizedBox(width: minWidth, child: child), SizedBox(width: minWidth, child: child),
@@ -495,8 +493,7 @@ class _UnauthorizedAccountScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBar: AppBar(title: const Text('account').tr()), appBar: AppBar(title: const Text('account').tr()),
body: body: ConstrainedBox(
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 360), constraints: const BoxConstraints(maxWidth: 360),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,

View File

@@ -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,8 +45,7 @@ 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();
@@ -68,8 +67,7 @@ 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: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -83,9 +81,7 @@ class SocialCreditsTab extends HookConsumerWidget {
? 'socialCreditsLevelGood'.tr() ? 'socialCreditsLevelGood'.tr()
: 'socialCreditsLevelExcellent'.tr(), : 'socialCreditsLevelExcellent'.tr(),
).tr().bold().fontSize(20), ).tr().bold().fontSize(20),
Text( Text('${credits.toStringAsFixed(2)} pts').fontSize(14),
'${credits.toStringAsFixed(2)} pts',
).fontSize(14),
const Gap(8), const Gap(8),
LinearProgressIndicator(value: credits / 200), LinearProgressIndicator(value: credits / 200),
], ],
@@ -119,8 +115,7 @@ 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(

View File

@@ -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,8 +35,7 @@ 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();
@@ -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,8 +186,7 @@ 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,
@@ -208,9 +207,7 @@ class LevelingScreen extends HookConsumerWidget {
subtitle: Row( subtitle: Row(
spacing: 8, spacing: 8,
children: [ children: [
Text( Text('${record.delta > 0 ? '+' : ''}${record.delta} EXP'),
'${record.delta > 0 ? '+' : ''}${record.delta} EXP',
),
if (record.bonusMultiplier != 1.0) if (record.bonusMultiplier != 1.0)
Text('x${record.bonusMultiplier}'), Text('x${record.bonusMultiplier}'),
], ],
@@ -249,8 +246,7 @@ 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;

View File

@@ -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,8 +45,7 @@ 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();
@@ -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,8 +138,7 @@ 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: [
@@ -165,8 +164,7 @@ class RelationshipListTile extends StatelessWidget {
PopupMenuButton( PopupMenuButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
icon: const Icon(Symbols.more_vert), icon: const Icon(Symbols.more_vert),
itemBuilder: itemBuilder: (context) => [
(context) => [
if (relationship.status >= 100) // If friend if (relationship.status >= 100) // If friend
PopupMenuItem( PopupMenuItem(
child: ListTile( child: ListTile(
@@ -174,11 +172,7 @@ class RelationshipListTile extends StatelessWidget {
title: Text('blockUser').tr(), title: Text('blockUser').tr(),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
), ),
onTap: onTap: () => onUpdateStatus?.call(relationship, -100),
() => onUpdateStatus?.call(
relationship,
-100,
),
) )
else if (relationship.status <= -100) // If blocked else if (relationship.status <= -100) // If blocked
PopupMenuItem( PopupMenuItem(
@@ -187,9 +181,7 @@ class RelationshipListTile extends StatelessWidget {
title: Text('unblockUser').tr(), title: Text('unblockUser').tr(),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
), ),
onTap: onTap: () => onUpdateStatus?.call(relationship, 100),
() =>
onUpdateStatus?.call(relationship, 100),
), ),
], ],
), ),
@@ -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,9 +373,7 @@ 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) =>
items.isEmpty
? Center( ? Center(
child: Text( child: Text(
'friendSentRequestEmpty'.tr(), 'friendSentRequestEmpty'.tr(),

View File

@@ -20,6 +20,7 @@ import 'package:island/widgets/navigation/fab_menu.dart';
import 'package:island/widgets/response.dart'; import 'package:island/widgets/response.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:relative_time/relative_time.dart'; import 'package:relative_time/relative_time.dart';
import 'package:skeletonizer/skeletonizer.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
import 'package:super_sliver_list/super_sliver_list.dart'; import 'package:super_sliver_list/super_sliver_list.dart';
import 'package:island/pods/chat/chat_room.dart'; import 'package:island/pods/chat/chat_room.dart';
@@ -50,8 +51,7 @@ class ChatRoomListTile extends HookConsumerWidget {
if (validMembers.isNotEmpty) { if (validMembers.isNotEmpty) {
final userInfo = ref.watch(userInfoProvider); final userInfo = ref.watch(userInfoProvider);
if (userInfo.value != null) { if (userInfo.value != null) {
validMembers = validMembers = validMembers
validMembers
.where((e) => e.accountId != userInfo.value!.id) .where((e) => e.accountId != userInfo.value!.id)
.toList(); .toList();
} }
@@ -60,37 +60,60 @@ class ChatRoomListTile extends HookConsumerWidget {
Widget buildSubtitle() { Widget buildSubtitle() {
if (subtitle != null) return subtitle!; if (subtitle != null) return subtitle!;
return summary.when( return AnimatedSwitcher(
data: (data) { duration: const Duration(milliseconds: 300),
if (data == null) { layoutBuilder: (currentChild, previousChildren) => Stack(
return isDirect && room.description == null alignment: Alignment.centerLeft,
children: [
...previousChildren,
if (currentChild != null) currentChild,
],
),
child: summary.when(
data: (data) => Container(
key: const ValueKey('data'),
child: data == null
? isDirect && room.description == null
? Text( ? Text(
validMembers.map((e) => '@${e.account.name}').join(', '), validMembers
.map((e) => '@${e.account.name}')
.join(', '),
maxLines: 1, maxLines: 1,
) )
: Text(room.description ?? 'descriptionNone'.tr(), maxLines: 1); : Text(
} room.description ?? 'descriptionNone'.tr(),
maxLines: 1,
return Column( )
: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
if (data.unreadCount > 0) if (data.unreadCount > 0)
Text( Text(
'unreadMessages'.plural(data.unreadCount), 'unreadMessages'.plural(data.unreadCount),
style: Theme.of(context).textTheme.bodySmall?.copyWith( style: Theme.of(context).textTheme.bodySmall
?.copyWith(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
), ),
if (data.lastMessage == null) if (data.lastMessage == null)
Text(room.description ?? 'descriptionNone'.tr(), maxLines: 1) Text(
room.description ?? 'descriptionNone'.tr(),
maxLines: 1,
)
else else
Row( Row(
spacing: 4, spacing: 4,
children: [ children: [
Badge( Badge(
label: Text(data.lastMessage!.sender.account.nick), label: Text(
textColor: Theme.of(context).colorScheme.onPrimary, data.lastMessage!.sender.account.nick,
backgroundColor: Theme.of(context).colorScheme.primary, ),
textColor: Theme.of(
context,
).colorScheme.onPrimary,
backgroundColor: Theme.of(
context,
).colorScheme.primary,
), ),
Expanded( Expanded(
child: Text( child: Text(
@@ -114,19 +137,37 @@ class ChatRoomListTile extends HookConsumerWidget {
], ],
), ),
], ],
),
),
loading: () => Container(
key: const ValueKey('loading'),
child: Builder(
builder: (context) {
final seed = DateTime.now().microsecondsSinceEpoch;
final len = 4 + (seed % 17); // 4..20 inclusive
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
var s = seed;
final buffer = StringBuffer();
for (var i = 0; i < len; i++) {
s = (s * 1103515245 + 12345) & 0x7fffffff;
buffer.write(chars[s % chars.length]);
}
return Skeletonizer(
enabled: true,
child: Text(buffer.toString()),
); );
}, },
loading: () => const SizedBox.shrink(), ),
error: ),
(_, _) => error: (_, _) => Container(
isDirect && room.description == null key: const ValueKey('error'),
child: isDirect && room.description == null
? Text( ? Text(
validMembers.map((e) => '@${e.account.name}').join(', '), validMembers.map((e) => '@${e.account.name}').join(', '),
maxLines: 1, maxLines: 1,
) )
: Text( : Text(room.description ?? 'descriptionNone'.tr(), maxLines: 1),
room.description ?? 'descriptionNone'.tr(), ),
maxLines: 1,
), ),
); );
} }
@@ -149,11 +190,9 @@ class ChatRoomListTile extends HookConsumerWidget {
loading: () => false, loading: () => false,
error: (_, _) => false, error: (_, _) => false,
), ),
child: child: (isDirect && room.picture?.id == null)
(isDirect && room.picture?.id == null)
? SplitAvatarWidget( ? SplitAvatarWidget(
filesId: filesId: validMembers
validMembers
.map((e) => e.account.profile.picture?.id) .map((e) => e.account.profile.picture?.id)
.toList(), .toList(),
) )
@@ -199,8 +238,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
builder: (context, ref, _) { builder: (context, ref, _) {
final summaryState = ref.watch(chatSummaryProvider); final summaryState = ref.watch(chatSummaryProvider);
return summaryState.maybeWhen( return summaryState.maybeWhen(
loading: loading: () => const LinearProgressIndicator(
() => const LinearProgressIndicator(
minHeight: 2, minHeight: 2,
borderRadius: BorderRadius.zero, borderRadius: BorderRadius.zero,
), ),
@@ -210,16 +248,13 @@ class ChatListBodyWidget extends HookConsumerWidget {
), ),
Expanded( Expanded(
child: chats.when( child: chats.when(
data: data: (items) => RefreshIndicator(
(items) => RefreshIndicator( onRefresh: () => Future.sync(() {
onRefresh:
() => Future.sync(() {
ref.invalidate(chatRoomJoinedProvider); ref.invalidate(chatRoomJoinedProvider);
}), }),
child: SuperListView.builder( child: SuperListView.builder(
padding: EdgeInsets.only(bottom: 96), padding: EdgeInsets.only(bottom: 96),
itemCount: itemCount: items
items
.where( .where(
(item) => (item) =>
selectedTab.value == 0 || selectedTab.value == 0 ||
@@ -228,13 +263,11 @@ class ChatListBodyWidget extends HookConsumerWidget {
) )
.length, .length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final filteredItems = final filteredItems = items
items
.where( .where(
(item) => (item) =>
selectedTab.value == 0 || selectedTab.value == 0 ||
(selectedTab.value == 1 && (selectedTab.value == 1 && item.type == 1) ||
item.type == 1) ||
(selectedTab.value == 2 && item.type != 1), (selectedTab.value == 2 && item.type != 1),
) )
.toList(); .toList();
@@ -260,8 +293,7 @@ class ChatListBodyWidget extends HookConsumerWidget {
), ),
), ),
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (error, stack) => ResponseErrorWidget(
(error, stack) => ResponseErrorWidget(
error: error, error: error,
onRetry: () { onRetry: () {
ref.invalidate(chatRoomJoinedProvider); ref.invalidate(chatRoomJoinedProvider);
@@ -552,15 +584,9 @@ class _ChatInvitesSheet extends HookConsumerWidget {
), ),
], ],
child: invites.when( child: invites.when(
data: data: (items) => items.isEmpty
(items) =>
items.isEmpty
? Center( ? Center(
child: child: Text('invitesEmpty', textAlign: TextAlign.center).tr(),
Text(
'invitesEmpty',
textAlign: TextAlign.center,
).tr(),
) )
: ListView.builder( : ListView.builder(
shrinkWrap: true, shrinkWrap: true,
@@ -576,10 +602,10 @@ class _ChatInvitesSheet extends HookConsumerWidget {
if (invite.chatRoom!.type == 1) if (invite.chatRoom!.type == 1)
Badge( Badge(
label: const Text('directMessage').tr(), label: const Text('directMessage').tr(),
backgroundColor: backgroundColor: Theme.of(
Theme.of(context).colorScheme.primary, context,
textColor: ).colorScheme.primary,
Theme.of(context).colorScheme.onPrimary, textColor: Theme.of(context).colorScheme.onPrimary,
), ),
], ],
), ),

View File

@@ -98,8 +98,7 @@ class PublisherMemberListNotifier extends AsyncNotifier<List<SnPublisherMember>>
); );
totalCount = int.parse(response.headers.value('X-Total') ?? '0'); totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final members = final members = response.data
response.data
.map((e) => SnPublisherMember.fromJson(e)) .map((e) => SnPublisherMember.fromJson(e))
.cast<SnPublisherMember>() .cast<SnPublisherMember>()
.toList(); .toList();
@@ -173,12 +172,10 @@ class PublisherSelector extends StatelessWidget {
iconStyleData: IconStyleData( iconStyleData: IconStyleData(
icon: Icon(Icons.arrow_drop_down), icon: Icon(Icons.arrow_drop_down),
iconSize: 19, iconSize: 19,
iconEnabledColor: iconEnabledColor: isWideScreen(context)
isWideScreen(context)
? null ? null
: Theme.of(context).appBarTheme.foregroundColor!, : Theme.of(context).appBarTheme.foregroundColor!,
iconDisabledColor: iconDisabledColor: isWideScreen(context)
isWideScreen(context)
? null ? null
: Theme.of(context).appBarTheme.foregroundColor!, : Theme.of(context).appBarTheme.foregroundColor!,
), ),
@@ -204,6 +201,13 @@ class _PublisherUnselectedWidget extends HookConsumerWidget {
child: Column( child: Column(
children: [ children: [
if (!hasPublishers) ...[ if (!hasPublishers) ...[
if (publishers.isLoading)
Padding(
padding: const EdgeInsets.all(8),
child: const CircularProgressIndicator(),
)
else
...([
const Icon( const Icon(
Symbols.info, Symbols.info,
fill: 1, fill: 1,
@@ -214,6 +218,7 @@ class _PublisherUnselectedWidget extends HookConsumerWidget {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge,
).tr(), ).tr(),
]),
const Gap(24), const Gap(24),
], ],
if (hasPublishers) if (hasPublishers)
@@ -288,14 +293,14 @@ class CreatorHubScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) =>
(context) =>
EditPublisherScreen(name: currentPublisher.value!.name), EditPublisherScreen(name: currentPublisher.value!.name),
).then((value) async { ).then((value) async {
if (value == null) return; if (value == null) return;
final data = await ref.refresh(publishersManagedProvider.future); final data = await ref.refresh(publishersManagedProvider.future);
currentPublisher.value = currentPublisher.value = data
data.where((e) => e.id == currentPublisher.value!.id).firstOrNull; .where((e) => e.id == currentPublisher.value!.id)
.firstOrNull;
}); });
} }
@@ -315,9 +320,7 @@ class CreatorHubScreen extends HookConsumerWidget {
} }
final List<DropdownMenuItem<SnPublisher>> publishersMenu = publishers.when( final List<DropdownMenuItem<SnPublisher>> publishersMenu = publishers.when(
data: data: (data) => data
(data) =>
data
.map( .map(
(item) => DropdownMenuItem<SnPublisher>( (item) => DropdownMenuItem<SnPublisher>(
value: item, value: item,
@@ -329,8 +332,7 @@ class CreatorHubScreen extends HookConsumerWidget {
), ),
title: Text(item.nick), title: Text(item.nick),
subtitle: Text('@${item.name}'), subtitle: Text('@${item.name}'),
trailing: trailing: currentPublisher.value?.id == item.id
currentPublisher.value?.id == item.id
? const Icon(Icons.check) ? const Icon(Icons.check)
: null, : null,
contentPadding: EdgeInsets.symmetric(horizontal: 8), contentPadding: EdgeInsets.symmetric(horizontal: 8),
@@ -443,8 +445,7 @@ class CreatorHubScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
context: context, context: context,
builder: builder: (context) => _PublisherMemberListSheet(
(context) => _PublisherMemberListSheet(
publisherUname: currentPublisher.value!.name, publisherUname: currentPublisher.value!.name,
), ),
); );
@@ -567,11 +568,9 @@ class CreatorHubScreen extends HookConsumerWidget {
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxWidth), constraints: BoxConstraints(maxWidth: maxWidth),
child: publisherStats.when( child: publisherStats.when(
data: data: (stats) => SingleChildScrollView(
(stats) => SingleChildScrollView(
padding: const EdgeInsets.symmetric(vertical: 24), padding: const EdgeInsets.symmetric(vertical: 24),
child: child: currentPublisher.value == null
currentPublisher.value == null
? ConstrainedBox( ? ConstrainedBox(
constraints: BoxConstraints(maxWidth: 640), constraints: BoxConstraints(maxWidth: 640),
child: _PublisherUnselectedWidget( child: _PublisherUnselectedWidget(
@@ -876,8 +875,7 @@ class _PublisherMemberListSheet extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
context: context, context: context,
builder: builder: (context) => _PublisherMemberRoleSheet(
(context) => _PublisherMemberRoleSheet(
publisherUname: publisherUname, publisherUname: publisherUname,
member: member, member: member,
), ),
@@ -991,12 +989,8 @@ class _PublisherMemberRoleSheet extends HookConsumerWidget {
onSelected: (int selection) { onSelected: (int selection) {
roleController.text = selection.toString(); roleController.text = selection.toString();
}, },
fieldViewBuilder: ( fieldViewBuilder:
context, (context, controller, focusNode, onFieldSubmitted) {
controller,
focusNode,
onFieldSubmitted,
) {
return TextField( return TextField(
controller: controller, controller: controller,
focusNode: focusNode, focusNode: focusNode,
@@ -1085,15 +1079,9 @@ class _PublisherInviteSheet extends HookConsumerWidget {
), ),
], ],
child: invites.when( child: invites.when(
data: data: (items) => items.isEmpty
(items) =>
items.isEmpty
? Center( ? Center(
child: child: Text('invitesEmpty', textAlign: TextAlign.center).tr(),
Text(
'invitesEmpty',
textAlign: TextAlign.center,
).tr(),
) )
: ListView.builder( : ListView.builder(
shrinkWrap: true, shrinkWrap: true,
@@ -1106,8 +1094,7 @@ class _PublisherInviteSheet extends HookConsumerWidget {
fallbackIcon: Symbols.group, fallbackIcon: Symbols.group,
), ),
title: Text(invite.publisher!.nick), title: Text(invite.publisher!.nick),
subtitle: subtitle: Text(
Text(
invite.role >= 100 invite.role >= 100
? 'permissionOwner' ? 'permissionOwner'
: invite.role >= 50 : invite.role >= 50
@@ -1131,8 +1118,7 @@ class _PublisherInviteSheet extends HookConsumerWidget {
}, },
), ),
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (error, _) => ResponseErrorWidget(
(error, _) => ResponseErrorWidget(
error: error, error: error,
onRetry: () => ref.invalidate(publisherInvitesProvider), onRetry: () => ref.invalidate(publisherInvitesProvider),
), ),

View File

@@ -44,8 +44,7 @@ class PollListNotifier extends AsyncNotifier<List<SnPollWithStats>>
queryParameters: queryParams, queryParameters: queryParams,
); );
totalCount = int.parse(response.headers.value('X-Total') ?? '0'); totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final items = final items = response.data
response.data
.map((json) => SnPollWithStats.fromJson(json)) .map((json) => SnPollWithStats.fromJson(json))
.cast<SnPollWithStats>() .cast<SnPollWithStats>()
.toList(); .toList();
@@ -91,6 +90,7 @@ class CreatorPollListScreen extends HookConsumerWidget {
body: ExtendedRefreshIndicator( body: ExtendedRefreshIndicator(
onRefresh: () => ref.refresh(pollListNotifierProvider(pubName).future), onRefresh: () => ref.refresh(pollListNotifierProvider(pubName).future),
child: PaginationList( child: PaginationList(
footerSkeletonMaxWidth: 640,
provider: pollListNotifierProvider(pubName), provider: pollListNotifierProvider(pubName),
notifier: pollListNotifierProvider(pubName).notifier, notifier: pollListNotifierProvider(pubName).notifier,
padding: const EdgeInsets.only(top: 12), padding: const EdgeInsets.only(top: 12),
@@ -119,8 +119,7 @@ class _CreatorPollItem extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final theme = Theme.of(context); final theme = Theme.of(context);
final ended = pollWithStats.endedAt; final ended = pollWithStats.endedAt;
final endedText = final endedText = ended == null
ended == null
? 'No end' ? 'No end'
: MaterialLocalizations.of(context).formatFullDate(ended); : MaterialLocalizations.of(context).formatFullDate(ended);
@@ -152,8 +151,7 @@ class _CreatorPollItem extends HookConsumerWidget {
], ],
), ),
trailing: PopupMenuButton<String>( trailing: PopupMenuButton<String>(
itemBuilder: itemBuilder: (context) => [
(context) => [
PopupMenuItem( PopupMenuItem(
child: Row( child: Row(
children: [ children: [
@@ -167,8 +165,7 @@ class _CreatorPollItem extends HookConsumerWidget {
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
isDismissible: false, isDismissible: false,
builder: builder: (context) => PollEditorScreen(
(context) => PollEditorScreen(
initialPublisher: pubName, initialPublisher: pubName,
initialPollId: pollWithStats.id, initialPollId: pollWithStats.id,
), ),
@@ -189,21 +186,16 @@ class _CreatorPollItem extends HookConsumerWidget {
onTap: () async { onTap: () async {
final confirmed = await showDialog<bool>( final confirmed = await showDialog<bool>(
context: context, context: context,
builder: builder: (context) => AlertDialog(
(context) => AlertDialog(
title: Text('Delete Poll'), title: Text('Delete Poll'),
content: Text( content: Text('Are you sure you want to delete this poll?'),
'Are you sure you want to delete this poll?',
),
actions: [ actions: [
TextButton( TextButton(
onPressed: onPressed: () => Navigator.of(context).pop(false),
() => Navigator.of(context).pop(false),
child: Text('Cancel'), child: Text('Cancel'),
), ),
TextButton( TextButton(
onPressed: onPressed: () => Navigator.of(context).pop(true),
() => Navigator.of(context).pop(true),
child: Text('Delete'), child: Text('Delete'),
), ),
], ],
@@ -212,9 +204,7 @@ class _CreatorPollItem extends HookConsumerWidget {
if (confirmed == true) { if (confirmed == true) {
try { try {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);
await client.delete( await client.delete('/sphere/polls/${pollWithStats.id}');
'/sphere/polls/${pollWithStats.id}',
);
ref.invalidate(pollListNotifierProvider(pubName)); ref.invalidate(pollListNotifierProvider(pubName));
showSnackBar('Poll deleted successfully'); showSnackBar('Poll deleted successfully');
} catch (e) { } catch (e) {

View File

@@ -12,7 +12,6 @@ import 'package:island/widgets/alert.dart';
import 'package:island/widgets/app_scaffold.dart'; 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';
import 'package:island/widgets/extended_refresh_indicator.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
final siteListNotifierProvider = AsyncNotifierProvider.family.autoDispose( final siteListNotifierProvider = AsyncNotifierProvider.family.autoDispose(
@@ -38,8 +37,7 @@ class SiteListNotifier extends AsyncNotifier<List<SnPublicationSite>>
queryParameters: queryParams, queryParameters: queryParams,
); );
totalCount = int.parse(response.headers.value('X-Total') ?? '0'); totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final items = final items = response.data
response.data
.map((json) => SnPublicationSite.fromJson(json)) .map((json) => SnPublicationSite.fromJson(json))
.cast<SnPublicationSite>() .cast<SnPublicationSite>()
.toList(); .toList();
@@ -70,14 +68,11 @@ class CreatorSiteListScreen extends HookConsumerWidget {
onPressed: () => _createSite(context), onPressed: () => _createSite(context),
child: Icon(Icons.add), child: Icon(Icons.add),
), ),
body: ExtendedRefreshIndicator( body: PaginationList(
onRefresh: () => ref.refresh(siteListNotifierProvider(pubName).future), footerSkeletonMaxWidth: 640,
child: CustomScrollView(
slivers: [
const SliverGap(8),
PaginationList(
provider: siteListNotifierProvider(pubName), provider: siteListNotifierProvider(pubName),
notifier: siteListNotifierProvider(pubName).notifier, notifier: siteListNotifierProvider(pubName).notifier,
padding: const EdgeInsets.only(top: 12),
itemBuilder: (context, index, site) { itemBuilder: (context, index, site) {
return ConstrainedBox( return ConstrainedBox(
constraints: BoxConstraints(maxWidth: 640), constraints: BoxConstraints(maxWidth: 640),
@@ -85,9 +80,6 @@ class CreatorSiteListScreen extends HookConsumerWidget {
).center(); ).center();
}, },
), ),
],
),
),
); );
} }
} }
@@ -148,8 +140,7 @@ class _CreatorSiteItem extends HookConsumerWidget {
), ),
), ),
PopupMenuButton<String>( PopupMenuButton<String>(
itemBuilder: itemBuilder: (context) => [
(context) => [
PopupMenuItem( PopupMenuItem(
child: Row( child: Row(
children: [ children: [
@@ -162,11 +153,8 @@ class _CreatorSiteItem extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) =>
(context) => SiteForm( SiteForm(pubName: pubName, siteSlug: site.slug),
pubName: pubName,
siteSlug: site.slug,
),
); );
}, },
), ),
@@ -179,26 +167,10 @@ class _CreatorSiteItem extends HookConsumerWidget {
], ],
), ),
onTap: () async { onTap: () async {
final confirmed = await showDialog<bool>( final confirmed = await showConfirmAlert(
context: context, 'publicationSiteDeleteConfirm'.tr(),
builder: 'deleteSite'.tr(),
(context) => AlertDialog( isDanger: true,
title: Text('deleteSite'.tr()),
content: Text('deleteSiteConfirm'.tr()),
actions: [
TextButton(
onPressed:
() =>
Navigator.of(context).pop(false),
child: Text('cancel'.tr()),
),
TextButton(
onPressed:
() => Navigator.of(context).pop(true),
child: Text('delete'.tr()),
),
],
),
); );
if (confirmed == true) { if (confirmed == true) {
try { try {

View File

@@ -41,8 +41,7 @@ class StickersScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'createStickerPack'.tr(), titleText: 'createStickerPack'.tr(),
child: StickerPackForm(pubName: pubName), child: StickerPackForm(pubName: pubName),
), ),
@@ -54,8 +53,7 @@ class StickersScreen extends HookConsumerWidget {
}, },
child: const Icon(Symbols.add), child: const Icon(Symbols.add),
), ),
body: body: isWideScreen(context)
isWideScreen(context)
? Center( ? Center(
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 640), constraints: BoxConstraints(maxWidth: 640),
@@ -83,6 +81,7 @@ class SliverStickerPacksList extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return PaginationList( return PaginationList(
padding: EdgeInsets.zero,
provider: stickerPacksProvider(pubName), provider: stickerPacksProvider(pubName),
notifier: stickerPacksProvider(pubName).notifier, notifier: stickerPacksProvider(pubName).notifier,
itemBuilder: (context, index, sticker) { itemBuilder: (context, index, sticker) {
@@ -97,8 +96,7 @@ class SliverStickerPacksList extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: sticker.name, titleText: sticker.name,
actions: [ actions: [
IconButton( IconButton(
@@ -108,8 +106,7 @@ class SliverStickerPacksList extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'createSticker'.tr(), titleText: 'createSticker'.tr(),
child: StickerForm(packId: id), child: StickerForm(packId: id),
), ),
@@ -165,8 +162,7 @@ class StickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
); );
totalCount = int.parse(response.headers.value('X-Total') ?? '0'); totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final stickers = final stickers = response.data
response.data
.map((e) => SnStickerPack.fromJson(e)) .map((e) => SnStickerPack.fromJson(e))
.cast<SnStickerPack>() .cast<SnStickerPack>()
.toList(); .toList();
@@ -262,8 +258,7 @@ class StickerPackForm extends HookConsumerWidget {
color: Theme.of(context).colorScheme.surfaceContainer, color: Theme.of(context).colorScheme.surfaceContainer,
borderRadius: BorderRadius.all(Radius.circular(8)), borderRadius: BorderRadius.all(Radius.circular(8)),
), ),
child: child: (icon.value?.isEmpty ?? true)
(icon.value?.isEmpty ?? true)
? const SizedBox.shrink() ? const SizedBox.shrink()
: CloudImageWidget(fileId: icon.value!), : CloudImageWidget(fileId: icon.value!),
), ),
@@ -273,8 +268,7 @@ class StickerPackForm extends HookConsumerWidget {
onPressed: () { onPressed: () {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
builder: builder: (context) => CloudFilePicker(
(context) => CloudFilePicker(
allowedTypes: {UniversalFileType.image}, allowedTypes: {UniversalFileType.image},
), ),
).then((value) { ).then((value) {
@@ -300,8 +294,8 @@ class StickerPackForm extends HookConsumerWidget {
} }
return null; return null;
}, },
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
TextFormField( TextFormField(
controller: descriptionController, controller: descriptionController,
@@ -314,8 +308,8 @@ class StickerPackForm extends HookConsumerWidget {
), ),
minLines: 3, minLines: 3,
maxLines: null, maxLines: null,
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
TextFormField( TextFormField(
controller: prefixController, controller: prefixController,
@@ -332,8 +326,8 @@ class StickerPackForm extends HookConsumerWidget {
} }
return null; return null;
}, },
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
], ],
), ),

View File

@@ -39,8 +39,7 @@ class AppDetailScreen extends HookConsumerWidget {
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Symbols.edit), icon: const Icon(Symbols.edit),
onPressed: onPressed: appData.value == null
appData.value == null
? null ? null
: () { : () {
context.pushNamed( context.pushNamed(
@@ -85,21 +84,31 @@ class AppDetailScreen extends HookConsumerWidget {
controller: tabController, controller: tabController,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
children: [ children: [
_AppOverview(app: app), Align(
AppSecretsScreen( alignment: Alignment.topCenter,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 640),
child: _AppOverview(app: app),
),
),
Align(
alignment: Alignment.topCenter,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 640),
child: AppSecretsScreen(
publisherName: publisherName, publisherName: publisherName,
projectId: projectId, projectId: projectId,
appId: appId, appId: appId,
), ),
),
),
], ],
); );
}, },
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (err, stack) => ResponseErrorWidget(
(err, stack) => ResponseErrorWidget(
error: err, error: err,
onRetry: onRetry: () => ref.invalidate(
() => ref.invalidate(
customAppProvider(publisherName, projectId, appId), customAppProvider(publisherName, projectId, appId),
), ),
), ),
@@ -115,6 +124,7 @@ class _AppOverview extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SingleChildScrollView( return SingleChildScrollView(
padding: EdgeInsets.zero,
child: Column( child: Column(
children: [ children: [
AspectRatio( AspectRatio(
@@ -125,8 +135,7 @@ class _AppOverview extends StatelessWidget {
children: [ children: [
Container( Container(
color: Theme.of(context).colorScheme.surfaceContainer, color: Theme.of(context).colorScheme.surfaceContainer,
child: child: app.background != null
app.background != null
? CloudFileWidget( ? CloudFileWidget(
item: app.background!, item: app.background!,
fit: BoxFit.cover, fit: BoxFit.cover,

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:gap/gap.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/models/custom_app_secret.dart'; import 'package:island/models/custom_app_secret.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
@@ -53,8 +54,7 @@ class AppSecretsScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'newSecretGenerated'.tr(), titleText: 'newSecretGenerated'.tr(),
child: Padding( child: Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
@@ -114,23 +114,39 @@ class AppSecretsScreen extends HookConsumerWidget {
controller: descriptionController, controller: descriptionController,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'description'.tr(), labelText: 'description'.tr(),
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
Radius.circular(12),
),
),
), ),
autofocus: true, autofocus: true,
), ),
const SizedBox(height: 20), const Gap(16),
TextFormField( TextFormField(
controller: expiresInController, controller: expiresInController,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'expiresIn'.tr(), labelText: 'expiresIn'.tr(),
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
Radius.circular(12),
),
),
), ),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
), ),
const SizedBox(height: 20), const Gap(16),
SwitchListTile( Card(
margin: EdgeInsets.zero,
child: SwitchListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
title: Text('isOidc'.tr()), title: Text('isOidc'.tr()),
value: isOidc.value, value: isOidc.value,
onChanged: (value) => isOidc.value = value, onChanged: (value) => isOidc.value = value,
), ),
),
const SizedBox(height: 20), const SizedBox(height: 20),
FilledButton.icon( FilledButton.icon(
onPressed: () async { onPressed: () async {
@@ -175,13 +191,8 @@ class AppSecretsScreen extends HookConsumerWidget {
return secrets.when( return secrets.when(
data: (data) { data: (data) {
return RefreshIndicator( return RefreshIndicator(
onRefresh: onRefresh: () => ref.refresh(
() => ref.refresh( customAppSecretsProvider(publisherName, projectId, appId).future,
customAppSecretsProvider(
publisherName,
projectId,
appId,
).future,
), ),
child: Column( child: Column(
children: [ children: [
@@ -240,11 +251,9 @@ class AppSecretsScreen extends HookConsumerWidget {
); );
}, },
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (err, stack) => ResponseErrorWidget(
(err, stack) => ResponseErrorWidget(
error: err, error: err,
onRetry: onRetry: () => ref.invalidate(
() => ref.invalidate(
customAppSecretsProvider(publisherName, projectId, appId), customAppSecretsProvider(publisherName, projectId, appId),
), ),
), ),

View File

@@ -76,8 +76,7 @@ class CustomAppsScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'createCustomApp'.tr(), titleText: 'createCustomApp'.tr(),
child: NewCustomAppScreen( child: NewCustomAppScreen(
publisherName: publisherName, publisherName: publisherName,
@@ -95,10 +94,8 @@ class CustomAppsScreen extends HookConsumerWidget {
); );
} }
return ExtendedRefreshIndicator( return ExtendedRefreshIndicator(
onRefresh: onRefresh: () =>
() => ref.refresh( ref.refresh(customAppsProvider(publisherName, projectId).future),
customAppsProvider(publisherName, projectId).future,
),
child: Column( child: Column(
children: [ children: [
const Gap(8), const Gap(8),
@@ -110,8 +107,7 @@ class CustomAppsScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'createCustomApp'.tr(), titleText: 'createCustomApp'.tr(),
child: NewCustomAppScreen( child: NewCustomAppScreen(
publisherName: publisherName, publisherName: publisherName,
@@ -145,32 +141,21 @@ class CustomAppsScreen extends HookConsumerWidget {
); );
}, },
child: Column( child: Column(
children: [
SizedBox(
height: 150,
child: Stack(
fit: StackFit.expand,
children: [ children: [
if (app.background != null) if (app.background != null)
CloudFileWidget( AspectRatio(
aspectRatio: 16 / 7,
child: CloudFileWidget(
item: app.background!, item: app.background!,
fit: BoxFit.cover, fit: BoxFit.cover,
).clipRRect(topLeft: 8, topRight: 8), ).clipRRect(topLeft: 8, topRight: 8),
if (app.picture != null)
Positioned(
left: 16,
bottom: 16,
child: ProfilePictureWidget(
fileId: app.picture!.id,
radius: 40,
fallbackIcon: Symbols.apps,
),
),
],
),
), ),
ListTile( ListTile(
title: Text(app.name), title: Text(app.name),
leading: ProfilePictureWidget(
fileId: app.picture?.id,
fallbackIcon: Symbols.apps,
),
subtitle: Text( subtitle: Text(
app.slug, app.slug,
style: GoogleFonts.robotoMono(fontSize: 12), style: GoogleFonts.robotoMono(fontSize: 12),
@@ -180,8 +165,7 @@ class CustomAppsScreen extends HookConsumerWidget {
right: 12, right: 12,
), ),
trailing: PopupMenuButton( trailing: PopupMenuButton(
itemBuilder: itemBuilder: (context) => [
(context) => [
PopupMenuItem( PopupMenuItem(
value: 'edit', value: 'edit',
child: Row( child: Row(
@@ -203,9 +187,7 @@ class CustomAppsScreen extends HookConsumerWidget {
const SizedBox(width: 12), const SizedBox(width: 12),
Text( Text(
'delete', 'delete',
style: TextStyle( style: TextStyle(color: Colors.red),
color: Colors.red,
),
).tr(), ).tr(),
], ],
), ),
@@ -216,8 +198,7 @@ class CustomAppsScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'editCustomApp'.tr(), titleText: 'editCustomApp'.tr(),
child: EditAppScreen( child: EditAppScreen(
publisherName: publisherName, publisherName: publisherName,
@@ -264,13 +245,10 @@ class CustomAppsScreen extends HookConsumerWidget {
); );
}, },
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (err, stack) => ResponseErrorWidget(
(err, stack) => ResponseErrorWidget(
error: err, error: err,
onRetry: onRetry: () =>
() => ref.invalidate( ref.invalidate(customAppsProvider(publisherName, projectId)),
customAppsProvider(publisherName, projectId),
),
), ),
); );
} }

View File

@@ -36,8 +36,7 @@ class BotDetailScreen extends HookConsumerWidget {
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Symbols.edit), icon: const Icon(Symbols.edit),
onPressed: onPressed: botData.value == null
botData.value == null
? null ? null
: () { : () {
context.pushNamed( context.pushNamed(
@@ -84,23 +83,32 @@ class BotDetailScreen extends HookConsumerWidget {
controller: tabController, controller: tabController,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
children: [ children: [
_BotOverview(bot: bot), Align(
BotKeysScreen( alignment: Alignment.topCenter,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 640),
child: _BotOverview(bot: bot),
),
),
Align(
alignment: Alignment.topCenter,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 640),
child: BotKeysScreen(
publisherName: publisherName, publisherName: publisherName,
projectId: projectId, projectId: projectId,
botId: botId, botId: botId,
), ),
),
),
], ],
); );
}, },
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (err, stack) => ResponseErrorWidget(
(err, stack) => ResponseErrorWidget(
error: err, error: err,
onRetry: onRetry: () =>
() => ref.invalidate( ref.invalidate(botProvider(publisherName, projectId, botId)),
botProvider(publisherName, projectId, botId),
),
), ),
), ),
); );
@@ -124,8 +132,7 @@ class _BotOverview extends StatelessWidget {
children: [ children: [
Container( Container(
color: Theme.of(context).colorScheme.surfaceContainer, color: Theme.of(context).colorScheme.surfaceContainer,
child: child: bot.account.profile.background != null
bot.account.profile.background != null
? CloudFileWidget( ? CloudFileWidget(
item: bot.account.profile.background!, item: bot.account.profile.background!,
fit: BoxFit.cover, fit: BoxFit.cover,

View File

@@ -53,8 +53,7 @@ class BotKeysScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'newKeyGenerated'.tr(), titleText: 'newKeyGenerated'.tr(),
child: Padding( child: Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
@@ -94,8 +93,8 @@ class BotKeysScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold( heightFactor: 0.7,
titleText: 'newBotKey'.tr(), titleText: 'newBotKey'.tr(),
child: Padding( child: Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
@@ -105,7 +104,12 @@ class BotKeysScreen extends HookConsumerWidget {
children: [ children: [
TextFormField( TextFormField(
controller: keyNameController, controller: keyNameController,
decoration: InputDecoration(labelText: 'keyName'.tr()), decoration: InputDecoration(
labelText: 'keyName'.tr(),
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
),
autofocus: true, autofocus: true,
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
@@ -189,22 +193,15 @@ class BotKeysScreen extends HookConsumerWidget {
ListTile( ListTile(
leading: const Icon(Symbols.add), leading: const Icon(Symbols.add),
title: Text('newBotKey'.tr()), title: Text('newBotKey'.tr()),
trailing: const Icon(Symbols.chevron_right),
onTap: createKey, onTap: createKey,
), ),
const Divider(height: 1), const Divider(height: 1),
Expanded( Expanded(
child: child: data.isEmpty
data.isEmpty
? Center(child: Text('noBotKeys'.tr())) ? Center(child: Text('noBotKeys'.tr()))
: RefreshIndicator( : RefreshIndicator(
onRefresh: onRefresh: () => ref.refresh(
() => ref.refresh( botKeysProvider(publisherName, projectId, botId).future,
botKeysProvider(
publisherName,
projectId,
botId,
).future,
), ),
child: ListView.builder( child: ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@@ -219,8 +216,7 @@ class BotKeysScreen extends HookConsumerWidget {
right: 12, right: 12,
), ),
trailing: PopupMenuButton( trailing: PopupMenuButton(
itemBuilder: itemBuilder: (context) => [
(context) => [
PopupMenuItem( PopupMenuItem(
value: 'rotate', value: 'rotate',
child: Row( child: Row(
@@ -242,9 +238,7 @@ class BotKeysScreen extends HookConsumerWidget {
const Gap(12), const Gap(12),
Text( Text(
'revoke'.tr(), 'revoke'.tr(),
style: TextStyle( style: TextStyle(color: Colors.red),
color: Colors.red,
),
), ),
], ],
), ),
@@ -267,13 +261,10 @@ class BotKeysScreen extends HookConsumerWidget {
); );
}, },
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (err, stack) => ResponseErrorWidget(
(err, stack) => ResponseErrorWidget(
error: err, error: err,
onRetry: onRetry: () =>
() => ref.invalidate( ref.invalidate(botKeysProvider(publisherName, projectId, botId)),
botKeysProvider(publisherName, projectId, botId),
),
), ),
); );
} }

View File

@@ -54,8 +54,7 @@ class BotsScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'createBot'.tr(), titleText: 'createBot'.tr(),
child: NewBotScreen( child: NewBotScreen(
publisherName: publisherName, publisherName: publisherName,
@@ -73,8 +72,8 @@ class BotsScreen extends HookConsumerWidget {
); );
} }
return ExtendedRefreshIndicator( return ExtendedRefreshIndicator(
onRefresh: onRefresh: () =>
() => ref.refresh(botsProvider(publisherName, projectId).future), ref.refresh(botsProvider(publisherName, projectId).future),
child: Column( child: Column(
children: [ children: [
const Gap(8), const Gap(8),
@@ -86,8 +85,7 @@ class BotsScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'createBot'.tr(), titleText: 'createBot'.tr(),
child: NewBotScreen( child: NewBotScreen(
publisherName: publisherName, publisherName: publisherName,
@@ -108,23 +106,30 @@ class BotsScreen extends HookConsumerWidget {
itemBuilder: (context, index) { itemBuilder: (context, index) {
final bot = data[index]; final bot = data[index];
return Card( return Card(
child: ListTile( child: Column(
shape: const RoundedRectangleBorder( children: [
borderRadius: BorderRadius.all(Radius.circular(8.0)), if (bot.account.profile.background != null)
AspectRatio(
aspectRatio: 16 / 7,
child: CloudFileWidget(
item: bot.account.profile.background!,
fit: BoxFit.cover,
).clipRRect(topLeft: 8, topRight: 8),
), ),
leading: CircleAvatar( ListTile(
child: shape: const RoundedRectangleBorder(
bot.account.profile.picture != null borderRadius: BorderRadius.all(
? ProfilePictureWidget( Radius.circular(8.0),
file: bot.account.profile.picture!, ),
) ),
: const Icon(Symbols.smart_toy), leading: ProfilePictureWidget(
fallbackIcon: Symbols.smart_toy,
file: bot.account.profile.picture,
), ),
title: Text(bot.account.nick), title: Text(bot.account.nick),
subtitle: Text(bot.account.name), subtitle: Text(bot.account.name),
trailing: PopupMenuButton( trailing: PopupMenuButton(
itemBuilder: itemBuilder: (context) => [
(context) => [
PopupMenuItem( PopupMenuItem(
value: 'edit', value: 'edit',
child: Row( child: Row(
@@ -157,8 +162,7 @@ class BotsScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'editBot'.tr(), titleText: 'editBot'.tr(),
child: EditBotScreen( child: EditBotScreen(
publisherName: publisherName, publisherName: publisherName,
@@ -175,7 +179,9 @@ class BotsScreen extends HookConsumerWidget {
isDanger: true, isDanger: true,
).then((confirm) { ).then((confirm) {
if (confirm) { if (confirm) {
final client = ref.read(apiClientProvider); final client = ref.read(
apiClientProvider,
);
client.delete( client.delete(
'/develop/developers/$publisherName/projects/$projectId/bots/${bot.id}', '/develop/developers/$publisherName/projects/$projectId/bots/${bot.id}',
); );
@@ -198,6 +204,8 @@ class BotsScreen extends HookConsumerWidget {
); );
}, },
), ),
],
),
); );
}, },
), ),
@@ -207,11 +215,9 @@ class BotsScreen extends HookConsumerWidget {
); );
}, },
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (err, stack) => ResponseErrorWidget(
(err, stack) => ResponseErrorWidget(
error: err, error: err,
onRetry: onRetry: () => ref.invalidate(botsProvider(publisherName, projectId)),
() => ref.invalidate(botsProvider(publisherName, projectId)),
), ),
); );
} }

View File

@@ -68,8 +68,7 @@ class DeveloperHubScreen extends HookConsumerWidget {
developers.value?.firstOrNull, developers.value?.firstOrNull,
); );
final projects = final projects = currentDeveloper.value?.publisher?.name != null
currentDeveloper.value?.publisher?.name != null
? ref.watch( ? ref.watch(
devProjectsProvider(currentDeveloper.value!.publisher!.name), devProjectsProvider(currentDeveloper.value!.publisher!.name),
) )
@@ -126,8 +125,7 @@ class DeveloperHubScreen extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'createProject'.tr(), titleText: 'createProject'.tr(),
child: ProjectForm( child: ProjectForm(
publisherName: publisherName:
@@ -211,9 +209,7 @@ class _MainContentSection extends HookConsumerWidget {
return Container( return Container(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: developerStats.when( child: developerStats.when(
data: data: (stats) => currentDeveloper == null
(stats) =>
currentDeveloper == null
? ConstrainedBox( ? ConstrainedBox(
constraints: BoxConstraints(maxWidth: 640), constraints: BoxConstraints(maxWidth: 640),
child: _DeveloperUnselectedWidget( child: _DeveloperUnselectedWidget(
@@ -229,9 +225,7 @@ class _MainContentSection extends HookConsumerWidget {
if (stats != null) ...[ if (stats != null) ...[
Text( Text(
'Overview', 'Overview',
style: Theme.of( style: Theme.of(context).textTheme.titleLarge?.copyWith(
context,
).textTheme.titleLarge?.copyWith(
color: Theme.of(context).colorScheme.onSurface, color: Theme.of(context).colorScheme.onSurface,
), ),
), ),
@@ -245,11 +239,9 @@ class _MainContentSection extends HookConsumerWidget {
children: [ children: [
Text( Text(
'Projects', 'Projects',
style: Theme.of( style: Theme.of(context).textTheme.titleLarge
context, ?.copyWith(
).textTheme.titleLarge?.copyWith( color: Theme.of(context).colorScheme.onSurface,
color:
Theme.of(context).colorScheme.onSurface,
), ),
), ),
const Spacer(), const Spacer(),
@@ -273,17 +265,13 @@ class _MainContentSection extends HookConsumerWidget {
// Projects List // Projects List
projects.value?.isNotEmpty ?? false projects.value?.isNotEmpty ?? false
? Column( ? Column(
children: children: projects.value!
projects.value!
.map( .map(
(project) => _ProjectListTile( (project) => _ProjectListTile(
project: project, project: project,
publisherName: publisherName:
currentDeveloper! currentDeveloper!.publisher!.name,
.publisher! onProjectSelected: onProjectSelected,
.name,
onProjectSelected:
onProjectSelected,
), ),
) )
.toList(), .toList(),
@@ -294,8 +282,7 @@ class _MainContentSection extends HookConsumerWidget {
child: Text( child: Text(
'No projects available', 'No projects available',
style: TextStyle( style: TextStyle(
color: color: Theme.of(context).colorScheme.onSurface,
Theme.of(context).colorScheme.onSurface,
fontSize: 16, fontSize: 16,
), ),
), ),
@@ -304,8 +291,7 @@ class _MainContentSection extends HookConsumerWidget {
), ),
), ),
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (err, stack) => ResponseErrorWidget(
(err, stack) => ResponseErrorWidget(
error: err, error: err,
onRetry: () { onRetry: () {
ref.invalidate( ref.invalidate(
@@ -335,9 +321,7 @@ class DeveloperSelector extends HookConsumerWidget {
final developers = ref.watch(developersProvider); final developers = ref.watch(developersProvider);
final List<DropdownMenuItem<SnDeveloper>> developersMenu = developers.when( final List<DropdownMenuItem<SnDeveloper>> developersMenu = developers.when(
data: data: (data) => data
(data) =>
data
.map( .map(
(item) => DropdownMenuItem<SnDeveloper>( (item) => DropdownMenuItem<SnDeveloper>(
value: item, value: item,
@@ -349,8 +333,7 @@ class DeveloperSelector extends HookConsumerWidget {
), ),
title: Text(item.publisher!.nick), title: Text(item.publisher!.nick),
subtitle: Text('@${item.publisher!.name}'), subtitle: Text('@${item.publisher!.name}'),
trailing: trailing: currentDeveloper?.id == item.id
currentDeveloper?.id == item.id
? const Icon(Icons.check) ? const Icon(Icons.check)
: null, : null,
contentPadding: EdgeInsets.symmetric(horizontal: 8), contentPadding: EdgeInsets.symmetric(horizontal: 8),
@@ -446,8 +429,7 @@ class ProjectSelector extends HookConsumerWidget {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
final List<DropdownMenuItem<DevProject>> projectsMenu = final List<DropdownMenuItem<DevProject>> projectsMenu = projects.value!
projects.value!
.map( .map(
(item) => DropdownMenuItem<DevProject>( (item) => DropdownMenuItem<DevProject>(
value: item, value: item,
@@ -469,8 +451,7 @@ class ProjectSelector extends HookConsumerWidget {
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
trailing: trailing: currentProject?.id == item.id
currentProject?.id == item.id
? const Icon(Icons.check) ? const Icon(Icons.check)
: null, : null,
contentPadding: EdgeInsets.symmetric(horizontal: 8), contentPadding: EdgeInsets.symmetric(horizontal: 8),
@@ -496,22 +477,21 @@ class ProjectSelector extends HookConsumerWidget {
final isWider = isWiderScreen(context); final isWider = isWiderScreen(context);
return projectsMenu return projectsMenu
.map( .map(
(e) => (e) => isWider
isWider
? Row( ? Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
CircleAvatar( CircleAvatar(
radius: 16, radius: 16,
backgroundColor: backgroundColor: Theme.of(
Theme.of(context).colorScheme.primary, context,
).colorScheme.primary,
child: Text( child: Text(
e.value?.name.isNotEmpty ?? false e.value?.name.isNotEmpty ?? false
? e.value!.name[0].toUpperCase() ? e.value!.name[0].toUpperCase()
: '?', : '?',
style: TextStyle( style: TextStyle(
color: color: Theme.of(context).colorScheme.onPrimary,
Theme.of(context).colorScheme.onPrimary,
), ),
), ),
), ),
@@ -519,8 +499,7 @@ class ProjectSelector extends HookConsumerWidget {
Text( Text(
e.value?.name ?? '?', e.value?.name ?? '?',
style: TextStyle( style: TextStyle(
color: color: Theme.of(
Theme.of(
context, context,
).appBarTheme.foregroundColor, ).appBarTheme.foregroundColor,
), ),
@@ -529,8 +508,7 @@ class ProjectSelector extends HookConsumerWidget {
).padding(right: 8) ).padding(right: 8)
: CircleAvatar( : CircleAvatar(
radius: 16, radius: 16,
backgroundColor: backgroundColor: Theme.of(context).colorScheme.primary,
Theme.of(context).colorScheme.primary,
child: Text( child: Text(
e.value?.name.isNotEmpty ?? false e.value?.name.isNotEmpty ?? false
? e.value!.name[0].toUpperCase() ? e.value!.name[0].toUpperCase()
@@ -590,8 +568,7 @@ class _ProjectListTile extends HookConsumerWidget {
subtitle: Text(project.description ?? ''), subtitle: Text(project.description ?? ''),
contentPadding: const EdgeInsets.only(left: 16, right: 17), contentPadding: const EdgeInsets.only(left: 16, right: 17),
trailing: PopupMenuButton( trailing: PopupMenuButton(
itemBuilder: itemBuilder: (context) => [
(context) => [
PopupMenuItem( PopupMenuItem(
value: 'edit', value: 'edit',
child: Row( child: Row(
@@ -608,10 +585,7 @@ class _ProjectListTile extends HookConsumerWidget {
children: [ children: [
const Icon(Symbols.delete, color: Colors.red), const Icon(Symbols.delete, color: Colors.red),
const SizedBox(width: 12), const SizedBox(width: 12),
Text( Text('delete', style: const TextStyle(color: Colors.red)).tr(),
'delete',
style: const TextStyle(color: Colors.red),
).tr(),
], ],
), ),
), ),
@@ -621,8 +595,7 @@ class _ProjectListTile extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'editProject'.tr(), titleText: 'editProject'.tr(),
child: ProjectForm( child: ProjectForm(
publisherName: publisherName, publisherName: publisherName,
@@ -735,6 +708,13 @@ class _DeveloperUnselectedWidget extends HookConsumerWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
if (!hasDevelopers) ...[ if (!hasDevelopers) ...[
if (developers.isLoading)
Padding(
padding: const EdgeInsets.all(8),
child: const CircularProgressIndicator(),
)
else
...([
const Icon( const Icon(
Symbols.info, Symbols.info,
fill: 1, fill: 1,
@@ -745,6 +725,7 @@ class _DeveloperUnselectedWidget extends HookConsumerWidget {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge,
).tr(), ).tr(),
]),
const Gap(24), const Gap(24),
], ],
if (hasDevelopers) if (hasDevelopers)
@@ -818,8 +799,7 @@ class ProjectForm extends HookConsumerWidget {
'description': descriptionController.text, 'description': descriptionController.text,
}; };
final resp = final resp = isEditing
isEditing
? await client.put( ? await client.put(
'/develop/developers/$publisherName/projects/${project!.id}', '/develop/developers/$publisherName/projects/${project!.id}',
data: data, data: data,
@@ -860,8 +840,8 @@ class ProjectForm extends HookConsumerWidget {
} }
return null; return null;
}, },
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
TextFormField( TextFormField(
controller: slugController, controller: slugController,
@@ -878,8 +858,8 @@ class ProjectForm extends HookConsumerWidget {
} }
return null; return null;
}, },
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
TextFormField( TextFormField(
controller: descriptionController, controller: descriptionController,
@@ -892,8 +872,8 @@ class ProjectForm extends HookConsumerWidget {
), ),
minLines: 3, minLines: 3,
maxLines: null, maxLines: null,
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
], ],
), ),
@@ -934,12 +914,9 @@ class _DeveloperEnrollmentSheet extends HookConsumerWidget {
return SheetScaffold( return SheetScaffold(
titleText: 'enrollDeveloper'.tr(), titleText: 'enrollDeveloper'.tr(),
child: publishers.when( child: publishers.when(
data: data: (items) => items.isEmpty
(items) =>
items.isEmpty
? Center( ? Center(
child: child: Text(
Text(
'noDevelopersToEnroll', 'noDevelopersToEnroll',
textAlign: TextAlign.center, textAlign: TextAlign.center,
).tr(), ).tr(),
@@ -961,8 +938,7 @@ class _DeveloperEnrollmentSheet extends HookConsumerWidget {
}, },
), ),
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: error: (error, _) => ResponseErrorWidget(
(error, _) => ResponseErrorWidget(
error: error, error: error,
onRetry: () => ref.invalidate(publishersManagedProvider), onRetry: () => ref.invalidate(publishersManagedProvider),
), ),

View File

@@ -24,6 +24,16 @@ class ProjectDetailView extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final tabController = useTabController(initialLength: 2); final tabController = useTabController(initialLength: 2);
final currentDest = useState(0);
useEffect(() {
tabController.addListener(() {
if (tabController.indexIsChanging) {
currentDest.value = tabController.index;
}
});
return null;
});
final isWide = isWideScreen(context); final isWide = isWideScreen(context);
@@ -38,14 +48,13 @@ class ProjectDetailView extends HookConsumerWidget {
child: NavigationRail( child: NavigationRail(
extended: isWiderScreen(context), extended: isWiderScreen(context),
scrollable: true, scrollable: true,
labelType: labelType: isWiderScreen(context)
isWiderScreen(context)
? null ? null
: NavigationRailLabelType.selected, : NavigationRailLabelType.selected,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
selectedIndex: tabController.index, selectedIndex: currentDest.value,
onDestinationSelected: onDestinationSelected: (index) =>
(index) => tabController.animateTo(index), tabController.animateTo(index),
destinations: [ destinations: [
NavigationRailDestination( NavigationRailDestination(
icon: Icon(Icons.apps), icon: Icon(Icons.apps),

View File

@@ -33,7 +33,12 @@ class ArticlesListNotifier extends AsyncNotifier<List<SnWebArticle>>
Future<List<SnWebArticle>> fetch() async { Future<List<SnWebArticle>> fetch() async {
final client = ref.read(apiClientProvider); final client = ref.read(apiClientProvider);
final queryParams = {'limit': pageSize, 'offset': fetchedCount.toString()}; final queryParams = {
'limit': pageSize,
'offset': fetchedCount.toString(),
'feedId': arg.feedId,
'publisherId': arg.publisherId,
}..removeWhere((key, value) => value == null);
try { try {
final response = await client.get( final response = await client.get(
@@ -41,11 +46,8 @@ class ArticlesListNotifier extends AsyncNotifier<List<SnWebArticle>>
queryParameters: queryParams, queryParameters: queryParams,
); );
final articles = final articles = response.data
response.data .map((json) => SnWebArticle.fromJson(json as Map<String, dynamic>))
.map(
(json) => SnWebArticle.fromJson(json as Map<String, dynamic>),
)
.cast<SnWebArticle>() .cast<SnWebArticle>()
.toList(); .toList();
@@ -81,6 +83,7 @@ class SliverArticlesList extends ConsumerWidget {
ArticleListQuery(feedId: feedId, publisherId: publisherId), ArticleListQuery(feedId: feedId, publisherId: publisherId),
); );
return PaginationList( return PaginationList(
spacing: 12,
provider: provider, provider: provider,
notifier: provider.notifier, notifier: provider.notifier,
isRefreshable: false, isRefreshable: false,
@@ -184,14 +187,12 @@ class ArticlesScreen extends ConsumerWidget {
), ),
); );
}, },
loading: loading: () => AppScaffold(
() => AppScaffold(
isNoBackground: false, isNoBackground: false,
appBar: AppBar(title: const Text('Articles')), appBar: AppBar(title: const Text('Articles')),
body: const Center(child: CircularProgressIndicator()), body: const Center(child: CircularProgressIndicator()),
), ),
error: error: (err, stack) => AppScaffold(
(err, stack) => AppScaffold(
isNoBackground: false, isNoBackground: false,
appBar: AppBar(title: const Text('Articles')), appBar: AppBar(title: const Text('Articles')),
body: Center(child: Text('Error: $err')), body: Center(child: Text('Error: $err')),

View File

@@ -44,8 +44,7 @@ class MarketplaceWebFeedContentNotifier
queryParameters: queryParams, queryParameters: queryParams,
); );
totalCount = int.parse(response.headers.value('X-Total') ?? '0'); totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final articles = final articles = response.data
response.data
.map((json) => SnWebArticle.fromJson(json)) .map((json) => SnWebArticle.fromJson(json))
.cast<SnWebArticle>() .cast<SnWebArticle>()
.toList(); .toList();
@@ -116,8 +115,7 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
// Feed meta // Feed meta
feed feed
.when( .when(
data: data: (data) => Column(
(data) => Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
Text(data.description ?? 'descriptionNone'.tr()), Text(data.description ?? 'descriptionNone'.tr()),
@@ -149,10 +147,12 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
// Articles list // Articles list
Expanded( Expanded(
child: PaginationList( child: PaginationList(
spacing: 8,
padding: EdgeInsets.symmetric(vertical: 8),
provider: marketplaceWebFeedContentNotifierProvider(id), provider: marketplaceWebFeedContentNotifierProvider(id),
notifier: marketplaceWebFeedContentNotifierProvider(id).notifier, notifier: marketplaceWebFeedContentNotifierProvider(id).notifier,
itemBuilder: (context, index, article) { itemBuilder: (context, index, article) {
return WebArticleCard(article: article); return WebArticleCard(article: article).padding(horizontal: 12);
}, },
), ),
), ),
@@ -165,10 +165,8 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
), ),
color: Theme.of(context).colorScheme.surfaceContainer, color: Theme.of(context).colorScheme.surfaceContainer,
child: subscribed.when( child: subscribed.when(
data: data: (isSubscribed) => FilledButton.icon(
(isSubscribed) => FilledButton.icon( onPressed: isSubscribed ? unsubscribeFromFeed : subscribeToFeed,
onPressed:
isSubscribed ? unsubscribeFromFeed : subscribeToFeed,
icon: Icon( icon: Icon(
isSubscribed ? Symbols.remove_circle : Symbols.add_circle, isSubscribed ? Symbols.remove_circle : Symbols.add_circle,
), ),
@@ -176,14 +174,12 @@ class MarketplaceWebFeedDetailScreen extends HookConsumerWidget {
isSubscribed ? 'unsubscribe'.tr() : 'subscribe'.tr(), isSubscribed ? 'unsubscribe'.tr() : 'subscribe'.tr(),
), ),
), ),
loading: loading: () => const SizedBox(
() => const SizedBox(
height: 32, height: 32,
width: 32, width: 32,
child: CircularProgressIndicator(strokeWidth: 2), child: CircularProgressIndicator(strokeWidth: 2),
), ).center(),
error: error: (_, _) => OutlinedButton.icon(
(_, _) => OutlinedButton.icon(
onPressed: subscribeToFeed, onPressed: subscribeToFeed,
icon: const Icon(Symbols.add_circle), icon: const Icon(Symbols.add_circle),
label: Text('subscribe').tr(), label: Text('subscribe').tr(),

View File

@@ -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,
); );
@@ -38,8 +38,7 @@ class MarketplaceWebFeedsNotifier extends AsyncNotifier<List<SnWebFeed>>
); );
totalCount = int.parse(response.headers.value('X-Total') ?? '0'); totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final feeds = final feeds = response.data
response.data
.map((e) => SnWebFeed.fromJson(e)) .map((e) => SnWebFeed.fromJson(e))
.cast<SnWebFeed>() .cast<SnWebFeed>()
.toList(); .toList();
@@ -92,8 +91,8 @@ class MarketplaceWebFeedsScreen extends HookConsumerWidget {
padding: WidgetStateProperty.all( padding: WidgetStateProperty.all(
const EdgeInsets.symmetric(horizontal: 24), const EdgeInsets.symmetric(horizontal: 24),
), ),
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
trailing: [ trailing: [
if (query.value != null && query.value!.isNotEmpty) if (query.value != null && query.value!.isNotEmpty)
IconButton( IconButton(
@@ -128,6 +127,7 @@ class MarketplaceWebFeedsScreen extends HookConsumerWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, index, feed) { itemBuilder: (context, index, feed) {
return ListTile( return ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
title: Text(feed.title), title: Text(feed.title),
subtitle: Text(feed.description ?? ''), subtitle: Text(feed.description ?? ''),
trailing: const Icon(Symbols.chevron_right), trailing: const Icon(Symbols.chevron_right),

View File

@@ -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),

View File

@@ -102,7 +102,7 @@ class ExploreScreen extends HookConsumerWidget {
// Listen for post creation events to refresh activities // Listen for post creation events to refresh activities
useEffect(() { useEffect(() {
final subscription = eventBus.on<PostCreatedEvent>().listen((event) { final subscription = eventBus.on<PostCreatedEvent>().listen((event) {
ref.invalidate(activityListProvider); ref.read(activityListProvider.notifier).refresh();
}); });
return subscription.cancel; return subscription.cancel;
}, []); }, []);
@@ -183,25 +183,13 @@ class ExploreScreen extends HookConsumerWidget {
children: [ children: [
const Icon(Symbols.category), const Icon(Symbols.category),
const Gap(12), const Gap(12),
Text('categories').tr(), Text('categoriesAndTags').tr(),
], ],
), ),
onTap: () { onTap: () {
context.pushNamed('postCategories'); context.pushNamed('postCategories');
}, },
), ),
PopupMenuItem(
child: Row(
children: [
const Icon(Symbols.label),
const Gap(12),
Text('tags').tr(),
],
),
onTap: () {
context.pushNamed('postTags');
},
),
PopupMenuItem( PopupMenuItem(
child: Row( child: Row(
children: [ children: [
@@ -490,25 +478,13 @@ class ExploreScreen extends HookConsumerWidget {
children: [ children: [
const Icon(Symbols.category), const Icon(Symbols.category),
const Gap(12), const Gap(12),
Text('categories').tr(), Text('categoriesAndTags').tr(),
], ],
), ),
onTap: () { onTap: () {
context.pushNamed('postCategories'); context.pushNamed('postCategories');
}, },
), ),
PopupMenuItem(
child: Row(
children: [
const Icon(Symbols.label),
const Gap(12),
Text('tags').tr(),
],
),
onTap: () {
context.pushNamed('postTags');
},
),
PopupMenuItem( PopupMenuItem(
child: Row( child: Row(
children: [ children: [

View File

@@ -18,11 +18,92 @@ import 'package:island/widgets/paging/pagination_list.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart'; import 'package:material_symbols_icons/material_symbols_icons.dart';
import 'package:relative_time/relative_time.dart'; import 'package:relative_time/relative_time.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:skeletonizer/skeletonizer.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
part 'notification.g.dart'; part 'notification.g.dart';
class SkeletonNotificationTile extends StatelessWidget {
const SkeletonNotificationTile({super.key});
@override
Widget build(BuildContext context) {
const fakeTitle = 'New notification';
const fakeSubtitle = 'You have a new message from someone';
const fakeContent =
'This is a preview of the notification content. It may contain formatted text.';
const List<String> fakeImageIds = []; // Empty list for no images
const String? fakePfp = null; // No profile picture
return ListTile(
isThreeLine: true,
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
leading: fakePfp != null
? ProfilePictureWidget(fileId: fakePfp, radius: 20)
: CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
child: Icon(
Symbols.notifications,
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
),
title: const Text(fakeTitle),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(fakeSubtitle).bold(),
Row(
spacing: 6,
children: [
Text('Loading...').fontSize(11),
Skeleton.ignore(child: Text('·').fontSize(11).bold()),
Text('Now').fontSize(11),
],
).opacity(0.75).padding(bottom: 4),
MarkdownTextContent(
content: fakeContent,
textStyle: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
),
),
if (fakeImageIds.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 8),
child: Wrap(
spacing: 8,
runSpacing: 8,
children: fakeImageIds.map((imageId) {
return SizedBox(
width: 80,
height: 80,
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: CloudImageWidget(
fileId: imageId,
aspectRatio: 1,
fit: BoxFit.cover,
),
),
);
}).toList(),
),
),
],
),
trailing: Container(
width: 12,
height: 12,
decoration: const BoxDecoration(
color: Colors.blue,
shape: BoxShape.circle,
),
),
onTap: () {},
);
}
}
@riverpod @riverpod
class NotificationUnreadCountNotifier class NotificationUnreadCountNotifier
extends _$NotificationUnreadCountNotifier { extends _$NotificationUnreadCountNotifier {
@@ -82,7 +163,7 @@ class NotificationUnreadCountNotifier
} }
} }
final notificationListProvider = AsyncNotifierProvider( final notificationListProvider = AsyncNotifierProvider.autoDispose(
NotificationListNotifier.new, NotificationListNotifier.new,
); );
@@ -182,6 +263,7 @@ class NotificationSheet extends HookConsumerWidget {
child: PaginationList( child: PaginationList(
provider: notificationListProvider, provider: notificationListProvider,
notifier: notificationListProvider.notifier, notifier: notificationListProvider.notifier,
footerSkeletonChild: const SkeletonNotificationTile(),
itemBuilder: (context, index, notification) { itemBuilder: (context, index, notification) {
final pfp = notification.meta['pfp'] as String?; final pfp = notification.meta['pfp'] as String?;
final images = notification.meta['images'] as List?; final images = notification.meta['images'] as List?;

View File

@@ -2,73 +2,64 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/models/post_category.dart'; import 'package:island/pods/post/post_categories.dart';
import 'package:island/models/post_tag.dart';
import 'package:island/pods/network.dart';
import 'package:island/pods/paging.dart';
import 'package:island/widgets/app_scaffold.dart'; 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';
// Post Categories Notifier class PostCategoriesListScreen extends HookConsumerWidget {
final postCategoriesProvider = AsyncNotifierProvider.autoDispose<
PostCategoriesNotifier,
List<SnPostCategory>
>(PostCategoriesNotifier.new);
class PostCategoriesNotifier extends AsyncNotifier<List<SnPostCategory>>
with AsyncPaginationController<SnPostCategory> {
@override
Future<List<SnPostCategory>> fetch() async {
final client = ref.read(apiClientProvider);
final response = await client.get(
'/sphere/posts/categories',
queryParameters: {'offset': fetchedCount, 'take': 20, 'order': 'usage'},
);
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final data = response.data as List;
return data.map((json) => SnPostCategory.fromJson(json)).toList();
}
}
// Post Tags Notifier
final postTagsProvider =
AsyncNotifierProvider.autoDispose<PostTagsNotifier, List<SnPostTag>>(
PostTagsNotifier.new,
);
class PostTagsNotifier extends AsyncNotifier<List<SnPostTag>>
with AsyncPaginationController<SnPostTag> {
@override
Future<List<SnPostTag>> fetch() async {
final client = ref.read(apiClientProvider);
final response = await client.get(
'/sphere/posts/tags',
queryParameters: {'offset': fetchedCount, 'take': 20, 'order': 'usage'},
);
totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final data = response.data as List;
return data.map((json) => SnPostTag.fromJson(json)).toList();
}
}
class PostCategoriesListScreen extends ConsumerWidget {
const PostCategoriesListScreen({super.key}); const PostCategoriesListScreen({super.key});
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return AppScaffold( return DefaultTabController(
appBar: AppBar(title: const Text('categories').tr()), length: 2,
body: PaginationList( child: AppScaffold(
isNoBackground: false,
appBar: AppBar(
title: const Text('categoriesAndTags').tr(),
bottom: TabBar(
tabs: [
Tab(
child: Text(
'categories'.tr(),
style: TextStyle(
color: Theme.of(context).appBarTheme.foregroundColor,
),
),
),
Tab(
child: Text(
'tags'.tr(),
style: TextStyle(
color: Theme.of(context).appBarTheme.foregroundColor,
),
),
),
],
),
),
body: const TabBarView(children: [_CategoriesTab(), _TagsTab()]),
),
);
}
}
class _CategoriesTab extends ConsumerWidget {
const _CategoriesTab();
@override
Widget build(BuildContext context, WidgetRef ref) {
return PaginationList(
provider: postCategoriesProvider, provider: postCategoriesProvider,
notifier: postCategoriesProvider.notifier, notifier: postCategoriesProvider.notifier,
footerSkeletonMaxWidth: 640,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, index, category) { itemBuilder: (context, index, category) {
return ListTile( return Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 640),
child: ListTile(
leading: const Icon(Symbols.category), leading: const Icon(Symbols.category),
contentPadding: const EdgeInsets.symmetric(horizontal: 24), contentPadding: const EdgeInsets.symmetric(horizontal: 24),
trailing: const Icon(Symbols.chevron_right), trailing: const Icon(Symbols.chevron_right),
@@ -80,26 +71,29 @@ class PostCategoriesListScreen extends ConsumerWidget {
pathParameters: {'slug': category.slug}, pathParameters: {'slug': category.slug},
); );
}, },
),
),
); );
}, },
),
); );
} }
} }
class PostTagsListScreen extends ConsumerWidget { class _TagsTab extends ConsumerWidget {
const PostTagsListScreen({super.key}); const _TagsTab();
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return AppScaffold( return PaginationList(
appBar: AppBar(title: const Text('tags').tr()),
body: PaginationList(
provider: postTagsProvider, provider: postTagsProvider,
notifier: postTagsProvider.notifier, notifier: postTagsProvider.notifier,
footerSkeletonMaxWidth: 640,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, index, tag) { itemBuilder: (context, index, tag) {
return ListTile( return Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 640),
child: ListTile(
title: Text(tag.name ?? '#${tag.slug}'), title: Text(tag.name ?? '#${tag.slug}'),
contentPadding: const EdgeInsets.symmetric(horizontal: 24), contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leading: const Icon(Symbols.label), leading: const Icon(Symbols.label),
@@ -111,9 +105,10 @@ class PostTagsListScreen extends ConsumerWidget {
pathParameters: {'slug': tag.slug}, pathParameters: {'slug': tag.slug},
); );
}, },
),
),
); );
}, },
),
); );
} }
} }

View File

@@ -6,6 +6,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/widgets/app_scaffold.dart'; import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/extended_refresh_indicator.dart'; import 'package:island/widgets/extended_refresh_indicator.dart';
import 'package:island/widgets/post/post_item.dart'; import 'package:island/widgets/post/post_item.dart';
import 'package:island/widgets/post/post_item_skeleton.dart';
import 'package:island/widgets/posts/post_filter.dart'; import 'package:island/widgets/posts/post_filter.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:island/pods/post/post_list.dart'; import 'package:island/pods/post/post_list.dart';
@@ -140,6 +141,12 @@ class PostSearchScreen extends HookConsumerWidget {
).notifier, ).notifier,
isSliver: true, isSliver: true,
isRefreshable: false, isRefreshable: false,
footerSkeletonChild: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8,
),
child: const PostItemSkeleton(),
),
itemBuilder: (context, index, post) { itemBuilder: (context, index, post) {
return Card( return Card(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
@@ -261,6 +268,10 @@ class PostSearchScreen extends HookConsumerWidget {
).notifier, ).notifier,
isSliver: true, isSliver: true,
isRefreshable: false, isRefreshable: false,
footerSkeletonChild: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: const PostItemSkeleton(),
),
itemBuilder: (context, index, post) { itemBuilder: (context, index, post) {
return Center( return Center(
child: ConstrainedBox( child: ConstrainedBox(

View File

@@ -127,13 +127,9 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
// Stickers grid // Stickers grid
Expanded( Expanded(
child: packContent.when( child: packContent.when(
data: data: (stickers) => RefreshIndicator(
(stickers) => RefreshIndicator( onRefresh: () => ref.refresh(
onRefresh: marketplaceStickerPackContentProvider(packId: id).future,
() => ref.refresh(
marketplaceStickerPackContentProvider(
packId: id,
).future,
), ),
child: GridView.builder( child: GridView.builder(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@@ -157,8 +153,7 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: color: Theme.of(
Theme.of(
context, context,
).colorScheme.surfaceContainer, ).colorScheme.surfaceContainer,
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(
@@ -178,9 +173,7 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
}, },
), ),
), ),
error: error: (err, _) => Text(
(err, _) =>
Text(
'Error: $err', 'Error: $err',
).textAlignment(TextAlign.center).center(), ).textAlignment(TextAlign.center).center(),
loading: () => const CircularProgressIndicator().center(), loading: () => const CircularProgressIndicator().center(),
@@ -189,27 +182,21 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8), padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8),
child: owned.when( child: owned.when(
data: data: (isOwned) => FilledButton.icon(
(isOwned) => FilledButton.icon( onPressed: isOwned
onPressed:
isOwned
? removePackFromMyCollection ? removePackFromMyCollection
: addPackToMyCollection, : addPackToMyCollection,
icon: Icon( icon: Icon(
isOwned ? Symbols.remove_circle : Symbols.add_circle, isOwned ? Symbols.remove_circle : Symbols.add_circle,
), ),
label: Text( label: Text(isOwned ? 'removePack'.tr() : 'addPack'.tr()),
isOwned ? 'removePack'.tr() : 'addPack'.tr(),
), ),
), loading: () => const SizedBox(
loading:
() => const SizedBox(
height: 32, height: 32,
width: 32, width: 32,
child: CircularProgressIndicator(strokeWidth: 2), child: CircularProgressIndicator(strokeWidth: 2),
), ).center(),
error: error: (_, _) => OutlinedButton.icon(
(_, _) => OutlinedButton.icon(
onPressed: addPackToMyCollection, onPressed: addPackToMyCollection,
icon: const Icon(Symbols.add_circle), icon: const Icon(Symbols.add_circle),
label: Text('addPack').tr(), label: Text('addPack').tr(),
@@ -220,8 +207,7 @@ class MarketplaceStickerPackDetailScreen extends HookConsumerWidget {
], ],
); );
}, },
error: error: (err, _) =>
(err, _) =>
Text('Error: $err').textAlignment(TextAlign.center).center(), Text('Error: $err').textAlignment(TextAlign.center).center(),
loading: () => const CircularProgressIndicator().center(), loading: () => const CircularProgressIndicator().center(),
), ),

View File

@@ -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
@@ -60,8 +59,7 @@ class MarketplaceStickerPacksNotifier extends AsyncNotifier<List<SnStickerPack>>
); );
totalCount = int.parse(response.headers.value('X-Total') ?? '0'); totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final stickers = final stickers = response.data
response.data
.map((e) => SnStickerPack.fromJson(e)) .map((e) => SnStickerPack.fromJson(e))
.cast<SnStickerPack>() .cast<SnStickerPack>()
.toList(); .toList();
@@ -112,12 +110,10 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
onPressed: () { onPressed: () {
query.value = query.value.copyWith(byUsage: !query.value.byUsage); query.value = query.value.copyWith(byUsage: !query.value.byUsage);
}, },
icon: icon: query.value.byUsage
query.value.byUsage
? const Icon(Symbols.local_fire_department) ? const Icon(Symbols.local_fire_department)
: const Icon(Symbols.access_time), : const Icon(Symbols.access_time),
tooltip: tooltip: query.value.byUsage
query.value.byUsage
? 'orderByPopularity'.tr() ? 'orderByPopularity'.tr()
: 'orderByReleaseDate'.tr(), : 'orderByReleaseDate'.tr(),
), ),
@@ -137,8 +133,8 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
padding: WidgetStateProperty.all( padding: WidgetStateProperty.all(
const EdgeInsets.symmetric(horizontal: 24), const EdgeInsets.symmetric(horizontal: 24),
), ),
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
trailing: [ trailing: [
if (query.value.query != null && query.value.query!.isNotEmpty) if (query.value.query != null && query.value.query!.isNotEmpty)
IconButton( IconButton(
@@ -171,14 +167,13 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
padding: EdgeInsets.only(top: 8), padding: EdgeInsets.only(top: 8),
provider: marketplaceStickerPacksNotifierProvider, provider: marketplaceStickerPacksNotifierProvider,
notifier: marketplaceStickerPacksNotifierProvider.notifier, notifier: marketplaceStickerPacksNotifierProvider.notifier,
itemBuilder: itemBuilder: (context, idx, pack) => Card(
(context, idx, pack) => Card(
margin: EdgeInsets.symmetric(horizontal: 12, vertical: 4), margin: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
child: Column( child: Column(
children: [ children: [
if (pack.stickers.isNotEmpty)
Container( Container(
color: color: Theme.of(context).colorScheme.secondaryContainer,
Theme.of(context).colorScheme.secondaryContainer,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 20, horizontal: 20,
@@ -200,11 +195,8 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
maxWidth: 80, maxWidth: 80,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(8),
8, color: Theme.of(
),
color:
Theme.of(
context, context,
).colorScheme.tertiaryContainer, ).colorScheme.tertiaryContainer,
), ),
@@ -234,14 +226,12 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
8, 8,
), ),
color: color: Theme.of(
Theme.of(
context, context,
).colorScheme.tertiaryContainer, ).colorScheme.tertiaryContainer,
), ),
child: CloudImageWidget( child: CloudImageWidget(
file: file: pack.stickers[index + 4].image,
pack.stickers[index + 4].image,
), ),
).clipRRect(all: 8), ).clipRRect(all: 8),
), ),
@@ -254,8 +244,7 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
ListTile( ListTile(
leading: Container( leading: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: color: Theme.of(
Theme.of(
context, context,
).colorScheme.tertiaryContainer, ).colorScheme.tertiaryContainer,
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(
@@ -263,7 +252,7 @@ class MarketplaceStickersScreen extends HookConsumerWidget {
), ),
), ),
child: CloudImageWidget( child: CloudImageWidget(
file: pack.icon ?? pack.stickers.first.image, file: pack.icon ?? pack.stickers.firstOrNull?.image,
), ),
).width(40).height(40).clipRRect(all: 8), ).width(40).height(40).clipRRect(all: 8),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(

View File

@@ -112,8 +112,8 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
), ),
), ),
), ),
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
const Gap(16), const Gap(16),
@@ -137,8 +137,7 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
), ),
), ),
), ),
items: items: kCurrencyIconData.keys.map((currency) {
kCurrencyIconData.keys.map((currency) {
return DropdownMenuItem( return DropdownMenuItem(
value: currency, value: currency,
child: Row( child: Row(
@@ -178,8 +177,7 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
inputFormatters: [FilteringTextInputFormatter.digitsOnly], inputFormatters: [FilteringTextInputFormatter.digitsOnly],
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'enterNumberOfSplits'.tr(), labelText: 'enterNumberOfSplits'.tr(),
hintText: hintText: selectedRecipients.isNotEmpty
selectedRecipients.isNotEmpty
? selectedRecipients.length.toString() ? selectedRecipients.length.toString()
: '1', : '1',
border: OutlineInputBorder( border: OutlineInputBorder(
@@ -188,12 +186,12 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
), ),
), ),
), ),
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
onChanged: (value) { onChanged: (value) {
if (value.isEmpty && selectedRecipients.isNotEmpty) { if (value.isEmpty && selectedRecipients.isNotEmpty) {
splitsController.text = splitsController.text = selectedRecipients.length
selectedRecipients.length.toString(); .toString();
} }
}, },
), ),
@@ -261,8 +259,7 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
).colorScheme.outline.withOpacity(0.2), ).colorScheme.outline.withOpacity(0.2),
), ),
), ),
child: child: selectedRecipients.isNotEmpty
selectedRecipients.isNotEmpty
? Column( ? Column(
children: [ children: [
...selectedRecipients.map((recipient) { ...selectedRecipients.map((recipient) {
@@ -283,26 +280,23 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
), ),
subtitle: Text( subtitle: Text(
'selectedRecipient'.tr(), 'selectedRecipient'.tr(),
style: Theme.of( style: Theme.of(context).textTheme.bodySmall
context, ?.copyWith(
).textTheme.bodySmall?.copyWith( color: Theme.of(
color:
Theme.of(
context, context,
).colorScheme.onSurfaceVariant, ).colorScheme.onSurfaceVariant,
), ),
), ),
trailing: IconButton( trailing: IconButton(
onPressed: onPressed: () => setState(
() => setState( () =>
() => selectedRecipients.remove( selectedRecipients.remove(recipient),
recipient,
),
), ),
icon: Icon( icon: Icon(
Icons.clear, Icons.clear,
color: color: Theme.of(
Theme.of(context).colorScheme.error, context,
).colorScheme.error,
), ),
tooltip: 'Remove recipient', tooltip: 'Remove recipient',
), ),
@@ -316,19 +310,16 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
Icon( Icon(
Icons.person_add_outlined, Icons.person_add_outlined,
size: 48, size: 48,
color: color: Theme.of(
Theme.of(
context, context,
).colorScheme.onSurfaceVariant, ).colorScheme.onSurfaceVariant,
), ),
const Gap(8), const Gap(8),
Text( Text(
'noRecipientsSelected'.tr(), 'noRecipientsSelected'.tr(),
style: Theme.of( style: Theme.of(context).textTheme.bodyMedium
context, ?.copyWith(
).textTheme.bodyMedium?.copyWith( color: Theme.of(
color:
Theme.of(
context, context,
).colorScheme.onSurfaceVariant, ).colorScheme.onSurfaceVariant,
), ),
@@ -336,11 +327,9 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
const Gap(4), const Gap(4),
Text( Text(
'selectRecipientsToSendFund'.tr(), 'selectRecipientsToSendFund'.tr(),
style: Theme.of( style: Theme.of(context).textTheme.bodySmall
context, ?.copyWith(
).textTheme.bodySmall?.copyWith( color: Theme.of(
color:
Theme.of(
context, context,
).colorScheme.onSurfaceVariant, ).colorScheme.onSurfaceVariant,
), ),
@@ -399,8 +388,8 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
), ),
), ),
maxLines: 3, maxLines: 3,
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
], ],
), ),
@@ -441,13 +430,10 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
useSafeArea: true, useSafeArea: true,
builder: builder: (context) => Container(
(context) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.surface,
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
top: Radius.circular(16),
),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
@@ -473,10 +459,10 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
const Gap(24), const Gap(24),
OtpTextField( OtpTextField(
numberOfFields: 6, numberOfFields: 6,
borderColor: borderColor: Theme.of(context).colorScheme.outline,
Theme.of(context).colorScheme.outline, focusedBorderColor: Theme.of(
focusedBorderColor: context,
Theme.of(context).colorScheme.primary, ).colorScheme.primary,
showFieldAsBox: true, showFieldAsBox: true,
obscureText: true, obscureText: true,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
@@ -484,9 +470,7 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
fieldHeight: 56, fieldHeight: 56,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
borderWidth: 1, borderWidth: 1,
textStyle: Theme.of(context) textStyle: Theme.of(context).textTheme.headlineSmall
.textTheme
.headlineSmall
?.copyWith(fontWeight: FontWeight.w600), ?.copyWith(fontWeight: FontWeight.w600),
onSubmit: (pin) { onSubmit: (pin) {
enteredPin = pin; enteredPin = pin;
@@ -552,8 +536,7 @@ class _CreateFundSheetState extends State<CreateFundSheet> {
'split_type': selectedSplitType, 'split_type': selectedSplitType,
'amount_of_splits': splits, 'amount_of_splits': splits,
'recipient_account_ids': selectedRecipients.map((r) => r.id).toList(), 'recipient_account_ids': selectedRecipients.map((r) => r.id).toList(),
'message': 'message': messageController.text.trim().isEmpty
messageController.text.trim().isEmpty
? null ? null
: messageController.text.trim(), : messageController.text.trim(),
'pin_code': '', // Will be filled by PIN verification 'pin_code': '', // Will be filled by PIN verification
@@ -632,8 +615,8 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
), ),
), ),
), ),
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
const Gap(16), const Gap(16),
@@ -657,8 +640,7 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
), ),
), ),
), ),
items: items: kCurrencyIconData.keys.map((currency) {
kCurrencyIconData.keys.map((currency) {
return DropdownMenuItem( return DropdownMenuItem(
value: currency, value: currency,
child: Row( child: Row(
@@ -702,8 +684,7 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
).colorScheme.outline.withOpacity(0.2), ).colorScheme.outline.withOpacity(0.2),
), ),
), ),
child: child: selectedPayee != null
selectedPayee != null
? ListTile( ? ListTile(
contentPadding: const EdgeInsets.only( contentPadding: const EdgeInsets.only(
left: 20, left: 20,
@@ -721,18 +702,16 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
), ),
subtitle: Text( subtitle: Text(
'selectedPayee'.tr(), 'selectedPayee'.tr(),
style: Theme.of( style: Theme.of(context).textTheme.bodySmall
context, ?.copyWith(
).textTheme.bodySmall?.copyWith( color: Theme.of(
color:
Theme.of(
context, context,
).colorScheme.onSurfaceVariant, ).colorScheme.onSurfaceVariant,
), ),
), ),
trailing: IconButton( trailing: IconButton(
onPressed: onPressed: () =>
() => setState(() => selectedPayee = null), setState(() => selectedPayee = null),
icon: Icon( icon: Icon(
Icons.clear, Icons.clear,
color: Theme.of(context).colorScheme.error, color: Theme.of(context).colorScheme.error,
@@ -746,19 +725,16 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
Icon( Icon(
Icons.person_add_outlined, Icons.person_add_outlined,
size: 48, size: 48,
color: color: Theme.of(
Theme.of(
context, context,
).colorScheme.onSurfaceVariant, ).colorScheme.onSurfaceVariant,
), ),
const Gap(8), const Gap(8),
Text( Text(
'noPayeeSelected'.tr(), 'noPayeeSelected'.tr(),
style: Theme.of( style: Theme.of(context).textTheme.bodyMedium
context, ?.copyWith(
).textTheme.bodyMedium?.copyWith( color: Theme.of(
color:
Theme.of(
context, context,
).colorScheme.onSurfaceVariant, ).colorScheme.onSurfaceVariant,
), ),
@@ -766,11 +742,9 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
const Gap(4), const Gap(4),
Text( Text(
'selectPayeeToTransfer'.tr(), 'selectPayeeToTransfer'.tr(),
style: Theme.of( style: Theme.of(context).textTheme.bodySmall
context, ?.copyWith(
).textTheme.bodySmall?.copyWith( color: Theme.of(
color:
Theme.of(
context, context,
).colorScheme.onSurfaceVariant, ).colorScheme.onSurfaceVariant,
), ),
@@ -824,8 +798,8 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
), ),
), ),
maxLines: 3, maxLines: 3,
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
], ],
), ),
@@ -866,13 +840,10 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
useSafeArea: true, useSafeArea: true,
builder: builder: (context) => Container(
(context) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.surface,
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
top: Radius.circular(16),
),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
@@ -898,10 +869,10 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
const Gap(24), const Gap(24),
OtpTextField( OtpTextField(
numberOfFields: 6, numberOfFields: 6,
borderColor: borderColor: Theme.of(context).colorScheme.outline,
Theme.of(context).colorScheme.outline, focusedBorderColor: Theme.of(
focusedBorderColor: context,
Theme.of(context).colorScheme.primary, ).colorScheme.primary,
showFieldAsBox: true, showFieldAsBox: true,
obscureText: true, obscureText: true,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
@@ -909,9 +880,7 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
fieldHeight: 56, fieldHeight: 56,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
borderWidth: 1, borderWidth: 1,
textStyle: Theme.of(context) textStyle: Theme.of(context).textTheme.headlineSmall
.textTheme
.headlineSmall
?.copyWith(fontWeight: FontWeight.w600), ?.copyWith(fontWeight: FontWeight.w600),
onSubmit: (pin) { onSubmit: (pin) {
enteredPin = pin; enteredPin = pin;
@@ -974,8 +943,7 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
'amount': amount, 'amount': amount,
'currency': selectedCurrency, 'currency': selectedCurrency,
'payee_account_id': selectedPayee!.id, 'payee_account_id': selectedPayee!.id,
'remark': 'remark': remarkController.text.trim().isEmpty
remarkController.text.trim().isEmpty
? null ? null
: remarkController.text.trim(), : remarkController.text.trim(),
}; };
@@ -991,7 +959,7 @@ class _CreateTransferSheetState extends State<CreateTransferSheet> {
} }
} }
final transactionListProvider = AsyncNotifierProvider( final transactionListProvider = AsyncNotifierProvider.autoDispose(
TransactionListNotifier.new, TransactionListNotifier.new,
); );
@@ -1012,14 +980,17 @@ class TransactionListNotifier extends AsyncNotifier<List<SnTransaction>>
); );
totalCount = int.parse(response.headers.value('X-Total') ?? '0'); totalCount = int.parse(response.headers.value('X-Total') ?? '0');
final List<dynamic> data = response.data; final List<dynamic> data = response.data;
final transactions = final transactions = data
data.map((json) => SnTransaction.fromJson(json)).toList(); .map((json) => SnTransaction.fromJson(json))
.toList();
return transactions; return transactions;
} }
} }
final walletFundsProvider = AsyncNotifierProvider(WalletFundsNotifier.new); final walletFundsProvider = AsyncNotifierProvider.autoDispose(
WalletFundsNotifier.new,
);
class WalletFundsNotifier extends AsyncNotifier<List<SnWalletFund>> class WalletFundsNotifier extends AsyncNotifier<List<SnWalletFund>>
with AsyncPaginationController<SnWalletFund> { with AsyncPaginationController<SnWalletFund> {
@@ -1034,8 +1005,9 @@ class WalletFundsNotifier extends AsyncNotifier<List<SnWalletFund>>
'/pass/wallets/funds?offset=$offset&take=$pageSize', '/pass/wallets/funds?offset=$offset&take=$pageSize',
); );
// Assuming total count header is present or we just check if list is empty // Assuming total count header is present or we just check if list is empty
final list = final list = (response.data as List)
(response.data as List).map((e) => SnWalletFund.fromJson(e)).toList(); .map((e) => SnWalletFund.fromJson(e))
.toList();
if (list.length < pageSize) { if (list.length < pageSize) {
totalCount = fetchedCount + list.length; totalCount = fetchedCount + list.length;
} }
@@ -1043,7 +1015,7 @@ class WalletFundsNotifier extends AsyncNotifier<List<SnWalletFund>>
} }
} }
final walletFundRecipientsProvider = AsyncNotifierProvider( final walletFundRecipientsProvider = AsyncNotifierProvider.autoDispose(
WalletFundRecipientsNotifier.new, WalletFundRecipientsNotifier.new,
); );
@@ -1060,8 +1032,7 @@ class WalletFundRecipientsNotifier
final response = await client.get( final response = await client.get(
'/pass/wallets/funds/recipients?offset=$offset&take=$_pageSize', '/pass/wallets/funds/recipients?offset=$offset&take=$_pageSize',
); );
final list = final list = (response.data as List)
(response.data as List)
.map((e) => SnWalletFundRecipient.fromJson(e)) .map((e) => SnWalletFundRecipient.fromJson(e))
.toList(); .toList();
@@ -1312,8 +1283,7 @@ class WalletScreen extends HookConsumerWidget {
return allCurrencies.map((currency) { return allCurrencies.map((currency) {
final existingPocket = pockets.firstWhere( final existingPocket = pockets.firstWhere(
(p) => p.currency == currency, (p) => p.currency == currency,
orElse: orElse: () => SnWalletPocket(
() => SnWalletPocket(
id: '', id: '',
currency: currency, currency: currency,
amount: 0.0, amount: 0.0,
@@ -1338,10 +1308,10 @@ class WalletScreen extends HookConsumerWidget {
? Symbols.money_bag ? Symbols.money_bag
: Symbols.swap_horiz, : Symbols.swap_horiz,
), ),
onPressed: onPressed: currentTabIndex.value == 1
currentTabIndex.value == 1 ? createFund : createTransfer, ? createFund
tooltip: : createTransfer,
currentTabIndex.value == 1 tooltip: currentTabIndex.value == 1
? 'createFund'.tr() ? 'createFund'.tr()
: 'createTransfer'.tr(), : 'createTransfer'.tr(),
), ),
@@ -1368,8 +1338,7 @@ class WalletScreen extends HookConsumerWidget {
} }
return NestedScrollView( return NestedScrollView(
headerSliverBuilder: headerSliverBuilder: (context, innerBoxIsScrolled) => [
(context, innerBoxIsScrolled) => [
// Wallet Overview // Wallet Overview
SliverToBoxAdapter( SliverToBoxAdapter(
child: Column( child: Column(
@@ -1388,11 +1357,8 @@ class WalletScreen extends HookConsumerWidget {
kCurrencyIconData[pocket.currency] ?? kCurrencyIconData[pocket.currency] ??
Symbols.universal_currency_alt, Symbols.universal_currency_alt,
), ),
title: title: Text(
Text( getCurrencyTranslationKey(pocket.currency),
getCurrencyTranslationKey(
pocket.currency,
),
).tr(), ).tr(),
subtitle: Text( subtitle: Text(
'${pocket.amount.toStringAsFixed(2)} ${getCurrencyTranslationKey(pocket.currency, isShort: true).tr()}', '${pocket.amount.toStringAsFixed(2)} ${getCurrencyTranslationKey(pocket.currency, isShort: true).tr()}',
@@ -1438,10 +1404,8 @@ class WalletScreen extends HookConsumerWidget {
context: context, context: context,
useRootNavigator: true, useRootNavigator: true,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) =>
(context) => TransactionDetailSheet( TransactionDetailSheet(transaction: transaction),
transaction: transaction,
),
); );
}, },
child: ListTile( child: ListTile(
@@ -1479,8 +1443,7 @@ class WalletScreen extends HookConsumerWidget {
), ),
); );
}, },
error: error: (error, stackTrace) => ResponseErrorWidget(
(error, stackTrace) => ResponseErrorWidget(
error: error, error: error,
onRetry: () => ref.invalidate(walletCurrentProvider), onRetry: () => ref.invalidate(walletCurrentProvider),
), ),
@@ -1554,8 +1517,9 @@ class WalletScreen extends HookConsumerWidget {
itemCount: fundList.length, itemCount: fundList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final fund = fundList[index]; final fund = fundList[index];
final claimedCount = final claimedCount = fund.recipients
fund.recipients.where((r) => r.isReceived).length; .where((r) => r.isReceived)
.length;
final totalRecipients = fund.recipients.length; final totalRecipients = fund.recipients.length;
return Card( return Card(
@@ -1724,16 +1688,14 @@ class WalletScreen extends HookConsumerWidget {
), ),
); );
}, },
loading: loading: () => Card(
() => Card(
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
child: const Padding( child: const Padding(
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
child: Center(child: CircularProgressIndicator()), child: Center(child: CircularProgressIndicator()),
), ),
), ),
error: error: (error, stack) => Card(
(error, stack) => Card(
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),

View File

@@ -1 +0,0 @@

View File

@@ -9,8 +9,11 @@ import 'package:island/models/file.dart';
import 'package:island/pods/config.dart'; import 'package:island/pods/config.dart';
import 'package:island/services/time.dart'; import 'package:island/services/time.dart';
import 'package:island/utils/format.dart'; import 'package:island/utils/format.dart';
import 'package:island/widgets/content/profile_decoration.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:island/widgets/data_saving_gate.dart'; import 'package:island/widgets/data_saving_gate.dart';
import 'file_viewer_contents.dart'; import 'file_viewer_contents.dart';
@@ -258,15 +261,13 @@ class CloudFileWidget extends HookConsumerWidget {
var content = switch (item.mimeType?.split('/').firstOrNull) { var content = switch (item.mimeType?.split('/').firstOrNull) {
'image' => AspectRatio( 'image' => AspectRatio(
aspectRatio: ratio, aspectRatio: ratio,
child: child: (useInternalGate && dataSaving && !unlocked.value)
(useInternalGate && dataSaving && !unlocked.value)
? dataPlaceHolder(Symbols.image) ? dataPlaceHolder(Symbols.image)
: cloudImage(), : cloudImage(),
), ),
'video' => AspectRatio( 'video' => AspectRatio(
aspectRatio: ratio, aspectRatio: ratio,
child: child: (useInternalGate && dataSaving && !unlocked.value)
(useInternalGate && dataSaving && !unlocked.value)
? dataPlaceHolder(Symbols.play_arrow) ? dataPlaceHolder(Symbols.play_arrow)
: cloudVideo(), : cloudVideo(),
), ),
@@ -383,8 +384,7 @@ class CloudVideoWidget extends HookConsumerWidget {
final serverUrl = ref.watch(serverUrlProvider); final serverUrl = ref.watch(serverUrlProvider);
final uri = '$serverUrl/drive/files/${item.id}'; final uri = '$serverUrl/drive/files/${item.id}';
var ratio = var ratio = item.fileMeta?['ratio'] is num
item.fileMeta?['ratio'] is num
? item.fileMeta!['ratio'].toDouble() ? item.fileMeta!['ratio'].toDouble()
: 1.0; : 1.0;
if (ratio == 0) ratio = 1.0; if (ratio == 0) ratio = 1.0;
@@ -533,8 +533,7 @@ class CloudImageWidget extends ConsumerWidget {
return AspectRatio( return AspectRatio(
aspectRatio: aspectRatio, aspectRatio: aspectRatio,
child: child: file != null
file != null
? CloudFileWidget(item: file!, fit: fit) ? CloudFileWidget(item: file!, fit: fit)
: UniversalImage(uri: uri, blurHash: blurHash, fit: fit), : UniversalImage(uri: uri, blurHash: blurHash, fit: fit),
); );
@@ -545,8 +544,7 @@ class CloudImageWidget extends ConsumerWidget {
required String serverUrl, required String serverUrl,
bool original = false, bool original = false,
}) { }) {
final uri = final uri = original
original
? '$serverUrl/drive/files/$fileId?original=true' ? '$serverUrl/drive/files/$fileId?original=true'
: '$serverUrl/drive/files/$fileId'; : '$serverUrl/drive/files/$fileId';
return CachedNetworkImageProvider(uri); return CachedNetworkImageProvider(uri);
@@ -560,6 +558,7 @@ class ProfilePictureWidget extends ConsumerWidget {
final double? borderRadius; final double? borderRadius;
final IconData? fallbackIcon; final IconData? fallbackIcon;
final Color? fallbackColor; final Color? fallbackColor;
final ProfileDecoration? decoration;
const ProfilePictureWidget({ const ProfilePictureWidget({
super.key, super.key,
this.fileId, this.fileId,
@@ -568,6 +567,7 @@ class ProfilePictureWidget extends ConsumerWidget {
this.borderRadius, this.borderRadius,
this.fallbackIcon, this.fallbackIcon,
this.fallbackColor, this.fallbackColor,
this.decoration,
}); });
@override @override
@@ -575,36 +575,49 @@ class ProfilePictureWidget extends ConsumerWidget {
final serverUrl = ref.watch(serverUrlProvider); final serverUrl = ref.watch(serverUrlProvider);
final String? id = file?.id ?? fileId; final String? id = file?.id ?? fileId;
final fallback = final fallback = Icon(
Icon(
fallbackIcon ?? Symbols.account_circle, fallbackIcon ?? Symbols.account_circle,
size: radius, size: radius,
color: color: fallbackColor ?? Theme.of(context).colorScheme.onPrimaryContainer,
fallbackColor ?? Theme.of(context).colorScheme.onPrimaryContainer,
).center(); ).center();
return ClipRRect( final image = id == null
borderRadius:
borderRadius == null
? BorderRadius.all(Radius.circular(radius))
: BorderRadius.all(Radius.circular(borderRadius!)),
child: Container(
width: radius * 2,
height: radius * 2,
color: Theme.of(context).colorScheme.primaryContainer,
child:
id == null
? fallback ? fallback
: DataSavingGate( : DataSavingGate(
bypass: true, bypass: true,
placeholder: fallback, placeholder: fallback,
content: content: () => UniversalImage(
() => UniversalImage(
uri: '$serverUrl/drive/files/$id', uri: '$serverUrl/drive/files/$id',
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
);
Widget content = Container(
width: radius * 2,
height: radius * 2,
color: Theme.of(context).colorScheme.primaryContainer,
child: decoration != null
? Stack(
fit: StackFit.expand,
children: [
image,
CustomPaint(
painter: _ProfileDecorationPainter(
text: decoration!.text,
color: decoration!.color,
textColor: decoration!.textColor ?? Colors.white,
), ),
), ),
],
)
: image,
);
return ClipRRect(
borderRadius: borderRadius == null
? BorderRadius.all(Radius.circular(radius))
: BorderRadius.all(Radius.circular(borderRadius!)),
child: content,
); );
} }
} }
@@ -716,11 +729,9 @@ class SplitAvatarWidget extends ConsumerWidget {
), ),
), ),
Expanded( Expanded(
child: child: filesId.length > 4
filesId.length > 4
? Container( ? Container(
color: color: Theme.of(
Theme.of(
context, context,
).colorScheme.primaryContainer, ).colorScheme.primaryContainer,
child: Center( child: Center(
@@ -728,8 +739,7 @@ class SplitAvatarWidget extends ConsumerWidget {
'+${filesId.length - 3}', '+${filesId.length - 3}',
style: TextStyle( style: TextStyle(
fontSize: radius * 0.4, fontSize: radius * 0.4,
color: color: Theme.of(
Theme.of(
context, context,
).colorScheme.onPrimaryContainer, ).colorScheme.onPrimaryContainer,
), ),
@@ -765,13 +775,11 @@ class SplitAvatarWidget extends ConsumerWidget {
width: radius, width: radius,
height: radius, height: radius,
color: Theme.of(context).colorScheme.primaryContainer, color: Theme.of(context).colorScheme.primaryContainer,
child: child: Icon(
Icon(
fallbackIcon, fallbackIcon,
size: radius * 0.6, size: radius * 0.6,
color: color:
fallbackColor ?? fallbackColor ?? Theme.of(context).colorScheme.onPrimaryContainer,
Theme.of(context).colorScheme.onPrimaryContainer,
).center(), ).center(),
); );
} }
@@ -786,3 +794,106 @@ class SplitAvatarWidget extends ConsumerWidget {
); );
} }
} }
class _ProfileDecorationPainter extends CustomPainter {
final String text;
final Color color;
final Color textColor;
_ProfileDecorationPainter({
required this.text,
required this.color,
required this.textColor,
});
@override
void paint(Canvas canvas, Size size) {
if (text.isEmpty) return;
final radius = size.width / 2;
final center = Offset(size.width / 2, size.height / 2);
final strokeWidth = radius * 0.4; // Increased thickness
final centerAngle = 3 * math.pi / 4;
final sweepAngle = math.pi / 1;
final startAngle = centerAngle - (sweepAngle / 2);
final arcRadius = radius - (strokeWidth / 2);
final rect = Rect.fromCircle(center: center, radius: arcRadius);
final paint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = strokeWidth
..shader = SweepGradient(
startAngle: startAngle,
endAngle: startAngle + sweepAngle,
colors: [color.withOpacity(0), color, color, color.withOpacity(0)],
stops: const [0.0, 0.25, 0.75, 1.0],
).createShader(rect);
canvas.drawArc(rect, startAngle, sweepAngle, false, paint);
_drawTextOnArc(canvas, center, arcRadius, text, centerAngle);
}
void _drawTextOnArc(
Canvas canvas,
Offset center,
double radius,
String text,
double centerAngle,
) {
final textStyle = TextStyle(
color: textColor,
fontSize: radius * 0.28,
fontWeight: FontWeight.bold,
);
double totalAngle = 0;
List<double> charAngles = [];
// Calculate total angle occupied by text
for (int i = 0; i < text.length; i++) {
final char = text[i];
final span = TextSpan(text: char, style: textStyle);
final tp = TextPainter(text: span, textDirection: ui.TextDirection.ltr);
tp.layout();
final charWidth = tp.width;
final angle = charWidth / radius;
charAngles.add(angle);
totalAngle += angle;
}
// Start from "Left" of the center (High angle)
// We want to traverse from centerAngle + total/2 to centerAngle - total/2
double currentAngle = centerAngle + (totalAngle / 2);
for (int i = 0; i < text.length; i++) {
final char = text[i];
final span = TextSpan(text: char, style: textStyle);
final tp = TextPainter(text: span, textDirection: ui.TextDirection.ltr);
tp.layout();
final charAngle = charAngles[i];
final midCharAngle = currentAngle - charAngle / 2;
final x = center.dx + radius * math.cos(midCharAngle);
final y = center.dy + radius * math.sin(midCharAngle);
canvas.save();
canvas.translate(x, y);
canvas.rotate(midCharAngle - math.pi / 2);
tp.paint(canvas, Offset(-tp.width / 2, -tp.height / 2));
canvas.restore();
currentAngle -= charAngle;
}
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return true;
}
}

View File

@@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'profile_decoration.freezed.dart';
@freezed
sealed class ProfileDecoration with _$ProfileDecoration {
const factory ProfileDecoration({
required String text,
required Color color,
Color? textColor,
}) = _ProfileDecoration;
}

View File

@@ -0,0 +1,277 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'profile_decoration.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ProfileDecoration {
String get text; Color get color; Color? get textColor;
/// Create a copy of ProfileDecoration
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ProfileDecorationCopyWith<ProfileDecoration> get copyWith => _$ProfileDecorationCopyWithImpl<ProfileDecoration>(this as ProfileDecoration, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ProfileDecoration&&(identical(other.text, text) || other.text == text)&&(identical(other.color, color) || other.color == color)&&(identical(other.textColor, textColor) || other.textColor == textColor));
}
@override
int get hashCode => Object.hash(runtimeType,text,color,textColor);
@override
String toString() {
return 'ProfileDecoration(text: $text, color: $color, textColor: $textColor)';
}
}
/// @nodoc
abstract mixin class $ProfileDecorationCopyWith<$Res> {
factory $ProfileDecorationCopyWith(ProfileDecoration value, $Res Function(ProfileDecoration) _then) = _$ProfileDecorationCopyWithImpl;
@useResult
$Res call({
String text, Color color, Color? textColor
});
}
/// @nodoc
class _$ProfileDecorationCopyWithImpl<$Res>
implements $ProfileDecorationCopyWith<$Res> {
_$ProfileDecorationCopyWithImpl(this._self, this._then);
final ProfileDecoration _self;
final $Res Function(ProfileDecoration) _then;
/// Create a copy of ProfileDecoration
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? text = null,Object? color = null,Object? textColor = freezed,}) {
return _then(_self.copyWith(
text: null == text ? _self.text : text // ignore: cast_nullable_to_non_nullable
as String,color: null == color ? _self.color : color // ignore: cast_nullable_to_non_nullable
as Color,textColor: freezed == textColor ? _self.textColor : textColor // ignore: cast_nullable_to_non_nullable
as Color?,
));
}
}
/// Adds pattern-matching-related methods to [ProfileDecoration].
extension ProfileDecorationPatterns on ProfileDecoration {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ProfileDecoration value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ProfileDecoration() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ProfileDecoration value) $default,){
final _that = this;
switch (_that) {
case _ProfileDecoration():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ProfileDecoration value)? $default,){
final _that = this;
switch (_that) {
case _ProfileDecoration() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String text, Color color, Color? textColor)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ProfileDecoration() when $default != null:
return $default(_that.text,_that.color,_that.textColor);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String text, Color color, Color? textColor) $default,) {final _that = this;
switch (_that) {
case _ProfileDecoration():
return $default(_that.text,_that.color,_that.textColor);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String text, Color color, Color? textColor)? $default,) {final _that = this;
switch (_that) {
case _ProfileDecoration() when $default != null:
return $default(_that.text,_that.color,_that.textColor);case _:
return null;
}
}
}
/// @nodoc
class _ProfileDecoration implements ProfileDecoration {
const _ProfileDecoration({required this.text, required this.color, this.textColor});
@override final String text;
@override final Color color;
@override final Color? textColor;
/// Create a copy of ProfileDecoration
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ProfileDecorationCopyWith<_ProfileDecoration> get copyWith => __$ProfileDecorationCopyWithImpl<_ProfileDecoration>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProfileDecoration&&(identical(other.text, text) || other.text == text)&&(identical(other.color, color) || other.color == color)&&(identical(other.textColor, textColor) || other.textColor == textColor));
}
@override
int get hashCode => Object.hash(runtimeType,text,color,textColor);
@override
String toString() {
return 'ProfileDecoration(text: $text, color: $color, textColor: $textColor)';
}
}
/// @nodoc
abstract mixin class _$ProfileDecorationCopyWith<$Res> implements $ProfileDecorationCopyWith<$Res> {
factory _$ProfileDecorationCopyWith(_ProfileDecoration value, $Res Function(_ProfileDecoration) _then) = __$ProfileDecorationCopyWithImpl;
@override @useResult
$Res call({
String text, Color color, Color? textColor
});
}
/// @nodoc
class __$ProfileDecorationCopyWithImpl<$Res>
implements _$ProfileDecorationCopyWith<$Res> {
__$ProfileDecorationCopyWithImpl(this._self, this._then);
final _ProfileDecoration _self;
final $Res Function(_ProfileDecoration) _then;
/// Create a copy of ProfileDecoration
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? text = null,Object? color = null,Object? textColor = freezed,}) {
return _then(_ProfileDecoration(
text: null == text ? _self.text : text // ignore: cast_nullable_to_non_nullable
as String,color: null == color ? _self.color : color // ignore: cast_nullable_to_non_nullable
as Color,textColor: freezed == textColor ? _self.textColor : textColor // ignore: cast_nullable_to_non_nullable
as Color?,
));
}
}
// dart format on

View File

@@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_riverpod/misc.dart'; import 'package:flutter_riverpod/misc.dart';
import 'package:gap/gap.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/pods/paging.dart'; import 'package:island/pods/paging.dart';
import 'package:island/widgets/extended_refresh_indicator.dart'; import 'package:island/widgets/extended_refresh_indicator.dart';
@@ -17,21 +18,27 @@ class PaginationList<T> extends HookConsumerWidget {
final ProviderListenable<AsyncValue<List<T>>> provider; final ProviderListenable<AsyncValue<List<T>>> provider;
final Refreshable<PaginationController<T>> notifier; final Refreshable<PaginationController<T>> notifier;
final Widget? Function(BuildContext, int, T) itemBuilder; final Widget? Function(BuildContext, int, T) itemBuilder;
final Widget? Function(BuildContext, int, T)? seperatorBuilder;
final double? spacing;
final bool isRefreshable; final bool isRefreshable;
final bool isSliver; final bool isSliver;
final bool showDefaultWidgets; final bool showDefaultWidgets;
final EdgeInsets? padding; final EdgeInsets? padding;
final Widget? footerSkeletonChild; final Widget? footerSkeletonChild;
final double? footerSkeletonMaxWidth;
const PaginationList({ const PaginationList({
super.key, super.key,
required this.provider, required this.provider,
required this.notifier, required this.notifier,
required this.itemBuilder, required this.itemBuilder,
this.seperatorBuilder,
this.spacing,
this.isRefreshable = true, this.isRefreshable = true,
this.isSliver = false, this.isSliver = false,
this.showDefaultWidgets = true, this.showDefaultWidgets = true,
this.padding, this.padding,
this.footerSkeletonChild, this.footerSkeletonChild,
this.footerSkeletonMaxWidth,
}); });
@override @override
@@ -39,8 +46,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,
@@ -53,7 +60,9 @@ class PaginationList<T> extends HookConsumerWidget {
).colorScheme.surfaceContainerHighest, ).colorScheme.surfaceContainerHighest,
), ),
containersColor: Theme.of(context).colorScheme.surfaceContainerLow, containersColor: Theme.of(context).colorScheme.surfaceContainerLow,
child: footerSkeletonChild ?? const _DefaultSkeletonChild(), child:
footerSkeletonChild ??
_DefaultSkeletonChild(maxWidth: footerSkeletonMaxWidth),
), ),
); );
return SliverList.list(children: content); return SliverList.list(children: content);
@@ -67,7 +76,7 @@ class PaginationList<T> extends HookConsumerWidget {
return SliverFillRemaining(child: content); return SliverFillRemaining(child: content);
} }
final listView = SuperSliverList.builder( final listView = SuperSliverList.separated(
itemCount: (data.value?.length ?? 0) + 1, itemCount: (data.value?.length ?? 0) + 1,
itemBuilder: (context, idx) { itemBuilder: (context, idx) {
if (idx == data.value?.length) { if (idx == data.value?.length) {
@@ -75,12 +84,27 @@ class PaginationList<T> extends HookConsumerWidget {
noti: noti, noti: noti,
data: data, data: data,
skeletonChild: footerSkeletonChild, skeletonChild: footerSkeletonChild,
skeletonMaxWidth: footerSkeletonMaxWidth,
); );
} }
final entry = data.value?[idx]; final entry = data.value?[idx];
if (entry != null) return itemBuilder(context, idx, entry); if (entry != null) return itemBuilder(context, idx, entry);
return null; return null;
}, },
separatorBuilder: (context, index) {
if (seperatorBuilder != null) {
final entry = data.value?[index];
if (entry != null) {
return seperatorBuilder!(context, index, entry) ??
const SizedBox();
}
return const SizedBox();
}
if (spacing != null && spacing! > 0) {
return Gap(spacing!);
}
return const SizedBox();
},
); );
return isRefreshable return isRefreshable
@@ -88,7 +112,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(
@@ -102,7 +126,9 @@ class PaginationList<T> extends HookConsumerWidget {
).colorScheme.surfaceContainerHighest, ).colorScheme.surfaceContainerHighest,
), ),
containersColor: Theme.of(context).colorScheme.surfaceContainerLow, containersColor: Theme.of(context).colorScheme.surfaceContainerLow,
child: footerSkeletonChild ?? const _DefaultSkeletonChild(), child:
footerSkeletonChild ??
_DefaultSkeletonChild(maxWidth: footerSkeletonMaxWidth),
), ),
); );
return SizedBox( return SizedBox(
@@ -119,7 +145,7 @@ class PaginationList<T> extends HookConsumerWidget {
return SizedBox(key: const ValueKey('error'), child: content); return SizedBox(key: const ValueKey('error'), child: content);
} }
final listView = SuperListView.builder( final listView = SuperListView.separated(
padding: padding, padding: padding,
itemCount: (data.value?.length ?? 0) + 1, itemCount: (data.value?.length ?? 0) + 1,
itemBuilder: (context, idx) { itemBuilder: (context, idx) {
@@ -128,12 +154,27 @@ class PaginationList<T> extends HookConsumerWidget {
noti: noti, noti: noti,
data: data, data: data,
skeletonChild: footerSkeletonChild, skeletonChild: footerSkeletonChild,
skeletonMaxWidth: footerSkeletonMaxWidth,
); );
} }
final entry = data.value?[idx]; final entry = data.value?[idx];
if (entry != null) return itemBuilder(context, idx, entry); if (entry != null) return itemBuilder(context, idx, entry);
return null; return null;
}, },
separatorBuilder: (context, index) {
if (seperatorBuilder != null) {
final entry = data.value?[index];
if (entry != null) {
return seperatorBuilder!(context, index, entry) ??
const SizedBox();
}
return const SizedBox();
}
if (spacing != null && spacing! > 0) {
return Gap(spacing!);
}
return const SizedBox();
},
); );
return SizedBox( return SizedBox(
@@ -159,6 +200,7 @@ class PaginationWidget<T> extends HookConsumerWidget {
final bool isSliver; final bool isSliver;
final bool showDefaultWidgets; final bool showDefaultWidgets;
final Widget? footerSkeletonChild; final Widget? footerSkeletonChild;
final double? footerSkeletonMaxWidth;
const PaginationWidget({ const PaginationWidget({
super.key, super.key,
required this.provider, required this.provider,
@@ -168,6 +210,7 @@ class PaginationWidget<T> extends HookConsumerWidget {
this.isSliver = false, this.isSliver = false,
this.showDefaultWidgets = true, this.showDefaultWidgets = true,
this.footerSkeletonChild, this.footerSkeletonChild,
this.footerSkeletonMaxWidth,
}); });
@override @override
@@ -175,8 +218,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,
@@ -189,7 +232,9 @@ class PaginationWidget<T> extends HookConsumerWidget {
).colorScheme.surfaceContainerHighest, ).colorScheme.surfaceContainerHighest,
), ),
containersColor: Theme.of(context).colorScheme.surfaceContainerLow, containersColor: Theme.of(context).colorScheme.surfaceContainerLow,
child: footerSkeletonChild ?? const _DefaultSkeletonChild(), child:
footerSkeletonChild ??
_DefaultSkeletonChild(maxWidth: footerSkeletonMaxWidth),
), ),
); );
return SliverList.list(children: content); return SliverList.list(children: content);
@@ -207,6 +252,7 @@ class PaginationWidget<T> extends HookConsumerWidget {
noti: noti, noti: noti,
data: data, data: data,
skeletonChild: footerSkeletonChild, skeletonChild: footerSkeletonChild,
skeletonMaxWidth: footerSkeletonMaxWidth,
); );
final content = contentBuilder(data.value ?? [], footer); final content = contentBuilder(data.value ?? [], footer);
@@ -215,7 +261,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(
@@ -229,7 +275,9 @@ class PaginationWidget<T> extends HookConsumerWidget {
).colorScheme.surfaceContainerHighest, ).colorScheme.surfaceContainerHighest,
), ),
containersColor: Theme.of(context).colorScheme.surfaceContainerLow, containersColor: Theme.of(context).colorScheme.surfaceContainerLow,
child: footerSkeletonChild ?? const _DefaultSkeletonChild(), child:
footerSkeletonChild ??
_DefaultSkeletonChild(maxWidth: footerSkeletonMaxWidth),
), ),
); );
return SizedBox( return SizedBox(
@@ -250,6 +298,7 @@ class PaginationWidget<T> extends HookConsumerWidget {
noti: noti, noti: noti,
data: data, data: data,
skeletonChild: footerSkeletonChild, skeletonChild: footerSkeletonChild,
skeletonMaxWidth: footerSkeletonMaxWidth,
); );
final content = contentBuilder(data.value ?? [], footer); final content = contentBuilder(data.value ?? [], footer);
@@ -272,6 +321,7 @@ class PaginationListFooter<T> extends HookConsumerWidget {
final PaginationController<T> noti; final PaginationController<T> noti;
final AsyncValue<List<T>> data; final AsyncValue<List<T>> data;
final Widget? skeletonChild; final Widget? skeletonChild;
final double? skeletonMaxWidth;
final bool isSliver; final bool isSliver;
const PaginationListFooter({ const PaginationListFooter({
@@ -279,6 +329,7 @@ class PaginationListFooter<T> extends HookConsumerWidget {
required this.noti, required this.noti,
required this.data, required this.data,
this.skeletonChild, this.skeletonChild,
this.skeletonMaxWidth,
this.isSliver = false, this.isSliver = false,
}); });
@@ -293,7 +344,7 @@ class PaginationListFooter<T> extends HookConsumerWidget {
highlightColor: Theme.of(context).colorScheme.surfaceContainerHighest, highlightColor: Theme.of(context).colorScheme.surfaceContainerHighest,
), ),
containersColor: Theme.of(context).colorScheme.surfaceContainerLow, containersColor: Theme.of(context).colorScheme.surfaceContainerLow,
child: skeletonChild ?? _DefaultSkeletonChild(), child: skeletonChild ?? _DefaultSkeletonChild(maxWidth: skeletonMaxWidth),
); );
final child = hasBeenVisible.value final child = hasBeenVisible.value
? data.isLoading ? data.isLoading
@@ -322,14 +373,24 @@ class PaginationListFooter<T> extends HookConsumerWidget {
} }
class _DefaultSkeletonChild extends StatelessWidget { class _DefaultSkeletonChild extends StatelessWidget {
const _DefaultSkeletonChild(); final double? maxWidth;
const _DefaultSkeletonChild({this.maxWidth});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListTile( final content = ListTile(
title: Text('Some data'), title: Text('Some data'),
subtitle: const Text('Subtitle here'), subtitle: const Text('Subtitle here'),
trailing: const Icon(Icons.ac_unit), trailing: const Icon(Icons.ac_unit),
); );
if (maxWidth != null) {
return Center(
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxWidth!),
child: content,
),
);
}
return content;
} }
} }

View File

@@ -9,33 +9,14 @@ import 'package:island/models/post_category.dart';
import 'package:island/models/post_tag.dart'; import 'package:island/models/post_tag.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/post/post_categories.dart';
import 'package:island/screens/realm/realms.dart'; import 'package:island/screens/realm/realms.dart';
import 'package:island/widgets/content/cloud_files.dart'; import 'package:island/widgets/content/cloud_files.dart';
import 'package:island/widgets/content/sheet.dart'; import 'package:island/widgets/content/sheet.dart';
import 'package:island/widgets/post/compose_shared.dart'; import 'package:island/widgets/post/compose_shared.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
part 'compose_settings_sheet.g.dart';
@riverpod
Future<List<SnPostCategory>> postCategories(Ref ref) async {
final apiClient = ref.watch(apiClientProvider);
final resp = await apiClient.get('/sphere/posts/categories');
final categories =
resp.data
.map((e) => SnPostCategory.fromJson(e))
.cast<SnPostCategory>()
.toList();
// Remove duplicates based on id
final uniqueCategories = <String, SnPostCategory>{};
for (final category in categories) {
uniqueCategories[category.id] = category;
}
return uniqueCategories.values.toList();
}
class ComposeSettingsSheet extends HookConsumerWidget { class ComposeSettingsSheet extends HookConsumerWidget {
final ComposeState state; final ComposeState state;
@@ -121,8 +102,7 @@ class ComposeSettingsSheet extends HookConsumerWidget {
void showVisibilitySheet() { void showVisibilitySheet() {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
builder: builder: (context) => SheetScaffold(
(context) => SheetScaffold(
titleText: 'postVisibility'.tr(), titleText: 'postVisibility'.tr(),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@@ -182,8 +162,8 @@ class ComposeSettingsSheet extends HookConsumerWidget {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
), ),
onTapOutside: onTapOutside: (_) =>
(_) => FocusManager.instance.primaryFocus?.unfocus(), FocusManager.instance.primaryFocus?.unfocus(),
), ),
// Tags field // Tags field
@@ -209,8 +189,7 @@ class ComposeSettingsSheet extends HookConsumerWidget {
Wrap( Wrap(
spacing: 8, spacing: 8,
runSpacing: 8, runSpacing: 8,
children: children: currentTags.map((tag) {
currentTags.map((tag) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
@@ -226,8 +205,7 @@ class ComposeSettingsSheet extends HookConsumerWidget {
Text( Text(
'#$tag', '#$tag',
style: TextStyle( style: TextStyle(
color: color: Theme.of(
Theme.of(
context, context,
).colorScheme.onPrimary, ).colorScheme.onPrimary,
fontSize: 14, fontSize: 14,
@@ -244,8 +222,7 @@ class ComposeSettingsSheet extends HookConsumerWidget {
child: Icon( child: Icon(
Icons.close, Icons.close,
size: 16, size: 16,
color: color: Theme.of(
Theme.of(
context, context,
).colorScheme.onPrimary, ).colorScheme.onPrimary,
), ),
@@ -274,8 +251,8 @@ class ComposeSettingsSheet extends HookConsumerWidget {
}, },
); );
}, },
suggestionsCallback: suggestionsCallback: (pattern) =>
(pattern) => _fetchTagSuggestions(pattern, ref), _fetchTagSuggestions(pattern, ref),
itemBuilder: (context, suggestion) { itemBuilder: (context, suggestion) {
return ListTile( return ListTile(
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
@@ -314,21 +291,17 @@ class ComposeSettingsSheet extends HookConsumerWidget {
), ),
), ),
hint: Text('categories'.tr(), style: TextStyle(fontSize: 15)), hint: Text('categories'.tr(), style: TextStyle(fontSize: 15)),
items: items: (postCategories.value ?? <SnPostCategory>[]).map((item) {
(postCategories.value ?? <SnPostCategory>[]).map((item) {
return DropdownMenuItem( return DropdownMenuItem(
value: item, value: item,
enabled: false, enabled: false,
child: StatefulBuilder( child: StatefulBuilder(
builder: (context, menuSetState) { builder: (context, menuSetState) {
final isSelected = state.categories.value.contains( final isSelected = state.categories.value.contains(item);
item,
);
return InkWell( return InkWell(
onTap: () { onTap: () {
isSelected isSelected
? state.categories.value = ? state.categories.value = state.categories.value
state.categories.value
.where((e) => e != item) .where((e) => e != item)
.toList() .toList()
: state.categories.value = [ : state.categories.value = [
@@ -339,9 +312,7 @@ class ComposeSettingsSheet extends HookConsumerWidget {
}, },
child: Container( child: Container(
height: double.infinity, height: double.infinity,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: 16.0),
horizontal: 16.0,
),
child: Row( child: Row(
children: [ children: [
if (isSelected) if (isSelected)

View File

@@ -1,51 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'compose_settings_sheet.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
@ProviderFor(postCategories)
const postCategoriesProvider = PostCategoriesProvider._();
final class PostCategoriesProvider
extends
$FunctionalProvider<
AsyncValue<List<SnPostCategory>>,
List<SnPostCategory>,
FutureOr<List<SnPostCategory>>
>
with
$FutureModifier<List<SnPostCategory>>,
$FutureProvider<List<SnPostCategory>> {
const PostCategoriesProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'postCategoriesProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$postCategoriesHash();
@$internal
@override
$FutureProviderElement<List<SnPostCategory>> $createElement(
$ProviderPointer pointer,
) => $FutureProviderElement(pointer);
@override
FutureOr<List<SnPostCategory>> create(Ref ref) {
return postCategories(ref);
}
}
String _$postCategoriesHash() => r'8799c10eb91cf8c8c7ea72eff3475e1eaa7b9a2b';

View File

@@ -1,12 +1,17 @@
import 'dart:io';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/models/file.dart'; import 'package:island/models/file.dart';
import 'package:island/models/post.dart'; import 'package:island/models/post.dart';
import 'package:island/screens/posts/compose.dart'; import 'package:island/screens/posts/compose.dart';
import 'package:island/screens/posts/post_detail.dart'; import 'package:island/screens/posts/post_detail.dart';
import 'package:island/services/compose_storage_db.dart'; import 'package:island/services/compose_storage_db.dart';
import 'package:island/services/responsive.dart';
import 'package:island/widgets/content/sheet.dart'; import 'package:island/widgets/content/sheet.dart';
import 'package:island/widgets/post/compose_card.dart'; import 'package:island/widgets/post/compose_card.dart';
import 'package:island/widgets/post/compose_shared.dart'; import 'package:island/widgets/post/compose_shared.dart';
@@ -32,12 +37,17 @@ class PostComposeSheet extends HookConsumerWidget {
SnPost? originalPost, SnPost? originalPost,
PostComposeInitialState? initialState, PostComposeInitialState? initialState,
}) { }) {
// Check if editing an article
if (originalPost != null && originalPost.type == 1) {
context.pushNamed('articleEdit', pathParameters: {'id': originalPost.id});
return Future.value(true);
}
return showModalBottomSheet<bool>( return showModalBottomSheet<bool>(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
useRootNavigator: true, useRootNavigator: true,
builder: builder: (context) => PostComposeSheet(
(context) => PostComposeSheet(
originalPost: originalPost, originalPost: originalPost,
initialState: initialState, initialState: initialState,
isBottomSheet: true, isBottomSheet: true,
@@ -52,8 +62,7 @@ class PostComposeSheet extends HookConsumerWidget {
final prompted = useState(false); final prompted = useState(false);
// Fetch full post data if we're editing a post // Fetch full post data if we're editing a post
final fullPostData = final fullPostData = originalPost != null
originalPost != null
? ref.watch(postProvider(originalPost!.id)) ? ref.watch(postProvider(originalPost!.id))
: const AsyncValue.data(null); : const AsyncValue.data(null);
@@ -115,7 +124,11 @@ class PostComposeSheet extends HookConsumerWidget {
}, [drafts, prompted.value]); }, [drafts, prompted.value]);
// Dispose state when widget is disposed // Dispose state when widget is disposed
useEffect(() => () => ComposeLogic.dispose(state), []); useEffect(
() =>
() => ComposeLogic.dispose(state),
[],
);
// Helper methods for actions // Helper methods for actions
void showSettingsSheet() { void showSettingsSheet() {
@@ -147,8 +160,7 @@ class PostComposeSheet extends HookConsumerWidget {
(state.submitting.value || state.currentPublisher.value == null) (state.submitting.value || state.currentPublisher.value == null)
? null ? null
: performSubmit, : performSubmit,
icon: icon: state.submitting.value
state.submitting.value
? SizedBox( ? SizedBox(
width: 24, width: 24,
height: 24, height: 24,
@@ -157,14 +169,20 @@ class PostComposeSheet extends HookConsumerWidget {
: Icon( : Icon(
effectiveOriginalPost != null ? Symbols.edit : Symbols.upload, effectiveOriginalPost != null ? Symbols.edit : Symbols.upload,
), ),
tooltip: tooltip: effectiveOriginalPost != null
effectiveOriginalPost != null
? 'postUpdate'.tr() ? 'postUpdate'.tr()
: 'postPublish'.tr(), : 'postPublish'.tr(),
), ),
]; ];
// Tablet will show a virtual keyboard, so we adjust the height factor accordingly
final isTablet =
isWideScreen(context) &&
!kIsWeb &&
(Platform.isAndroid || Platform.isAndroid);
return SheetScaffold( return SheetScaffold(
heightFactor: isTablet ? 0.95 : 0.8,
titleText: 'postCompose'.tr(), titleText: 'postCompose'.tr(),
actions: actions, actions: actions,
child: PostComposeCard( child: PostComposeCard(
@@ -192,8 +210,7 @@ class PostComposeSheet extends HookConsumerWidget {
final restore = await showDialog<bool>( final restore = await showDialog<bool>(
context: ref.context, context: ref.context,
useRootNavigator: true, useRootNavigator: true,
builder: builder: (context) => AlertDialog(
(context) => AlertDialog(
title: Text('restoreDraftTitle'.tr()), title: Text('restoreDraftTitle'.tr()),
content: Column( content: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@@ -226,8 +243,7 @@ class PostComposeSheet extends HookConsumerWidget {
description: latestDraft.description, description: latestDraft.description,
content: latestDraft.content, content: latestDraft.content,
visibility: latestDraft.visibility, visibility: latestDraft.visibility,
attachments: attachments: latestDraft.attachments
latestDraft.attachments
.map((e) => UniversalFile.fromAttachment(e)) .map((e) => UniversalFile.fromAttachment(e))
.toList(), .toList(),
); );

View File

@@ -65,7 +65,10 @@ class SliverPostList extends HookConsumerWidget {
notifier: provider.notifier, notifier: provider.notifier,
isRefreshable: false, isRefreshable: false,
isSliver: true, isSliver: true,
footerSkeletonChild: const PostItemSkeleton(), footerSkeletonChild: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: const PostItemSkeleton(),
),
itemBuilder: (context, index, post) { itemBuilder: (context, index, post) {
if (maxWidth != null) { if (maxWidth != null) {
return Center( return Center(

View File

@@ -48,12 +48,24 @@ class PostRepliesList extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final provider = postRepliesProvider(postId); final provider = postRepliesProvider(postId);
final skeletonItem = Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: const PostItemSkeleton(),
);
return PaginationList( return PaginationList(
provider: provider, provider: provider,
notifier: provider.notifier, notifier: provider.notifier,
isRefreshable: false, isRefreshable: false,
isSliver: true, isSliver: true,
footerSkeletonChild: const PostItemSkeleton(), footerSkeletonChild: maxWidth == null
? skeletonItem
: Center(
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxWidth!),
child: skeletonItem,
),
),
itemBuilder: (context, index, item) { itemBuilder: (context, index, item) {
final contentWidget = Card( final contentWidget = Card(
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4), margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4),

View File

@@ -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: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child:
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 540), constraints: const BoxConstraints(maxWidth: 540),
child: RealmCard(realm: realm), child: RealmListTile(realm: realm),
).center(), ).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),
],
);
}, },
); );
} }

View File

@@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
@@ -10,6 +11,7 @@ import 'package:island/pods/site_files.dart';
import 'package:island/widgets/alert.dart'; import 'package:island/widgets/alert.dart';
import 'package:island/widgets/sites/file_upload_dialog.dart'; import 'package:island/widgets/sites/file_upload_dialog.dart';
import 'package:island/widgets/sites/file_item.dart'; import 'package:island/widgets/sites/file_item.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
@@ -53,6 +55,9 @@ class FileManagementSection extends HookConsumerWidget {
PopupMenuButton<String>( PopupMenuButton<String>(
icon: const Icon(Symbols.upload), icon: const Icon(Symbols.upload),
onSelected: (String choice) async { onSelected: (String choice) async {
if (!kIsWeb) {
await Permission.storage.request();
}
List<File> files = []; List<File> files = [];
List<Map<String, dynamic>>? results; List<Map<String, dynamic>>? results;
if (choice == 'files') { if (choice == 'files') {
@@ -65,17 +70,17 @@ class FileManagementSection extends HookConsumerWidget {
selectedFiles.files.isEmpty) { selectedFiles.files.isEmpty) {
return; // User canceled return; // User canceled
} }
files = files = selectedFiles.files
selectedFiles.files
.map((f) => File(f.path!)) .map((f) => File(f.path!))
.toList(); .toList();
} else if (choice == 'folder') { } else if (choice == 'folder') {
final dirPath = final dirPath = await FilePicker.platform
await FilePicker.platform.getDirectoryPath(); .getDirectoryPath();
if (dirPath == null) return; if (dirPath == null) return;
results = await _getFilesRecursive(dirPath); results = await _getFilesRecursive(dirPath);
files = files = results
results.map((m) => m['file'] as File).toList(); .map((m) => m['file'] as File)
.toList();
if (files.isEmpty) { if (files.isEmpty) {
showSnackBar('noFilesFoundInFolder'.tr()); showSnackBar('noFilesFoundInFolder'.tr());
return; return;
@@ -88,15 +93,11 @@ class FileManagementSection extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) => FileUploadDialog(
(context) => FileUploadDialog(
selectedFiles: files, selectedFiles: files,
site: site, site: site,
relativePaths: relativePaths: results
results ?.map((m) => m['relativePath'] as String)
?.map(
(m) => m['relativePath'] as String,
)
.toList(), .toList(),
onUploadComplete: () { onUploadComplete: () {
// Refresh file list // Refresh file list
@@ -110,8 +111,7 @@ class FileManagementSection extends HookConsumerWidget {
), ),
); );
}, },
itemBuilder: itemBuilder: (BuildContext context) => [
(BuildContext context) => [
PopupMenuItem<String>( PopupMenuItem<String>(
value: 'files', value: 'files',
child: Row( child: Row(
@@ -156,8 +156,7 @@ class FileManagementSection extends HookConsumerWidget {
IconButton( IconButton(
icon: Icon(Symbols.arrow_back), icon: Icon(Symbols.arrow_back),
onPressed: () { onPressed: () {
final pathParts = final pathParts = currentPath.value!
currentPath.value!
.split('/') .split('/')
.where((part) => part.isNotEmpty) .where((part) => part.isNotEmpty)
.toList(); .toList();
@@ -165,8 +164,7 @@ class FileManagementSection extends HookConsumerWidget {
currentPath.value = null; currentPath.value = null;
} else { } else {
pathParts.removeLast(); pathParts.removeLast();
currentPath.value = currentPath.value = pathParts.isEmpty
pathParts.isEmpty
? null ? null
: pathParts.join('/'); : pathParts.join('/');
} }
@@ -185,8 +183,7 @@ class FileManagementSection extends HookConsumerWidget {
child: Text('siteRoot'.tr()), child: Text('siteRoot'.tr()),
), ),
...() { ...() {
final parts = final parts = currentPath.value!
currentPath.value!
.split('/') .split('/')
.where((part) => part.isNotEmpty) .where((part) => part.isNotEmpty)
.toList(); .toList();
@@ -200,8 +197,8 @@ class FileManagementSection extends HookConsumerWidget {
widgets.addAll([ widgets.addAll([
const Text(' / '), const Text(' / '),
InkWell( InkWell(
onTap: onTap: () =>
() => currentPath.value = pathToSet, currentPath.value = pathToSet,
child: Text(part), child: Text(part),
), ),
]); ]);
@@ -253,23 +250,21 @@ class FileManagementSection extends HookConsumerWidget {
return FileItem( return FileItem(
file: file, file: file,
site: site, site: site,
onNavigateDirectory: onNavigateDirectory: (path) =>
(path) => currentPath.value = path, currentPath.value = path,
); );
}, },
); );
}, },
loading: loading: () =>
() => const Center(child: CircularProgressIndicator()), const Center(child: CircularProgressIndicator()),
error: error: (error, stack) => Center(
(error, stack) => Center(
child: Column( child: Column(
children: [ children: [
Text('failedToLoadFiles'.tr()), Text('failedToLoadFiles'.tr()),
const Gap(8), const Gap(8),
ElevatedButton( ElevatedButton(
onPressed: onPressed: () => ref.invalidate(
() => ref.invalidate(
siteFilesProvider( siteFilesProvider(
siteId: site.id, siteId: site.id,
path: currentPath.value, path: currentPath.value,

View File

@@ -19,8 +19,7 @@ class SiteActionMenu extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return PopupMenuButton<String>( return PopupMenuButton<String>(
itemBuilder: itemBuilder: (context) => [
(context) => [
PopupMenuItem( PopupMenuItem(
value: 'edit', value: 'edit',
child: Row( child: Row(
@@ -52,31 +51,18 @@ class SiteActionMenu extends HookConsumerWidget {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
builder: builder: (context) =>
(context) => SiteForm(pubName: pubName, siteSlug: site.slug), SiteForm(pubName: pubName, siteSlug: site.slug),
).then((_) { ).then((_) {
// Refresh site data after potential edit // Refresh site data after potential edit
ref.invalidate(publicationSiteDetailProvider(pubName, site.slug)); ref.invalidate(publicationSiteDetailProvider(pubName, site.slug));
}); });
break; break;
case 'delete': case 'delete':
final confirmed = await showDialog<bool>( final confirmed = await showConfirmAlert(
context: context, 'publicationSiteDeleteConfirm'.tr(),
builder: 'deleteSite'.tr(),
(context) => AlertDialog( isDanger: true,
title: Text('deleteSite'.tr()),
content: Text('publicationSiteDeleteConfirm'.tr()),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: Text('cancel'.tr()),
),
TextButton(
onPressed: () => Navigator.of(context).pop(true),
child: Text('delete'.tr()),
),
],
),
); );
if (confirmed == true) { if (confirmed == true) {

View File

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:island/models/webfeed.dart'; import 'package:island/models/webfeed.dart';
import 'package:island/services/time.dart'; import 'package:island/services/time.dart';
import 'package:material_symbols_icons/symbols.dart';
class WebArticleCard extends StatelessWidget { class WebArticleCard extends StatelessWidget {
final SnWebArticle article; final SnWebArticle article;
@@ -22,9 +23,6 @@ class WebArticleCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final colorScheme = theme.colorScheme;
return ConstrainedBox( return ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxWidth ?? double.infinity), constraints: BoxConstraints(maxWidth: maxWidth ?? double.infinity),
child: Card( child: Card(
@@ -32,111 +30,44 @@ class WebArticleCard extends StatelessWidget {
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: InkWell( child: InkWell(
onTap: () => _onTap(context), onTap: () => _onTap(context),
child: AspectRatio( child: Column(
aspectRatio: 16 / 9,
child: Stack(
fit: StackFit.expand,
children: [ children: [
// Image or fallback if (article.preview?.imageUrl != null)
article.preview?.imageUrl != null AspectRatio(
? CachedNetworkImage( aspectRatio: 16 / 9,
child: CachedNetworkImage(
imageUrl: article.preview!.imageUrl!, imageUrl: article.preview!.imageUrl!,
fit: BoxFit.cover, fit: BoxFit.cover,
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
)
: ColoredBox(
color: colorScheme.secondaryContainer,
child: const Center(
child: Icon(
Icons.article_outlined,
size: 48,
color: Colors.white,
), ),
), ),
ListTile(
isThreeLine: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 4,
), ),
// Gradient overlay trailing: const Icon(Symbols.chevron_right),
Container( title: Text(article.title),
decoration: BoxDecoration( subtitle: Column(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.black.withOpacity(0.7),
],
),
),
),
// Title
Align(
alignment: Alignment.bottomLeft,
child: Container(
padding: const EdgeInsets.only(
left: 12,
right: 12,
bottom: 8,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [ children: [
if (showDetails)
const SizedBox(height: 8)
else
Spacer(),
Text( Text(
article.title, '${article.createdAt.formatSystem()} · ${article.createdAt.formatRelative(context)}',
style: theme.textTheme.titleSmall?.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
height: 1.3,
), ),
maxLines: showDetails ? 3 : 1,
overflow: TextOverflow.ellipsis,
),
if (showDetails &&
article.author?.isNotEmpty == true) ...[
const SizedBox(height: 4),
Text(
article.author!,
style: TextStyle(
fontSize: 10,
color: Colors.white.withOpacity(0.9),
fontWeight: FontWeight.w500,
),
),
],
if (showDetails) const Spacer(),
if (showDetails && article.publishedAt != null) ...[
Text(
'${article.publishedAt!.formatSystem()} · ${article.publishedAt!.formatRelative(context)}',
style: const TextStyle(
fontSize: 9,
color: Colors.white70,
),
),
const SizedBox(height: 2),
],
Text( Text(
article.feed?.title ?? 'Unknown Source', article.feed?.title ?? 'Unknown Source',
style: const TextStyle(
fontSize: 9,
color: Colors.white70,
),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
], ],
), ),
), ),
),
], ],
), ),
), ),
), ),
),
); );
} }
} }

View File

@@ -493,26 +493,26 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: drift name: drift
sha256: "83290a32ae006a7535c5ecf300722cb77177250d9df4ee2becc5fa8a36095114" sha256: "3669e1b68d7bffb60192ac6ba9fd2c0306804d7a00e5879f6364c69ecde53a7f"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.29.0" version: "2.30.0"
drift_dev: drift_dev:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: drift_dev name: drift_dev
sha256: "6019f827544e77524ffd5134ae0cb75dfd92ef5ef3e269872af92840c929cd43" sha256: afe4d1d2cfce6606c86f11a6196e974a2ddbfaa992956ce61e054c9b1899c769
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.29.0" version: "2.30.0"
drift_flutter: drift_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
name: drift_flutter name: drift_flutter
sha256: b7534bf320aac5213259aac120670ba67b63a1fd010505babc436ff86083818f sha256: c07120854742a0cae2f7501a0da02493addde550db6641d284983c08762e60a7
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.7" version: "0.2.8"
dropdown_button2: dropdown_button2:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1917,6 +1917,54 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.0+3" version: "3.1.0+3"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
sha256: bc917da36261b00137bbc8896bf1482169cd76f866282368948f032c8c1caae1
url: "https://pub.dev"
source: hosted
version: "12.0.1"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
sha256: "1e3bc410ca1bf84662104b100eb126e066cb55791b7451307f9708d4007350e6"
url: "https://pub.dev"
source: hosted
version: "13.0.1"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023
url: "https://pub.dev"
source: hosted
version: "9.4.7"
permission_handler_html:
dependency: transitive
description:
name: permission_handler_html
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
url: "https://pub.dev"
source: hosted
version: "0.1.3+5"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878
url: "https://pub.dev"
source: hosted
version: "4.3.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
url: "https://pub.dev"
source: hosted
version: "0.2.1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
@@ -2607,10 +2655,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: sqlparser name: sqlparser
sha256: "54eea43e36dd3769274c3108625f9ea1a382f8d2ac8b16f3e4589d9bd9b0e16c" sha256: "162435ede92bcc793ea939fdc0452eef0a73d11f8ed053b58a89792fba749da5"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.42.0" version: "0.42.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@@ -2783,42 +2831,42 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: talker name: talker
sha256: "5ab800e29d91ce7728fa218c8a7d46f6c228202ac89af650c3f82cb938a64ba6" sha256: "1f94c986b282ccb4efdb3bf0b2549bf314aa20c9e35cbde2c8111d6dd31a7b9a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.1.3" version: "5.1.4"
talker_dio_logger: talker_dio_logger:
dependency: "direct main" dependency: "direct main"
description: description:
name: talker_dio_logger name: talker_dio_logger
sha256: "214a31d2ecc488ae6abf623ca9dac3831d34e66195f633bd1909a9d0c282ab8c" sha256: "775cad84e935f3c47b7cbfb07f1ab459850b2df28893eb798b1d537eea9feb34"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.1.3" version: "5.1.4"
talker_flutter: talker_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
name: talker_flutter name: talker_flutter
sha256: "79158cf0fe3fd2bcdb1dc6f5a870cb623f18d0b59a4fd87414f53ce446d80a45" sha256: "60350aef6b2f5f66e9d1350dc6ab60f9800ab2c4904912f635899dae64f44229"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.1.3" version: "5.1.4"
talker_logger: talker_logger:
dependency: "direct main" dependency: "direct main"
description: description:
name: talker_logger name: talker_logger
sha256: bc75612ace4dbb82fbad36181ff27e95b1ee152c719c2fea6b8ac59c4f091cd2 sha256: c2d58daa0d99518c83b4941967e7527dc4d98328b145bbf07a638bbaf4f0e039
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.1.3" version: "5.1.4"
talker_riverpod_logger: talker_riverpod_logger:
dependency: "direct main" dependency: "direct main"
description: description:
name: talker_riverpod_logger name: talker_riverpod_logger
sha256: "7040a9e4efcd6b41a169b607bfd1db6cbe0a22182659006979531f63155a1426" sha256: "3b236ee086f5f2943da997b70f03e42ae4f9a0c155b35491f9e94a239a9908ec"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.1.3" version: "5.1.4"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:

View File

@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 3.5.0+150 version: 3.5.0+151
environment: environment:
sdk: ^3.8.0 sdk: ^3.8.0
@@ -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
@@ -171,6 +171,7 @@ dependencies:
http_parser: ^4.1.2 http_parser: ^4.1.2
flutter_code_editor: ^0.3.5 flutter_code_editor: ^0.3.5
skeletonizer: ^2.1.1 skeletonizer: ^2.1.1
permission_handler: ^12.0.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@@ -188,7 +189,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

View File

@@ -24,6 +24,7 @@
#include <media_kit_libs_windows_video/media_kit_libs_windows_video_plugin_c_api.h> #include <media_kit_libs_windows_video/media_kit_libs_windows_video_plugin_c_api.h>
#include <media_kit_video/media_kit_video_plugin_c_api.h> #include <media_kit_video/media_kit_video_plugin_c_api.h>
#include <pasteboard/pasteboard_plugin.h> #include <pasteboard/pasteboard_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <protocol_handler_windows/protocol_handler_windows_plugin_c_api.h> #include <protocol_handler_windows/protocol_handler_windows_plugin_c_api.h>
#include <record_windows/record_windows_plugin_c_api.h> #include <record_windows/record_windows_plugin_c_api.h>
#include <screen_retriever_windows/screen_retriever_windows_plugin_c_api.h> #include <screen_retriever_windows/screen_retriever_windows_plugin_c_api.h>
@@ -73,6 +74,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi")); registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi"));
PasteboardPluginRegisterWithRegistrar( PasteboardPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PasteboardPlugin")); registry->GetRegistrarForPlugin("PasteboardPlugin"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
ProtocolHandlerWindowsPluginCApiRegisterWithRegistrar( ProtocolHandlerWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ProtocolHandlerWindowsPluginCApi")); registry->GetRegistrarForPlugin("ProtocolHandlerWindowsPluginCApi"));
RecordWindowsPluginCApiRegisterWithRegistrar( RecordWindowsPluginCApiRegisterWithRegistrar(

View File

@@ -21,6 +21,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
media_kit_libs_windows_video media_kit_libs_windows_video
media_kit_video media_kit_video
pasteboard pasteboard
permission_handler_windows
protocol_handler_windows protocol_handler_windows
record_windows record_windows
screen_retriever_windows screen_retriever_windows