🐛 Dozens of bug fixes

This commit is contained in:
2025-08-24 21:49:40 +08:00
parent 4fdc8eb1d0
commit abf395ff9a
6 changed files with 116 additions and 1202 deletions

View File

@@ -297,16 +297,24 @@ class EditAppScreen extends HookConsumerWidget {
} }
: null, : null,
}; };
if (isNew) { try {
await client.post( showLoadingModal(context);
'/develop/developers/$publisherName/projects/$projectId/apps', if (isNew) {
data: data, await client.post(
); '/develop/developers/$publisherName/projects/$projectId/apps',
} else { data: data,
await client.patch( );
'/develop/developers/$publisherName/projects/$projectId/apps/$id', } else {
data: data, await client.patch(
); '/develop/developers/$publisherName/projects/$projectId/apps/$id',
data: data,
);
}
} catch (err) {
showErrorAlert(err);
return;
} finally {
if (context.mounted) hideLoadingModal(context);
} }
ref.invalidate(customAppsProvider(publisherName, projectId)); ref.invalidate(customAppsProvider(publisherName, projectId));
if (context.mounted) { if (context.mounted) {

View File

@@ -116,33 +116,89 @@ class SliverArticlesList extends ConsumerWidget {
} }
} }
class ArticlesScreen extends ConsumerWidget { @riverpod
final String? feedId; Future<List<SnWebFeed>> subscribedFeeds(Ref ref) async {
final String? publisherId; final client = ref.watch(apiClientProvider);
final String? title; final response = await client.get('/sphere/feeds/subscribed');
final data = response.data as List<dynamic>;
return data.map((json) => SnWebFeed.fromJson(json)).toList();
}
const ArticlesScreen({super.key, this.feedId, this.publisherId, this.title}); class ArticlesScreen extends ConsumerWidget {
const ArticlesScreen({super.key});
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return AppScaffold( final subscribedFeedsAsync = ref.watch(subscribedFeedsProvider);
appBar: AppBar(title: Text(title ?? 'Articles')),
body: Center( return subscribedFeedsAsync.when(
child: ConstrainedBox( data: (feeds) {
constraints: const BoxConstraints(maxWidth: 560), return DefaultTabController(
child: CustomScrollView( length: feeds.length + 1,
slivers: [ child: AppScaffold(
SliverPadding( appBar: AppBar(
padding: const EdgeInsets.only(top: 8, left: 8, right: 8), title: const Text('Articles'),
sliver: SliverArticlesList( bottom: TabBar(
feedId: feedId, isScrollable: true,
publisherId: publisherId, tabs: [
), const Tab(text: 'All'),
...feeds.map((feed) => Tab(text: feed.title)),
],
), ),
], ),
body: TabBarView(
children: [
Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 560),
child: CustomScrollView(
slivers: [
SliverPadding(
padding: const EdgeInsets.only(
top: 8,
left: 8,
right: 8,
),
sliver: SliverArticlesList(),
),
],
),
),
),
...feeds.map((feed) {
return Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 560),
child: CustomScrollView(
slivers: [
SliverPadding(
padding: const EdgeInsets.only(
top: 8,
left: 8,
right: 8,
),
sliver: SliverArticlesList(feedId: feed.id),
),
],
),
),
);
}).toList(),
],
),
),
);
},
loading:
() => AppScaffold(
appBar: AppBar(title: const Text('Articles')),
body: const Center(child: CircularProgressIndicator()),
),
error:
(err, stack) => AppScaffold(
appBar: AppBar(title: const Text('Articles')),
body: Center(child: Text('Error: $err')),
), ),
),
),
); );
} }
} }

View File

@@ -6,6 +6,25 @@ part of 'articles.dart';
// RiverpodGenerator // RiverpodGenerator
// ************************************************************************** // **************************************************************************
String _$subscribedFeedsHash() => r'cd2f5d7d4ea49ad00dc731f8fc2ed65450a3f0e4';
/// See also [subscribedFeeds].
@ProviderFor(subscribedFeeds)
final subscribedFeedsProvider =
AutoDisposeFutureProvider<List<SnWebFeed>>.internal(
subscribedFeeds,
name: r'subscribedFeedsProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$subscribedFeedsHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef SubscribedFeedsRef = AutoDisposeFutureProviderRef<List<SnWebFeed>>;
String _$articlesListNotifierHash() => String _$articlesListNotifierHash() =>
r'579741af4d90c7c81f2e2697e57c4895b7a9dabc'; r'579741af4d90c7c81f2e2697e57c4895b7a9dabc';

View File

@@ -291,7 +291,7 @@ class _MarketplaceWebFeedSubscriptionProviderElement
} }
String _$marketplaceWebFeedContentNotifierHash() => String _$marketplaceWebFeedContentNotifierHash() =>
r'eff0eee14a244a2597756a61ad5957ae397c9bf5'; r'25688082884cb824eeff300888ba38c9748295dc';
abstract class _$MarketplaceWebFeedContentNotifier abstract class _$MarketplaceWebFeedContentNotifier
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnWebArticle>> { extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnWebArticle>> {

View File

@@ -399,7 +399,7 @@ class _RealmChatRoomsProviderElement
} }
String _$realmMemberListNotifierHash() => String _$realmMemberListNotifierHash() =>
r'2f88f803b2e61e7287ed8a43025173e56ff6ca3b'; r'db1fd8a6741dfb3d5bb921d5d965f0cfdc0e7bcc';
abstract class _$RealmMemberListNotifier abstract class _$RealmMemberListNotifier
extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnRealmMember>> { extends BuildlessAutoDisposeAsyncNotifier<CursorPagingData<SnRealmMember>> {

File diff suppressed because it is too large Load Diff