|
|
@ -5,6 +5,7 @@ import 'package:fluffychat/pages/settings_emotes.dart';
|
|
|
|
import 'package:fluffychat/pages/settings_multiple_emotes.dart';
|
|
|
|
import 'package:fluffychat/pages/settings_multiple_emotes.dart';
|
|
|
|
import 'package:fluffychat/pages/sign_up.dart';
|
|
|
|
import 'package:fluffychat/pages/sign_up.dart';
|
|
|
|
import 'package:fluffychat/pages/sign_up_password.dart';
|
|
|
|
import 'package:fluffychat/pages/sign_up_password.dart';
|
|
|
|
|
|
|
|
import 'package:fluffychat/widgets/layouts/side_view_layout.dart';
|
|
|
|
import 'package:fluffychat/widgets/layouts/two_column_layout.dart';
|
|
|
|
import 'package:fluffychat/widgets/layouts/two_column_layout.dart';
|
|
|
|
import 'package:fluffychat/pages/chat.dart';
|
|
|
|
import 'package:fluffychat/pages/chat.dart';
|
|
|
|
import 'package:fluffychat/pages/chat_details.dart';
|
|
|
|
import 'package:fluffychat/pages/chat_details.dart';
|
|
|
@ -28,36 +29,61 @@ import 'package:flutter/material.dart';
|
|
|
|
import 'package:vrouter/vrouter.dart';
|
|
|
|
import 'package:vrouter/vrouter.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class AppRoutes {
|
|
|
|
class AppRoutes {
|
|
|
|
final int columns;
|
|
|
|
final bool columnMode;
|
|
|
|
|
|
|
|
|
|
|
|
AppRoutes(this.columns);
|
|
|
|
AppRoutes(this.columnMode);
|
|
|
|
|
|
|
|
|
|
|
|
List<VRouteElement> get routes => [
|
|
|
|
List<VRouteElement> get routes => [
|
|
|
|
VWidget(path: '/', widget: LoadingView()),
|
|
|
|
..._homeRoutes,
|
|
|
|
|
|
|
|
if (columnMode) ..._tabletRoutes,
|
|
|
|
|
|
|
|
if (!columnMode) ..._mobileRoutes,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<VRouteElement> get _mobileRoutes => [
|
|
|
|
VWidget(
|
|
|
|
VWidget(
|
|
|
|
path: '/home',
|
|
|
|
path: '/rooms',
|
|
|
|
widget: HomeserverPicker(),
|
|
|
|
widget: ChatList(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
|
|
|
|
stackedRoutes: [
|
|
|
|
stackedRoutes: [
|
|
|
|
|
|
|
|
VWidget(path: ':roomid', widget: Chat(), stackedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
VWidget(
|
|
|
|
path: '/signup',
|
|
|
|
path: 'encryption',
|
|
|
|
widget: SignUp(),
|
|
|
|
widget: ChatEncryptionSettings(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
stackedRoutes: [
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
VWidget(
|
|
|
|
path: 'password/:username',
|
|
|
|
path: 'invite',
|
|
|
|
widget: SignUpPassword(),
|
|
|
|
widget: InvitationSelection(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
VWidget(
|
|
|
|
path: '/login',
|
|
|
|
path: 'details',
|
|
|
|
widget: Login(),
|
|
|
|
widget: ChatDetails(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
stackedRoutes: _chatDetailsRoutes,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/settings',
|
|
|
|
|
|
|
|
widget: Settings(),
|
|
|
|
|
|
|
|
stackedRoutes: _settingsRoutes,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/search',
|
|
|
|
|
|
|
|
widget: Search(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/archive',
|
|
|
|
|
|
|
|
widget: Archive(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/newprivatechat',
|
|
|
|
|
|
|
|
widget: NewPrivateChat(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/newgroup',
|
|
|
|
|
|
|
|
widget: NewGroup(),
|
|
|
|
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (columns > 1) ...{
|
|
|
|
];
|
|
|
|
|
|
|
|
List<VRouteElement> get _tabletRoutes => [
|
|
|
|
VNester(
|
|
|
|
VNester(
|
|
|
|
path: '/rooms',
|
|
|
|
path: '/rooms',
|
|
|
|
widgetBuilder: (child) => TwoColumnLayout(
|
|
|
|
widgetBuilder: (child) => TwoColumnLayout(
|
|
|
@ -81,33 +107,12 @@ class AppRoutes {
|
|
|
|
widget: NewGroup(),
|
|
|
|
widget: NewGroup(),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
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(
|
|
|
|
VNester(
|
|
|
|
path: ':roomid',
|
|
|
|
path: ':roomid',
|
|
|
|
widgetBuilder: (child) => Chat(sideView: child),
|
|
|
|
widgetBuilder: (child) => SideViewLayout(
|
|
|
|
|
|
|
|
mainView: Chat(),
|
|
|
|
|
|
|
|
sideView: child,
|
|
|
|
|
|
|
|
),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
nestedRoutes: [
|
|
|
|
nestedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
VWidget(
|
|
|
@ -179,48 +184,31 @@ class AppRoutes {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
if (columns == 1)
|
|
|
|
|
|
|
|
|
|
|
|
List<VRouteElement> get _homeRoutes => [
|
|
|
|
|
|
|
|
VWidget(path: '/', widget: LoadingView()),
|
|
|
|
VWidget(
|
|
|
|
VWidget(
|
|
|
|
path: '/rooms',
|
|
|
|
path: '/home',
|
|
|
|
widget: ChatList(),
|
|
|
|
widget: HomeserverPicker(),
|
|
|
|
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
stackedRoutes: [
|
|
|
|
stackedRoutes: [
|
|
|
|
VWidget(path: ':roomid', widget: Chat(), stackedRoutes: [
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
VWidget(
|
|
|
|
path: 'encryption',
|
|
|
|
path: '/signup',
|
|
|
|
widget: ChatEncryptionSettings(),
|
|
|
|
widget: SignUp(),
|
|
|
|
),
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
|
|
|
|
stackedRoutes: [
|
|
|
|
VWidget(
|
|
|
|
VWidget(
|
|
|
|
path: 'invite',
|
|
|
|
path: 'password/:username',
|
|
|
|
widget: InvitationSelection(),
|
|
|
|
widget: SignUpPassword(),
|
|
|
|
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VWidget(
|
|
|
|
VWidget(
|
|
|
|
path: 'details',
|
|
|
|
path: '/login',
|
|
|
|
widget: ChatDetails(),
|
|
|
|
widget: Login(),
|
|
|
|
stackedRoutes: _chatDetailsRoutes,
|
|
|
|
buildTransition: _fadeTransition,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/settings',
|
|
|
|
|
|
|
|
widget: Settings(),
|
|
|
|
|
|
|
|
stackedRoutes: _settingsRoutes,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/search',
|
|
|
|
|
|
|
|
widget: Search(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/archive',
|
|
|
|
|
|
|
|
widget: Archive(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/newprivatechat',
|
|
|
|
|
|
|
|
widget: NewPrivateChat(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
VWidget(
|
|
|
|
|
|
|
|
path: '/newgroup',
|
|
|
|
|
|
|
|
widget: NewGroup(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
];
|
|
|
@ -285,5 +273,5 @@ class AppRoutes {
|
|
|
|
FadeTransition(opacity: animation1, child: child);
|
|
|
|
FadeTransition(opacity: animation1, child: child);
|
|
|
|
|
|
|
|
|
|
|
|
FadeTransition Function(dynamic, dynamic, dynamic) get _dynamicTransition =>
|
|
|
|
FadeTransition Function(dynamic, dynamic, dynamic) get _dynamicTransition =>
|
|
|
|
columns > 1 ? _fadeTransition : null;
|
|
|
|
columnMode ? _fadeTransition : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|