💄 Optimized creator dashboard

This commit is contained in:
LittleSheep 2025-05-16 15:09:38 +08:00
parent 9fcc70d659
commit a9da4b4f4f
3 changed files with 81 additions and 26 deletions

View File

@ -154,7 +154,6 @@
"language": "Language", "language": "Language",
"settingsDisplayLanguage": "Display Language", "settingsDisplayLanguage": "Display Language",
"languageFollowSystem": "Follow System", "languageFollowSystem": "Follow System",
"publisherUnselected": "Unselected",
"postsCreatedCount": "Posts", "postsCreatedCount": "Posts",
"stickerPacksCreatedCount": "Sticker Packs", "stickerPacksCreatedCount": "Sticker Packs",
"stickersCreatedCount": "Stickers", "stickersCreatedCount": "Stickers",
@ -212,5 +211,6 @@
"walletCurrencyShortPoints": "NSP", "walletCurrencyShortPoints": "NSP",
"walletCurrencyGolds": "The Solar Dollars", "walletCurrencyGolds": "The Solar Dollars",
"walletCurrencyShortGolds": "TSD", "walletCurrencyShortGolds": "TSD",
"retry": "Retry" "retry": "Retry",
"creatorHubUnselectedHint": "Pick / create a publisher to get started."
} }

View File

@ -59,7 +59,11 @@ class ManagedPublisherScreen extends HookConsumerWidget {
trailing: const Icon(Symbols.chevron_right), trailing: const Icon(Symbols.chevron_right),
contentPadding: const EdgeInsets.symmetric(horizontal: 24), contentPadding: const EdgeInsets.symmetric(horizontal: 24),
onTap: () { onTap: () {
context.router.push(NewPublisherRoute()); context.router.push(NewPublisherRoute()).then((value) {
if (value != null) {
ref.invalidate(publishersManagedProvider);
}
});
}, },
), ),
const Divider(height: 1), const Divider(height: 1),

View File

@ -79,8 +79,11 @@ class CreatorHubScreen extends HookConsumerWidget {
hint: CircleAvatar( hint: CircleAvatar(
radius: 16, radius: 16,
child: Icon( child: Icon(
Symbols.unknown_med, Symbols.person,
color: Theme.of(context).colorScheme.onSecondaryContainer, color: Theme.of(
context,
).colorScheme.onSecondaryContainer.withOpacity(0.9),
fill: 1,
), ),
).center().padding(right: 8), ).center().padding(right: 8),
items: [...publishersMenu], items: [...publishersMenu],
@ -129,27 +132,75 @@ class CreatorHubScreen extends HookConsumerWidget {
body: publisherStats.when( body: publisherStats.when(
data: data:
(stats) => SingleChildScrollView( (stats) => SingleChildScrollView(
child: Column( child:
children: [ currentPublisher.value == null
if (stats != null) ? Column(
_PublisherStatsWidget( children: [
stats: stats, const Gap(24),
).padding(vertical: 12, horizontal: 12), const Icon(Symbols.info, size: 32).padding(bottom: 4),
if (currentPublisher.value != null) Text(
ListTile( 'creatorHubUnselectedHint',
minTileHeight: 48, textAlign: TextAlign.center,
title: Text('stickers').tr(), ).tr(),
trailing: Icon(Symbols.chevron_right), const Gap(24),
leading: const Icon(Symbols.sticky_note), const Divider(height: 1),
contentPadding: EdgeInsets.symmetric(horizontal: 24), ...(publishers.value?.map(
onTap: () { (publisher) => ListTile(
context.router.push( leading: ProfilePictureWidget(
StickersRoute(pubName: currentPublisher.value!.name), fileId: publisher.pictureId,
); ),
}, title: Text(publisher.nick),
), subtitle: Text('@${publisher.name}'),
], onTap: () {
), currentPublisher.value = publisher;
},
),
) ??
[]),
ListTile(
leading: const CircleAvatar(
child: Icon(Symbols.add),
),
title: Text('createPublisher').tr(),
subtitle: Text('createPublisherHint').tr(),
trailing: const Icon(Symbols.chevron_right),
onTap: () {
context.router.push(NewPublisherRoute()).then((
value,
) {
if (value != null) {
ref.invalidate(publishersManagedProvider);
}
});
},
),
],
)
: Column(
children: [
if (stats != null)
_PublisherStatsWidget(
stats: stats,
).padding(vertical: 12, horizontal: 12),
if (currentPublisher.value != null)
ListTile(
minTileHeight: 48,
title: Text('stickers').tr(),
trailing: Icon(Symbols.chevron_right),
leading: const Icon(Symbols.sticky_note),
contentPadding: EdgeInsets.symmetric(
horizontal: 24,
),
onTap: () {
context.router.push(
StickersRoute(
pubName: currentPublisher.value!.name,
),
);
},
),
],
),
), ),
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
error: (_, __) => const SizedBox.shrink(), error: (_, __) => const SizedBox.shrink(),