Large screen support

This commit is contained in:
LittleSheep 2024-06-27 14:56:09 +08:00
parent 977cc2e524
commit b913c6a432
5 changed files with 202 additions and 150 deletions

View File

@ -31,11 +31,49 @@ abstract class AppRouter {
showSidebar: false,
child: child,
),
routes: [
ShellRoute(
builder: (context, state, child) => BasicShell(
state: state,
sidebarFirst: true,
showAppBar: false,
sidebar: const SocialScreen(),
child: child,
),
routes: [
GoRoute(
path: '/',
name: 'social',
builder: (context, state) => const SocialScreen(),
builder: (context, state) =>
SolianTheme.isExtraLargeScreen(context)
? const EmptyPagePlaceholder()
: const SocialScreen(),
),
GoRoute(
path: '/posts/view/:alias',
name: 'postDetail',
builder: (context, state) => TitleShell(
showAppBar: SolianTheme.isExtraLargeScreen(context),
state: state,
child: PostDetailScreen(
alias: state.pathParameters['alias']!,
),
),
),
GoRoute(
path: '/posts/publish',
name: 'postPublishing',
builder: (context, state) {
final arguments = state.extra as PostPublishingArguments?;
return PostPublishingScreen(
edit: arguments?.edit,
reply: arguments?.reply,
repost: arguments?.repost,
realm: arguments?.realm,
);
},
),
],
),
ShellRoute(
builder: (context, state, child) => BasicShell(
@ -49,7 +87,8 @@ abstract class AppRouter {
GoRoute(
path: '/chat',
name: 'chat',
builder: (context, state) => SolianTheme.isExtraLargeScreen(context)
builder: (context, state) =>
SolianTheme.isExtraLargeScreen(context)
? const EmptyPagePlaceholder()
: const ChatScreen(),
),
@ -92,78 +131,34 @@ abstract class AppRouter {
),
],
),
ShellRoute(
builder: (context, state, child) => BasicShell(
state: state,
sidebarFirst: true,
showAppBar: false,
sidebar: const RealmListScreen(),
child: child,
),
routes: [
GoRoute(
path: '/realms',
name: 'realms',
builder: (context, state) => const RealmListScreen(),
builder: (context, state) =>
SolianTheme.isExtraLargeScreen(context)
? const EmptyPagePlaceholder()
: const RealmListScreen(),
),
GoRoute(
path: '/account',
name: 'account',
builder: (context, state) => const AccountScreen(),
),
],
),
ShellRoute(
builder: (context, state, child) =>
BasicShell(state: state, child: child),
routes: [
GoRoute(
path: '/posts/view/:alias',
name: 'postDetail',
builder: (context, state) => PostDetailScreen(
alias: state.pathParameters['alias']!,
),
),
],
),
GoRoute(
path: '/posts/publish',
name: 'postPublishing',
builder: (context, state) {
final arguments = state.extra as PostPublishingArguments?;
return PostPublishingScreen(
edit: arguments?.edit,
reply: arguments?.reply,
repost: arguments?.repost,
realm: arguments?.realm,
);
},
),
ShellRoute(
builder: (context, state, child) =>
BasicShell(state: state, child: child),
routes: [
GoRoute(
path: '/account/friend',
name: 'accountFriend',
builder: (context, state) => const FriendScreen(),
),
GoRoute(
path: '/account/personalize',
name: 'accountPersonalize',
builder: (context, state) => const PersonalizeScreen(),
),
GoRoute(
path: '/about',
name: 'about',
builder: (context, state) => const AboutScreen(),
),
],
),
ShellRoute(
builder: (context, state, child) =>
BasicShell(state: state, child: child),
routes: [
GoRoute(
path: '/realms/:alias/detail',
name: 'realmDetail',
builder: (context, state) => RealmDetailScreen(
builder: (context, state) => TitleShell(
showAppBar: SolianTheme.isExtraLargeScreen(context),
state: state,
child: RealmDetailScreen(
realm: state.extra as Realm,
alias: state.pathParameters['alias']!,
),
),
],
),
GoRoute(
path: '/realm/organize',
@ -185,5 +180,55 @@ abstract class AppRouter {
},
),
],
),
ShellRoute(
builder: (context, state, child) => BasicShell(
state: state,
sidebarFirst: true,
showAppBar: false,
sidebar: const AccountScreen(),
child: child,
),
routes: [
GoRoute(
path: '/account',
name: 'account',
builder: (context, state) =>
SolianTheme.isExtraLargeScreen(context)
? const EmptyPagePlaceholder()
: const AccountScreen(),
),
GoRoute(
path: '/account/friend',
name: 'accountFriend',
builder: (context, state) => TitleShell(
showAppBar: SolianTheme.isExtraLargeScreen(context),
state: state,
child: const FriendScreen(),
),
),
GoRoute(
path: '/account/personalize',
name: 'accountPersonalize',
builder: (context, state) => TitleShell(
showAppBar: SolianTheme.isExtraLargeScreen(context),
state: state,
child: const PersonalizeScreen(),
),
),
GoRoute(
path: '/about',
name: 'about',
builder: (context, state) => TitleShell(
showAppBar: SolianTheme.isExtraLargeScreen(context),
state: state,
child: const AboutScreen(),
),
),
],
),
],
),
],
);
}

View File

@ -12,6 +12,8 @@ class AboutScreen extends StatelessWidget {
return Material(
color: Theme.of(context).colorScheme.surface,
child: SizedBox(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -64,6 +66,7 @@ class AboutScreen extends StatelessWidget {
),
],
),
),
);
}
}

View File

@ -76,7 +76,7 @@ class SolianMessages extends Translations {
'postInRealm': 'In realm @realm',
'postDetail': 'Post',
'postReplies': 'Replies',
'postPublishing': 'Post post',
'postPublishing': 'Post a post',
'postIdentityNotify': 'You will post this post as',
'postContentPlaceholder': 'What\'s happened?!',
'postReaction': 'Reactions of the Post',

View File

@ -1,13 +1,15 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class EmptyPagePlaceholder extends StatelessWidget {
const EmptyPagePlaceholder({super.key});
@override
Widget build(BuildContext context) {
return Center(
return Material(
color: Theme.of(context).colorScheme.surface,
child: Center(
child: Image.asset('assets/logo.png', width: 80, height: 80),
),
);
}
}

View File

@ -1,13 +1,15 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class SidebarPlaceholder extends StatelessWidget {
const SidebarPlaceholder({super.key});
@override
Widget build(BuildContext context) {
return const Center(
return Material(
color: Theme.of(context).colorScheme.surface,
child: const Center(
child: Icon(Icons.menu_open, size: 50),
),
);
}
}