💄 Put appbar back to explore

This commit is contained in:
2025-10-28 01:17:18 +08:00
parent a7990f83db
commit 11fb20c673

View File

@@ -206,8 +206,11 @@ class ExploreScreen extends HookConsumerWidget {
).padding(horizontal: 8), ).padding(horizontal: 8),
); );
final appBar = isWide ? null : _buildAppBar(tabController, context);
return AppScaffold( return AppScaffold(
isNoBackground: false, isNoBackground: false,
appBar: appBar,
body: body:
isWide isWide
? _buildWideBody( ? _buildWideBody(
@@ -221,7 +224,7 @@ class ExploreScreen extends HookConsumerWidget {
selectedDay, selectedDay,
currentFilter.value, currentFilter.value,
) )
: _buildNarrowBody(context, ref, filterBar, currentFilter.value), : _buildNarrowBody(context, ref, currentFilter.value),
); );
} }
@@ -337,10 +340,121 @@ class ExploreScreen extends HookConsumerWidget {
).padding(horizontal: 12); ).padding(horizontal: 12);
} }
PreferredSizeWidget _buildAppBar(
TabController tabController,
BuildContext context,
) {
final foregroundColor = Theme.of(context).appBarTheme.foregroundColor;
return AppBar(
toolbarHeight: 48 + 4,
flexibleSpace: Container(
height: 48,
margin: const EdgeInsets.only(left: 8, right: 8, top: 4),
child: Row(
children: [
Expanded(
child: TabBar(
controller: tabController,
tabAlignment: TabAlignment.start,
isScrollable: true,
dividerColor: Colors.transparent,
tabs: [
Tab(
icon: Tooltip(
message: 'explore'.tr(),
child: Icon(Symbols.explore, color: foregroundColor),
),
),
Tab(
icon: Tooltip(
message: 'exploreFilterSubscriptions'.tr(),
child: Icon(
Symbols.subscriptions,
color: foregroundColor,
),
),
),
Tab(
icon: Tooltip(
message: 'exploreFilterFriends'.tr(),
child: Icon(Symbols.people, color: foregroundColor),
),
),
],
),
),
IconButton(
onPressed: () {
context.pushNamed('articles');
},
icon: Icon(Symbols.auto_stories, color: foregroundColor),
tooltip: 'webArticlesStand'.tr(),
),
PopupMenuButton(
itemBuilder:
(context) => [
PopupMenuItem(
child: Row(
children: [
const Icon(Symbols.category),
const Gap(12),
Text('categories').tr(),
],
),
onTap: () {
context.pushNamed('postCategories');
},
),
PopupMenuItem(
child: Row(
children: [
const Icon(Symbols.label),
const Gap(12),
Text('tags').tr(),
],
),
onTap: () {
context.pushNamed('postTags');
},
),
PopupMenuItem(
child: Row(
children: [
const Icon(Symbols.shuffle),
const Gap(12),
Text('postShuffle').tr(),
],
),
onTap: () {
context.pushNamed('postShuffle');
},
),
PopupMenuItem(
child: Row(
children: [
const Icon(Symbols.search),
const Gap(12),
Text('search').tr(),
],
),
onTap: () {
context.pushNamed('postSearch');
},
),
],
icon: Icon(Symbols.action_key, color: foregroundColor),
tooltip: 'search'.tr(),
),
],
),
),
);
}
Widget _buildNarrowBody( Widget _buildNarrowBody(
BuildContext context, BuildContext context,
WidgetRef ref, WidgetRef ref,
Widget filterBar,
String? currentFilter, String? currentFilter,
) { ) {
final user = ref.watch(userInfoProvider); final user = ref.watch(userInfoProvider);
@@ -354,45 +468,39 @@ class ExploreScreen extends HookConsumerWidget {
final bodyView = _buildActivityList(context, ref, currentFilter); final bodyView = _buildActivityList(context, ref, currentFilter);
return Column( return Expanded(
spacing: 8, child: ExtendedRefreshIndicator(
children: [ onRefresh: () => Future.sync(activitiesNotifier.forceRefresh),
filterBar.padding(horizontal: 8, top: 8), child: ClipRRect(
Expanded( borderRadius: const BorderRadius.all(Radius.circular(8)),
child: ExtendedRefreshIndicator( child: CustomScrollView(
onRefresh: () => Future.sync(activitiesNotifier.forceRefresh), slivers: [
child: ClipRRect( if (user.value != null)
borderRadius: const BorderRadius.all(Radius.circular(8)), SliverToBoxAdapter(
child: CustomScrollView( child: CheckInWidget(
slivers: [ margin: const EdgeInsets.only(bottom: 8),
if (user.value != null)
SliverToBoxAdapter(
child: CheckInWidget(
margin: const EdgeInsets.only(bottom: 8),
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.only(bottom: 8),
child: PostFeaturedList(),
),
), ),
if (notificationCount.value != null && ),
notificationCount.value! > 0) SliverToBoxAdapter(
SliverToBoxAdapter( child: Padding(
child: notificationIndicatorWidget( padding: const EdgeInsets.only(bottom: 8),
context, child: PostFeaturedList(),
count: notificationCount.value ?? 0, ),
margin: const EdgeInsets.only(bottom: 8),
),
),
bodyView,
],
), ),
).padding(horizontal: 8), if (notificationCount.value != null &&
notificationCount.value! > 0)
SliverToBoxAdapter(
child: notificationIndicatorWidget(
context,
count: notificationCount.value ?? 0,
margin: const EdgeInsets.only(bottom: 8),
),
),
bodyView,
],
), ),
), ).padding(horizontal: 8),
], ),
); );
} }
} }