mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-09 13:39:30 +01:00
348 lines
11 KiB
Dart
348 lines
11 KiB
Dart
import 'package:fluffychat/pages/archive.dart';
|
|
import 'package:fluffychat/pages/homeserver_picker.dart';
|
|
import 'package:fluffychat/pages/invitation_selection.dart';
|
|
import 'package:fluffychat/pages/new_space.dart';
|
|
import 'package:fluffychat/pages/settings_account.dart';
|
|
import 'package:fluffychat/pages/settings_chat.dart';
|
|
import 'package:fluffychat/pages/settings_emotes.dart';
|
|
import 'package:fluffychat/pages/settings_multiple_emotes.dart';
|
|
import 'package:fluffychat/pages/settings_security.dart';
|
|
import 'package:fluffychat/pages/signup.dart';
|
|
import 'package:fluffychat/widgets/layouts/side_view_layout.dart';
|
|
import 'package:fluffychat/widgets/layouts/two_column_layout.dart';
|
|
import 'package:fluffychat/pages/chat.dart';
|
|
import 'package:fluffychat/pages/chat_details.dart';
|
|
import 'package:fluffychat/pages/chat_encryption_settings.dart';
|
|
import 'package:fluffychat/pages/chat_list.dart';
|
|
import 'package:fluffychat/pages/chat_permissions_settings.dart';
|
|
import 'package:fluffychat/pages/views/empty_page_view.dart';
|
|
import 'package:fluffychat/widgets/layouts/loading_view.dart';
|
|
import 'package:fluffychat/widgets/log_view.dart';
|
|
import 'package:fluffychat/pages/login.dart';
|
|
import 'package:fluffychat/pages/new_group.dart';
|
|
import 'package:fluffychat/pages/new_private_chat.dart';
|
|
import 'package:fluffychat/pages/search.dart';
|
|
import 'package:fluffychat/pages/settings.dart';
|
|
import 'package:fluffychat/pages/settings_3pid.dart';
|
|
import 'package:fluffychat/pages/device_settings.dart';
|
|
import 'package:fluffychat/pages/settings_ignore_list.dart';
|
|
import 'package:fluffychat/pages/settings_notifications.dart';
|
|
import 'package:fluffychat/pages/settings_style.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:vrouter/vrouter.dart';
|
|
|
|
class AppRoutes {
|
|
final bool columnMode;
|
|
|
|
AppRoutes(this.columnMode);
|
|
|
|
List<VRouteElement> get routes => [
|
|
..._homeRoutes,
|
|
if (columnMode) ..._tabletRoutes,
|
|
if (!columnMode) ..._mobileRoutes,
|
|
];
|
|
|
|
List<VRouteElement> get _mobileRoutes => [
|
|
VWidget(
|
|
path: '/rooms',
|
|
widget: const ChatList(),
|
|
stackedRoutes: [
|
|
VWidget(
|
|
path: '/spaces/:roomid',
|
|
widget: const ChatDetails(),
|
|
stackedRoutes: _chatDetailsRoutes,
|
|
),
|
|
VWidget(path: ':roomid', widget: const Chat(), stackedRoutes: [
|
|
VWidget(
|
|
path: 'encryption',
|
|
widget: const ChatEncryptionSettings(),
|
|
),
|
|
VWidget(
|
|
path: 'invite',
|
|
widget: const InvitationSelection(),
|
|
),
|
|
VWidget(
|
|
path: 'details',
|
|
widget: const ChatDetails(),
|
|
stackedRoutes: _chatDetailsRoutes,
|
|
),
|
|
]),
|
|
VWidget(
|
|
path: '/settings',
|
|
widget: const Settings(),
|
|
stackedRoutes: _settingsRoutes,
|
|
),
|
|
VWidget(
|
|
path: '/search',
|
|
widget: const Search(),
|
|
),
|
|
VWidget(
|
|
path: '/archive',
|
|
widget: const Archive(),
|
|
),
|
|
VWidget(
|
|
path: '/newprivatechat',
|
|
widget: const NewPrivateChat(),
|
|
),
|
|
VWidget(
|
|
path: '/newgroup',
|
|
widget: const NewGroup(),
|
|
),
|
|
VWidget(
|
|
path: '/newspace',
|
|
widget: const NewSpace(),
|
|
),
|
|
],
|
|
),
|
|
];
|
|
List<VRouteElement> get _tabletRoutes => [
|
|
VNester(
|
|
path: '/rooms',
|
|
widgetBuilder: (child) => TwoColumnLayout(
|
|
mainView: const ChatList(),
|
|
sideView: child,
|
|
),
|
|
buildTransition: _fadeTransition,
|
|
nestedRoutes: [
|
|
VWidget(
|
|
path: '',
|
|
widget: const EmptyPage(),
|
|
buildTransition: _fadeTransition,
|
|
stackedRoutes: [
|
|
VWidget(
|
|
path: '/spaces/:roomid',
|
|
widget: const ChatDetails(),
|
|
buildTransition: _fadeTransition,
|
|
stackedRoutes: _chatDetailsRoutes,
|
|
),
|
|
VWidget(
|
|
path: '/newprivatechat',
|
|
widget: const NewPrivateChat(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
VWidget(
|
|
path: '/newgroup',
|
|
widget: const NewGroup(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
VWidget(
|
|
path: '/newspace',
|
|
widget: const NewSpace(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
VNester(
|
|
path: ':roomid',
|
|
widgetBuilder: (child) => SideViewLayout(
|
|
mainView: const Chat(),
|
|
sideView: child,
|
|
),
|
|
buildTransition: _fadeTransition,
|
|
nestedRoutes: [
|
|
VWidget(
|
|
path: '',
|
|
widget: const Chat(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
VWidget(
|
|
path: 'encryption',
|
|
widget: const ChatEncryptionSettings(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
VWidget(
|
|
path: 'details',
|
|
widget: const ChatDetails(),
|
|
buildTransition: _fadeTransition,
|
|
stackedRoutes: _chatDetailsRoutes,
|
|
),
|
|
VWidget(
|
|
path: 'invite',
|
|
widget: const InvitationSelection(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
VWidget(
|
|
path: '/rooms',
|
|
widget: const TwoColumnLayout(
|
|
mainView: ChatList(),
|
|
sideView: EmptyPage(),
|
|
),
|
|
buildTransition: _fadeTransition,
|
|
stackedRoutes: [
|
|
VNester(
|
|
path: '/settings',
|
|
widgetBuilder: (child) => TwoColumnLayout(
|
|
mainView: const Settings(),
|
|
sideView: child,
|
|
),
|
|
buildTransition: _dynamicTransition,
|
|
nestedRoutes: [
|
|
VWidget(
|
|
path: '',
|
|
widget: const EmptyPage(),
|
|
buildTransition: _dynamicTransition,
|
|
stackedRoutes: _settingsRoutes,
|
|
),
|
|
],
|
|
),
|
|
VWidget(
|
|
path: '/search',
|
|
widget: const TwoColumnLayout(
|
|
mainView: Search(),
|
|
sideView: EmptyPage(),
|
|
),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
VWidget(
|
|
path: '/archive',
|
|
widget: const TwoColumnLayout(
|
|
mainView: Archive(),
|
|
sideView: EmptyPage(),
|
|
),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
],
|
|
),
|
|
];
|
|
|
|
List<VRouteElement> get _homeRoutes => [
|
|
VWidget(path: '/', widget: const LoadingView()),
|
|
VWidget(
|
|
path: '/home',
|
|
widget: const HomeserverPicker(),
|
|
buildTransition: _fadeTransition,
|
|
stackedRoutes: [
|
|
VWidget(
|
|
path: 'login',
|
|
widget: const Login(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
VWidget(
|
|
path: 'signup',
|
|
widget: const SignupPage(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
VWidget(
|
|
path: 'logs',
|
|
widget: const LogViewer(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
],
|
|
),
|
|
];
|
|
|
|
List<VRouteElement> get _chatDetailsRoutes => [
|
|
VWidget(
|
|
path: 'permissions',
|
|
widget: const ChatPermissionsSettings(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
VWidget(
|
|
path: 'invite',
|
|
widget: const InvitationSelection(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
VWidget(
|
|
path: 'multiple_emotes',
|
|
widget: const MultipleEmotesSettings(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
VWidget(
|
|
path: 'emotes',
|
|
widget: const EmotesSettings(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
VWidget(
|
|
path: 'emotes/:state_key',
|
|
widget: const EmotesSettings(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
];
|
|
|
|
List<VRouteElement> get _settingsRoutes => [
|
|
VWidget(
|
|
path: 'notifications',
|
|
widget: const SettingsNotifications(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
VWidget(
|
|
path: 'chat',
|
|
widget: const SettingsChat(),
|
|
buildTransition: _dynamicTransition,
|
|
stackedRoutes: [
|
|
VWidget(
|
|
path: 'emotes',
|
|
widget: const EmotesSettings(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
VWidget(
|
|
path: 'style',
|
|
widget: const SettingsStyle(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
],
|
|
),
|
|
VWidget(
|
|
path: 'account',
|
|
widget: const SettingsAccount(),
|
|
buildTransition: _dynamicTransition,
|
|
stackedRoutes: [
|
|
VWidget(
|
|
path: 'devices',
|
|
widget: const DevicesSettings(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
VWidget(
|
|
path: 'add',
|
|
widget: const HomeserverPicker(),
|
|
buildTransition: _fadeTransition,
|
|
stackedRoutes: [
|
|
VWidget(
|
|
path: 'login',
|
|
widget: const Login(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
VWidget(
|
|
path: 'signup',
|
|
widget: const SignupPage(),
|
|
buildTransition: _fadeTransition,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
VWidget(
|
|
path: 'security',
|
|
widget: const SettingsSecurity(),
|
|
buildTransition: _dynamicTransition,
|
|
stackedRoutes: [
|
|
VWidget(
|
|
path: 'ignorelist',
|
|
widget: const SettingsIgnoreList(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
VWidget(
|
|
path: '3pid',
|
|
widget: const Settings3Pid(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
],
|
|
),
|
|
VWidget(
|
|
path: 'logs',
|
|
widget: const LogViewer(),
|
|
buildTransition: _dynamicTransition,
|
|
),
|
|
];
|
|
|
|
FadeTransition Function(dynamic, dynamic, dynamic) get _dynamicTransition =>
|
|
columnMode ? _fadeTransition : null;
|
|
|
|
FadeTransition _fadeTransition(animation1, _, child) =>
|
|
FadeTransition(opacity: animation1, child: child);
|
|
}
|