🐛 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,
};
if (isNew) {
await client.post(
'/develop/developers/$publisherName/projects/$projectId/apps',
data: data,
);
} else {
await client.patch(
'/develop/developers/$publisherName/projects/$projectId/apps/$id',
data: data,
);
try {
showLoadingModal(context);
if (isNew) {
await client.post(
'/develop/developers/$publisherName/projects/$projectId/apps',
data: data,
);
} else {
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));
if (context.mounted) {

View File

@@ -116,33 +116,89 @@ class SliverArticlesList extends ConsumerWidget {
}
}
class ArticlesScreen extends ConsumerWidget {
final String? feedId;
final String? publisherId;
final String? title;
@riverpod
Future<List<SnWebFeed>> subscribedFeeds(Ref ref) async {
final client = ref.watch(apiClientProvider);
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
Widget build(BuildContext context, WidgetRef ref) {
return AppScaffold(
appBar: AppBar(title: Text(title ?? 'Articles')),
body: 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: feedId,
publisherId: publisherId,
),
final subscribedFeedsAsync = ref.watch(subscribedFeedsProvider);
return subscribedFeedsAsync.when(
data: (feeds) {
return DefaultTabController(
length: feeds.length + 1,
child: AppScaffold(
appBar: AppBar(
title: const Text('Articles'),
bottom: TabBar(
isScrollable: true,
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
// **************************************************************************
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() =>
r'579741af4d90c7c81f2e2697e57c4895b7a9dabc';

View File

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

View File

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