From c06abf6e42ebf12722fc60ddd9ec02d01c313533 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 21 Jul 2025 19:35:52 +0800 Subject: [PATCH] :rewind: Remove the two column in the explore --- lib/route.dart | 66 ++++++++++++++---------------- lib/screens/discovery/realms.dart | 1 + lib/screens/explore.dart | 35 +--------------- lib/screens/posts/post_detail.dart | 1 + lib/screens/posts/post_search.dart | 1 + lib/screens/posts/pub_profile.dart | 1 + 6 files changed, 36 insertions(+), 69 deletions(-) diff --git a/lib/route.dart b/lib/route.dart index d2da6d0..19e1505 100644 --- a/lib/route.dart +++ b/lib/route.dart @@ -310,42 +310,36 @@ final routerProvider = Provider((ref) { }, routes: [ // Explore tab - ShellRoute( - builder: - (context, state, child) => ExploreShellScreen(child: child), - routes: [ - GoRoute( - name: 'explore', - path: '/', - builder: (context, state) => const ExploreScreen(), - ), - GoRoute( - name: 'postSearch', - path: '/posts/search', - builder: (context, state) => const PostSearchScreen(), - ), - GoRoute( - name: 'postDetail', - path: '/posts/:id', - builder: (context, state) { - final id = state.pathParameters['id']!; - return PostDetailScreen(id: id); - }, - ), - GoRoute( - name: 'publisherProfile', - path: '/publishers/:name', - builder: (context, state) { - final name = state.pathParameters['name']!; - return PublisherProfileScreen(name: name); - }, - ), - GoRoute( - name: 'discoveryRealms', - path: '/discovery/realms', - builder: (context, state) => const DiscoveryRealmsScreen(), - ), - ], + GoRoute( + name: 'explore', + path: '/', + builder: (context, state) => const ExploreScreen(), + ), + GoRoute( + name: 'postSearch', + path: '/posts/search', + builder: (context, state) => const PostSearchScreen(), + ), + GoRoute( + name: 'postDetail', + path: '/posts/:id', + builder: (context, state) { + final id = state.pathParameters['id']!; + return PostDetailScreen(id: id); + }, + ), + GoRoute( + name: 'publisherProfile', + path: '/publishers/:name', + builder: (context, state) { + final name = state.pathParameters['name']!; + return PublisherProfileScreen(name: name); + }, + ), + GoRoute( + name: 'discoveryRealms', + path: '/discovery/realms', + builder: (context, state) => const DiscoveryRealmsScreen(), ), // Chat tab diff --git a/lib/screens/discovery/realms.dart b/lib/screens/discovery/realms.dart index 7bbdda9..78a816f 100644 --- a/lib/screens/discovery/realms.dart +++ b/lib/screens/discovery/realms.dart @@ -17,6 +17,7 @@ class DiscoveryRealmsScreen extends HookConsumerWidget { final currentQuery = useState(null); return AppScaffold( + noBackground: false, appBar: AppBar(title: Text('discoverRealms'.tr())), body: Stack( children: [ diff --git a/lib/screens/explore.dart b/lib/screens/explore.dart index c6e77ae..c991618 100644 --- a/lib/screens/explore.dart +++ b/lib/screens/explore.dart @@ -27,42 +27,11 @@ import 'package:styled_widget/styled_widget.dart'; part 'explore.g.dart'; -class ExploreShellScreen extends HookConsumerWidget { - final Widget child; - const ExploreShellScreen({super.key, required this.child}); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final isWide = MediaQuery.of(context).size.width > 640; - - if (isWide) { - return AppBackground( - isRoot: true, - child: Row( - children: [ - Flexible(flex: 2, child: ExploreScreen(isAside: true)), - VerticalDivider(width: 1), - Flexible(flex: 3, child: child), - ], - ), - ); - } - - return AppBackground(isRoot: true, child: child); - } -} - class ExploreScreen extends HookConsumerWidget { - final bool isAside; - const ExploreScreen({super.key, this.isAside = false}); + const ExploreScreen({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { - final isWide = isWideScreen(context); - if (isWide && !isAside) { - return const EmptyPageHolder(); - } - final tabController = useTabController(initialLength: 3); final currentFilter = useState(null); @@ -90,7 +59,7 @@ class ExploreScreen extends HookConsumerWidget { ); return AppScaffold( - extendBody: false, // Prevent conflicts with tabs navigation + noBackground: false, appBar: AppBar( toolbarHeight: 0, bottom: PreferredSize( diff --git a/lib/screens/posts/post_detail.dart b/lib/screens/posts/post_detail.dart index 940cc93..0c200ff 100644 --- a/lib/screens/posts/post_detail.dart +++ b/lib/screens/posts/post_detail.dart @@ -57,6 +57,7 @@ class PostDetailScreen extends HookConsumerWidget { final isWide = isWideScreen(context); return AppScaffold( + noBackground: false, appBar: AppBar(title: const Text('Post')), body: postState.when( data: (post) { diff --git a/lib/screens/posts/post_search.dart b/lib/screens/posts/post_search.dart index dabf3f8..d443026 100644 --- a/lib/screens/posts/post_search.dart +++ b/lib/screens/posts/post_search.dart @@ -109,6 +109,7 @@ class _PostSearchScreenState extends ConsumerState { @override Widget build(BuildContext context) { return AppScaffold( + noBackground: false, appBar: AppBar( title: TextField( controller: _searchController, diff --git a/lib/screens/posts/pub_profile.dart b/lib/screens/posts/pub_profile.dart index 6317b02..e8d77ff 100644 --- a/lib/screens/posts/pub_profile.dart +++ b/lib/screens/posts/pub_profile.dart @@ -124,6 +124,7 @@ class PublisherProfileScreen extends HookConsumerWidget { return publisher.when( data: (data) => AppScaffold( + noBackground: false, body: CustomScrollView( slivers: [ SliverAppBar(