fix: Regressions because of vrouter

This commit is contained in:
Christian Pauly 2021-05-23 15:02:36 +02:00
parent 00e43c666e
commit 8ee4e3c155
24 changed files with 122 additions and 53 deletions

View File

@ -145,7 +145,22 @@ class AppRoutes {
),
buildTransition: _fadeTransition,
stackedRoutes: [
_settingsRoute,
VNester(
path: '/settings',
widgetBuilder: (child) => TwoColumnLayout(
mainView: Settings(),
sideView: child,
),
buildTransition: _dynamicTransition,
nestedRoutes: [
VWidget(
path: '',
widget: EmptyPage(),
buildTransition: _dynamicTransition,
stackedRoutes: _settingsRoutes,
),
],
),
VWidget(
path: '/search',
widget: TwoColumnLayout(
@ -185,7 +200,11 @@ class AppRoutes {
stackedRoutes: _chatDetailsRoutes,
),
]),
_settingsRoute,
VWidget(
path: '/settings',
widget: Settings(),
stackedRoutes: _settingsRoutes,
),
VWidget(
path: '/search',
widget: Search(),
@ -224,58 +243,43 @@ class AppRoutes {
),
];
VNester get _settingsRoute => VNester(
path: '/settings',
widgetBuilder: (child) => TwoColumnLayout(
mainView: Settings(),
sideView: child,
List<VRouteElement> get _settingsRoutes => [
VWidget(
path: 'emotes',
widget: EmotesSettings(),
buildTransition: _dynamicTransition,
),
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,
),
],
),
],
);
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,
),
];
final _fadeTransition = (animation1, _, child) =>
FadeTransition(opacity: animation1, child: child);

View File

@ -23,6 +23,7 @@ class ArchiveController extends State<Archive> {
void forgetAllAction() async {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,

View File

@ -26,11 +26,13 @@ class BootstrapDialog extends StatefulWidget {
context: context,
builder: (context) => this,
barrierDismissible: true,
useRootNavigator: false,
)
: showDialog(
context: context,
builder: (context) => this,
barrierDismissible: true,
useRootNavigator: false,
);
@override
@ -193,6 +195,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
onPressed: () async {
if (OkCancelResult.ok ==
await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).securityKeyLost,
message: L10n.of(context).wipeChatBackup,

View File

@ -233,6 +233,7 @@ class ChatController extends State<Chat> {
if (result == null) return;
await showDialog(
context: context,
useRootNavigator: false,
builder: (c) => SendFileDialog(
file: MatrixFile(
bytes: result.toUint8List(),
@ -249,6 +250,7 @@ class ChatController extends State<Chat> {
if (result == null) return;
await showDialog(
context: context,
useRootNavigator: false,
builder: (c) => SendFileDialog(
file: MatrixImageFile(
bytes: result.toUint8List(),
@ -265,6 +267,7 @@ class ChatController extends State<Chat> {
final bytes = await file.readAsBytes();
await showDialog(
context: context,
useRootNavigator: false,
builder: (c) => SendFileDialog(
file: MatrixImageFile(
bytes: bytes,
@ -282,6 +285,7 @@ class ChatController extends State<Chat> {
}
final result = await showDialog<String>(
context: context,
useRootNavigator: false,
builder: (c) => RecordingDialog(),
);
if (result == null) return;
@ -339,6 +343,7 @@ class ChatController extends State<Chat> {
]);
if (score == null) return;
final reason = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).whyDoYouWantToReportThis,
okLabel: L10n.of(context).ok,
@ -362,6 +367,7 @@ class ChatController extends State<Chat> {
void redactEventsAction() async {
final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).messageWillBeRemovedWarning,
okLabel: L10n.of(context).remove,
@ -538,6 +544,7 @@ class ChatController extends State<Chat> {
void goToNewRoomAction() async {
if (OkCancelResult.ok !=
await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).goToTheNewRoom,
message: room

View File

@ -31,6 +31,7 @@ class ChatDetailsController extends State<ChatDetails> {
void setDisplaynameAction() async {
final room = Matrix.of(context).client.getRoomById(roomId);
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).changeTheNameOfTheGroup,
okLabel: L10n.of(context).ok,
@ -88,6 +89,7 @@ class ChatDetailsController extends State<ChatDetails> {
return setAliasAction();
}
final select = await showConfirmationDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).editRoomAliases,
actions: [
@ -155,6 +157,7 @@ class ChatDetailsController extends State<ChatDetails> {
final domain = room.client.userID.domain;
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).setInvitationLink,
okLabel: L10n.of(context).ok,
@ -179,6 +182,7 @@ class ChatDetailsController extends State<ChatDetails> {
void setTopicAction() async {
final room = Matrix.of(context).client.getRoomById(roomId);
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).setGroupDescription,
okLabel: L10n.of(context).ok,

View File

@ -155,6 +155,7 @@ class ChatListController extends State<ChatList> {
Future<void> archiveAction() async {
final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,
@ -171,6 +172,7 @@ class ChatListController extends State<ChatList> {
void setStatus() async {
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).setStatus,
okLabel: L10n.of(context).ok,

View File

@ -78,6 +78,7 @@ class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
if (newVersion == null ||
OkCancelResult.cancel ==
await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context).cancel,

View File

@ -29,6 +29,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
void removeDevicesAction(List<Device> devices) async {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,
@ -63,6 +64,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
void renameDeviceAction(Device device) async {
final displayName = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).changeDeviceName,
okLabel: L10n.of(context).ok,

View File

@ -16,11 +16,13 @@ class KeyVerificationDialog extends StatefulWidget {
context: context,
barrierDismissible: true,
builder: (context) => this,
useRootNavigator: false,
)
: showDialog(
context: context,
barrierDismissible: true,
builder: (context) => this,
useRootNavigator: false,
);
final KeyVerification request;
@ -96,6 +98,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
});
if (valid.error != null) {
await showOkAlertDialog(
useRootNavigator: false,
context: context,
message: L10n.of(context).incorrectPassphraseOrKey,
);
@ -183,6 +186,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
label: L10n.of(context).verifyManual,
onPressed: () async {
final result = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).verifyManual,
message: key.ed25519Key.beautified,

View File

@ -115,6 +115,7 @@ class LoginController extends State<Login> {
void passwordForgotten() async {
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).enterAnEmailAddress,
okLabel: L10n.of(context).ok,
@ -138,6 +139,7 @@ class LoginController extends State<Login> {
);
if (response.error != null) return;
final ok = await showOkAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).weSentYouAnEmail,
message: L10n.of(context).pleaseClickOnLink,
@ -145,6 +147,7 @@ class LoginController extends State<Login> {
);
if (ok == null) return;
final password = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).chooseAStrongPassword,
okLabel: L10n.of(context).ok,

View File

@ -14,10 +14,12 @@ class PermissionSliderDialog extends StatefulWidget {
? showCupertinoDialog<int>(
context: context,
builder: (context) => this,
useRootNavigator: false,
)
: showDialog<int>(
context: context,
builder: (context) => this,
useRootNavigator: false,
);
final int initialPermission;

View File

@ -59,6 +59,7 @@ class SearchController extends State<Search> {
void joinGroupAction(PublicRoom room) async {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
okLabel: L10n.of(context).joinRoom,
title: '${room.name} (${room.numJoinedMembers ?? 0})',
@ -85,6 +86,7 @@ class SearchController extends State<Search> {
void setServer() async {
final newServer = await showTextInputDialog(
useRootNavigator: false,
title: L10n.of(context).changeTheHomeserver,
context: context,
okLabel: L10n.of(context).ok,

View File

@ -37,6 +37,7 @@ class SettingsController extends State<Settings> {
void logoutAction() async {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).areYouSureYouWantToLogout,
okLabel: L10n.of(context).yes,
@ -54,6 +55,7 @@ class SettingsController extends State<Settings> {
void changePasswordAccountAction() async {
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).changePassword,
okLabel: L10n.of(context).ok,
@ -88,6 +90,7 @@ class SettingsController extends State<Settings> {
void deleteAccountAction() async {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).warning,
message: L10n.of(context).deactivateAccountWarning,
@ -98,6 +101,7 @@ class SettingsController extends State<Settings> {
return;
}
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,
@ -107,6 +111,7 @@ class SettingsController extends State<Settings> {
return;
}
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).pleaseEnterYourPassword,
okLabel: L10n.of(context).ok,
@ -137,6 +142,7 @@ class SettingsController extends State<Settings> {
void setJitsiInstanceAction() async {
const prefix = 'https://';
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).editJitsiInstance,
okLabel: L10n.of(context).ok,
@ -160,6 +166,7 @@ class SettingsController extends State<Settings> {
void setDisplaynameAction() async {
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).editDisplayname,
okLabel: L10n.of(context).ok,
@ -224,6 +231,7 @@ class SettingsController extends State<Settings> {
Future<void> requestSSSSCache() async {
final handle = Matrix.of(context).client.encryption.ssss.open();
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).askSSSSCache,
okLabel: L10n.of(context).ok,
@ -256,6 +264,7 @@ class SettingsController extends State<Settings> {
if (valid.result == true) {
await handle.maybeCacheAll();
await showOkAlertDialog(
useRootNavigator: false,
context: context,
message: L10n.of(context).cachedKeys,
okLabel: L10n.of(context).ok,
@ -268,6 +277,7 @@ class SettingsController extends State<Settings> {
});
} else {
await showOkAlertDialog(
useRootNavigator: false,
context: context,
message: L10n.of(context).incorrectPassphraseOrKey,
okLabel: L10n.of(context).ok,
@ -283,6 +293,7 @@ class SettingsController extends State<Settings> {
await AppLock.of(context).showLockScreen();
}
final newLock = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).pleaseChooseAPasscode,
message: L10n.of(context).pleaseEnter4Digits,
@ -317,6 +328,7 @@ class SettingsController extends State<Settings> {
if (await Matrix.of(context).client.encryption.keyManager.isCached()) {
if (OkCancelResult.ok ==
await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).keysCached,
message: L10n.of(context).wipeChatBackup,

View File

@ -17,6 +17,7 @@ class Settings3Pid extends StatefulWidget {
class Settings3PidController extends State<Settings3Pid> {
void add3PidAction() async {
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).enterAnEmailAddress,
okLabel: L10n.of(context).ok,
@ -40,6 +41,7 @@ class Settings3PidController extends State<Settings3Pid> {
);
if (response.error != null) return;
final ok = await showOkAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).weSentYouAnEmail,
message: L10n.of(context).pleaseClickOnLink,
@ -64,6 +66,7 @@ class Settings3PidController extends State<Settings3Pid> {
void delete3Pid(ThirdPartyIdentifier identifier) async {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,

View File

@ -135,6 +135,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
-1) {
controller.text = emote.emoteClean;
showOkAlertDialog(
useRootNavigator: false,
context: context,
message: L10n.of(context).emoteExists,
okLabel: L10n.of(context).ok,
@ -144,6 +145,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
if (!RegExp(r'^:[-\w]+:$').hasMatch(emoteCode)) {
controller.text = emote.emoteClean;
showOkAlertDialog(
useRootNavigator: false,
context: context,
message: L10n.of(context).emoteInvalid,
okLabel: L10n.of(context).ok,
@ -182,6 +184,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
newMxcController.text == null ||
newMxcController.text.isEmpty) {
await showOkAlertDialog(
useRootNavigator: false,
context: context,
message: L10n.of(context).emoteWarnNeedToPick,
okLabel: L10n.of(context).ok,
@ -192,6 +195,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
final mxc = newMxcController.text;
if (emotes.indexWhere((e) => e.emote == emoteCode && e.mxc != mxc) != -1) {
await showOkAlertDialog(
useRootNavigator: false,
context: context,
message: L10n.of(context).emoteExists,
okLabel: L10n.of(context).ok,
@ -200,6 +204,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
}
if (!RegExp(r'^:[-\w]+:$').hasMatch(emoteCode)) {
await showOkAlertDialog(
useRootNavigator: false,
context: context,
message: L10n.of(context).emoteInvalid,
okLabel: L10n.of(context).ok,

View File

@ -58,6 +58,7 @@ class SignUpPasswordController extends State<SignUpPassword> {
);
if (OkCancelResult.ok !=
await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
message: L10n.of(context).weSentYouAnEmail,
okLabel: L10n.of(context).confirm,

View File

@ -30,6 +30,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
void participantAction(String action) async {
final Function _askConfirmation =
() async => (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,

View File

@ -202,6 +202,7 @@ class SettingsView extends StatelessWidget {
ListTile(
title: Text(L10n.of(context).yourPublicKey),
onTap: () => showOkAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).yourPublicKey,
message: client.fingerprintKey.beautified,

View File

@ -43,6 +43,7 @@ abstract class PlatformInfos {
final version = await PlatformInfos.getVersion();
showAboutDialog(
context: context,
useRootNavigator: false,
children: [
Text('Version: $version'),
OutlinedButton(

View File

@ -70,6 +70,7 @@ class UrlLauncher {
}
if (roomIdOrAlias.sigil == '!') {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: 'Join room $roomIdOrAlias',
) ==
@ -111,6 +112,7 @@ class UrlLauncher {
}
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: 'Message user ${user.id}',
) ==

View File

@ -68,6 +68,7 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
switch (choice) {
case 'leave':
final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).ok,

View File

@ -26,6 +26,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
}
if (widget.room.joinRules == JoinRules.public) {
await showOkAlertDialog(
useRootNavigator: false,
context: context,
okLabel: L10n.of(context).ok,
message: L10n.of(context).noEncryptionForPublicRooms,
@ -33,6 +34,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
return;
}
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).enableEncryption,
message: widget.room.client.encryptionEnabled

View File

@ -93,6 +93,7 @@ class ChatListItem extends StatelessWidget {
'chat.fluffy.shared_file') {
await showDialog(
context: context,
useRootNavigator: false,
builder: (c) => SendFileDialog(
file: Matrix.of(context).shareContent['file'],
room: room,
@ -121,6 +122,7 @@ class ChatListItem extends StatelessWidget {
return success;
}
final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,

View File

@ -128,6 +128,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
case AuthenticationTypes.password:
final input = cachedPassword ??
(await showTextInputDialog(
useRootNavigator: false,
context: navigatorContext,
title: L10n.of(widget.context).pleaseEnterYourPassword,
okLabel: L10n.of(widget.context).ok,
@ -182,6 +183,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
);
if (OkCancelResult.ok ==
await showOkCancelAlertDialog(
useRootNavigator: false,
message: L10n.of(widget.context).pleaseFollowInstructionsOnWeb,
context: navigatorContext,
okLabel: L10n.of(widget.context).next,
@ -293,6 +295,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
hidPopup = true;
};
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: navigatorContext,
title: L10n.of(widget.context).newVerificationRequest,
message: