chore: Add pagekey to custom page builder
This commit is contained in:
parent
335a55963b
commit
20fd4dcf59
1 changed files with 45 additions and 2 deletions
|
|
@ -59,6 +59,7 @@ abstract class AppRoutes {
|
||||||
path: '/home',
|
path: '/home',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const HomeserverPicker(),
|
const HomeserverPicker(),
|
||||||
),
|
),
|
||||||
redirect: loggedInRedirect,
|
redirect: loggedInRedirect,
|
||||||
|
|
@ -67,6 +68,7 @@ abstract class AppRoutes {
|
||||||
path: 'login',
|
path: 'login',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const Login(),
|
const Login(),
|
||||||
),
|
),
|
||||||
redirect: loggedInRedirect,
|
redirect: loggedInRedirect,
|
||||||
|
|
@ -77,12 +79,14 @@ abstract class AppRoutes {
|
||||||
path: '/logs',
|
path: '/logs',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const LogViewer(),
|
const LogViewer(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ShellRoute(
|
ShellRoute(
|
||||||
pageBuilder: (context, state, child) => defaultPageBuilder(
|
pageBuilder: (context, state, child) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
FluffyThemes.isColumnMode(context) &&
|
FluffyThemes.isColumnMode(context) &&
|
||||||
state.fullPath?.startsWith('/rooms/settings') == false
|
state.fullPath?.startsWith('/rooms/settings') == false
|
||||||
? TwoColumnLayout(
|
? TwoColumnLayout(
|
||||||
|
|
@ -103,6 +107,7 @@ abstract class AppRoutes {
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
FluffyThemes.isColumnMode(context)
|
FluffyThemes.isColumnMode(context)
|
||||||
? const EmptyPage()
|
? const EmptyPage()
|
||||||
: ChatList(
|
: ChatList(
|
||||||
|
|
@ -114,6 +119,7 @@ abstract class AppRoutes {
|
||||||
path: 'archive',
|
path: 'archive',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const Archive(),
|
const Archive(),
|
||||||
),
|
),
|
||||||
routes: [
|
routes: [
|
||||||
|
|
@ -121,6 +127,7 @@ abstract class AppRoutes {
|
||||||
path: ':roomid',
|
path: ':roomid',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
ChatPage(
|
ChatPage(
|
||||||
roomId: state.pathParameters['roomid']!,
|
roomId: state.pathParameters['roomid']!,
|
||||||
),
|
),
|
||||||
|
|
@ -134,6 +141,7 @@ abstract class AppRoutes {
|
||||||
path: 'newprivatechat',
|
path: 'newprivatechat',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const NewPrivateChat(),
|
const NewPrivateChat(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -142,6 +150,7 @@ abstract class AppRoutes {
|
||||||
path: 'newgroup',
|
path: 'newgroup',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const NewGroup(),
|
const NewGroup(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -150,6 +159,7 @@ abstract class AppRoutes {
|
||||||
path: 'newspace',
|
path: 'newspace',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const NewSpace(),
|
const NewSpace(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -157,6 +167,7 @@ abstract class AppRoutes {
|
||||||
ShellRoute(
|
ShellRoute(
|
||||||
pageBuilder: (context, state, child) => defaultPageBuilder(
|
pageBuilder: (context, state, child) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
FluffyThemes.isColumnMode(context)
|
FluffyThemes.isColumnMode(context)
|
||||||
? TwoColumnLayout(
|
? TwoColumnLayout(
|
||||||
mainView: const Settings(),
|
mainView: const Settings(),
|
||||||
|
|
@ -170,6 +181,7 @@ abstract class AppRoutes {
|
||||||
path: 'settings',
|
path: 'settings',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
FluffyThemes.isColumnMode(context)
|
FluffyThemes.isColumnMode(context)
|
||||||
? const EmptyPage()
|
? const EmptyPage()
|
||||||
: const Settings(),
|
: const Settings(),
|
||||||
|
|
@ -179,6 +191,7 @@ abstract class AppRoutes {
|
||||||
path: 'notifications',
|
path: 'notifications',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const SettingsNotifications(),
|
const SettingsNotifications(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -187,6 +200,7 @@ abstract class AppRoutes {
|
||||||
path: 'style',
|
path: 'style',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const SettingsStyle(),
|
const SettingsStyle(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -195,6 +209,7 @@ abstract class AppRoutes {
|
||||||
path: 'devices',
|
path: 'devices',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const DevicesSettings(),
|
const DevicesSettings(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -203,6 +218,7 @@ abstract class AppRoutes {
|
||||||
path: 'chat',
|
path: 'chat',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const SettingsChat(),
|
const SettingsChat(),
|
||||||
),
|
),
|
||||||
routes: [
|
routes: [
|
||||||
|
|
@ -210,6 +226,7 @@ abstract class AppRoutes {
|
||||||
path: 'emotes',
|
path: 'emotes',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const EmotesSettings(),
|
const EmotesSettings(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -221,6 +238,7 @@ abstract class AppRoutes {
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const HomeserverPicker(),
|
const HomeserverPicker(),
|
||||||
),
|
),
|
||||||
routes: [
|
routes: [
|
||||||
|
|
@ -228,6 +246,7 @@ abstract class AppRoutes {
|
||||||
path: 'login',
|
path: 'login',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const Login(),
|
const Login(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -239,6 +258,7 @@ abstract class AppRoutes {
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const SettingsSecurity(),
|
const SettingsSecurity(),
|
||||||
),
|
),
|
||||||
routes: [
|
routes: [
|
||||||
|
|
@ -247,6 +267,7 @@ abstract class AppRoutes {
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return defaultPageBuilder(
|
return defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const SettingsPassword(),
|
const SettingsPassword(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -257,6 +278,7 @@ abstract class AppRoutes {
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
return defaultPageBuilder(
|
return defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
SettingsIgnoreList(
|
SettingsIgnoreList(
|
||||||
initialUserId: state.extra?.toString(),
|
initialUserId: state.extra?.toString(),
|
||||||
),
|
),
|
||||||
|
|
@ -268,6 +290,7 @@ abstract class AppRoutes {
|
||||||
path: '3pid',
|
path: '3pid',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const Settings3Pid(),
|
const Settings3Pid(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -283,6 +306,7 @@ abstract class AppRoutes {
|
||||||
path: ':roomid',
|
path: ':roomid',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
ChatPage(
|
ChatPage(
|
||||||
roomId: state.pathParameters['roomid']!,
|
roomId: state.pathParameters['roomid']!,
|
||||||
shareText: state.uri.queryParameters['body'],
|
shareText: state.uri.queryParameters['body'],
|
||||||
|
|
@ -294,6 +318,7 @@ abstract class AppRoutes {
|
||||||
path: 'encryption',
|
path: 'encryption',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const ChatEncryptionSettings(),
|
const ChatEncryptionSettings(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -302,6 +327,7 @@ abstract class AppRoutes {
|
||||||
path: 'invite',
|
path: 'invite',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
InvitationSelection(
|
InvitationSelection(
|
||||||
roomId: state.pathParameters['roomid']!,
|
roomId: state.pathParameters['roomid']!,
|
||||||
),
|
),
|
||||||
|
|
@ -312,6 +338,7 @@ abstract class AppRoutes {
|
||||||
path: 'details',
|
path: 'details',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
ChatDetails(
|
ChatDetails(
|
||||||
roomId: state.pathParameters['roomid']!,
|
roomId: state.pathParameters['roomid']!,
|
||||||
),
|
),
|
||||||
|
|
@ -321,6 +348,7 @@ abstract class AppRoutes {
|
||||||
path: 'members',
|
path: 'members',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
ChatMembersPage(
|
ChatMembersPage(
|
||||||
roomId: state.pathParameters['roomid']!,
|
roomId: state.pathParameters['roomid']!,
|
||||||
),
|
),
|
||||||
|
|
@ -331,6 +359,7 @@ abstract class AppRoutes {
|
||||||
path: 'permissions',
|
path: 'permissions',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const ChatPermissionsSettings(),
|
const ChatPermissionsSettings(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -339,6 +368,7 @@ abstract class AppRoutes {
|
||||||
path: 'invite',
|
path: 'invite',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
InvitationSelection(
|
InvitationSelection(
|
||||||
roomId: state.pathParameters['roomid']!,
|
roomId: state.pathParameters['roomid']!,
|
||||||
),
|
),
|
||||||
|
|
@ -349,6 +379,7 @@ abstract class AppRoutes {
|
||||||
path: 'multiple_emotes',
|
path: 'multiple_emotes',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const MultipleEmotesSettings(),
|
const MultipleEmotesSettings(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -357,6 +388,7 @@ abstract class AppRoutes {
|
||||||
path: 'emotes',
|
path: 'emotes',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const EmotesSettings(),
|
const EmotesSettings(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -365,6 +397,7 @@ abstract class AppRoutes {
|
||||||
path: 'emotes/:state_key',
|
path: 'emotes/:state_key',
|
||||||
pageBuilder: (context, state) => defaultPageBuilder(
|
pageBuilder: (context, state) => defaultPageBuilder(
|
||||||
context,
|
context,
|
||||||
|
state,
|
||||||
const EmotesSettings(),
|
const EmotesSettings(),
|
||||||
),
|
),
|
||||||
redirect: loggedOutRedirect,
|
redirect: loggedOutRedirect,
|
||||||
|
|
@ -380,13 +413,23 @@ abstract class AppRoutes {
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
static Page defaultPageBuilder(BuildContext context, Widget child) =>
|
static Page defaultPageBuilder(
|
||||||
|
BuildContext context,
|
||||||
|
GoRouterState state,
|
||||||
|
Widget child,
|
||||||
|
) =>
|
||||||
FluffyThemes.isColumnMode(context)
|
FluffyThemes.isColumnMode(context)
|
||||||
? CustomTransitionPage(
|
? CustomTransitionPage(
|
||||||
|
key: state.pageKey,
|
||||||
|
restorationId: state.pageKey.value,
|
||||||
child: child,
|
child: child,
|
||||||
transitionsBuilder:
|
transitionsBuilder:
|
||||||
(context, animation, secondaryAnimation, child) =>
|
(context, animation, secondaryAnimation, child) =>
|
||||||
FadeTransition(opacity: animation, child: child),
|
FadeTransition(opacity: animation, child: child),
|
||||||
)
|
)
|
||||||
: MaterialPage(child: child);
|
: MaterialPage(
|
||||||
|
key: state.pageKey,
|
||||||
|
restorationId: state.pageKey.value,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue