💄 Optimize explore page styles

This commit is contained in:
2025-07-31 01:17:20 +08:00
parent ed90152462
commit f320855348
10 changed files with 145 additions and 137 deletions

View File

@@ -198,21 +198,23 @@ class ExploreScreen extends HookConsumerWidget {
if (isWider) {
return Row(
children: [
Flexible(flex: 3, child: bodyView),
const VerticalDivider(width: 1),
Flexible(flex: 3, child: bodyView.padding(left: 8)),
if (user.value != null)
Flexible(
flex: 2,
child: SingleChildScrollView(
child: Column(
children: [
CheckInWidget(),
Card(
CheckInWidget(
margin: EdgeInsets.only(
left: 16,
left: 8,
right: 16,
top: 8,
top: 16,
bottom: 8,
),
),
Card(
margin: EdgeInsets.only(left: 8, right: 16, top: 8),
child: Column(
children: [
// Use the reusable EventCalendarWidget
@@ -227,6 +229,11 @@ class ExploreScreen extends HookConsumerWidget {
),
),
FortuneGraphWidget(
margin: EdgeInsets.only(
left: 8,
right: 16,
top: 16,
),
events: events,
constrainWidth: true,
onPointSelected: onDaySelected,
@@ -306,56 +313,55 @@ class _DiscoveryActivityItem extends StatelessWidget {
final items = data['items'] as List;
final type = items.firstOrNull?['type'] ?? 'unknown';
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(Symbols.explore, size: 19),
const Gap(8),
Text(
(switch (type) {
'realm' => 'discoverRealms',
'publisher' => 'discoverPublishers',
'article' => 'discoverWebArticles',
_ => 'unknown',
}).tr(),
style: Theme.of(context).textTheme.titleMedium,
).padding(top: 1),
],
).padding(horizontal: 20, top: 8, bottom: 4),
SizedBox(
height: 180,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: items.length,
padding: const EdgeInsets.symmetric(horizontal: 8),
itemBuilder: (context, index) {
final item = items[index];
switch (type) {
case 'realm':
return RealmCard(
return Card(
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(Symbols.explore, size: 19),
const Gap(8),
Text(
(switch (type) {
'realm' => 'discoverRealms',
'publisher' => 'discoverPublishers',
'article' => 'discoverWebArticles',
_ => 'unknown',
}).tr(),
style: Theme.of(context).textTheme.titleMedium,
).padding(top: 1),
],
).padding(horizontal: 20, top: 8, bottom: 4),
SizedBox(
height: 180,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: items.length,
padding: const EdgeInsets.symmetric(horizontal: 8),
itemBuilder: (context, index) {
final item = items[index];
return switch (type) {
'realm' => RealmCard(
realm: SnRealm.fromJson(item['data']),
maxWidth: 280,
);
case 'publisher':
return PublisherCard(
),
'publisher' => PublisherCard(
publisher: SnPublisher.fromJson(item['data']),
maxWidth: 280,
);
case 'article':
return WebArticleCard(
),
'article' => WebArticleCard(
article: SnWebArticle.fromJson(item['data']),
maxWidth: 280,
);
default:
return Placeholder();
}
},
),
).padding(bottom: 4),
],
),
_ => Placeholder(),
};
},
),
).padding(bottom: 8),
],
),
);
}
}
@@ -381,6 +387,7 @@ class _ActivityListView extends HookConsumerWidget {
return CustomScrollView(
slivers: [
SliverGap(12),
if (user.value != null && !contentOnly)
SliverToBoxAdapter(child: CheckInWidget()),
SliverList.builder(

View File

@@ -67,21 +67,16 @@ class PostDetailScreen extends HookConsumerWidget {
CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Column(
children: [
PostItem(
item: post!,
isFullPost: true,
backgroundColor: isWide ? Colors.transparent : null,
onUpdate: (newItem) {
// Update the local state with the new post data
ref
.read(postStateProvider(id).notifier)
.updatePost(newItem);
},
),
const Divider(height: 1),
],
child: PostItem(
item: post!,
isFullPost: true,
backgroundColor: isWide ? Colors.transparent : null,
onUpdate: (newItem) {
// Update the local state with the new post data
ref
.read(postStateProvider(id).notifier)
.updatePost(newItem);
},
),
),
PostRepliesList(postId: id),

View File

@@ -5,6 +5,7 @@ import 'package:island/models/post.dart';
import 'package:island/pods/network.dart';
import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/post/post_item.dart';
import 'package:island/widgets/response.dart';
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
final postSearchNotifierProvider = StateNotifierProvider.autoDispose<
@@ -141,6 +142,7 @@ class _PostSearchScreenState extends ConsumerState<PostSearchScreen> {
}
return ListView.builder(
padding: EdgeInsets.zero,
itemCount: data.items.length + (data.hasMore ? 1 : 0),
itemBuilder: (context, index) {
if (index >= data.items.length) {
@@ -151,14 +153,19 @@ class _PostSearchScreenState extends ConsumerState<PostSearchScreen> {
}
final post = data.items[index];
return Column(
children: [PostItem(item: post), const Divider(height: 1)],
return Card(
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: PostActionableItem(item: post, borderRadius: 8),
);
},
);
},
loading: () => const Center(child: CircularProgressIndicator()),
error: (error, stack) => Center(child: Text('Error: $error')),
error:
(error, stack) => ResponseErrorWidget(
error: error,
onRetry: () => ref.invalidate(postSearchNotifierProvider),
),
);
},
),

View File

@@ -285,33 +285,31 @@ class PublisherProfileScreen extends HookConsumerWidget {
).padding(horizontal: 24, top: 24),
),
SliverToBoxAdapter(
child: Column(
children: [
if (badges.value?.isNotEmpty ?? false)
BadgeList(badges: badges.value!).padding(top: 16),
if (data.verification != null)
VerificationStatusCard(
mark: data.verification!,
).padding(top: 16),
],
).padding(horizontal: 24),
child: Card(
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: Column(
children: [
if (badges.value?.isNotEmpty ?? false)
BadgeList(badges: badges.value!).padding(top: 16),
if (data.verification != null)
VerificationStatusCard(mark: data.verification!),
],
),
).padding(top: 16),
),
SliverToBoxAdapter(
child: const Divider(height: 1).padding(vertical: 24),
),
SliverToBoxAdapter(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text('bio').tr().bold(),
Text(
data.bio.isEmpty ? 'descriptionNone'.tr() : data.bio,
),
],
).padding(horizontal: 24),
),
SliverToBoxAdapter(
child: const Divider(height: 1).padding(top: 24),
child: Card(
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text('bio').tr().bold().padding(bottom: 2),
Text(
data.bio.isEmpty ? 'descriptionNone'.tr() : data.bio,
),
],
).padding(horizontal: 20, vertical: 16),
),
),
SliverPostList(pubName: name),
SliverGap(MediaQuery.of(context).padding.bottom + 16),