♻️ Explore two column
This commit is contained in:
		@@ -70,10 +70,42 @@ final _appRoutes = [
 | 
			
		||||
    name: 'home',
 | 
			
		||||
    builder: (context, state) => const HomeScreen(),
 | 
			
		||||
  ),
 | 
			
		||||
  ShellRoute(
 | 
			
		||||
    builder: (context, state, child) => ResponsiveScaffold(
 | 
			
		||||
      asideFlex: 2,
 | 
			
		||||
      contentFlex: 3,
 | 
			
		||||
      aside: const ExploreScreen(),
 | 
			
		||||
      child: child,
 | 
			
		||||
    ),
 | 
			
		||||
    routes: [
 | 
			
		||||
      GoRoute(
 | 
			
		||||
        path: '/explore',
 | 
			
		||||
        name: 'explore',
 | 
			
		||||
        builder: (context, state) => const ResponsiveScaffoldLanding(
 | 
			
		||||
          child: ExploreScreen(),
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
      GoRoute(
 | 
			
		||||
        path: '/posts/:slug',
 | 
			
		||||
        name: 'postDetail',
 | 
			
		||||
        builder: (context, state) => PostDetailScreen(
 | 
			
		||||
          key: ValueKey(state.pathParameters['slug']!),
 | 
			
		||||
          slug: state.pathParameters['slug']!,
 | 
			
		||||
          preload: state.extra as SnPost?,
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
      GoRoute(
 | 
			
		||||
        path: '/publishers/:name',
 | 
			
		||||
        name: 'postPublisher',
 | 
			
		||||
        builder: (context, state) =>
 | 
			
		||||
            PostPublisherScreen(name: state.pathParameters['name']!),
 | 
			
		||||
      ),
 | 
			
		||||
    ],
 | 
			
		||||
  ),
 | 
			
		||||
  GoRoute(
 | 
			
		||||
    path: '/posts',
 | 
			
		||||
    name: 'explore',
 | 
			
		||||
    builder: (context, state) => const ExploreScreen(),
 | 
			
		||||
    name: 'posts',
 | 
			
		||||
    builder: (_, __) => const SizedBox.shrink(),
 | 
			
		||||
    routes: [
 | 
			
		||||
      GoRoute(
 | 
			
		||||
        path: '/draft',
 | 
			
		||||
@@ -111,20 +143,6 @@ final _appRoutes = [
 | 
			
		||||
              state.uri.queryParameters['categories']?.split(','),
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
      GoRoute(
 | 
			
		||||
        path: '/publishers/:name',
 | 
			
		||||
        name: 'postPublisher',
 | 
			
		||||
        builder: (context, state) =>
 | 
			
		||||
            PostPublisherScreen(name: state.pathParameters['name']!),
 | 
			
		||||
      ),
 | 
			
		||||
      GoRoute(
 | 
			
		||||
        path: '/:slug',
 | 
			
		||||
        name: 'postDetail',
 | 
			
		||||
        builder: (context, state) => PostDetailScreen(
 | 
			
		||||
          slug: state.pathParameters['slug']!,
 | 
			
		||||
          preload: state.extra as SnPost?,
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
    ],
 | 
			
		||||
  ),
 | 
			
		||||
  ShellRoute(
 | 
			
		||||
 
 | 
			
		||||
@@ -243,6 +243,7 @@ class _ExploreScreenState extends State<ExploreScreen>
 | 
			
		||||
                        GoRouter.of(context).pushNamed('postShuffle');
 | 
			
		||||
                      },
 | 
			
		||||
                    ),
 | 
			
		||||
                    const Gap(48),
 | 
			
		||||
                    Expanded(
 | 
			
		||||
                      child: Center(
 | 
			
		||||
                        child: IconButton(
 | 
			
		||||
@@ -534,6 +535,7 @@ class _PostListWidgetState extends State<_PostListWidget> {
 | 
			
		||||
            switch (ele.type) {
 | 
			
		||||
              case 'interactive.post':
 | 
			
		||||
                return OpenablePostItem(
 | 
			
		||||
                  useReplace: true,
 | 
			
		||||
                  data: SnPost.fromJson(ele.data),
 | 
			
		||||
                  maxWidth: 640,
 | 
			
		||||
                  onChanged: (data) {
 | 
			
		||||
 
 | 
			
		||||
@@ -228,8 +228,15 @@ class AppRootScaffold extends StatelessWidget {
 | 
			
		||||
class ResponsiveScaffold extends StatelessWidget {
 | 
			
		||||
  final Widget aside;
 | 
			
		||||
  final Widget? child;
 | 
			
		||||
  const ResponsiveScaffold(
 | 
			
		||||
      {super.key, required this.aside, required this.child});
 | 
			
		||||
  final int asideFlex;
 | 
			
		||||
  final int contentFlex;
 | 
			
		||||
  const ResponsiveScaffold({
 | 
			
		||||
    super.key,
 | 
			
		||||
    required this.aside,
 | 
			
		||||
    required this.child,
 | 
			
		||||
    this.asideFlex = 1,
 | 
			
		||||
    this.contentFlex = 2,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
@@ -237,15 +244,15 @@ class ResponsiveScaffold extends StatelessWidget {
 | 
			
		||||
      return Row(
 | 
			
		||||
        children: [
 | 
			
		||||
          Flexible(
 | 
			
		||||
            flex: 1,
 | 
			
		||||
            flex: asideFlex,
 | 
			
		||||
            child: aside,
 | 
			
		||||
          ),
 | 
			
		||||
          VerticalDivider(width: 1),
 | 
			
		||||
          if (child != null && child != aside)
 | 
			
		||||
            Flexible(flex: 2, child: child!)
 | 
			
		||||
            Flexible(flex: contentFlex, child: child!)
 | 
			
		||||
          else
 | 
			
		||||
            const Flexible(
 | 
			
		||||
              flex: 2,
 | 
			
		||||
            Flexible(
 | 
			
		||||
              flex: contentFlex,
 | 
			
		||||
              child: ResponsiveScaffoldLanding(child: null),
 | 
			
		||||
            ),
 | 
			
		||||
        ],
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,6 @@ import 'package:gap/gap.dart';
 | 
			
		||||
import 'package:go_router/go_router.dart';
 | 
			
		||||
import 'package:material_symbols_icons/symbols.dart';
 | 
			
		||||
import 'package:provider/provider.dart';
 | 
			
		||||
import 'package:responsive_framework/responsive_framework.dart';
 | 
			
		||||
import 'package:styled_widget/styled_widget.dart';
 | 
			
		||||
import 'package:surface/providers/post.dart';
 | 
			
		||||
import 'package:surface/providers/sn_network.dart';
 | 
			
		||||
@@ -30,24 +29,14 @@ class PostCommentQuickAction extends StatelessWidget {
 | 
			
		||||
    return Container(
 | 
			
		||||
      height: 240,
 | 
			
		||||
      constraints: BoxConstraints(maxWidth: maxWidth ?? double.infinity),
 | 
			
		||||
      margin: ResponsiveBreakpoints.of(context).largerThan(MOBILE)
 | 
			
		||||
          ? const EdgeInsets.symmetric(vertical: 8)
 | 
			
		||||
          : EdgeInsets.zero,
 | 
			
		||||
      decoration: BoxDecoration(
 | 
			
		||||
        borderRadius: ResponsiveBreakpoints.of(context).largerThan(MOBILE)
 | 
			
		||||
            ? const BorderRadius.all(Radius.circular(8))
 | 
			
		||||
            : BorderRadius.zero,
 | 
			
		||||
        border: ResponsiveBreakpoints.of(context).largerThan(MOBILE)
 | 
			
		||||
            ? Border.all(
 | 
			
		||||
                color: Theme.of(context).dividerColor,
 | 
			
		||||
                width: 1 / devicePixelRatio,
 | 
			
		||||
              )
 | 
			
		||||
            : Border.symmetric(
 | 
			
		||||
                horizontal: BorderSide(
 | 
			
		||||
                  color: Theme.of(context).dividerColor,
 | 
			
		||||
                  width: 1 / devicePixelRatio,
 | 
			
		||||
                ),
 | 
			
		||||
              ),
 | 
			
		||||
        borderRadius: BorderRadius.zero,
 | 
			
		||||
        border: Border.symmetric(
 | 
			
		||||
          horizontal: BorderSide(
 | 
			
		||||
            color: Theme.of(context).dividerColor,
 | 
			
		||||
            width: 1 / devicePixelRatio,
 | 
			
		||||
          ),
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
      child: PostMiniEditor(
 | 
			
		||||
        postReplyId: parentPost.id,
 | 
			
		||||
 
 | 
			
		||||
@@ -51,6 +51,7 @@ class OpenablePostItem extends StatelessWidget {
 | 
			
		||||
  final bool showMenu;
 | 
			
		||||
  final bool showFullPost;
 | 
			
		||||
  final bool showExpandableComments;
 | 
			
		||||
  final bool useReplace;
 | 
			
		||||
  final double? maxWidth;
 | 
			
		||||
  final Function(SnPost data)? onChanged;
 | 
			
		||||
  final Function()? onDeleted;
 | 
			
		||||
@@ -64,6 +65,7 @@ class OpenablePostItem extends StatelessWidget {
 | 
			
		||||
    this.showMenu = true,
 | 
			
		||||
    this.showFullPost = false,
 | 
			
		||||
    this.showExpandableComments = false,
 | 
			
		||||
    this.useReplace = false,
 | 
			
		||||
    this.maxWidth,
 | 
			
		||||
    this.onChanged,
 | 
			
		||||
    this.onDeleted,
 | 
			
		||||
@@ -87,9 +89,16 @@ class OpenablePostItem extends StatelessWidget {
 | 
			
		||||
            onSelectAnswer: onSelectAnswer,
 | 
			
		||||
          ),
 | 
			
		||||
          onTap: () {
 | 
			
		||||
            GoRouter.of(context).pushNamed('postDetail', pathParameters: {
 | 
			
		||||
              'slug': data.id.toString(),
 | 
			
		||||
            });
 | 
			
		||||
            if (useReplace) {
 | 
			
		||||
              GoRouter.of(context)
 | 
			
		||||
                  .pushReplacementNamed('postDetail', pathParameters: {
 | 
			
		||||
                'slug': data.id.toString(),
 | 
			
		||||
              });
 | 
			
		||||
            } else {
 | 
			
		||||
              GoRouter.of(context).pushNamed('postDetail', pathParameters: {
 | 
			
		||||
                'slug': data.id.toString(),
 | 
			
		||||
              });
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user