mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 08:55:12 +00:00
refactor: Dialog BuildContext
This commit is contained in:
parent
40003628b9
commit
315a43c1a4
24 changed files with 30 additions and 68 deletions
|
@ -383,14 +383,16 @@ abstract class AppRoutes {
|
||||||
static Page defaultPageBuilder(BuildContext context, Widget child) =>
|
static Page defaultPageBuilder(BuildContext context, Widget child) =>
|
||||||
CustomTransitionPage(
|
CustomTransitionPage(
|
||||||
child: child,
|
child: child,
|
||||||
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
|
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
||||||
FluffyThemes.isColumnMode(context)
|
Matrix.of(context).navigatorContext = context;
|
||||||
|
return FluffyThemes.isColumnMode(context)
|
||||||
? FadeTransition(opacity: animation, child: child)
|
? FadeTransition(opacity: animation, child: child)
|
||||||
: CupertinoPageTransition(
|
: CupertinoPageTransition(
|
||||||
primaryRouteAnimation: animation,
|
primaryRouteAnimation: animation,
|
||||||
secondaryRouteAnimation: secondaryAnimation,
|
secondaryRouteAnimation: secondaryAnimation,
|
||||||
linearTransition: false,
|
linearTransition: false,
|
||||||
child: child,
|
child: child,
|
||||||
),
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ class ArchiveController extends State<Archive> {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
if (archive.isEmpty) return;
|
if (archive.isEmpty) return;
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
|
|
@ -378,7 +378,6 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
||||||
: () async {
|
: () async {
|
||||||
if (OkCancelResult.ok ==
|
if (OkCancelResult.ok ==
|
||||||
await showOkCancelAlertDialog(
|
await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.recoveryKeyLost,
|
title: L10n.of(context)!.recoveryKeyLost,
|
||||||
message: L10n.of(context)!.wipeChatBackup,
|
message: L10n.of(context)!.wipeChatBackup,
|
||||||
|
|
|
@ -77,7 +77,6 @@ class ImageBubble extends StatelessWidget {
|
||||||
if (!tapToView) return;
|
if (!tapToView) return;
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
useRootNavigator: false,
|
|
||||||
builder: (_) => ImageViewer(event),
|
builder: (_) => ImageViewer(event),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,6 @@ class _AdaptableReactorsDialog extends StatelessWidget {
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => this,
|
builder: (context) => this,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
useRootNavigator: false,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -59,7 +59,6 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
||||||
);
|
);
|
||||||
} else if (!kIsWeb && tmpFile != null && _chewieManager == null) {
|
} else if (!kIsWeb && tmpFile != null && _chewieManager == null) {
|
||||||
_chewieManager ??= ChewieController(
|
_chewieManager ??= ChewieController(
|
||||||
useRootNavigator: false,
|
|
||||||
videoPlayerController: VideoPlayerController.file(tmpFile),
|
videoPlayerController: VideoPlayerController.file(tmpFile),
|
||||||
autoPlay: true,
|
autoPlay: true,
|
||||||
autoInitialize: true,
|
autoInitialize: true,
|
||||||
|
|
|
@ -176,7 +176,6 @@ class ChatListController extends State<ChatList>
|
||||||
|
|
||||||
void setServer() async {
|
void setServer() async {
|
||||||
final newServer = await showTextInputDialog(
|
final newServer = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
title: L10n.of(context)!.changeTheHomeserver,
|
title: L10n.of(context)!.changeTheHomeserver,
|
||||||
context: context,
|
context: context,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -473,12 +472,12 @@ class ChatListController extends State<ChatList>
|
||||||
|
|
||||||
Future<void> archiveAction() async {
|
Future<void> archiveAction() async {
|
||||||
final confirmed = await showOkCancelAlertDialog(
|
final confirmed = await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
message: L10n.of(context)!.archiveRoomDescription,
|
message: L10n.of(context)!.archiveRoomDescription,
|
||||||
|
isDestructiveAction: true,
|
||||||
) ==
|
) ==
|
||||||
OkCancelResult.ok;
|
OkCancelResult.ok;
|
||||||
if (!confirmed) return;
|
if (!confirmed) return;
|
||||||
|
@ -493,7 +492,6 @@ class ChatListController extends State<ChatList>
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final currentPresence = await client.fetchCurrentPresence(client.userID!);
|
final currentPresence = await client.fetchCurrentPresence(client.userID!);
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.setStatus,
|
title: L10n.of(context)!.setStatus,
|
||||||
message: L10n.of(context)!.leaveEmptyToClearStatus,
|
message: L10n.of(context)!.leaveEmptyToClearStatus,
|
||||||
|
|
|
@ -118,7 +118,6 @@ class ChatListItem extends StatelessWidget {
|
||||||
shareFile != null) {
|
shareFile != null) {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
useRootNavigator: false,
|
|
||||||
builder: (c) => SendFileDialog(
|
builder: (c) => SendFileDialog(
|
||||||
files: [shareFile],
|
files: [shareFile],
|
||||||
room: room,
|
room: room,
|
||||||
|
@ -160,12 +159,12 @@ class ChatListItem extends StatelessWidget {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final confirmed = await showOkCancelAlertDialog(
|
final confirmed = await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
cancelLabel: L10n.of(context)!.no,
|
cancelLabel: L10n.of(context)!.no,
|
||||||
message: L10n.of(context)!.archiveRoomDescription,
|
message: L10n.of(context)!.archiveRoomDescription,
|
||||||
|
isDestructiveAction: true,
|
||||||
);
|
);
|
||||||
if (confirmed == OkCancelResult.cancel) return;
|
if (confirmed == OkCancelResult.cancel) return;
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
|
|
|
@ -94,7 +94,6 @@ class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
||||||
if (newVersion == null ||
|
if (newVersion == null ||
|
||||||
OkCancelResult.cancel ==
|
OkCancelResult.cancel ==
|
||||||
await showOkCancelAlertDialog(
|
await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
|
|
|
@ -85,7 +85,6 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
||||||
);
|
);
|
||||||
if (valid.error != null) {
|
if (valid.error != null) {
|
||||||
await showOkAlertDialog(
|
await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context)!.incorrectPassphraseOrKey,
|
message: L10n.of(context)!.incorrectPassphraseOrKey,
|
||||||
);
|
);
|
||||||
|
|
|
@ -127,7 +127,6 @@ class LoginController extends State<Login> {
|
||||||
);
|
);
|
||||||
final dialogResult = await showOkCancelAlertDialog(
|
final dialogResult = await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
useRootNavigator: false,
|
|
||||||
message:
|
message:
|
||||||
L10n.of(context)!.noMatrixServer(newDomain, oldHomeserver!),
|
L10n.of(context)!.noMatrixServer(newDomain, oldHomeserver!),
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -157,7 +156,6 @@ class LoginController extends State<Login> {
|
||||||
|
|
||||||
void passwordForgotten() async {
|
void passwordForgotten() async {
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.passwordForgotten,
|
title: L10n.of(context)!.passwordForgotten,
|
||||||
message: L10n.of(context)!.enterAnEmailAddress,
|
message: L10n.of(context)!.enterAnEmailAddress,
|
||||||
|
@ -186,7 +184,6 @@ class LoginController extends State<Login> {
|
||||||
);
|
);
|
||||||
if (response.error != null) return;
|
if (response.error != null) return;
|
||||||
final password = await showTextInputDialog(
|
final password = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.passwordForgotten,
|
title: L10n.of(context)!.passwordForgotten,
|
||||||
message: L10n.of(context)!.chooseAStrongPassword,
|
message: L10n.of(context)!.chooseAStrongPassword,
|
||||||
|
@ -204,7 +201,6 @@ class LoginController extends State<Login> {
|
||||||
);
|
);
|
||||||
if (password == null) return;
|
if (password == null) return;
|
||||||
final ok = await showOkAlertDialog(
|
final ok = await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.weSentYouAnEmail,
|
title: L10n.of(context)!.weSentYouAnEmail,
|
||||||
message: L10n.of(context)!.pleaseClickOnLink,
|
message: L10n.of(context)!.pleaseClickOnLink,
|
||||||
|
|
|
@ -35,7 +35,6 @@ class SettingsController extends State<Settings> {
|
||||||
void setDisplaynameAction() async {
|
void setDisplaynameAction() async {
|
||||||
final profile = await profileFuture;
|
final profile = await profileFuture;
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.editDisplayname,
|
title: L10n.of(context)!.editDisplayname,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -62,7 +61,6 @@ class SettingsController extends State<Settings> {
|
||||||
void logoutAction() async {
|
void logoutAction() async {
|
||||||
final noBackup = showChatBackupBanner == true;
|
final noBackup = showChatBackupBanner == true;
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSureYouWantToLogout,
|
title: L10n.of(context)!.areYouSureYouWantToLogout,
|
||||||
message: L10n.of(context)!.noBackupWarning,
|
message: L10n.of(context)!.noBackupWarning,
|
||||||
|
|
|
@ -20,7 +20,6 @@ class Settings3Pid extends StatefulWidget {
|
||||||
class Settings3PidController extends State<Settings3Pid> {
|
class Settings3PidController extends State<Settings3Pid> {
|
||||||
void add3PidAction() async {
|
void add3PidAction() async {
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.enterAnEmailAddress,
|
title: L10n.of(context)!.enterAnEmailAddress,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -44,7 +43,6 @@ class Settings3PidController extends State<Settings3Pid> {
|
||||||
);
|
);
|
||||||
if (response.error != null) return;
|
if (response.error != null) return;
|
||||||
final ok = await showOkAlertDialog(
|
final ok = await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.weSentYouAnEmail,
|
title: L10n.of(context)!.weSentYouAnEmail,
|
||||||
message: L10n.of(context)!.pleaseClickOnLink,
|
message: L10n.of(context)!.pleaseClickOnLink,
|
||||||
|
@ -69,7 +67,6 @@ class Settings3PidController extends State<Settings3Pid> {
|
||||||
|
|
||||||
void delete3Pid(ThirdPartyIdentifier identifier) async {
|
void delete3Pid(ThirdPartyIdentifier identifier) async {
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
|
|
@ -119,7 +119,6 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
|
||||||
final completer = Completer<OkCancelResult>();
|
final completer = Completer<OkCancelResult>();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
final result = await showOkCancelAlertDialog(
|
final result = await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.emoteExists,
|
title: L10n.of(context)!.emoteExists,
|
||||||
message: imageCode,
|
message: imageCode,
|
||||||
|
|
|
@ -138,7 +138,6 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
if (pack!.images.keys.any((k) => k == imageCode && k != oldImageCode)) {
|
if (pack!.images.keys.any((k) => k == imageCode && k != oldImageCode)) {
|
||||||
controller.text = oldImageCode;
|
controller.text = oldImageCode;
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context)!.emoteExists,
|
message: L10n.of(context)!.emoteExists,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -148,7 +147,6 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
if (!RegExp(r'^[-\w]+$').hasMatch(imageCode)) {
|
if (!RegExp(r'^[-\w]+$').hasMatch(imageCode)) {
|
||||||
controller.text = oldImageCode;
|
controller.text = oldImageCode;
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context)!.emoteInvalid,
|
message: L10n.of(context)!.emoteInvalid,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -184,7 +182,6 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
if (newImageCodeController.text.isEmpty ||
|
if (newImageCodeController.text.isEmpty ||
|
||||||
newImageController.value == null) {
|
newImageController.value == null) {
|
||||||
await showOkAlertDialog(
|
await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context)!.emoteWarnNeedToPick,
|
message: L10n.of(context)!.emoteWarnNeedToPick,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -194,7 +191,6 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
final imageCode = newImageCodeController.text;
|
final imageCode = newImageCodeController.text;
|
||||||
if (pack!.images.containsKey(imageCode)) {
|
if (pack!.images.containsKey(imageCode)) {
|
||||||
await showOkAlertDialog(
|
await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context)!.emoteExists,
|
message: L10n.of(context)!.emoteExists,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -203,7 +199,6 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
}
|
}
|
||||||
if (!RegExp(r'^[-\w]+$').hasMatch(imageCode)) {
|
if (!RegExp(r'^[-\w]+$').hasMatch(imageCode)) {
|
||||||
await showOkAlertDialog(
|
await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context)!.emoteInvalid,
|
message: L10n.of(context)!.emoteInvalid,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -310,7 +305,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
// breaks [Matrix.of] calls otherwise
|
// breaks [Matrix.of] calls otherwise
|
||||||
useRootNavigator: false,
|
|
||||||
builder: (context) => ImportEmoteArchiveDialog(
|
builder: (context) => ImportEmoteArchiveDialog(
|
||||||
controller: this,
|
controller: this,
|
||||||
archive: archive,
|
archive: archive,
|
||||||
|
|
|
@ -28,7 +28,6 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
AppLock.of(context).showLockScreen();
|
AppLock.of(context).showLockScreen();
|
||||||
}
|
}
|
||||||
final newLock = await showTextInputDialog(
|
final newLock = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.pleaseChooseAPasscode,
|
title: L10n.of(context)!.pleaseChooseAPasscode,
|
||||||
message: L10n.of(context)!.pleaseEnter4Digits,
|
message: L10n.of(context)!.pleaseEnter4Digits,
|
||||||
|
@ -57,7 +56,6 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
|
|
||||||
void deleteAccountAction() async {
|
void deleteAccountAction() async {
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.warning,
|
title: L10n.of(context)!.warning,
|
||||||
message: L10n.of(context)!.deactivateAccountWarning,
|
message: L10n.of(context)!.deactivateAccountWarning,
|
||||||
|
@ -69,7 +67,6 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
}
|
}
|
||||||
final supposedMxid = Matrix.of(context).client.userID!;
|
final supposedMxid = Matrix.of(context).client.userID!;
|
||||||
final mxids = await showTextInputDialog(
|
final mxids = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.confirmMatrixId,
|
title: L10n.of(context)!.confirmMatrixId,
|
||||||
textFields: [
|
textFields: [
|
||||||
|
@ -86,7 +83,6 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.pleaseEnterYourPassword,
|
title: L10n.of(context)!.pleaseEnterYourPassword,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
|
|
@ -120,7 +120,6 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
);
|
);
|
||||||
if (score == null) return;
|
if (score == null) return;
|
||||||
final reason = await showTextInputDialog(
|
final reason = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.whyDoYouWantToReportThis,
|
title: L10n.of(context)!.whyDoYouWantToReportThis,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
|
@ -150,12 +149,12 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
case UserBottomSheetAction.ban:
|
case UserBottomSheetAction.ban:
|
||||||
if (user == null) throw ('User must not be null for this action!');
|
if (user == null) throw ('User must not be null for this action!');
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
cancelLabel: L10n.of(context)!.no,
|
cancelLabel: L10n.of(context)!.no,
|
||||||
message: L10n.of(context)!.banUserDescription,
|
message: L10n.of(context)!.banUserDescription,
|
||||||
|
isDestructiveAction: true,
|
||||||
) ==
|
) ==
|
||||||
OkCancelResult.ok) {
|
OkCancelResult.ok) {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
|
@ -168,7 +167,6 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
case UserBottomSheetAction.unban:
|
case UserBottomSheetAction.unban:
|
||||||
if (user == null) throw ('User must not be null for this action!');
|
if (user == null) throw ('User must not be null for this action!');
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
@ -186,7 +184,6 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
case UserBottomSheetAction.kick:
|
case UserBottomSheetAction.kick:
|
||||||
if (user == null) throw ('User must not be null for this action!');
|
if (user == null) throw ('User must not be null for this action!');
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
@ -210,7 +207,6 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
if (newPermission != null) {
|
if (newPermission != null) {
|
||||||
if (newPermission == 100 &&
|
if (newPermission == 100 &&
|
||||||
await showOkCancelAlertDialog(
|
await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.yes,
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
|
|
@ -324,7 +324,7 @@ class BackgroundPush {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setupUp() async {
|
Future<void> setupUp() async {
|
||||||
await UnifiedPush.registerAppWithDialog(matrix!.context);
|
await UnifiedPush.registerAppWithDialog(matrix!.navigatorContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _newUpEndpoint(String newEndpoint, String i) async {
|
Future<void> _newUpEndpoint(String newEndpoint, String i) async {
|
||||||
|
|
|
@ -22,7 +22,7 @@ extension UiaRequestManager on MatrixState {
|
||||||
case AuthenticationTypes.password:
|
case AuthenticationTypes.password:
|
||||||
final input = cachedPassword ??
|
final input = cachedPassword ??
|
||||||
(await showTextInputDialog(
|
(await showTextInputDialog(
|
||||||
context: context,
|
context: navigatorContext,
|
||||||
title: l10n.pleaseEnterYourPassword,
|
title: l10n.pleaseEnterYourPassword,
|
||||||
okLabel: l10n.ok,
|
okLabel: l10n.ok,
|
||||||
cancelLabel: l10n.cancel,
|
cancelLabel: l10n.cancel,
|
||||||
|
@ -62,8 +62,7 @@ extension UiaRequestManager on MatrixState {
|
||||||
);
|
);
|
||||||
if (OkCancelResult.ok ==
|
if (OkCancelResult.ok ==
|
||||||
await showOkCancelAlertDialog(
|
await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
context: navigatorContext,
|
||||||
context: context,
|
|
||||||
title: l10n.weSentYouAnEmail,
|
title: l10n.weSentYouAnEmail,
|
||||||
message: l10n.pleaseClickOnLink,
|
message: l10n.pleaseClickOnLink,
|
||||||
okLabel: l10n.iHaveClickedOnLink,
|
okLabel: l10n.iHaveClickedOnLink,
|
||||||
|
@ -86,9 +85,8 @@ extension UiaRequestManager on MatrixState {
|
||||||
launchUrlString(url.toString());
|
launchUrlString(url.toString());
|
||||||
if (OkCancelResult.ok ==
|
if (OkCancelResult.ok ==
|
||||||
await showOkCancelAlertDialog(
|
await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
message: l10n.pleaseFollowInstructionsOnWeb,
|
message: l10n.pleaseFollowInstructionsOnWeb,
|
||||||
context: context,
|
context: navigatorContext,
|
||||||
okLabel: l10n.next,
|
okLabel: l10n.next,
|
||||||
cancelLabel: l10n.cancel,
|
cancelLabel: l10n.cancel,
|
||||||
)) {
|
)) {
|
||||||
|
|
|
@ -189,7 +189,6 @@ class UrlLauncher {
|
||||||
}
|
}
|
||||||
if (roomIdOrAlias.sigil == '!') {
|
if (roomIdOrAlias.sigil == '!') {
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: 'Join room $roomIdOrAlias',
|
title: 'Join room $roomIdOrAlias',
|
||||||
) ==
|
) ==
|
||||||
|
|
|
@ -247,7 +247,6 @@ class CallKeepManager {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
useRootNavigator: false,
|
|
||||||
builder: (_) => AlertDialog(
|
builder: (_) => AlertDialog(
|
||||||
title: Text(L10n.of(context)!.callingPermissions),
|
title: Text(L10n.of(context)!.callingPermissions),
|
||||||
content: Column(
|
content: Column(
|
||||||
|
|
|
@ -106,12 +106,12 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
case 'leave':
|
case 'leave':
|
||||||
final confirmed = await showOkCancelAlertDialog(
|
final confirmed = await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.areYouSure,
|
title: L10n.of(context)!.areYouSure,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
message: L10n.of(context)!.archiveRoomDescription,
|
message: L10n.of(context)!.archiveRoomDescription,
|
||||||
|
isDestructiveAction: true,
|
||||||
);
|
);
|
||||||
if (confirmed == OkCancelResult.ok) {
|
if (confirmed == OkCancelResult.ok) {
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
|
|
|
@ -52,19 +52,13 @@ class FluffyChatApp extends StatelessWidget {
|
||||||
builder: (context, child) => AppLockWidget(
|
builder: (context, child) => AppLockWidget(
|
||||||
pincode: pincode,
|
pincode: pincode,
|
||||||
clients: clients,
|
clients: clients,
|
||||||
// Need a navigator above the Matrix widget for
|
child: Matrix(
|
||||||
// displaying dialogs
|
|
||||||
child: Navigator(
|
|
||||||
onGenerateRoute: (_) => MaterialPageRoute(
|
|
||||||
builder: (_) => Matrix(
|
|
||||||
clients: clients,
|
clients: clients,
|
||||||
store: store,
|
store: store,
|
||||||
child: testWidget ?? child,
|
child: testWidget ?? child,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,8 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
|
|
||||||
BackgroundPush? backgroundPush;
|
BackgroundPush? backgroundPush;
|
||||||
|
|
||||||
|
late BuildContext navigatorContext;
|
||||||
|
|
||||||
Client get client {
|
Client get client {
|
||||||
if (widget.clients.isEmpty) {
|
if (widget.clients.isEmpty) {
|
||||||
widget.clients.add(getLoginClient());
|
widget.clients.add(getLoginClient());
|
||||||
|
@ -311,7 +313,8 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
};
|
};
|
||||||
request.onUpdate = null;
|
request.onUpdate = null;
|
||||||
hidPopup = true;
|
hidPopup = true;
|
||||||
await KeyVerificationDialog(request: request).show(context);
|
|
||||||
|
await KeyVerificationDialog(request: request).show(navigatorContext);
|
||||||
});
|
});
|
||||||
onLoginStateChanged[name] ??= c.onLoginStateChanged.stream.listen((state) {
|
onLoginStateChanged[name] ??= c.onLoginStateChanged.stream.listen((state) {
|
||||||
final loggedInWithMultipleClients = widget.clients.length > 1;
|
final loggedInWithMultipleClients = widget.clients.length > 1;
|
||||||
|
@ -322,7 +325,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
_cancelSubs(c.clientName);
|
_cancelSubs(c.clientName);
|
||||||
widget.clients.remove(c);
|
widget.clients.remove(c);
|
||||||
ClientManager.removeClientNameFromStore(c.clientName, store);
|
ClientManager.removeClientNameFromStore(c.clientName, store);
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(navigatorContext).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(L10n.of(context)!.oneClientLoggedOut),
|
content: Text(L10n.of(context)!.oneClientLoggedOut),
|
||||||
),
|
),
|
||||||
|
@ -382,7 +385,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
onFcmError: (errorMsg, {Uri? link}) async {
|
onFcmError: (errorMsg, {Uri? link}) async {
|
||||||
final result = await showOkCancelAlertDialog(
|
final result = await showOkCancelAlertDialog(
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
context: context,
|
context: navigatorContext,
|
||||||
title: L10n.of(context)!.pushNotificationsNotAvailable,
|
title: L10n.of(context)!.pushNotificationsNotAvailable,
|
||||||
message: errorMsg,
|
message: errorMsg,
|
||||||
fullyCapitalizedForMaterial: false,
|
fullyCapitalizedForMaterial: false,
|
||||||
|
|
Loading…
Reference in a new issue