2021-05-22 08:57:49 +02:00
|
|
|
import 'package:fluffychat/pages/archive.dart';
|
|
|
|
import 'package:fluffychat/pages/homeserver_picker.dart';
|
|
|
|
import 'package:fluffychat/pages/invitation_selection.dart';
|
|
|
|
import 'package:fluffychat/pages/settings_emotes.dart';
|
|
|
|
import 'package:fluffychat/pages/settings_multiple_emotes.dart';
|
|
|
|
import 'package:fluffychat/pages/sign_up.dart';
|
|
|
|
import 'package:fluffychat/pages/sign_up_password.dart';
|
2021-05-23 13:11:55 +02:00
|
|
|
import 'package:fluffychat/widgets/layouts/two_column_layout.dart';
|
2021-05-22 08:57:49 +02:00
|
|
|
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';
|
2021-05-22 09:08:23 +02:00
|
|
|
import 'package:fluffychat/pages/views/empty_page_view.dart';
|
2021-05-22 08:53:52 +02:00
|
|
|
import 'package:fluffychat/widgets/layouts/loading_view.dart';
|
|
|
|
import 'package:fluffychat/widgets/log_view.dart';
|
2021-05-22 09:08:23 +02:00
|
|
|
import 'package:fluffychat/pages/login.dart';
|
2021-05-22 08:57:49 +02:00
|
|
|
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';
|
2021-01-16 12:46:38 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2021-05-23 13:11:55 +02:00
|
|
|
import 'package:vrouter/vrouter.dart';
|
2021-01-16 12:46:38 +01:00
|
|
|
|
2021-05-23 13:11:55 +02:00
|
|
|
class AppRoutes {
|
|
|
|
final int columns;
|
2021-01-16 12:46:38 +01:00
|
|
|
|
2021-05-23 13:11:55 +02:00
|
|
|
AppRoutes(this.columns);
|
2021-01-16 12:46:38 +01:00
|
|
|
|
2021-05-23 13:11:55 +02:00
|
|
|
List<VRouteElement> get routes => [
|
|
|
|
VWidget(path: '/', widget: LoadingView()),
|
|
|
|
VWidget(
|
|
|
|
path: '/home',
|
|
|
|
widget: HomeserverPicker(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
stackedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
path: '/signup',
|
|
|
|
widget: SignUp(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
stackedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
path: 'password/:username',
|
|
|
|
widget: SignUpPassword(),
|
|
|
|
buildTransition: _fadeTransition,
|
2021-02-01 16:25:28 +01:00
|
|
|
),
|
2021-05-23 13:11:55 +02:00
|
|
|
VWidget(
|
|
|
|
path: '/login',
|
|
|
|
widget: Login(),
|
|
|
|
buildTransition: _fadeTransition,
|
2021-02-02 09:00:06 +01:00
|
|
|
),
|
2021-05-23 13:11:55 +02:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
if (columns > 1) ...{
|
|
|
|
VNester(
|
|
|
|
path: '/rooms',
|
|
|
|
widgetBuilder: (child) => TwoColumnLayout(
|
|
|
|
mainView: ChatList(),
|
|
|
|
sideView: child,
|
|
|
|
),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
nestedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
path: '',
|
|
|
|
widget: EmptyPage(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
stackedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
path: '/newprivatechat',
|
|
|
|
widget: NewPrivateChat(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: '/newgroup',
|
|
|
|
widget: NewGroup(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
if (columns == 2)
|
|
|
|
VWidget(
|
|
|
|
path: ':roomid',
|
|
|
|
widget: Chat(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
stackedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
path: 'encryption',
|
|
|
|
widget: ChatEncryptionSettings(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'details',
|
|
|
|
widget: ChatDetails(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
stackedRoutes: _chatDetailsRoutes,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'invite',
|
|
|
|
widget: InvitationSelection(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
if (columns > 2)
|
|
|
|
VNester(
|
|
|
|
path: ':roomid',
|
|
|
|
widgetBuilder: (child) => Chat(sideView: child),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
nestedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
path: '',
|
|
|
|
widget: EmptyPage(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'encryption',
|
|
|
|
widget: ChatEncryptionSettings(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'details',
|
|
|
|
widget: ChatDetails(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
stackedRoutes: _chatDetailsRoutes,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'invite',
|
|
|
|
widget: InvitationSelection(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: '/rooms',
|
|
|
|
widget: TwoColumnLayout(
|
|
|
|
mainView: ChatList(),
|
|
|
|
sideView: EmptyPage(),
|
|
|
|
),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
stackedRoutes: [
|
|
|
|
_settingsRoute,
|
|
|
|
VWidget(
|
|
|
|
path: '/search',
|
|
|
|
widget: TwoColumnLayout(
|
|
|
|
mainView: Search(),
|
|
|
|
sideView: EmptyPage(),
|
|
|
|
),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: '/archive',
|
|
|
|
widget: TwoColumnLayout(
|
|
|
|
mainView: Archive(),
|
|
|
|
sideView: EmptyPage(),
|
|
|
|
),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
},
|
|
|
|
if (columns == 1)
|
|
|
|
VWidget(
|
|
|
|
path: '/rooms',
|
|
|
|
widget: ChatList(),
|
|
|
|
stackedRoutes: [
|
|
|
|
VWidget(path: ':roomid', widget: Chat(), stackedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
path: 'encryption',
|
|
|
|
widget: ChatEncryptionSettings(),
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'invite',
|
|
|
|
widget: InvitationSelection(),
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'details',
|
|
|
|
widget: ChatDetails(),
|
|
|
|
stackedRoutes: _chatDetailsRoutes,
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
_settingsRoute,
|
|
|
|
VWidget(
|
|
|
|
path: '/search',
|
|
|
|
widget: Search(),
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: '/archive',
|
|
|
|
widget: Archive(),
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: '/newprivatechat',
|
|
|
|
widget: NewPrivateChat(),
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: '/newgroup',
|
|
|
|
widget: NewGroup(),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
];
|
2021-01-16 12:46:38 +01:00
|
|
|
|
2021-05-23 13:11:55 +02:00
|
|
|
List<VRouteElement> get _chatDetailsRoutes => [
|
|
|
|
VWidget(
|
|
|
|
path: 'permissions',
|
|
|
|
widget: ChatPermissionsSettings(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'invite',
|
|
|
|
widget: InvitationSelection(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'emotes',
|
|
|
|
widget: MultipleEmotesSettings(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
];
|
2021-01-16 12:46:38 +01:00
|
|
|
|
2021-05-23 13:11:55 +02:00
|
|
|
VNester get _settingsRoute => VNester(
|
|
|
|
path: '/settings',
|
|
|
|
widgetBuilder: (child) => TwoColumnLayout(
|
|
|
|
mainView: Settings(),
|
|
|
|
sideView: child,
|
|
|
|
),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
nestedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
path: '',
|
|
|
|
widget: EmptyPage(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
stackedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
path: 'emotes',
|
|
|
|
widget: EmotesSettings(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'notifications',
|
|
|
|
widget: SettingsNotifications(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'ignorelist',
|
|
|
|
widget: SettingsIgnoreList(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'style',
|
|
|
|
widget: SettingsStyle(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: 'devices',
|
|
|
|
widget: DevicesSettings(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: '/logs',
|
|
|
|
widget: LogViewer(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
path: '3pid',
|
|
|
|
widget: Settings3Pid(),
|
|
|
|
buildTransition: _dynamicTransition,
|
|
|
|
),
|
|
|
|
],
|
2021-01-16 12:46:38 +01:00
|
|
|
),
|
2021-05-23 13:11:55 +02:00
|
|
|
],
|
|
|
|
);
|
|
|
|
|
|
|
|
final _fadeTransition = (animation1, _, child) =>
|
|
|
|
FadeTransition(opacity: animation1, child: child);
|
|
|
|
|
|
|
|
FadeTransition Function(dynamic, dynamic, dynamic) get _dynamicTransition =>
|
|
|
|
columns > 1 ? _fadeTransition : null;
|
2021-01-16 12:46:38 +01:00
|
|
|
}
|