refactor: Migrate routes to go router
This commit is contained in:
parent
739edde729
commit
ee957ab1f6
52 changed files with 584 additions and 612 deletions
|
|
@ -207,7 +207,7 @@ class AddStoryController extends State<AddStoryPage> {
|
|||
},
|
||||
);
|
||||
if (postResult.error == null) {
|
||||
VRouter.of(context).pop();
|
||||
context.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,14 +38,17 @@ import 'sticker_picker_dialog.dart';
|
|||
|
||||
class ChatPage extends StatelessWidget {
|
||||
final Widget? sideView;
|
||||
final String roomId;
|
||||
|
||||
const ChatPage({Key? key, this.sideView}) : super(key: key);
|
||||
const ChatPage({
|
||||
Key? key,
|
||||
this.sideView,
|
||||
required this.roomId,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final roomId = context.vRouter.pathParameters['roomid'];
|
||||
final room =
|
||||
roomId == null ? null : Matrix.of(context).client.getRoomById(roomId);
|
||||
final room = Matrix.of(context).client.getRoomById(roomId);
|
||||
if (room == null) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(L10n.of(context)!.oopsSomethingWentWrong)),
|
||||
|
|
@ -58,7 +61,11 @@ class ChatPage extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
return ChatPageWithRoom(sideView: sideView, room: room);
|
||||
return ChatPageWithRoom(
|
||||
key: Key('chat_page_$roomId'),
|
||||
sideView: sideView,
|
||||
room: room,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +195,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
);
|
||||
final roomId = success.result;
|
||||
if (roomId == null) return;
|
||||
VRouter.of(context).toSegments(['rooms', roomId]);
|
||||
context.go(['', 'rooms', roomId].join('/'));
|
||||
}
|
||||
|
||||
void leaveChat() async {
|
||||
|
|
@ -197,7 +204,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
future: room.leave,
|
||||
);
|
||||
if (success.error != null) return;
|
||||
VRouter.of(context).to('/rooms');
|
||||
context.go('/rooms');
|
||||
}
|
||||
|
||||
EmojiPickerType emojiPickerType = EmojiPickerType.keyboard;
|
||||
|
|
@ -329,7 +336,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
// "load more" button is visible on the screen
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
||||
if (mounted) {
|
||||
final event = VRouter.of(context).queryParameters['event'];
|
||||
final event = GoRouterState.of(context).uri.queryParameters['event'];
|
||||
if (event != null) {
|
||||
scrollToEventId(event);
|
||||
}
|
||||
|
|
@ -803,7 +810,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
};
|
||||
}
|
||||
setState(() => selectedEvents.clear());
|
||||
VRouter.of(context).to('/rooms');
|
||||
context.go('/rooms');
|
||||
}
|
||||
|
||||
void sendAgainAction() {
|
||||
|
|
@ -901,7 +908,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
future: room.forget,
|
||||
);
|
||||
if (result.error != null) return;
|
||||
VRouter.of(context).to('/archive');
|
||||
context.go('/rooms/archive');
|
||||
}
|
||||
|
||||
void typeEmoji(Emoji? emoji) {
|
||||
|
|
@ -1017,7 +1024,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
future: room.leave,
|
||||
);
|
||||
if (result.error == null) {
|
||||
VRouter.of(context).toSegments(['rooms', result.result!]);
|
||||
context.go(['', 'rooms', result.result!].join('/'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ class ChatAppBarTitle extends StatelessWidget {
|
|||
)
|
||||
: controller.isArchived
|
||||
? null
|
||||
: () =>
|
||||
VRouter.of(context).toSegments(['rooms', room.id, 'details']),
|
||||
: () => context.go(['', 'rooms', room.id, 'details'].join('/')),
|
||||
child: Row(
|
||||
children: [
|
||||
Hero(
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import 'package:badges/badges.dart';
|
|||
import 'package:desktop_drop/desktop_drop.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
|
|
@ -147,15 +146,16 @@ class ChatView extends StatelessWidget {
|
|||
}
|
||||
final bottomSheetPadding = FluffyThemes.isColumnMode(context) ? 16.0 : 8.0;
|
||||
|
||||
return VWidgetGuard(
|
||||
onSystemPop: (redirector) async {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (controller.selectedEvents.isNotEmpty) {
|
||||
controller.clearSelectedEvents();
|
||||
redirector.stopRedirection();
|
||||
return false;
|
||||
} else if (controller.showEmojiPicker) {
|
||||
controller.emojiPickerAction();
|
||||
redirector.stopRedirection();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
child: GestureDetector(
|
||||
onTapDown: (_) => controller.setReadMarker(),
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ class EncryptionButton extends StatelessWidget {
|
|||
? Colors.orange
|
||||
: null,
|
||||
),
|
||||
onPressed: () => VRouter.of(context)
|
||||
.toSegments(['rooms', room.id, 'encryption']),
|
||||
onPressed: () =>
|
||||
context.go(['', 'rooms', room.id, 'encryption'].join('/')),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,7 +19,12 @@ import 'package:fluffychat/widgets/matrix.dart';
|
|||
enum AliasActions { copy, delete, setCanonical }
|
||||
|
||||
class ChatDetails extends StatefulWidget {
|
||||
const ChatDetails({Key? key}) : super(key: key);
|
||||
final String roomId;
|
||||
|
||||
const ChatDetails({
|
||||
Key? key,
|
||||
required this.roomId,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
ChatDetailsController createState() => ChatDetailsController();
|
||||
|
|
@ -32,7 +37,7 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
void toggleDisplaySettings() =>
|
||||
setState(() => displaySettings = !displaySettings);
|
||||
|
||||
String? get roomId => VRouter.of(context).pathParameters['roomid'];
|
||||
String? get roomId => widget.roomId;
|
||||
|
||||
void setDisplaynameAction() async {
|
||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||
|
|
@ -257,9 +262,9 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
if ((room.states['im.ponies.room_emotes'] ?? <String, Event>{})
|
||||
.keys
|
||||
.any((String s) => s.isNotEmpty)) {
|
||||
VRouter.of(context).to('multiple_emotes');
|
||||
context.go('/rooms/${room.id}/details/multiple_emotes');
|
||||
} else {
|
||||
VRouter.of(context).to('emotes');
|
||||
context.go('/rooms/${room.id}/details/emotes');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,11 @@ class ChatDetailsView extends StatelessWidget {
|
|||
leading: IconButton(
|
||||
icon: const Icon(Icons.close_outlined),
|
||||
onPressed: () =>
|
||||
VRouter.of(context).path.startsWith('/spaces/')
|
||||
? VRouter.of(context).pop()
|
||||
: VRouter.of(context)
|
||||
.toSegments(['rooms', controller.roomId!]),
|
||||
GoRouterState.of(context).uri.path.startsWith('/spaces/')
|
||||
? context.pop()
|
||||
: context.go(
|
||||
['', 'rooms', controller.roomId!].join('/'),
|
||||
),
|
||||
),
|
||||
elevation: Theme.of(context).appBarTheme.elevation,
|
||||
expandedHeight: 300.0,
|
||||
|
|
@ -380,8 +381,8 @@ class ChatDetailsView extends StatelessWidget {
|
|||
Icons.edit_attributes_outlined,
|
||||
),
|
||||
),
|
||||
onTap: () =>
|
||||
VRouter.of(context).to('permissions'),
|
||||
onTap: () => context
|
||||
.go('/rooms/${room.id}/details/permissions'),
|
||||
),
|
||||
],
|
||||
const Divider(height: 1),
|
||||
|
|
@ -408,7 +409,8 @@ class ChatDetailsView extends StatelessWidget {
|
|||
radius: Avatar.defaultSize / 2,
|
||||
child: const Icon(Icons.add_outlined),
|
||||
),
|
||||
onTap: () => VRouter.of(context).to('invite'),
|
||||
onTap: () =>
|
||||
context.go('/rooms/${room.id}/invite'),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class ChatEncryptionSettings extends StatefulWidget {
|
|||
}
|
||||
|
||||
class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
|
||||
String? get roomId => VRouter.of(context).pathParameters['roomid'];
|
||||
String? get roomId => GoRouterState.of(context).pathParameters['roomid'];
|
||||
|
||||
Room get room => Matrix.of(context).client.getRoomById(roomId!)!;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
|||
leading: IconButton(
|
||||
icon: const Icon(Icons.close_outlined),
|
||||
onPressed: () =>
|
||||
VRouter.of(context).toSegments(['rooms', controller.roomId!]),
|
||||
context.go(['', 'rooms', controller.roomId!].join('/')),
|
||||
),
|
||||
title: Text(L10n.of(context)!.encryption),
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -56,8 +56,14 @@ enum ActiveFilter {
|
|||
|
||||
class ChatList extends StatefulWidget {
|
||||
static BuildContext? contextForVoip;
|
||||
final bool displayNavigationRail;
|
||||
final String? activeChat;
|
||||
|
||||
const ChatList({Key? key}) : super(key: key);
|
||||
const ChatList({
|
||||
Key? key,
|
||||
this.displayNavigationRail = false,
|
||||
required this.activeChat,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
ChatListController createState() => ChatListController();
|
||||
|
|
@ -259,7 +265,7 @@ class ChatListController extends State<ChatList>
|
|||
|
||||
Stream<Client> get clientStream => _clientStream.stream;
|
||||
|
||||
void addAccountAction() => VRouter.of(context).to('/settings/account');
|
||||
void addAccountAction() => context.go('/rooms/settings/account');
|
||||
|
||||
void _onScroll() {
|
||||
final newScrolledToTop = scrollController.position.pixels <= 0;
|
||||
|
|
@ -271,7 +277,7 @@ class ChatListController extends State<ChatList>
|
|||
void editSpace(BuildContext context, String spaceId) async {
|
||||
await Matrix.of(context).client.getRoomById(spaceId)!.postLoad();
|
||||
if (mounted) {
|
||||
VRouter.of(context).toSegments(['spaces', spaceId]);
|
||||
context.go('/rooms/spaces/$spaceId');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +287,7 @@ class ChatListController extends State<ChatList>
|
|||
|
||||
final selectedRoomIds = <String>{};
|
||||
|
||||
String? get activeChat => VRouter.of(context).pathParameters['roomid'];
|
||||
String? get activeChat => widget.activeChat;
|
||||
|
||||
SelectMode get selectMode => Matrix.of(context).shareContent != null
|
||||
? SelectMode.share
|
||||
|
|
@ -300,7 +306,7 @@ class ChatListController extends State<ChatList>
|
|||
name: file.path,
|
||||
).detectFileType,
|
||||
};
|
||||
VRouter.of(context).to('/rooms');
|
||||
context.go('/rooms');
|
||||
}
|
||||
|
||||
void _processIncomingSharedText(String? text) {
|
||||
|
|
@ -315,12 +321,12 @@ class ChatListController extends State<ChatList>
|
|||
'msgtype': 'm.text',
|
||||
'body': text,
|
||||
};
|
||||
VRouter.of(context).to('/rooms');
|
||||
context.go('/rooms');
|
||||
}
|
||||
|
||||
void _processIncomingUris(String? text) async {
|
||||
if (text == null) return;
|
||||
VRouter.of(context).to('/rooms');
|
||||
context.go('/rooms');
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
UrlLauncher(context, text).openMatrixToUrl();
|
||||
});
|
||||
|
|
@ -582,7 +588,7 @@ class ChatListController extends State<ChatList>
|
|||
}
|
||||
|
||||
void setActiveClient(Client client) {
|
||||
VRouter.of(context).to('/rooms');
|
||||
context.go('/rooms');
|
||||
setState(() {
|
||||
activeFilter = AppConfig.separateChatTypes
|
||||
? ActiveFilter.messages
|
||||
|
|
@ -595,7 +601,7 @@ class ChatListController extends State<ChatList>
|
|||
}
|
||||
|
||||
void setActiveBundle(String bundle) {
|
||||
VRouter.of(context).to('/rooms');
|
||||
context.go('/rooms');
|
||||
setState(() {
|
||||
selectedRoomIds.clear();
|
||||
Matrix.of(context).activeBundle = bundle;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class ChatListItem extends StatelessWidget {
|
|||
}
|
||||
|
||||
if (room.membership == Membership.leave) {
|
||||
VRouter.of(context).toSegments(['archive', room.id]);
|
||||
context.go(['', 'archive', room.id].join('/'));
|
||||
}
|
||||
|
||||
if (room.membership == Membership.join) {
|
||||
|
|
@ -86,7 +86,7 @@ class ChatListItem extends StatelessWidget {
|
|||
Matrix.of(context).shareContent = null;
|
||||
}
|
||||
|
||||
VRouter.of(context).toSegments(['rooms', room.id]);
|
||||
context.go(['', 'rooms', room.id].join('/'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,13 +86,12 @@ class ChatListView extends StatelessWidget {
|
|||
stream: Matrix.of(context).onShareContentChanged.stream,
|
||||
builder: (_, __) {
|
||||
final selectMode = controller.selectMode;
|
||||
return VWidgetGuard(
|
||||
onSystemPop: (redirector) async {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
final selMode = controller.selectMode;
|
||||
if (selMode != SelectMode.normal) {
|
||||
controller.cancelAction();
|
||||
redirector.stopRedirection();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (controller.activeFilter !=
|
||||
(AppConfig.separateChatTypes
|
||||
|
|
@ -100,14 +99,14 @@ class ChatListView extends StatelessWidget {
|
|||
: ActiveFilter.allChats)) {
|
||||
controller
|
||||
.onDestinationSelected(AppConfig.separateChatTypes ? 1 : 0);
|
||||
redirector.stopRedirection();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
if (FluffyThemes.isColumnMode(context) &&
|
||||
FluffyThemes.getDisplayNavigationRail(context)) ...[
|
||||
controller.widget.displayNavigationRail) ...[
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final allSpaces =
|
||||
|
|
@ -193,8 +192,7 @@ class ChatListView extends StatelessWidget {
|
|||
LogicalKeyboardKey.controlLeft,
|
||||
LogicalKeyboardKey.keyN
|
||||
},
|
||||
onKeysPressed: () =>
|
||||
VRouter.of(context).to('/newprivatechat'),
|
||||
onKeysPressed: () => context.go('/rooms/newprivatechat'),
|
||||
helpLabel: L10n.of(context)!.newChat,
|
||||
child: selectMode == SelectMode.normal &&
|
||||
!controller.isSearchMode
|
||||
|
|
|
|||
|
|
@ -261,16 +261,16 @@ class ClientChooserButton extends StatelessWidget {
|
|||
cancelLabel: L10n.of(context)!.cancel,
|
||||
);
|
||||
if (consent != OkCancelResult.ok) return;
|
||||
VRouter.of(context).to('/settings/addaccount');
|
||||
context.go('/rooms/settings/addaccount');
|
||||
break;
|
||||
case SettingsAction.newStory:
|
||||
VRouter.of(context).to('/stories/create');
|
||||
context.go('/rooms/stories/create');
|
||||
break;
|
||||
case SettingsAction.newGroup:
|
||||
VRouter.of(context).to('/newgroup');
|
||||
context.go('/rooms/newgroup');
|
||||
break;
|
||||
case SettingsAction.newSpace:
|
||||
VRouter.of(context).to('/newspace');
|
||||
context.go('/rooms/newspace');
|
||||
break;
|
||||
case SettingsAction.invite:
|
||||
FluffyShare.share(
|
||||
|
|
@ -282,10 +282,10 @@ class ClientChooserButton extends StatelessWidget {
|
|||
);
|
||||
break;
|
||||
case SettingsAction.settings:
|
||||
VRouter.of(context).to('/settings');
|
||||
context.go('/rooms/settings');
|
||||
break;
|
||||
case SettingsAction.archive:
|
||||
VRouter.of(context).to('/archive');
|
||||
context.go('/rooms/archive');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,13 +73,13 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
}
|
||||
if (spaceChild.roomType == 'm.space') {
|
||||
if (spaceChild.roomId == widget.controller.activeSpaceId) {
|
||||
VRouter.of(context).toSegments(['spaces', spaceChild.roomId]);
|
||||
context.go('/rooms/spaces/${spaceChild.roomId}');
|
||||
} else {
|
||||
widget.controller.setActiveSpace(spaceChild.roomId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
VRouter.of(context).toSegments(['rooms', spaceChild.roomId]);
|
||||
context.go(['', 'rooms', spaceChild.roomId].join('/'));
|
||||
}
|
||||
|
||||
void _onSpaceChildContextMenu([
|
||||
|
|
@ -234,13 +234,13 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
);
|
||||
final spaceChildren = response.rooms;
|
||||
final canLoadMore = response.nextBatch != null;
|
||||
return VWidgetGuard(
|
||||
onSystemPop: (redirector) async {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (parentSpace != null) {
|
||||
widget.controller.setActiveSpace(parentSpace.id);
|
||||
redirector.stopRedirection();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
child: CustomScrollView(
|
||||
controller: widget.scrollController,
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ class StartChatFloatingActionButton extends StatelessWidget {
|
|||
switch (activeFilter) {
|
||||
case ActiveFilter.allChats:
|
||||
case ActiveFilter.messages:
|
||||
VRouter.of(context).to('/newprivatechat');
|
||||
context.go('/rooms/newprivatechat');
|
||||
break;
|
||||
case ActiveFilter.groups:
|
||||
VRouter.of(context).to('/newgroup');
|
||||
context.go('/rooms/newgroup');
|
||||
break;
|
||||
case ActiveFilter.spaces:
|
||||
VRouter.of(context).to('/newspace');
|
||||
context.go('/rooms/newspace');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class StoriesHeader extends StatelessWidget {
|
|||
const StoriesHeader({required this.filter, Key? key}) : super(key: key);
|
||||
|
||||
void _addToStoryAction(BuildContext context) =>
|
||||
VRouter.of(context).to('/stories/create');
|
||||
context.go('/rooms/stories/create');
|
||||
|
||||
void _goToStoryAction(BuildContext context, String roomId) async {
|
||||
final room = Matrix.of(context).client.getRoomById(roomId);
|
||||
|
|
@ -35,7 +35,7 @@ class StoriesHeader extends StatelessWidget {
|
|||
);
|
||||
if (result.error != null) return;
|
||||
}
|
||||
VRouter.of(context).toSegments(['stories', roomId]);
|
||||
context.go(['', 'stories', roomId].join('/'));
|
||||
}
|
||||
|
||||
void _contextualActions(BuildContext context, Room room) async {
|
||||
|
|
@ -249,7 +249,7 @@ class _StoryButton extends StatelessWidget {
|
|||
child: FloatingActionButton.small(
|
||||
heroTag: null,
|
||||
onPressed: () =>
|
||||
VRouter.of(context).to('/stories/create'),
|
||||
context.go('/rooms/stories/create'),
|
||||
child: const Icon(
|
||||
Icons.add_outlined,
|
||||
size: 16,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class ChatPermissionsSettings extends StatefulWidget {
|
|||
}
|
||||
|
||||
class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
||||
String? get roomId => VRouter.of(context).pathParameters['roomid'];
|
||||
String? get roomId => GoRouterState.of(context).pathParameters['roomid'];
|
||||
void editPowerLevel(
|
||||
BuildContext context,
|
||||
String key,
|
||||
|
|
@ -105,7 +105,7 @@ class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
|||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room.client.upgradeRoom(roomId!, newVersion),
|
||||
).then((_) => VRouter.of(context).pop());
|
||||
).then((_) => context.pop());
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: VRouter.of(context).path.startsWith('/spaces/')
|
||||
leading: GoRouterState.of(context).uri.path.startsWith('/spaces/')
|
||||
? null
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.close_outlined),
|
||||
onPressed: () => VRouter.of(context)
|
||||
.toSegments(['rooms', controller.roomId!]),
|
||||
onPressed: () =>
|
||||
context.go(['', 'rooms', controller.roomId!].join('/')),
|
||||
),
|
||||
title: Text(L10n.of(context)!.editChatPermissions),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||
return list;
|
||||
}
|
||||
|
||||
void login() => VRouter.of(context).to('login');
|
||||
void login() => context.go('/home/login');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class ImageViewerController extends State<ImageViewer> {
|
|||
/// Forward this image to another room.
|
||||
void forwardAction() {
|
||||
Matrix.of(context).shareContent = widget.event.content;
|
||||
VRouter.of(context).to('/rooms');
|
||||
context.go('/rooms');
|
||||
}
|
||||
|
||||
/// Save this file with a system call.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
|||
List<Profile> foundProfiles = [];
|
||||
Timer? coolDown;
|
||||
|
||||
String? get roomId => VRouter.of(context).pathParameters['roomid'];
|
||||
String? get roomId => GoRouterState.of(context).pathParameters['roomid'];
|
||||
|
||||
Future<List<User>> getContacts(BuildContext context) async {
|
||||
final client = Matrix.of(context).client;
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ class InvitationSelectionView extends StatelessWidget {
|
|||
final groupName = room.name.isEmpty ? L10n.of(context)!.group : room.name;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: VRouter.of(context).path.startsWith('/spaces/')
|
||||
leading: GoRouterState.of(context).uri.path.startsWith('/spaces/')
|
||||
? null
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.close_outlined),
|
||||
onPressed: () => VRouter.of(context)
|
||||
.toSegments(['rooms', controller.roomId!]),
|
||||
onPressed: () =>
|
||||
context.go(['', 'rooms', controller.roomId!].join('/')),
|
||||
),
|
||||
titleSpacing: 0,
|
||||
title: SizedBox(
|
||||
|
|
|
|||
|
|
@ -108,10 +108,10 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||
var title = Text(L10n.of(context)!.verifyTitle);
|
||||
Widget body;
|
||||
final buttons = <Widget>[];
|
||||
|
||||
switch (widget.request.state) {
|
||||
case KeyVerificationState.showQRSuccess:
|
||||
case KeyVerificationState.confirmQRScan:
|
||||
case KeyVerificationState.askChoice:
|
||||
throw 'Not implemented';
|
||||
case KeyVerificationState.askSSSS:
|
||||
// prompt the user for their ssss passphrase / key
|
||||
|
|
@ -200,6 +200,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||
),
|
||||
);
|
||||
break;
|
||||
case KeyVerificationState.askChoice:
|
||||
case KeyVerificationState.waitingAccept:
|
||||
body = Center(
|
||||
child: Column(
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class NewGroupController extends State<NewGroup> {
|
|||
},
|
||||
);
|
||||
if (roomID.error == null) {
|
||||
VRouter.of(context).toSegments(['rooms', roomID.result!, 'invite']);
|
||||
context.go(['', 'rooms', roomID.result!, 'invite'].join('/'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class NewPrivateChatView extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextButton(
|
||||
onPressed: () => VRouter.of(context).to('/newgroup'),
|
||||
onPressed: () => context.go('/rooms/newgroup'),
|
||||
child: Text(
|
||||
L10n.of(context)!.createNewGroup,
|
||||
style:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class NewSpaceController extends State<NewSpace> {
|
|||
),
|
||||
);
|
||||
if (roomID.error == null) {
|
||||
VRouter.of(context).toSegments(['spaces', roomID.result!]);
|
||||
context.go('/rooms/spaces/${roomID.result!}');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class SettingsView extends StatelessWidget {
|
|||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: CloseButton(
|
||||
onPressed: VRouter.of(context).pop,
|
||||
onPressed: () => context.go('/rooms'),
|
||||
),
|
||||
title: Text(L10n.of(context)!.settings),
|
||||
actions: [
|
||||
|
|
@ -153,31 +153,31 @@ class SettingsView extends StatelessWidget {
|
|||
ListTile(
|
||||
leading: const Icon(Icons.format_paint_outlined),
|
||||
title: Text(L10n.of(context)!.changeTheme),
|
||||
onTap: () => VRouter.of(context).to('/settings/style'),
|
||||
onTap: () => context.go('/rooms/settings/style'),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications_outlined),
|
||||
title: Text(L10n.of(context)!.notifications),
|
||||
onTap: () => VRouter.of(context).to('/settings/notifications'),
|
||||
onTap: () => context.go('/rooms/settings/notifications'),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.devices_outlined),
|
||||
title: Text(L10n.of(context)!.devices),
|
||||
onTap: () => VRouter.of(context).to('/settings/devices'),
|
||||
onTap: () => context.go('/rooms/settings/devices'),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.forum_outlined),
|
||||
title: Text(L10n.of(context)!.chat),
|
||||
onTap: () => VRouter.of(context).to('/settings/chat'),
|
||||
onTap: () => context.go('/rooms/settings/chat'),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.shield_outlined),
|
||||
title: Text(L10n.of(context)!.security),
|
||||
onTap: () => VRouter.of(context).to('/settings/security'),
|
||||
onTap: () => context.go('/rooms/settings/security'),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
),
|
||||
const Divider(thickness: 1),
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class SettingsChatView extends StatelessWidget {
|
|||
children: [
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.emoteSettings),
|
||||
onTap: () => VRouter.of(context).to('emotes'),
|
||||
onTap: () => context.go('/rooms/settings/chat/emotes'),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
leading: const Icon(Icons.emoji_emotions_outlined),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@ class EmotesSettings extends StatefulWidget {
|
|||
}
|
||||
|
||||
class EmotesSettingsController extends State<EmotesSettings> {
|
||||
String? get roomId => VRouter.of(context).pathParameters['roomid'];
|
||||
String? get roomId => GoRouterState.of(context).pathParameters['roomid'];
|
||||
|
||||
Room? get room =>
|
||||
roomId != null ? Matrix.of(context).client.getRoomById(roomId!) : null;
|
||||
|
||||
String? get stateKey => VRouter.of(context).pathParameters['state_key'];
|
||||
String? get stateKey => GoRouterState.of(context).pathParameters['state_key'];
|
||||
|
||||
bool showSave = false;
|
||||
TextEditingController newImageCodeController = TextEditingController();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class MultipleEmotesSettings extends StatefulWidget {
|
|||
}
|
||||
|
||||
class MultipleEmotesSettingsController extends State<MultipleEmotesSettings> {
|
||||
String? get roomId => VRouter.of(context).pathParameters['roomid'];
|
||||
String? get roomId => GoRouterState.of(context).pathParameters['roomid'];
|
||||
@override
|
||||
Widget build(BuildContext context) => MultipleEmotesSettingsView(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,8 +49,9 @@ class MultipleEmotesSettingsView extends StatelessWidget {
|
|||
return ListTile(
|
||||
title: Text(packName),
|
||||
onTap: () async {
|
||||
VRouter.of(context).toSegments(
|
||||
['rooms', room.id, 'details', 'emotes', keys[i]],
|
||||
context.go(
|
||||
['', 'rooms', room.id, 'details', 'emotes', keys[i]]
|
||||
.join('/'),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ class SettingsSecurityView extends StatelessWidget {
|
|||
leading: const Icon(Icons.camera_outlined),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
title: Text(L10n.of(context)!.whoCanSeeMyStories),
|
||||
onTap: () => VRouter.of(context).to('stories'),
|
||||
onTap: () => context.go('/rooms/settings/security/stories'),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.block_outlined),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
title: Text(L10n.of(context)!.ignoredUsers),
|
||||
onTap: () => VRouter.of(context).to('ignorelist'),
|
||||
onTap: () => context.go('/rooms/settings/security/ignorelist'),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.password_outlined),
|
||||
|
|
@ -47,7 +47,7 @@ class SettingsSecurityView extends StatelessWidget {
|
|||
leading: const Icon(Icons.mail_outlined),
|
||||
trailing: const Icon(Icons.chevron_right_outlined),
|
||||
title: Text(L10n.of(context)!.passwordRecovery),
|
||||
onTap: () => VRouter.of(context).to('3pid'),
|
||||
onTap: () => context.go('/rooms/settings/security/3pid'),
|
||||
),
|
||||
if (Matrix.of(context).client.encryption != null) ...{
|
||||
const Divider(thickness: 1),
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class StoryPageController extends State<StoryPage> {
|
|||
void share() async {
|
||||
Matrix.of(context).shareContent = currentEvent?.content;
|
||||
hold();
|
||||
VRouter.of(context).to('share');
|
||||
context.go('share');
|
||||
}
|
||||
|
||||
void displaySeenByUsers() async {
|
||||
|
|
@ -199,7 +199,7 @@ class StoryPageController extends State<StoryPage> {
|
|||
return room.ownPowerLevel >= 100;
|
||||
}
|
||||
|
||||
String get roomId => VRouter.of(context).pathParameters['roomid'] ?? '';
|
||||
String get roomId => GoRouterState.of(context).pathParameters['roomid'] ?? '';
|
||||
|
||||
Future<VideoPlayerController?>? loadVideoControllerFuture;
|
||||
|
||||
|
|
@ -228,9 +228,9 @@ class StoryPageController extends State<StoryPage> {
|
|||
void skip() {
|
||||
if (index + 1 >= max) {
|
||||
if (isOwnStory) {
|
||||
VRouter.of(context).to('/stories/create');
|
||||
context.go('/rooms/stories/create');
|
||||
} else {
|
||||
VRouter.of(context).to('/rooms');
|
||||
context.go('/rooms');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -497,7 +497,8 @@ class StoryPageController extends State<StoryPage> {
|
|||
currentEvent!.senderFromMemoryOrFallback.startDirectChat(),
|
||||
);
|
||||
if (roomIdResult.error != null) return;
|
||||
VRouter.of(context).toSegments(['rooms', roomIdResult.result!]);
|
||||
context.go(['', 'rooms', roomIdResult.result!].join('/'));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,8 +147,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
future: () => widget.user.startDirectChat(),
|
||||
);
|
||||
if (roomIdResult.error != null) return;
|
||||
VRouter.of(widget.outerContext)
|
||||
.toSegments(['rooms', roomIdResult.result!]);
|
||||
widget.outerContext.go(['', 'rooms', roomIdResult.result!].join('/'));
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
break;
|
||||
case UserBottomSheetAction.ignore:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue