fix: Dialog using wrong Navigator
This commit is contained in:
parent
57f81a3aa3
commit
1a167bebe7
30 changed files with 240 additions and 193 deletions
|
|
@ -211,13 +211,13 @@ class _ChatState extends State<Chat> {
|
|||
if (result == null) return;
|
||||
await showDialog(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
builder: (c) => SendFileDialog(
|
||||
file: MatrixFile(
|
||||
bytes: result.toUint8List(),
|
||||
name: result.fileName,
|
||||
).detectFileType,
|
||||
room: room,
|
||||
l10n: L10n.of(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -228,13 +228,13 @@ class _ChatState extends State<Chat> {
|
|||
if (result == null) return;
|
||||
await showDialog(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
builder: (c) => SendFileDialog(
|
||||
file: MatrixImageFile(
|
||||
bytes: result.toUint8List(),
|
||||
name: result.fileName,
|
||||
),
|
||||
room: room,
|
||||
l10n: L10n.of(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -245,13 +245,13 @@ class _ChatState extends State<Chat> {
|
|||
final bytes = await file.readAsBytes();
|
||||
await showDialog(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
builder: (c) => SendFileDialog(
|
||||
file: MatrixImageFile(
|
||||
bytes: bytes,
|
||||
name: file.path,
|
||||
),
|
||||
room: room,
|
||||
l10n: L10n.of(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -263,9 +263,8 @@ class _ChatState extends State<Chat> {
|
|||
}
|
||||
final result = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (c) => RecordingDialog(
|
||||
l10n: L10n.of(context),
|
||||
),
|
||||
builder: (c) => RecordingDialog(),
|
||||
useRootNavigator: false,
|
||||
);
|
||||
if (result == null) return;
|
||||
final audioFile = File(result);
|
||||
|
|
@ -306,6 +305,7 @@ class _ChatState extends State<Chat> {
|
|||
final score = await showConfirmationDialog<int>(
|
||||
context: context,
|
||||
title: L10n.of(context).howOffensiveIsThisContent,
|
||||
useRootNavigator: false,
|
||||
actions: [
|
||||
AlertDialogAction(
|
||||
key: -100,
|
||||
|
|
@ -326,6 +326,7 @@ class _ChatState extends State<Chat> {
|
|||
title: L10n.of(context).whyDoYouWantToReportThis,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [DialogTextField(hintText: L10n.of(context).reason)]);
|
||||
if (reason == null || reason.single.isEmpty) return;
|
||||
final result = await showFutureLoadingDialog(
|
||||
|
|
@ -350,6 +351,7 @@ class _ChatState extends State<Chat> {
|
|||
title: L10n.of(context).messageWillBeRemovedWarning,
|
||||
okLabel: L10n.of(context).remove,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
) ==
|
||||
OkCancelResult.ok;
|
||||
if (!confirmed) return;
|
||||
|
|
@ -473,7 +475,7 @@ class _ChatState extends State<Chat> {
|
|||
// make sure we remove duplicates
|
||||
prefs.setStringList('recents', recents.toSet().toList());
|
||||
});
|
||||
Navigator.of(context).pop<Emoji>(emoji);
|
||||
Navigator.of(context, rootNavigator: false).pop<Emoji>(emoji);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
@ -538,7 +540,6 @@ class _ChatState extends State<Chat> {
|
|||
? () => showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (c) => UserBottomSheet(
|
||||
l10n: L10n.of(context),
|
||||
user: room.getUserByMXIDSync(
|
||||
room.directChatMatrixID),
|
||||
onMention: () => sendController.text +=
|
||||
|
|
@ -823,7 +824,6 @@ class _ChatState extends State<Chat> {
|
|||
context: context,
|
||||
builder: (c) =>
|
||||
UserBottomSheet(
|
||||
l10n: L10n.of(context),
|
||||
user: event.sender,
|
||||
onMention: () =>
|
||||
sendController.text +=
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|||
title: L10n.of(context).changeTheNameOfTheGroup,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
initialText: room.getLocalizedDisplayname(
|
||||
|
|
@ -67,6 +68,7 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|||
title: L10n.of(context).setInvitationLink,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: '#localpart:domain',
|
||||
|
|
@ -109,6 +111,7 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|||
title: L10n.of(context).setGroupDescription,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: L10n.of(context).setGroupDescription,
|
||||
|
|
|
|||
|
|
@ -35,10 +35,7 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
|
|||
setState(() => null);
|
||||
}
|
||||
};
|
||||
await KeyVerificationDialog(
|
||||
request: req,
|
||||
l10n: L10n.of(context),
|
||||
).show(context);
|
||||
await KeyVerificationDialog(request: req).show(context);
|
||||
break;
|
||||
case 'verify_user':
|
||||
await unblock();
|
||||
|
|
@ -49,10 +46,7 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
|
|||
setState(() => null);
|
||||
}
|
||||
};
|
||||
await KeyVerificationDialog(
|
||||
request: req,
|
||||
l10n: L10n.of(context),
|
||||
).show(context);
|
||||
await KeyVerificationDialog(request: req).show(context);
|
||||
break;
|
||||
case 'block':
|
||||
if (key.directVerified) {
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ class _ChatListState extends State<ChatList> {
|
|||
title: L10n.of(context).areYouSure,
|
||||
okLabel: L10n.of(context).yes,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
) ==
|
||||
OkCancelResult.ok;
|
||||
if (!confirmed) return;
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@ class ChatPermissionsSettings extends StatelessWidget {
|
|||
return FlushbarHelper.createError(message: L10n.of(context).noPermission)
|
||||
.show(context);
|
||||
}
|
||||
final newLevel = await PermissionSliderDialog(
|
||||
initialPermission: currentLevel,
|
||||
l10n: L10n.of(context),
|
||||
).show(context);
|
||||
final newLevel =
|
||||
await PermissionSliderDialog(initialPermission: currentLevel)
|
||||
.show(context);
|
||||
if (newLevel == null) return;
|
||||
final content = Map<String, dynamic>.from(
|
||||
room.getState(EventTypes.RoomPowerLevels).content);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class _ContactsState extends State<Contacts> {
|
|||
title: L10n.of(context).setStatus,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: L10n.of(context).statusExampleMessage,
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ class _DiscoverState extends State<Discover> {
|
|||
title: '${room.name} (${room.numJoinedMembers ?? 0})',
|
||||
message: room.topic ?? L10n.of(context).noDescription,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
) ==
|
||||
OkCancelResult.cancel) {
|
||||
return;
|
||||
|
|
@ -92,6 +93,7 @@ class _DiscoverState extends State<Discover> {
|
|||
context: context,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
prefixText: 'https://',
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class ImageView extends StatelessWidget {
|
|||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
|
||||
color: Colors.white,
|
||||
tooltip: L10n.of(context).close,
|
||||
),
|
||||
|
|
@ -67,7 +67,7 @@ class ImageView extends StatelessWidget {
|
|||
onInteractionEnd: (ScaleEndDetails endDetails) {
|
||||
if (PlatformInfos.usesTouchscreen == false) {
|
||||
if (endDetails.velocity.pixelsPerSecond.dy > calcVelocity) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ class _LoginState extends State<Login> {
|
|||
title: L10n.of(context).enterAnEmailAddress,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: L10n.of(context).enterAnEmailAddress,
|
||||
|
|
@ -119,6 +120,7 @@ class _LoginState extends State<Login> {
|
|||
title: L10n.of(context).weSentYouAnEmail,
|
||||
message: L10n.of(context).pleaseClickOnLink,
|
||||
okLabel: L10n.of(context).iHaveClickedOnLink,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
if (ok == null) return;
|
||||
final password = await showTextInputDialog(
|
||||
|
|
@ -126,6 +128,7 @@ class _LoginState extends State<Login> {
|
|||
title: L10n.of(context).chooseAStrongPassword,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: '******',
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class _SettingsState extends State<Settings> {
|
|||
title: L10n.of(context).areYouSureYouWantToLogout,
|
||||
okLabel: L10n.of(context).yes,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
) ==
|
||||
OkCancelResult.cancel) {
|
||||
return;
|
||||
|
|
@ -64,6 +65,7 @@ class _SettingsState extends State<Settings> {
|
|||
title: L10n.of(context).changePassword,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: L10n.of(context).pleaseEnterYourPassword,
|
||||
|
|
@ -98,6 +100,7 @@ class _SettingsState extends State<Settings> {
|
|||
message: L10n.of(context).deactivateAccountWarning,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
) ==
|
||||
OkCancelResult.cancel) {
|
||||
return;
|
||||
|
|
@ -107,6 +110,7 @@ class _SettingsState extends State<Settings> {
|
|||
title: L10n.of(context).areYouSure,
|
||||
okLabel: L10n.of(context).yes,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
) ==
|
||||
OkCancelResult.cancel) {
|
||||
return;
|
||||
|
|
@ -116,6 +120,7 @@ class _SettingsState extends State<Settings> {
|
|||
title: L10n.of(context).pleaseEnterYourPassword,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
obscureText: true,
|
||||
|
|
@ -146,6 +151,7 @@ class _SettingsState extends State<Settings> {
|
|||
title: L10n.of(context).editJitsiInstance,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
initialText: AppConfig.jitsiInstance.replaceFirst(prefix, ''),
|
||||
|
|
@ -169,6 +175,7 @@ class _SettingsState extends State<Settings> {
|
|||
title: L10n.of(context).editDisplayname,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
initialText: profile?.displayname ??
|
||||
|
|
@ -233,6 +240,7 @@ class _SettingsState extends State<Settings> {
|
|||
title: L10n.of(context).askSSSSCache,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: L10n.of(context).passphraseOrKey,
|
||||
|
|
@ -263,6 +271,8 @@ class _SettingsState extends State<Settings> {
|
|||
await showOkAlertDialog(
|
||||
context: context,
|
||||
message: L10n.of(context).cachedKeys,
|
||||
okLabel: L10n.of(context).ok,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
setState(() {
|
||||
crossSigningCachedFuture = null;
|
||||
|
|
@ -274,6 +284,8 @@ class _SettingsState extends State<Settings> {
|
|||
await showOkAlertDialog(
|
||||
context: context,
|
||||
message: L10n.of(context).incorrectPassphraseOrKey,
|
||||
okLabel: L10n.of(context).ok,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -297,6 +309,7 @@ class _SettingsState extends State<Settings> {
|
|||
title: L10n.of(context).pleaseChooseAPasscode,
|
||||
message: L10n.of(context).pleaseEnter4Digits,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
validator: (text) {
|
||||
|
|
@ -516,6 +529,8 @@ class _SettingsState extends State<Settings> {
|
|||
context: context,
|
||||
title: L10n.of(context).yourPublicKey,
|
||||
message: client.fingerprintKey.beautified,
|
||||
okLabel: L10n.of(context).ok,
|
||||
useRootNavigator: false,
|
||||
),
|
||||
trailing: Icon(Icons.vpn_key_outlined),
|
||||
),
|
||||
|
|
@ -534,19 +549,13 @@ class _SettingsState extends State<Settings> {
|
|||
isDestructiveAction: true,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
)) {
|
||||
await BootstrapDialog(
|
||||
l10n: L10n.of(context),
|
||||
client: Matrix.of(context).client,
|
||||
wipe: true,
|
||||
).show(context);
|
||||
await BootstrapDialog(wipe: true).show(context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
await BootstrapDialog(
|
||||
l10n: L10n.of(context),
|
||||
client: Matrix.of(context).client,
|
||||
).show(context);
|
||||
await BootstrapDialog().show(context);
|
||||
},
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class _Settings3PidState extends State<Settings3Pid> {
|
|||
title: L10n.of(context).enterAnEmailAddress,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: L10n.of(context).enterAnEmailAddress,
|
||||
|
|
@ -42,6 +43,7 @@ class _Settings3PidState extends State<Settings3Pid> {
|
|||
title: L10n.of(context).weSentYouAnEmail,
|
||||
message: L10n.of(context).pleaseClickOnLink,
|
||||
okLabel: L10n.of(context).iHaveClickedOnLink,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
if (ok == null) return;
|
||||
final password = await showTextInputDialog(
|
||||
|
|
@ -49,6 +51,7 @@ class _Settings3PidState extends State<Settings3Pid> {
|
|||
title: L10n.of(context).pleaseEnterYourPassword,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: '******',
|
||||
|
|
@ -82,6 +85,7 @@ class _Settings3PidState extends State<Settings3Pid> {
|
|||
title: L10n.of(context).areYouSure,
|
||||
okLabel: L10n.of(context).yes,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
) !=
|
||||
OkCancelResult.ok) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class DevicesSettingsState extends State<DevicesSettings> {
|
|||
title: L10n.of(context).areYouSure,
|
||||
okLabel: L10n.of(context).yes,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
) ==
|
||||
OkCancelResult.cancel) return;
|
||||
var matrix = Matrix.of(context);
|
||||
|
|
@ -68,6 +69,7 @@ class DevicesSettingsState extends State<DevicesSettings> {
|
|||
title: L10n.of(context).changeDeviceName,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: device.displayName,
|
||||
|
|
@ -98,10 +100,7 @@ class DevicesSettingsState extends State<DevicesSettings> {
|
|||
setState(() => null);
|
||||
}
|
||||
};
|
||||
await KeyVerificationDialog(
|
||||
request: req,
|
||||
l10n: L10n.of(context),
|
||||
).show(context);
|
||||
await KeyVerificationDialog(request: req).show(context);
|
||||
}
|
||||
|
||||
void _blockDeviceAction(BuildContext context, Device device) async {
|
||||
|
|
|
|||
|
|
@ -233,8 +233,11 @@ class _EmotesSettingsState extends State<EmotesSettings> {
|
|||
newMxcController.text == null ||
|
||||
newMxcController.text.isEmpty) {
|
||||
await showOkAlertDialog(
|
||||
context: context,
|
||||
message: L10n.of(context).emoteWarnNeedToPick);
|
||||
context: context,
|
||||
message: L10n.of(context).emoteWarnNeedToPick,
|
||||
okLabel: L10n.of(context).ok,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
return;
|
||||
}
|
||||
final emoteCode = ':${newEmoteController.text}:';
|
||||
|
|
@ -243,14 +246,20 @@ class _EmotesSettingsState extends State<EmotesSettings> {
|
|||
e.emote == emoteCode && e.mxc != mxc) !=
|
||||
-1) {
|
||||
await showOkAlertDialog(
|
||||
context: context,
|
||||
message: L10n.of(context).emoteExists);
|
||||
context: context,
|
||||
message: L10n.of(context).emoteExists,
|
||||
okLabel: L10n.of(context).ok,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!RegExp(r'^:[-\w]+:$').hasMatch(emoteCode)) {
|
||||
await showOkAlertDialog(
|
||||
context: context,
|
||||
message: L10n.of(context).emoteInvalid);
|
||||
context: context,
|
||||
message: L10n.of(context).emoteInvalid,
|
||||
okLabel: L10n.of(context).ok,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
return;
|
||||
}
|
||||
emotes.add(_EmoteEntry(emote: emoteCode, mxc: mxc));
|
||||
|
|
@ -344,18 +353,22 @@ class _EmotesSettingsState extends State<EmotesSettings> {
|
|||
-1) {
|
||||
controller.text = emote.emoteClean;
|
||||
showOkAlertDialog(
|
||||
context: context,
|
||||
message:
|
||||
L10n.of(context).emoteExists);
|
||||
context: context,
|
||||
message: L10n.of(context).emoteExists,
|
||||
okLabel: L10n.of(context).ok,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!RegExp(r'^:[-\w]+:$')
|
||||
.hasMatch(emoteCode)) {
|
||||
controller.text = emote.emoteClean;
|
||||
showOkAlertDialog(
|
||||
context: context,
|
||||
message:
|
||||
L10n.of(context).emoteInvalid);
|
||||
context: context,
|
||||
message: L10n.of(context).emoteInvalid,
|
||||
okLabel: L10n.of(context).ok,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
|||
context: context,
|
||||
okLabel: L10n.of(context).next,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
useRootNavigator: false,
|
||||
)) {
|
||||
_signUpAction(
|
||||
context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue