From 0d4b7d67cc53e353868b7711af62d5f80ab06c8c Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 6 Oct 2024 08:35:37 +0200 Subject: [PATCH] refactor: Use non nullable localizations builder and lazy load on web --- l10n.yaml | 2 + lib/pages/archive/archive.dart | 8 +- lib/pages/archive/archive_view.dart | 6 +- lib/pages/bootstrap/bootstrap_dialog.dart | 66 ++++++------- lib/pages/chat/add_widget_tile.dart | 6 +- lib/pages/chat/add_widget_tile_view.dart | 16 ++-- lib/pages/chat/chat.dart | 83 ++++++++-------- lib/pages/chat/chat_app_bar_title.dart | 8 +- lib/pages/chat/chat_emoji_picker.dart | 6 +- lib/pages/chat/chat_input_row.dart | 30 +++--- lib/pages/chat/chat_view.dart | 30 +++--- lib/pages/chat/encryption_button.dart | 4 +- lib/pages/chat/event_info_dialog.dart | 16 ++-- lib/pages/chat/events/cute_events.dart | 6 +- lib/pages/chat/events/message.dart | 2 +- lib/pages/chat/events/message_content.dart | 18 ++-- lib/pages/chat/events/reply_content.dart | 2 +- lib/pages/chat/events/state_message.dart | 2 +- .../events/verification_request_content.dart | 6 +- lib/pages/chat/events/video_player.dart | 4 +- lib/pages/chat/input_bar.dart | 2 +- lib/pages/chat/pinned_events.dart | 10 +- lib/pages/chat/recording_dialog.dart | 10 +- lib/pages/chat/reply_display.dart | 4 +- lib/pages/chat/send_file_dialog.dart | 22 ++--- lib/pages/chat/send_location_dialog.dart | 14 +-- lib/pages/chat/sticker_picker_dialog.dart | 6 +- .../chat_access_settings_controller.dart | 20 ++-- .../chat_access_settings_page.dart | 24 ++--- lib/pages/chat_details/chat_details.dart | 28 +++--- lib/pages/chat_details/chat_details_view.dart | 39 ++++---- .../chat_details/participant_list_item.dart | 12 +-- .../chat_encryption_settings.dart | 28 +++--- .../chat_encryption_settings_view.dart | 18 ++-- lib/pages/chat_list/chat_list.dart | 95 +++++++++---------- lib/pages/chat_list/chat_list_body.dart | 20 ++-- lib/pages/chat_list/chat_list_header.dart | 8 +- lib/pages/chat_list/chat_list_item.dart | 22 ++--- lib/pages/chat_list/chat_list_view.dart | 10 +- .../chat_list/client_chooser_button.dart | 26 ++--- lib/pages/chat_list/space_view.dart | 56 +++++------ lib/pages/chat_members/chat_members_view.dart | 10 +- .../chat_permissions_settings.dart | 2 +- .../chat_permissions_settings_view.dart | 12 +-- .../permission_list_tile.dart | 42 ++++---- .../chat_search/chat_search_files_tab.dart | 10 +- .../chat_search/chat_search_images_tab.dart | 8 +- .../chat_search/chat_search_message_tab.dart | 10 +- lib/pages/chat_search/chat_search_view.dart | 17 ++-- .../device_settings/device_settings.dart | 22 ++--- .../device_settings/device_settings_view.dart | 8 +- .../user_device_list_item.dart | 18 ++-- lib/pages/dialer/dialer.dart | 10 +- .../homeserver_picker/homeserver_picker.dart | 4 +- .../homeserver_picker_view.dart | 22 ++--- lib/pages/image_viewer/image_viewer_view.dart | 8 +- .../invitation_selection.dart | 12 +-- .../invitation_selection_view.dart | 20 ++-- .../key_verification_dialog.dart | 42 ++++---- lib/pages/login/login.dart | 37 ++++---- lib/pages/login/login_view.dart | 10 +- lib/pages/new_group/new_group_view.dart | 12 +-- .../new_private_chat/new_private_chat.dart | 4 +- .../new_private_chat_view.dart | 18 ++-- .../new_private_chat/qr_scanner_modal.dart | 4 +- lib/pages/new_space/new_space.dart | 2 +- lib/pages/new_space/new_space_view.dart | 10 +- lib/pages/settings/settings.dart | 28 +++--- lib/pages/settings/settings_view.dart | 26 ++--- lib/pages/settings_3pid/settings_3pid.dart | 20 ++-- .../settings_3pid/settings_3pid_view.dart | 10 +- .../settings_chat/settings_chat_view.dart | 34 +++---- .../import_archive_dialog.dart | 18 ++-- .../settings_emotes/settings_emotes.dart | 20 ++-- .../settings_emotes/settings_emotes_view.dart | 16 ++-- .../settings_ignore_list.dart | 2 +- .../settings_ignore_list_view.dart | 10 +- .../settings_multiple_emotes_view.dart | 2 +- .../settings_notifications.dart | 16 ++-- .../settings_notifications_view.dart | 10 +- .../settings_password/settings_password.dart | 8 +- .../settings_password_view.dart | 12 +-- .../settings_security/settings_security.dart | 30 +++--- .../settings_security_view.dart | 30 +++--- .../settings_style/settings_style_view.dart | 28 +++--- .../user_bottom_sheet/user_bottom_sheet.dart | 56 +++++------ .../user_bottom_sheet_view.dart | 38 ++++---- lib/utils/client_manager.dart | 4 +- lib/utils/date_time_extension.dart | 8 +- lib/utils/error_reporter.dart | 8 +- lib/utils/fluffy_share.dart | 4 +- lib/utils/init_with_restore.dart | 2 +- lib/utils/localized_exception_extension.dart | 20 ++-- .../builder.dart | 2 +- .../cipher.dart | 2 +- .../matrix_file_extension.dart | 4 +- lib/utils/platform_infos.dart | 2 +- lib/utils/push_helper.dart | 2 +- lib/utils/room_status_extension.dart | 12 +-- lib/utils/show_update_snackbar.dart | 4 +- lib/utils/uia_request_manager.dart | 4 +- lib/utils/url_launcher.dart | 10 +- lib/utils/voip/callkeep_manager.dart | 12 +-- lib/widgets/chat_settings_popup_menu.dart | 20 ++-- lib/widgets/connection_status_header.dart | 4 +- lib/widgets/layouts/login_scaffold.dart | 4 +- .../local_notifications_extension.dart | 8 +- lib/widgets/lock_screen.dart | 6 +- lib/widgets/matrix.dart | 19 ++-- lib/widgets/permission_slider_dialog.dart | 6 +- lib/widgets/public_room_bottom_sheet.dart | 12 +-- 111 files changed, 879 insertions(+), 883 deletions(-) diff --git a/l10n.yaml b/l10n.yaml index a714613ee..95a4c4eac 100644 --- a/l10n.yaml +++ b/l10n.yaml @@ -3,3 +3,5 @@ template-arb-file: intl_en.arb output-localization-file: l10n.dart output-class: L10n preferred-supported-locales: ["en"] +use-deferred-loading: true +nullable-getter: false \ No newline at end of file diff --git a/lib/pages/archive/archive.dart b/lib/pages/archive/archive.dart index a3c35c347..d9550cd15 100644 --- a/lib/pages/archive/archive.dart +++ b/lib/pages/archive/archive.dart @@ -42,10 +42,10 @@ class ArchiveController extends State { if (await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.cancel, - message: L10n.of(context)!.clearArchive, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, + message: L10n.of(context).clearArchive, ) != OkCancelResult.ok) { return; diff --git a/lib/pages/archive/archive_view.dart b/lib/pages/archive/archive_view.dart index dc73addb9..8cfdb20c3 100644 --- a/lib/pages/archive/archive_view.dart +++ b/lib/pages/archive/archive_view.dart @@ -20,14 +20,14 @@ class ArchiveView extends StatelessWidget { builder: (BuildContext context, snapshot) => Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.archive), + title: Text(L10n.of(context).archive), actions: [ if (snapshot.data?.isNotEmpty ?? false) Padding( padding: const EdgeInsets.all(8.0), child: TextButton.icon( onPressed: controller.forgetAllAction, - label: Text(L10n.of(context)!.clearArchive), + label: Text(L10n.of(context).clearArchive), icon: const Icon(Icons.cleaning_services_outlined), ), ), @@ -40,7 +40,7 @@ class ArchiveView extends StatelessWidget { if (snapshot.hasError) { return Center( child: Text( - L10n.of(context)!.oopsSomethingWentWrong, + L10n.of(context).oopsSomethingWentWrong, textAlign: TextAlign.center, ), ); diff --git a/lib/pages/bootstrap/bootstrap_dialog.dart b/lib/pages/bootstrap/bootstrap_dialog.dart index b816d2fc1..322f73e18 100644 --- a/lib/pages/bootstrap/bootstrap_dialog.dart +++ b/lib/pages/bootstrap/bootstrap_dialog.dart @@ -61,12 +61,12 @@ class BootstrapDialogState extends State { String _getSecureStorageLocalizedName() { if (PlatformInfos.isAndroid) { - return L10n.of(context)!.storeInAndroidKeystore; + return L10n.of(context).storeInAndroidKeystore; } if (PlatformInfos.isIOS || PlatformInfos.isMacOS) { - return L10n.of(context)!.storeInAppleKeyChain; + return L10n.of(context).storeInAppleKeyChain; } - return L10n.of(context)!.storeSecurlyOnThisDevice; + return L10n.of(context).storeSecurlyOnThisDevice; } @override @@ -92,12 +92,12 @@ class BootstrapDialogState extends State { _wipe ??= widget.wipe; final buttons = []; Widget body = const CircularProgressIndicator.adaptive(); - titleText = L10n.of(context)!.loadingPleaseWait; + titleText = L10n.of(context).loadingPleaseWait; if (bootstrap.newSsssKey?.recoveryKey != null && _recoveryKeyStored == false) { final key = bootstrap.newSsssKey!.recoveryKey; - titleText = L10n.of(context)!.recoveryKey; + titleText = L10n.of(context).recoveryKey; return Scaffold( appBar: AppBar( centerTitle: true, @@ -105,7 +105,7 @@ class BootstrapDialogState extends State { icon: const Icon(Icons.close), onPressed: Navigator.of(context).pop, ), - title: Text(L10n.of(context)!.recoveryKey), + title: Text(L10n.of(context).recoveryKey), ), body: Center( child: ConstrainedBox( @@ -123,7 +123,7 @@ class BootstrapDialogState extends State { color: theme.colorScheme.primary, ), ), - subtitle: Text(L10n.of(context)!.chatBackupDescription), + subtitle: Text(L10n.of(context).chatBackupDescription), ), const Divider( height: 32, @@ -153,7 +153,7 @@ class BootstrapDialogState extends State { }, title: Text(_getSecureStorageLocalizedName()), subtitle: - Text(L10n.of(context)!.storeInSecureStorageDescription), + Text(L10n.of(context).storeInSecureStorageDescription), ), const SizedBox(height: 16), CheckboxListTile.adaptive( @@ -164,13 +164,13 @@ class BootstrapDialogState extends State { FluffyShare.share(key!, context); setState(() => _recoveryKeyCopied = true); }, - title: Text(L10n.of(context)!.copyToClipboard), - subtitle: Text(L10n.of(context)!.saveKeyManuallyDescription), + title: Text(L10n.of(context).copyToClipboard), + subtitle: Text(L10n.of(context).saveKeyManuallyDescription), ), const SizedBox(height: 16), ElevatedButton.icon( icon: const Icon(Icons.check_outlined), - label: Text(L10n.of(context)!.next), + label: Text(L10n.of(context).next), onPressed: (_recoveryKeyCopied || _storeInSecureStorage == true) ? () { @@ -227,7 +227,7 @@ class BootstrapDialogState extends State { icon: const Icon(Icons.close), onPressed: Navigator.of(context).pop, ), - title: Text(L10n.of(context)!.chatBackup), + title: Text(L10n.of(context).chatBackup), ), body: Center( child: ConstrainedBox( @@ -245,7 +245,7 @@ class BootstrapDialogState extends State { color: theme.colorScheme.primary, ), subtitle: Text( - L10n.of(context)!.pleaseEnterRecoveryKeyDescription, + L10n.of(context).pleaseEnterRecoveryKeyDescription, ), ), const Divider(height: 32), @@ -265,7 +265,7 @@ class BootstrapDialogState extends State { fontFamily: theme.textTheme.bodyLarge?.fontFamily, ), prefixIcon: const Icon(Icons.key_outlined), - labelText: L10n.of(context)!.recoveryKey, + labelText: L10n.of(context).recoveryKey, hintText: 'Es** **** **** ****', errorText: _recoveryKeyInputError, errorMaxLines: 2, @@ -280,7 +280,7 @@ class BootstrapDialogState extends State { icon: _recoveryKeyInputLoading ? const CircularProgressIndicator.adaptive() : const Icon(Icons.lock_open_outlined), - label: Text(L10n.of(context)!.unlockOldMessages), + label: Text(L10n.of(context).unlockOldMessages), onPressed: _recoveryKeyInputLoading ? null : () async { @@ -323,7 +323,7 @@ class BootstrapDialogState extends State { } on FormatException catch (_) { setState( () => _recoveryKeyInputError = - L10n.of(context)!.wrongRecoveryKey, + L10n.of(context).wrongRecoveryKey, ); } catch (e, s) { ErrorReporter( @@ -347,7 +347,7 @@ class BootstrapDialogState extends State { const Expanded(child: Divider()), Padding( padding: const EdgeInsets.all(12.0), - child: Text(L10n.of(context)!.or), + child: Text(L10n.of(context).or), ), const Expanded(child: Divider()), ], @@ -355,17 +355,17 @@ class BootstrapDialogState extends State { const SizedBox(height: 16), ElevatedButton.icon( icon: const Icon(Icons.cast_connected_outlined), - label: Text(L10n.of(context)!.transferFromAnotherDevice), + label: Text(L10n.of(context).transferFromAnotherDevice), onPressed: _recoveryKeyInputLoading ? null : () async { final consent = await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.verifyOtherDevice, - message: L10n.of(context)! + title: L10n.of(context).verifyOtherDevice, + message: L10n.of(context) .verifyOtherDeviceDescription, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, fullyCapitalizedForMaterial: false, ); if (consent != OkCancelResult.ok) return; @@ -391,7 +391,7 @@ class BootstrapDialogState extends State { foregroundColor: theme.colorScheme.onErrorContainer, ), icon: const Icon(Icons.delete_outlined), - label: Text(L10n.of(context)!.recoveryKeyLost), + label: Text(L10n.of(context).recoveryKeyLost), onPressed: _recoveryKeyInputLoading ? null : () async { @@ -399,10 +399,10 @@ class BootstrapDialogState extends State { await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.recoveryKeyLost, - message: L10n.of(context)!.wipeChatBackup, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).recoveryKeyLost, + message: L10n.of(context).wipeChatBackup, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, isDestructiveAction: true, )) { setState(() => _createBootstrap(true)); @@ -440,18 +440,18 @@ class BootstrapDialogState extends State { ); break; case BootstrapState.error: - titleText = L10n.of(context)!.oopsSomethingWentWrong; + titleText = L10n.of(context).oopsSomethingWentWrong; body = const Icon(Icons.error_outline, color: Colors.red, size: 80); buttons.add( OutlinedButton( onPressed: () => Navigator.of(context, rootNavigator: false).pop(false), - child: Text(L10n.of(context)!.close), + child: Text(L10n.of(context).close), ), ); break; case BootstrapState.done: - titleText = L10n.of(context)!.everythingReady; + titleText = L10n.of(context).everythingReady; body = Column( mainAxisSize: MainAxisSize.min, children: [ @@ -462,7 +462,7 @@ class BootstrapDialogState extends State { ), const SizedBox(height: 16), Text( - L10n.of(context)!.yourChatBackupHasBeenSetUp, + L10n.of(context).yourChatBackupHasBeenSetUp, style: const TextStyle(fontSize: 20), ), const SizedBox(height: 16), @@ -472,7 +472,7 @@ class BootstrapDialogState extends State { OutlinedButton( onPressed: () => Navigator.of(context, rootNavigator: false).pop(false), - child: Text(L10n.of(context)!.close), + child: Text(L10n.of(context).close), ), ); break; @@ -487,7 +487,7 @@ class BootstrapDialogState extends State { Navigator.of(context, rootNavigator: false).pop(true), ), ), - title: Text(titleText ?? L10n.of(context)!.loadingPleaseWait), + title: Text(titleText ?? L10n.of(context).loadingPleaseWait), ), body: Center( child: Column( diff --git a/lib/pages/chat/add_widget_tile.dart b/lib/pages/chat/add_widget_tile.dart index 11e3cce5d..066ce3d65 100644 --- a/lib/pages/chat/add_widget_tile.dart +++ b/lib/pages/chat/add_widget_tile.dart @@ -43,14 +43,14 @@ class AddWidgetTileState extends State { if (name.length < 3) { setState(() { - nameError = L10n.of(context)!.widgetNameError; + nameError = L10n.of(context).widgetNameError; }); return; } if (uri == null || uri.scheme != 'https') { setState(() { - urlError = L10n.of(context)!.widgetUrlError; + urlError = L10n.of(context).widgetUrlError; }); return; } @@ -75,7 +75,7 @@ class AddWidgetTileState extends State { Navigator.of(context).pop(); } catch (e) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.errorAddingWidget)), + SnackBar(content: Text(L10n.of(context).errorAddingWidget)), ); } } diff --git a/lib/pages/chat/add_widget_tile_view.dart b/lib/pages/chat/add_widget_tile_view.dart index 18153faba..ea7bb9721 100644 --- a/lib/pages/chat/add_widget_tile_view.dart +++ b/lib/pages/chat/add_widget_tile_view.dart @@ -13,7 +13,7 @@ class AddWidgetTileView extends StatelessWidget { @override Widget build(BuildContext context) { return ExpansionTile( - title: Text(L10n.of(context)!.addWidget), + title: Text(L10n.of(context).addWidget), leading: const Icon(Icons.add), initiallyExpanded: controller.initiallyExpanded, children: [ @@ -21,10 +21,10 @@ class AddWidgetTileView extends StatelessWidget { groupValue: controller.widgetType, padding: const EdgeInsets.all(8), children: { - 'm.etherpad': Text(L10n.of(context)!.widgetEtherpad), - 'm.jitsi': Text(L10n.of(context)!.widgetJitsi), - 'm.video': Text(L10n.of(context)!.widgetVideo), - 'm.custom': Text(L10n.of(context)!.widgetCustom), + 'm.etherpad': Text(L10n.of(context).widgetEtherpad), + 'm.jitsi': Text(L10n.of(context).widgetJitsi), + 'm.video': Text(L10n.of(context).widgetVideo), + 'm.custom': Text(L10n.of(context).widgetCustom), }.map( (key, value) => MapEntry( key, @@ -43,7 +43,7 @@ class AddWidgetTileView extends StatelessWidget { autofocus: true, decoration: InputDecoration( prefixIcon: const Icon(Icons.label), - label: Text(L10n.of(context)!.widgetName), + label: Text(L10n.of(context).widgetName), errorText: controller.nameError, ), ), @@ -54,7 +54,7 @@ class AddWidgetTileView extends StatelessWidget { controller: controller.urlController, decoration: InputDecoration( prefixIcon: const Icon(Icons.add_link), - label: Text(L10n.of(context)!.link), + label: Text(L10n.of(context).link), errorText: controller.urlError, ), ), @@ -63,7 +63,7 @@ class AddWidgetTileView extends StatelessWidget { children: [ TextButton( onPressed: controller.addWidget, - child: Text(L10n.of(context)!.addWidget), + child: Text(L10n.of(context).addWidget), ), ], ), diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 69fd67062..d872a02f9 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -56,12 +56,11 @@ class ChatPage extends StatelessWidget { final room = Matrix.of(context).client.getRoomById(roomId); if (room == null) { return Scaffold( - appBar: AppBar(title: Text(L10n.of(context)!.oopsSomethingWentWrong)), + appBar: AppBar(title: Text(L10n.of(context).oopsSomethingWentWrong)), body: Center( child: Padding( padding: const EdgeInsets.all(16), - child: - Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat), + child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat), ), ), ); @@ -446,7 +445,7 @@ class ChatController extends State final commandMatch = RegExp(r'^\/(\w+)').firstMatch(sendController.text); if (commandMatch != null && !sendingClient.commands.keys.contains(commandMatch[1]!.toLowerCase())) { - final l10n = L10n.of(context)!; + final l10n = L10n.of(context); final dialogResult = await showOkCancelAlertDialog( context: context, title: l10n.commandInvalid, @@ -564,9 +563,9 @@ class ChatController extends State if (info.version.sdkInt < 19) { showOkAlertDialog( context: context, - title: L10n.of(context)!.unsupportedAndroidVersion, - message: L10n.of(context)!.unsupportedAndroidVersionLong, - okLabel: L10n.of(context)!.close, + title: L10n.of(context).unsupportedAndroidVersion, + message: L10n.of(context).unsupportedAndroidVersionLong, + okLabel: L10n.of(context).close, ); return; } @@ -646,12 +645,12 @@ class ChatController extends State if (selectedEvents.length == 1) { return selectedEvents.first .getDisplayEvent(timeline!) - .calcLocalizedBodyFallback(MatrixLocals(L10n.of(context)!)); + .calcLocalizedBodyFallback(MatrixLocals(L10n.of(context))); } for (final event in selectedEvents) { if (copyString.isNotEmpty) copyString += '\n\n'; copyString += event.getDisplayEvent(timeline!).calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), withSenderNamePrefix: true, ); } @@ -670,32 +669,32 @@ class ChatController extends State final event = selectedEvents.single; final score = await showConfirmationDialog( context: context, - title: L10n.of(context)!.reportMessage, - message: L10n.of(context)!.howOffensiveIsThisContent, - cancelLabel: L10n.of(context)!.cancel, - okLabel: L10n.of(context)!.ok, + title: L10n.of(context).reportMessage, + message: L10n.of(context).howOffensiveIsThisContent, + cancelLabel: L10n.of(context).cancel, + okLabel: L10n.of(context).ok, actions: [ AlertDialogAction( key: -100, - label: L10n.of(context)!.extremeOffensive, + label: L10n.of(context).extremeOffensive, ), AlertDialogAction( key: -50, - label: L10n.of(context)!.offensive, + label: L10n.of(context).offensive, ), AlertDialogAction( key: 0, - label: L10n.of(context)!.inoffensive, + label: L10n.of(context).inoffensive, ), ], ); if (score == null) return; final reason = await showTextInputDialog( context: context, - title: L10n.of(context)!.whyDoYouWantToReportThis, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, - textFields: [DialogTextField(hintText: L10n.of(context)!.reason)], + title: L10n.of(context).whyDoYouWantToReportThis, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, + textFields: [DialogTextField(hintText: L10n.of(context).reason)], ); if (reason == null || reason.single.isEmpty) return; final result = await showFutureLoadingDialog( @@ -713,7 +712,7 @@ class ChatController extends State selectedEvents.clear(); }); ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.contentHasBeenReported)), + SnackBar(content: Text(L10n.of(context).contentHasBeenReported)), ); } @@ -740,16 +739,16 @@ class ChatController extends State final reasonInput = selectedEvents.any((event) => event.status.isSent) ? await showTextInputDialog( context: context, - title: L10n.of(context)!.redactMessage, - message: L10n.of(context)!.redactMessageDescription, + title: L10n.of(context).redactMessage, + message: L10n.of(context).redactMessageDescription, isDestructiveAction: true, textFields: [ DialogTextField( - hintText: L10n.of(context)!.optionalRedactReason, + hintText: L10n.of(context).optionalRedactReason, ), ], - okLabel: L10n.of(context)!.remove, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).remove, + cancelLabel: L10n.of(context).cancel, ) : []; if (reasonInput == null) return; @@ -1015,7 +1014,7 @@ class ChatController extends State editEvent = selectedEvents.first; sendController.text = editEvent!.getDisplayEvent(timeline!).calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), withSenderNamePrefix: false, hideReply: true, ); @@ -1028,13 +1027,13 @@ class ChatController extends State if (OkCancelResult.ok != await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.goToTheNewRoom, + title: L10n.of(context).goToTheNewRoom, message: room .getState(EventTypes.RoomTombstone)! .parsedTombstoneContent .body, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, )) { return; } @@ -1117,10 +1116,10 @@ class ChatController extends State unpinEvent(String eventId) async { final response = await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.unpin, - message: L10n.of(context)!.confirmEventUnpin, - okLabel: L10n.of(context)!.unpin, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).unpin, + message: L10n.of(context).confirmEventUnpin, + okLabel: L10n.of(context).unpin, + cancelLabel: L10n.of(context).cancel, ); if (response == OkCancelResult.ok) { final events = room.pinnedEventIds @@ -1214,26 +1213,26 @@ class ChatController extends State Navigator.pop(context); showOkAlertDialog( context: context, - title: L10n.of(context)!.unsupportedAndroidVersion, - message: L10n.of(context)!.unsupportedAndroidVersionLong, - okLabel: L10n.of(context)!.close, + title: L10n.of(context).unsupportedAndroidVersion, + message: L10n.of(context).unsupportedAndroidVersionLong, + okLabel: L10n.of(context).close, ); } }); } final callType = await showModalActionSheet( context: context, - title: L10n.of(context)!.warning, - message: L10n.of(context)!.videoCallsBetaWarning, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).warning, + message: L10n.of(context).videoCallsBetaWarning, + cancelLabel: L10n.of(context).cancel, actions: [ SheetAction( - label: L10n.of(context)!.voiceCall, + label: L10n.of(context).voiceCall, icon: Icons.phone_outlined, key: CallType.kVoice, ), SheetAction( - label: L10n.of(context)!.videoCall, + label: L10n.of(context).videoCall, icon: Icons.video_call_outlined, key: CallType.kVideo, ), diff --git a/lib/pages/chat/chat_app_bar_title.dart b/lib/pages/chat/chat_app_bar_title.dart index 5d3f34457..09ead63ce 100644 --- a/lib/pages/chat/chat_app_bar_title.dart +++ b/lib/pages/chat/chat_app_bar_title.dart @@ -36,7 +36,7 @@ class ChatAppBarTitle extends StatelessWidget { child: Avatar( mxContent: room.avatar, name: room.getLocalizedDisplayname( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ), size: 32, ), @@ -47,7 +47,7 @@ class ChatAppBarTitle extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), + room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))), maxLines: 1, overflow: TextOverflow.ellipsis, style: const TextStyle( @@ -63,13 +63,13 @@ class ChatAppBarTitle extends StatelessWidget { final style = Theme.of(context).textTheme.bodySmall; if (presence?.currentlyActive == true) { return Text( - L10n.of(context)!.currentlyActive, + L10n.of(context).currentlyActive, style: style, ); } if (lastActiveTimestamp != null) { return Text( - L10n.of(context)!.lastActiveAgo( + L10n.of(context).lastActiveAgo( lastActiveTimestamp.localizedTimeShort(context), ), style: style, diff --git a/lib/pages/chat/chat_emoji_picker.dart b/lib/pages/chat/chat_emoji_picker.dart index 1ef7e2363..0c5633545 100644 --- a/lib/pages/chat/chat_emoji_picker.dart +++ b/lib/pages/chat/chat_emoji_picker.dart @@ -30,8 +30,8 @@ class ChatEmojiPicker extends StatelessWidget { children: [ TabBar( tabs: [ - Tab(text: L10n.of(context)!.emojis), - Tab(text: L10n.of(context)!.stickers), + Tab(text: L10n.of(context).emojis), + Tab(text: L10n.of(context).stickers), ], ), Expanded( @@ -97,7 +97,7 @@ class NoRecent extends StatelessWidget { @override Widget build(BuildContext context) { return Text( - L10n.of(context)!.emoteKeyboardNoRecents, + L10n.of(context).emoteKeyboardNoRecents, style: Theme.of(context).textTheme.bodyLarge, ); } diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index 3ad750376..b22d905af 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -44,7 +44,7 @@ class ChatInputRow extends StatelessWidget { child: Row( children: [ const Icon(Icons.delete), - Text(L10n.of(context)!.delete), + Text(L10n.of(context).delete), ], ), ), @@ -57,7 +57,7 @@ class ChatInputRow extends StatelessWidget { child: Row( children: [ const Icon(Icons.keyboard_arrow_left_outlined), - Text(L10n.of(context)!.forward), + Text(L10n.of(context).forward), ], ), ), @@ -73,7 +73,7 @@ class ChatInputRow extends StatelessWidget { onPressed: controller.replyAction, child: Row( children: [ - Text(L10n.of(context)!.reply), + Text(L10n.of(context).reply), const Icon(Icons.keyboard_arrow_right), ], ), @@ -85,7 +85,7 @@ class ChatInputRow extends StatelessWidget { onPressed: controller.sendAgainAction, child: Row( children: [ - Text(L10n.of(context)!.tryToSendAgain), + Text(L10n.of(context).tryToSendAgain), const SizedBox(width: 4), const Icon(Icons.send_outlined, size: 16), ], @@ -103,7 +103,7 @@ class ChatInputRow extends StatelessWidget { }, onKeysPressed: () => controller.onAddPopupMenuButtonSelected('file'), - helpLabel: L10n.of(context)!.sendFile, + helpLabel: L10n.of(context).sendFile, child: AnimatedContainer( duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve, @@ -125,7 +125,7 @@ class ChatInputRow extends StatelessWidget { foregroundColor: Colors.white, child: Icon(Icons.attachment_outlined), ), - title: Text(L10n.of(context)!.sendFile), + title: Text(L10n.of(context).sendFile), contentPadding: const EdgeInsets.all(0), ), ), @@ -137,7 +137,7 @@ class ChatInputRow extends StatelessWidget { foregroundColor: Colors.white, child: Icon(Icons.image_outlined), ), - title: Text(L10n.of(context)!.sendImage), + title: Text(L10n.of(context).sendImage), contentPadding: const EdgeInsets.all(0), ), ), @@ -150,7 +150,7 @@ class ChatInputRow extends StatelessWidget { foregroundColor: Colors.white, child: Icon(Icons.camera_alt_outlined), ), - title: Text(L10n.of(context)!.openCamera), + title: Text(L10n.of(context).openCamera), contentPadding: const EdgeInsets.all(0), ), ), @@ -163,7 +163,7 @@ class ChatInputRow extends StatelessWidget { foregroundColor: Colors.white, child: Icon(Icons.videocam_outlined), ), - title: Text(L10n.of(context)!.openVideoCamera), + title: Text(L10n.of(context).openVideoCamera), contentPadding: const EdgeInsets.all(0), ), ), @@ -176,7 +176,7 @@ class ChatInputRow extends StatelessWidget { foregroundColor: Colors.white, child: Icon(Icons.gps_fixed_outlined), ), - title: Text(L10n.of(context)!.shareLocation), + title: Text(L10n.of(context).shareLocation), contentPadding: const EdgeInsets.all(0), ), ), @@ -194,9 +194,9 @@ class ChatInputRow extends StatelessWidget { LogicalKeyboardKey.keyE, }, onKeysPressed: controller.emojiPickerAction, - helpLabel: L10n.of(context)!.emojis, + helpLabel: L10n.of(context).emojis, child: IconButton( - tooltip: L10n.of(context)!.emojis, + tooltip: L10n.of(context).emojis, icon: PageTransitionSwitcher( transitionBuilder: ( Widget child, @@ -255,7 +255,7 @@ class ChatInputRow extends StatelessWidget { bottom: 6.0, top: 3.0, ), - hintText: L10n.of(context)!.writeAMessage, + hintText: L10n.of(context).writeAMessage, hintMaxLines: 1, border: InputBorder.none, enabledBorder: InputBorder.none, @@ -272,7 +272,7 @@ class ChatInputRow extends StatelessWidget { child: PlatformInfos.platformCanRecord && controller.sendController.text.isEmpty ? FloatingActionButton.small( - tooltip: L10n.of(context)!.voiceMessage, + tooltip: L10n.of(context).voiceMessage, onPressed: controller.voiceMessageAction, elevation: 0, heroTag: null, @@ -284,7 +284,7 @@ class ChatInputRow extends StatelessWidget { child: const Icon(Icons.mic_none_outlined), ) : FloatingActionButton.small( - tooltip: L10n.of(context)!.send, + tooltip: L10n.of(context).send, onPressed: controller.send, elevation: 0, heroTag: null, diff --git a/lib/pages/chat/chat_view.dart b/lib/pages/chat/chat_view.dart index f22ef46bb..38484baa6 100644 --- a/lib/pages/chat/chat_view.dart +++ b/lib/pages/chat/chat_view.dart @@ -38,12 +38,12 @@ class ChatView extends StatelessWidget { if (controller.canEditSelectedEvents) IconButton( icon: const Icon(Icons.edit_outlined), - tooltip: L10n.of(context)!.edit, + tooltip: L10n.of(context).edit, onPressed: controller.editSelectedEventAction, ), IconButton( icon: const Icon(Icons.copy_outlined), - tooltip: L10n.of(context)!.copy, + tooltip: L10n.of(context).copy, onPressed: controller.copyEventsAction, ), if (controller.canSaveSelectedEvent) @@ -51,7 +51,7 @@ class ChatView extends StatelessWidget { Builder( builder: (context) => IconButton( icon: Icon(Icons.adaptive.share), - tooltip: L10n.of(context)!.share, + tooltip: L10n.of(context).share, onPressed: () => controller.saveSelectedEvent(context), ), ), @@ -59,12 +59,12 @@ class ChatView extends StatelessWidget { IconButton( icon: const Icon(Icons.push_pin_outlined), onPressed: controller.pinEvent, - tooltip: L10n.of(context)!.pinMessage, + tooltip: L10n.of(context).pinMessage, ), if (controller.canRedactSelectedEvents) IconButton( icon: const Icon(Icons.delete_outlined), - tooltip: L10n.of(context)!.redactMessage, + tooltip: L10n.of(context).redactMessage, onPressed: controller.redactEventsAction, ), if (controller.selectedEvents.length == 1) @@ -88,7 +88,7 @@ class ChatView extends StatelessWidget { children: [ const Icon(Icons.info_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.messageInfo), + Text(L10n.of(context).messageInfo), ], ), ), @@ -103,7 +103,7 @@ class ChatView extends StatelessWidget { color: Colors.red, ), const SizedBox(width: 12), - Text(L10n.of(context)!.reportMessage), + Text(L10n.of(context).reportMessage), ], ), ), @@ -117,7 +117,7 @@ class ChatView extends StatelessWidget { IconButton( onPressed: controller.onPhoneButtonTap, icon: const Icon(Icons.call_outlined), - tooltip: L10n.of(context)!.placeCall, + tooltip: L10n.of(context).placeCall, ), EncryptionButton(controller.room), ChatSettingsPopupMenu(controller.room, true), @@ -180,7 +180,7 @@ class ChatView extends StatelessWidget { ? IconButton( icon: const Icon(Icons.close), onPressed: controller.clearSelectedEvents, - tooltip: L10n.of(context)!.close, + tooltip: L10n.of(context).close, color: theme.colorScheme.primary, ) : StreamBuilder( @@ -213,7 +213,7 @@ class ChatView extends StatelessWidget { ), trailing: TextButton( onPressed: controller.goToNewRoomAction, - child: Text(L10n.of(context)!.goToTheNewRoom), + child: Text(L10n.of(context).goToTheNewRoom), ), ), if (scrollUpBannerEventId != null) @@ -221,13 +221,13 @@ class ChatView extends StatelessWidget { leading: IconButton( color: theme.colorScheme.onSurfaceVariant, icon: const Icon(Icons.close), - tooltip: L10n.of(context)!.close, + tooltip: L10n.of(context).close, onPressed: () { controller.discardScrollUpBannerEventId(); controller.setReadMarker(); }, ), - title: L10n.of(context)!.jumpToLastReadMessage, + title: L10n.of(context).jumpToLastReadMessage, trailing: TextButton( onPressed: () { controller.scrollToEventId( @@ -235,7 +235,7 @@ class ChatView extends StatelessWidget { ); controller.discardScrollUpBannerEventId(); }, - child: Text(L10n.of(context)!.jump), + child: Text(L10n.of(context).jump), ), ), ], @@ -333,7 +333,7 @@ class ChatView extends StatelessWidget { ), onPressed: controller.leaveChat, label: Text( - L10n.of(context)!.leave, + L10n.of(context).leave, ), ), TextButton.icon( @@ -347,7 +347,7 @@ class ChatView extends StatelessWidget { ), onPressed: controller.recreateChat, label: Text( - L10n.of(context)!.reopenChat, + L10n.of(context).reopenChat, ), ), ], diff --git a/lib/pages/chat/encryption_button.dart b/lib/pages/chat/encryption_button.dart index c68a1c976..9eae07677 100644 --- a/lib/pages/chat/encryption_button.dart +++ b/lib/pages/chat/encryption_button.dart @@ -25,8 +25,8 @@ class EncryptionButton extends StatelessWidget { : Future.value(EncryptionHealthState.allVerified), builder: (BuildContext context, snapshot) => IconButton( tooltip: room.encrypted - ? L10n.of(context)!.encrypted - : L10n.of(context)!.encryptionNotEnabled, + ? L10n.of(context).encrypted + : L10n.of(context).encryptionNotEnabled, icon: Icon( room.encrypted ? Icons.lock_outlined : Icons.lock_open_outlined, size: 20, diff --git a/lib/pages/chat/event_info_dialog.dart b/lib/pages/chat/event_info_dialog.dart index fd2dcc68f..dca325dfd 100644 --- a/lib/pages/chat/event_info_dialog.dart +++ b/lib/pages/chat/event_info_dialog.dart @@ -14,7 +14,7 @@ extension EventInfoDialogExtension on Event { void showInfoDialog(BuildContext context) => showAdaptiveBottomSheet( context: context, builder: (context) => - EventInfoDialog(l10n: L10n.of(context)!, event: this), + EventInfoDialog(l10n: L10n.of(context), event: this), ); } @@ -40,11 +40,11 @@ class EventInfoDialog extends StatelessWidget { final originalSource = event.originalSource; return Scaffold( appBar: AppBar( - title: Text(L10n.of(context)!.messageInfo), + title: Text(L10n.of(context).messageInfo), leading: IconButton( icon: const Icon(Icons.arrow_downward_outlined), onPressed: Navigator.of(context, rootNavigator: false).pop, - tooltip: L10n.of(context)!.close, + tooltip: L10n.of(context).close, ), ), body: ListView( @@ -56,20 +56,20 @@ class EventInfoDialog extends StatelessWidget { client: event.room.client, presenceUserId: event.senderId, ), - title: Text(L10n.of(context)!.sender), + title: Text(L10n.of(context).sender), subtitle: Text( '${event.senderFromMemoryOrFallback.calcDisplayname()} [${event.senderId}]', ), ), ListTile( - title: Text('${L10n.of(context)!.time}:'), + title: Text('${L10n.of(context).time}:'), subtitle: Text(event.originServerTs.localizedTime(context)), ), ListTile( - title: Text('${L10n.of(context)!.status}:'), + title: Text('${L10n.of(context).status}:'), subtitle: Text(event.status.name), ), - ListTile(title: Text('${L10n.of(context)!.sourceCode}:')), + ListTile(title: Text('${L10n.of(context).sourceCode}:')), Padding( padding: const EdgeInsets.all(12.0), child: Material( @@ -88,7 +88,7 @@ class EventInfoDialog extends StatelessWidget { ), ), if (originalSource != null) ...[ - ListTile(title: Text('${L10n.of(context)!.encrypted}:')), + ListTile(title: Text('${L10n.of(context).encrypted}:')), Padding( padding: const EdgeInsets.all(12.0), child: Material( diff --git a/lib/pages/chat/events/cute_events.dart b/lib/pages/chat/events/cute_events.dart index 6a9424818..4f073a283 100644 --- a/lib/pages/chat/events/cute_events.dart +++ b/lib/pages/chat/events/cute_events.dart @@ -72,19 +72,19 @@ class _CuteContentState extends State { generateLabel(User? user) { switch (widget.event.content['cute_type']) { case 'googly_eyes': - return L10n.of(context)?.googlyEyesContent( + return L10n.of(context).googlyEyesContent( user?.displayName ?? widget.event.senderFromMemoryOrFallback.displayName ?? '', ); case 'cuddle': - return L10n.of(context)?.cuddleContent( + return L10n.of(context).cuddleContent( user?.displayName ?? widget.event.senderFromMemoryOrFallback.displayName ?? '', ); case 'hug': - return L10n.of(context)?.hugContent( + return L10n.of(context).hugContent( user?.displayName ?? widget.event.senderFromMemoryOrFallback.displayName ?? '', diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart index 08bf9e306..d1a627b55 100644 --- a/lib/pages/chat/events/message.dart +++ b/lib/pages/chat/events/message.dart @@ -484,7 +484,7 @@ class Message extends StatelessWidget { horizontal: 8, ), child: Text( - L10n.of(context)!.readUpToHere, + L10n.of(context).readUpToHere, style: TextStyle(color: theme.colorScheme.primary), ), ), diff --git a/lib/pages/chat/events/message_content.dart b/lib/pages/chat/events/message_content.dart index 415e37428..48bc8c583 100644 --- a/lib/pages/chat/events/message_content.dart +++ b/lib/pages/chat/events/message_content.dart @@ -38,7 +38,7 @@ class MessageContent extends StatelessWidget { }); void _verifyOrRequestKey(BuildContext context) async { - final l10n = L10n.of(context)!; + final l10n = L10n.of(context); if (event.content['can_request_session'] != true) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( @@ -184,7 +184,7 @@ class MessageContent extends StatelessWidget { textColor: buttonTextColor, onPressed: () => _verifyOrRequestKey(context), icon: '🔒', - label: L10n.of(context)!.encrypted, + label: L10n.of(context).encrypted, fontSize: fontSize, ); case MessageTypes.Location: @@ -213,7 +213,7 @@ class MessageContent extends StatelessWidget { onPressed: UrlLauncher(context, geoUri.toString()).launchUrl, label: Text( - L10n.of(context)!.openInMaps, + L10n.of(context).openInMaps, style: TextStyle(color: textColor), ), ), @@ -233,11 +233,11 @@ class MessageContent extends StatelessWidget { event.redactedBecause?.content.tryGet('reason'); final redactedBy = snapshot.data?.calcDisplayname() ?? event.redactedBecause?.senderId.localpart ?? - L10n.of(context)!.user; + L10n.of(context).user; return _ButtonContent( label: reason == null - ? L10n.of(context)!.redactedBy(redactedBy) - : L10n.of(context)!.redactedByBecause( + ? L10n.of(context).redactedBy(redactedBy) + : L10n.of(context).redactedByBecause( redactedBy, reason, ), @@ -254,7 +254,7 @@ class MessageContent extends StatelessWidget { event.numberEmotes <= 10; return Linkify( text: event.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), hideReply: true, ), style: TextStyle( @@ -277,7 +277,7 @@ class MessageContent extends StatelessWidget { future: event.fetchSenderUser(), builder: (context, snapshot) { return _ButtonContent( - label: L10n.of(context)!.startedACall( + label: L10n.of(context).startedACall( snapshot.data?.calcDisplayname() ?? event.senderFromMemoryOrFallback.calcDisplayname(), ), @@ -293,7 +293,7 @@ class MessageContent extends StatelessWidget { future: event.fetchSenderUser(), builder: (context, snapshot) { return _ButtonContent( - label: L10n.of(context)!.userSentUnknownEvent( + label: L10n.of(context).userSentUnknownEvent( snapshot.data?.calcDisplayname() ?? event.senderFromMemoryOrFallback.calcDisplayname(), event.type, diff --git a/lib/pages/chat/events/reply_content.dart b/lib/pages/chat/events/reply_content.dart index 02e986f81..a3f18efee 100644 --- a/lib/pages/chat/events/reply_content.dart +++ b/lib/pages/chat/events/reply_content.dart @@ -72,7 +72,7 @@ class ReplyContent extends StatelessWidget { ), Text( displayEvent.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), withSenderNamePrefix: false, hideReply: true, ), diff --git a/lib/pages/chat/events/state_message.dart b/lib/pages/chat/events/state_message.dart index e38f75815..ab135a5c1 100644 --- a/lib/pages/chat/events/state_message.dart +++ b/lib/pages/chat/events/state_message.dart @@ -21,7 +21,7 @@ class StateMessage extends StatelessWidget { padding: const EdgeInsets.all(8), child: Text( event.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ), textAlign: TextAlign.center, style: TextStyle( diff --git a/lib/pages/chat/events/verification_request_content.dart b/lib/pages/chat/events/verification_request_content.dart index a09f007f7..9b085114f 100644 --- a/lib/pages/chat/events/verification_request_content.dart +++ b/lib/pages/chat/events/verification_request_content.dart @@ -58,10 +58,10 @@ class VerificationRequestContent extends StatelessWidget { canceled ? 'Error ${cancel.first.content.tryGet('code')}: ${cancel.first.content.tryGet('reason')}' : (fullyDone - ? L10n.of(context)!.verifySuccess + ? L10n.of(context).verifySuccess : (started - ? L10n.of(context)!.loadingPleaseWait - : L10n.of(context)!.newVerificationRequest)), + ? L10n.of(context).loadingPleaseWait + : L10n.of(context).newVerificationRequest)), ), ], ), diff --git a/lib/pages/chat/events/video_player.dart b/lib/pages/chat/events/video_player.dart index a23ab7bb0..3f2b3d0cc 100644 --- a/lib/pages/chat/events/video_player.dart +++ b/lib/pages/chat/events/video_player.dart @@ -137,8 +137,8 @@ class EventVideoPlayerState extends State { ) : const Icon(Icons.play_circle_outlined), tooltip: _isDownloading - ? L10n.of(context)!.loadingPleaseWait - : L10n.of(context)!.videoWithSize( + ? L10n.of(context).loadingPleaseWait + : L10n.of(context).videoWithSize( widget.event.sizeString ?? '?MB', ), onPressed: _isDownloading ? null : _downloadAction, diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index 1e1f3f40e..1d34c7055 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -226,7 +226,7 @@ class InputBar extends StatelessWidget { const padding = EdgeInsets.all(4.0); if (suggestion['type'] == 'command') { final command = suggestion['name']!; - final hint = commandHint(L10n.of(context)!, command); + final hint = commandHint(L10n.of(context), command); return Tooltip( message: hint, waitDuration: const Duration(days: 1), // don't show on hover diff --git a/lib/pages/chat/pinned_events.dart b/lib/pages/chat/pinned_events.dart index 1baa488c5..cae6bd2c9 100644 --- a/lib/pages/chat/pinned_events.dart +++ b/lib/pages/chat/pinned_events.dart @@ -32,13 +32,13 @@ class PinnedEvents extends StatelessWidget { ? events.single?.eventId : await showConfirmationDialog( context: context, - title: L10n.of(context)!.pinMessage, + title: L10n.of(context).pinMessage, actions: events .map( (event) => AlertDialogAction( key: event?.eventId ?? '', label: event?.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), withSenderNamePrefix: true, hideReply: true, ) ?? @@ -67,17 +67,17 @@ class PinnedEvents extends StatelessWidget { final event = snapshot.data; return ChatAppBarListTile( title: event?.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), withSenderNamePrefix: true, hideReply: true, ) ?? - L10n.of(context)!.loadingPleaseWait, + L10n.of(context).loadingPleaseWait, leading: IconButton( splashRadius: 18, iconSize: 18, color: theme.colorScheme.onSurfaceVariant, icon: const Icon(Icons.push_pin), - tooltip: L10n.of(context)!.unpin, + tooltip: L10n.of(context).unpin, onPressed: controller.room.canSendEvent(EventTypes.RoomPinnedEvents) ? () => controller.unpinEvent(event!.eventId) : null, diff --git a/lib/pages/chat/recording_dialog.dart b/lib/pages/chat/recording_dialog.dart index 937b0045d..68e86fa11 100644 --- a/lib/pages/chat/recording_dialog.dart +++ b/lib/pages/chat/recording_dialog.dart @@ -137,7 +137,7 @@ class RecordingDialogState extends State { final time = '${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}'; final content = error - ? Text(L10n.of(context)!.oopsSomethingWentWrong) + ? Text(L10n.of(context).oopsSomethingWentWrong) : Row( children: [ Container( @@ -185,7 +185,7 @@ class RecordingDialogState extends State { CupertinoDialogAction( onPressed: () => Navigator.of(context, rootNavigator: false).pop(), child: Text( - L10n.of(context)!.cancel.toUpperCase(), + L10n.of(context).cancel.toUpperCase(), style: TextStyle( color: theme.textTheme.bodyMedium?.color?.withAlpha(150), ), @@ -194,7 +194,7 @@ class RecordingDialogState extends State { if (error != true) CupertinoDialogAction( onPressed: _stopAndSend, - child: Text(L10n.of(context)!.send.toUpperCase()), + child: Text(L10n.of(context).send.toUpperCase()), ), ], ); @@ -205,7 +205,7 @@ class RecordingDialogState extends State { TextButton( onPressed: () => Navigator.of(context, rootNavigator: false).pop(), child: Text( - L10n.of(context)!.cancel.toUpperCase(), + L10n.of(context).cancel.toUpperCase(), style: TextStyle( color: theme.textTheme.bodyMedium?.color?.withAlpha(150), ), @@ -217,7 +217,7 @@ class RecordingDialogState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text(L10n.of(context)!.send.toUpperCase()), + Text(L10n.of(context).send.toUpperCase()), const SizedBox(width: 4), const Icon(Icons.send_outlined, size: 15), ], diff --git a/lib/pages/chat/reply_display.dart b/lib/pages/chat/reply_display.dart index 8de51d0f3..ec607e1ac 100644 --- a/lib/pages/chat/reply_display.dart +++ b/lib/pages/chat/reply_display.dart @@ -29,7 +29,7 @@ class ReplyDisplay extends StatelessWidget { child: Row( children: [ IconButton( - tooltip: L10n.of(context)!.close, + tooltip: L10n.of(context).close, icon: const Icon(Icons.close), onPressed: controller.cancelReplyEventAction, ), @@ -71,7 +71,7 @@ class _EditContent extends StatelessWidget { Container(width: 15.0), Text( event.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), withSenderNamePrefix: false, hideReply: true, ), diff --git a/lib/pages/chat/send_file_dialog.dart b/lib/pages/chat/send_file_dialog.dart index 5092d5566..121c215d6 100644 --- a/lib/pages/chat/send_file_dialog.dart +++ b/lib/pages/chat/send_file_dialog.dart @@ -40,7 +40,7 @@ class SendFileDialogState extends State { Future _send() async { final scaffoldMessenger = ScaffoldMessenger.of(widget.outerContext); - final l10n = L10n.of(context)!; + final l10n = L10n.of(context); try { scaffoldMessenger.showLoadingSnackBar(l10n.prepareSendingAttachment); @@ -146,7 +146,7 @@ class SendFileDialogState extends State { Widget build(BuildContext context) { final theme = Theme.of(context); - var sendStr = L10n.of(context)!.sendFile; + var sendStr = L10n.of(context).sendFile; final uniqueMimeType = widget.files .map((file) => file.mimeType ?? lookupMimeType(file.path)) .toSet() @@ -154,21 +154,21 @@ class SendFileDialogState extends State { final fileName = widget.files.length == 1 ? widget.files.single.name - : L10n.of(context)!.countFiles(widget.files.length.toString()); + : L10n.of(context).countFiles(widget.files.length.toString()); if (uniqueMimeType?.startsWith('image') ?? false) { - sendStr = L10n.of(context)!.sendImage; + sendStr = L10n.of(context).sendImage; } else if (uniqueMimeType?.startsWith('audio') ?? false) { - sendStr = L10n.of(context)!.sendAudio; + sendStr = L10n.of(context).sendAudio; } else if (uniqueMimeType?.startsWith('video') ?? false) { - sendStr = L10n.of(context)!.sendVideo; + sendStr = L10n.of(context).sendVideo; } return FutureBuilder( future: _calcCombinedFileSize(), builder: (context, snapshot) { final sizeString = - snapshot.data ?? L10n.of(context)!.calculatingFileSize; + snapshot.data ?? L10n.of(context).calculatingFileSize; Widget contentWidget; if (uniqueMimeType?.startsWith('image') ?? false) { @@ -210,7 +210,7 @@ class SendFileDialogState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - L10n.of(context)!.sendOriginal, + L10n.of(context).sendOriginal, style: const TextStyle(fontWeight: FontWeight.bold), ), Text(sizeString), @@ -270,7 +270,7 @@ class SendFileDialogState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - L10n.of(context)!.sendOriginal, + L10n.of(context).sendOriginal, style: const TextStyle(fontWeight: FontWeight.bold), ), @@ -293,11 +293,11 @@ class SendFileDialogState extends State { // just close the dialog Navigator.of(context, rootNavigator: false).pop(); }, - child: Text(L10n.of(context)!.cancel), + child: Text(L10n.of(context).cancel), ), TextButton( onPressed: _send, - child: Text(L10n.of(context)!.send), + child: Text(L10n.of(context).send), ), ], ); diff --git a/lib/pages/chat/send_location_dialog.dart b/lib/pages/chat/send_location_dialog.dart index b2a99004e..71d13b2c1 100644 --- a/lib/pages/chat/send_location_dialog.dart +++ b/lib/pages/chat/send_location_dialog.dart @@ -93,12 +93,12 @@ class SendLocationDialogState extends State { longitude: position!.longitude, ); } else if (disabled) { - contentWidget = Text(L10n.of(context)!.locationDisabledNotice); + contentWidget = Text(L10n.of(context).locationDisabledNotice); } else if (denied) { - contentWidget = Text(L10n.of(context)!.locationPermissionDeniedNotice); + contentWidget = Text(L10n.of(context).locationPermissionDeniedNotice); } else if (error != null) { contentWidget = - Text(L10n.of(context)!.errorObtainingLocation(error.toString())); + Text(L10n.of(context).errorObtainingLocation(error.toString())); } else { contentWidget = Row( mainAxisSize: MainAxisSize.min, @@ -106,22 +106,22 @@ class SendLocationDialogState extends State { children: [ const CupertinoActivityIndicator(), const SizedBox(width: 12), - Text(L10n.of(context)!.obtainingLocation), + Text(L10n.of(context).obtainingLocation), ], ); } return AlertDialog.adaptive( - title: Text(L10n.of(context)!.shareLocation), + title: Text(L10n.of(context).shareLocation), content: contentWidget, actions: [ TextButton( onPressed: Navigator.of(context, rootNavigator: false).pop, - child: Text(L10n.of(context)!.cancel), + child: Text(L10n.of(context).cancel), ), if (position != null) TextButton( onPressed: isSending ? null : sendAction, - child: Text(L10n.of(context)!.send), + child: Text(L10n.of(context).send), ), ], ); diff --git a/lib/pages/chat/sticker_picker_dialog.dart b/lib/pages/chat/sticker_picker_dialog.dart index 1517b8a40..eaa066413 100644 --- a/lib/pages/chat/sticker_picker_dialog.dart +++ b/lib/pages/chat/sticker_picker_dialog.dart @@ -117,7 +117,7 @@ class StickerPickerDialogState extends State { child: TextField( autofocus: false, decoration: InputDecoration( - hintText: L10n.of(context)!.search, + hintText: L10n.of(context).search, prefixIcon: const Icon(Icons.search_outlined), contentPadding: EdgeInsets.zero, ), @@ -131,7 +131,7 @@ class StickerPickerDialogState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Text(L10n.of(context)!.noEmotesFound), + Text(L10n.of(context).noEmotesFound), const SizedBox(height: 12), OutlinedButton.icon( onPressed: () => UrlLauncher( @@ -139,7 +139,7 @@ class StickerPickerDialogState extends State { 'https://matrix.to/#/#fluffychat-stickers:janian.de', ).launchUrl(), icon: const Icon(Icons.explore_outlined), - label: Text(L10n.of(context)!.discover), + label: Text(L10n.of(context).discover), ), ], ), diff --git a/lib/pages/chat_access_settings/chat_access_settings_controller.dart b/lib/pages/chat_access_settings/chat_access_settings_controller.dart index fd7624790..11fd0fbc6 100644 --- a/lib/pages/chat_access_settings/chat_access_settings_controller.dart +++ b/lib/pages/chat_access_settings/chat_access_settings_controller.dart @@ -151,7 +151,7 @@ class ChatAccessSettingsController extends State { if (capabilities == null) return; final newVersion = await showConfirmationDialog( context: context, - title: L10n.of(context)!.replaceRoomWithNewerVersion, + title: L10n.of(context).replaceRoomWithNewerVersion, actions: capabilities.mRoomVersions!.available.entries .where((r) => r.key != roomVersion) .map( @@ -168,10 +168,10 @@ class ChatAccessSettingsController extends State { await showOkCancelAlertDialog( useRootNavigator: false, context: context, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.cancel, - title: L10n.of(context)!.areYouSure, - message: L10n.of(context)!.roomUpgradeDescription, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, + title: L10n.of(context).areYouSure, + message: L10n.of(context).roomUpgradeDescription, isDestructiveAction: true, )) { return; @@ -190,12 +190,12 @@ class ChatAccessSettingsController extends State { final input = await showTextInputDialog( context: context, - title: L10n.of(context)!.editRoomAliases, + title: L10n.of(context).editRoomAliases, textFields: [ DialogTextField( prefixText: '#', suffixText: domain, - hintText: L10n.of(context)!.alias, + hintText: L10n.of(context).alias, ), ], ); @@ -214,10 +214,10 @@ class ChatAccessSettingsController extends State { final canonicalAliasConsent = await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.setAsCanonicalAlias, + title: L10n.of(context).setAsCanonicalAlias, message: alias, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.no, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).no, ); final altAliases = room diff --git a/lib/pages/chat_access_settings/chat_access_settings_page.dart b/lib/pages/chat_access_settings/chat_access_settings_page.dart index a4a6538a6..34ee6c559 100644 --- a/lib/pages/chat_access_settings/chat_access_settings_page.dart +++ b/lib/pages/chat_access_settings/chat_access_settings_page.dart @@ -20,7 +20,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.accessAndVisibility), + title: Text(L10n.of(context).accessAndVisibility), ), body: MaxWidthBody( child: StreamBuilder( @@ -38,7 +38,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { children: [ ListTile( title: Text( - L10n.of(context)!.visibilityOfTheChatHistory, + L10n.of(context).visibilityOfTheChatHistory, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -49,7 +49,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { RadioListTile.adaptive( title: Text( historyVisibility - .getLocalizedString(MatrixLocals(L10n.of(context)!)), + .getLocalizedString(MatrixLocals(L10n.of(context))), ), value: historyVisibility, groupValue: room.historyVisibility, @@ -61,7 +61,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.whoIsAllowedToJoinThisGroup, + L10n.of(context).whoIsAllowedToJoinThisGroup, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -72,7 +72,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { if (joinRule != JoinRules.private) RadioListTile.adaptive( title: Text( - joinRule.localizedString(L10n.of(context)!), + joinRule.localizedString(L10n.of(context)), ), value: joinRule, groupValue: room.joinRules, @@ -86,7 +86,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { .contains(room.joinRules)) ...[ ListTile( title: Text( - L10n.of(context)!.areGuestsAllowedToJoin, + L10n.of(context).areGuestsAllowedToJoin, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -97,7 +97,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { RadioListTile.adaptive( title: Text( guestAccess.getLocalizedString( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ), ), value: guestAccess, @@ -110,7 +110,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.publicChatAddresses, + L10n.of(context).publicChatAddresses, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -118,7 +118,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { ), trailing: IconButton( icon: const Icon(Icons.add_outlined), - tooltip: L10n.of(context)!.createNewAddress, + tooltip: L10n.of(context).createNewAddress, onPressed: controller.addAlias, ), ), @@ -171,7 +171,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { builder: (context, snapshot) => SwitchListTile.adaptive( value: snapshot.data == Visibility.public, title: Text( - L10n.of(context)!.chatCanBeDiscoveredViaSearchOnServer( + L10n.of(context).chatCanBeDiscoveredViaSearchOnServer( room.client.userID!.domain!, ), ), @@ -180,7 +180,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { ), ], ListTile( - title: Text(L10n.of(context)!.globalChatId), + title: Text(L10n.of(context).globalChatId), subtitle: SelectableText(room.id), trailing: IconButton( icon: const Icon(Icons.copy_outlined), @@ -188,7 +188,7 @@ class ChatAccessSettingsPageView extends StatelessWidget { ), ), ListTile( - title: Text(L10n.of(context)!.roomVersion), + title: Text(L10n.of(context).roomVersion), subtitle: SelectableText( room .getState(EventTypes.RoomCreate)! diff --git a/lib/pages/chat_details/chat_details.dart b/lib/pages/chat_details/chat_details.dart index 526d1261e..4159249d7 100644 --- a/lib/pages/chat_details/chat_details.dart +++ b/lib/pages/chat_details/chat_details.dart @@ -43,14 +43,14 @@ class ChatDetailsController extends State { final room = Matrix.of(context).client.getRoomById(roomId!)!; final input = await showTextInputDialog( context: context, - title: L10n.of(context)!.changeTheNameOfTheGroup, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).changeTheNameOfTheGroup, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, textFields: [ DialogTextField( initialText: room.getLocalizedDisplayname( MatrixLocals( - L10n.of(context)!, + L10n.of(context), ), ), ), @@ -63,7 +63,7 @@ class ChatDetailsController extends State { ); if (success.error == null) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.displaynameHasBeenChanged)), + SnackBar(content: Text(L10n.of(context).displaynameHasBeenChanged)), ); } } @@ -72,12 +72,12 @@ class ChatDetailsController extends State { final room = Matrix.of(context).client.getRoomById(roomId!)!; final input = await showTextInputDialog( context: context, - title: L10n.of(context)!.setChatDescription, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).setChatDescription, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, textFields: [ DialogTextField( - hintText: L10n.of(context)!.noChatDescriptionYet, + hintText: L10n.of(context).noChatDescriptionYet, initialText: room.topic, minLines: 4, maxLines: 8, @@ -92,7 +92,7 @@ class ChatDetailsController extends State { if (success.error == null) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text(L10n.of(context)!.chatDescriptionHasBeenChanged), + content: Text(L10n.of(context).chatDescriptionHasBeenChanged), ), ); } @@ -118,19 +118,19 @@ class ChatDetailsController extends State { if (PlatformInfos.isMobile) SheetAction( key: AvatarAction.camera, - label: L10n.of(context)!.openCamera, + label: L10n.of(context).openCamera, isDefaultAction: true, icon: Icons.camera_alt_outlined, ), SheetAction( key: AvatarAction.file, - label: L10n.of(context)!.openGallery, + label: L10n.of(context).openGallery, icon: Icons.photo_outlined, ), if (room?.avatar != null) SheetAction( key: AvatarAction.remove, - label: L10n.of(context)!.delete, + label: L10n.of(context).delete, isDestructiveAction: true, icon: Icons.delete_outlined, ), @@ -139,7 +139,7 @@ class ChatDetailsController extends State { ? actions.single.key : await showModalActionSheet( context: context, - title: L10n.of(context)!.editRoomAvatar, + title: L10n.of(context).editRoomAvatar, actions: actions, ); if (action == null) return; diff --git a/lib/pages/chat_details/chat_details_view.dart b/lib/pages/chat_details/chat_details_view.dart index c55e3fe0f..87baae98f 100644 --- a/lib/pages/chat_details/chat_details_view.dart +++ b/lib/pages/chat_details/chat_details_view.dart @@ -29,10 +29,10 @@ class ChatDetailsView extends StatelessWidget { if (room == null) { return Scaffold( appBar: AppBar( - title: Text(L10n.of(context)!.oopsSomethingWentWrong), + title: Text(L10n.of(context).oopsSomethingWentWrong), ), body: Center( - child: Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat), + child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat), ), ); } @@ -49,7 +49,7 @@ class ChatDetailsView extends StatelessWidget { final canRequestMoreMembers = members.length < actualMembersCount; final iconColor = theme.textTheme.bodyLarge!.color; final displayname = room.getLocalizedDisplayname( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ); return Scaffold( appBar: AppBar( @@ -59,7 +59,7 @@ class ChatDetailsView extends StatelessWidget { actions: [ if (room.canonicalAlias.isNotEmpty) IconButton( - tooltip: L10n.of(context)!.share, + tooltip: L10n.of(context).share, icon: Icon(Icons.adaptive.share_outlined), onPressed: () => FluffyShare.share( AppConfig.inviteLinkPrefix + room.canonicalAlias, @@ -69,7 +69,7 @@ class ChatDetailsView extends StatelessWidget { if (controller.widget.embeddedCloseButton == null) ChatSettingsPopupMenu(room, false), ], - title: Text(L10n.of(context)!.chatDetails), + title: Text(L10n.of(context).chatDetails), backgroundColor: theme.appBarTheme.backgroundColor, ), body: MaxWidthBody( @@ -150,7 +150,7 @@ class ChatDetailsView extends StatelessWidget { ), label: Text( room.isDirectChat - ? L10n.of(context)!.directChat + ? L10n.of(context).directChat : displayname, maxLines: 1, overflow: TextOverflow.ellipsis, @@ -172,7 +172,7 @@ class ChatDetailsView extends StatelessWidget { theme.colorScheme.secondary, ), label: Text( - L10n.of(context)!.countParticipants( + L10n.of(context).countParticipants( actualMembersCount, ), maxLines: 1, @@ -189,7 +189,7 @@ class ChatDetailsView extends StatelessWidget { if (!room.canChangeStateEvent(EventTypes.RoomTopic)) ListTile( title: Text( - L10n.of(context)!.chatDescription, + L10n.of(context).chatDescription, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -201,7 +201,7 @@ class ChatDetailsView extends StatelessWidget { padding: const EdgeInsets.all(16.0), child: TextButton.icon( onPressed: controller.setTopicAction, - label: Text(L10n.of(context)!.setChatDescription), + label: Text(L10n.of(context).setChatDescription), icon: const Icon(Icons.edit_outlined), style: TextButton.styleFrom( backgroundColor: @@ -217,7 +217,7 @@ class ChatDetailsView extends StatelessWidget { ), child: SelectableLinkify( text: room.topic.isEmpty - ? L10n.of(context)!.noChatDescriptionYet + ? L10n.of(context).noChatDescriptionYet : room.topic, options: const LinkifyOptions(humanize: false), linkStyle: const TextStyle( @@ -247,9 +247,8 @@ class ChatDetailsView extends StatelessWidget { Icons.insert_emoticon_outlined, ), ), - title: - Text(L10n.of(context)!.customEmojisAndStickers), - subtitle: Text(L10n.of(context)!.setCustomEmotes), + title: Text(L10n.of(context).customEmojisAndStickers), + subtitle: Text(L10n.of(context).setCustomEmotes), onTap: controller.goToEmoteSettings, trailing: const Icon(Icons.chevron_right_outlined), ), @@ -261,10 +260,10 @@ class ChatDetailsView extends StatelessWidget { child: const Icon(Icons.shield_outlined), ), title: Text( - L10n.of(context)!.accessAndVisibility, + L10n.of(context).accessAndVisibility, ), subtitle: Text( - L10n.of(context)!.accessAndVisibilityDescription, + L10n.of(context).accessAndVisibilityDescription, ), onTap: () => context .push('/rooms/${room.id}/details/access'), @@ -272,9 +271,9 @@ class ChatDetailsView extends StatelessWidget { ), if (!room.isDirectChat) ListTile( - title: Text(L10n.of(context)!.chatPermissions), + title: Text(L10n.of(context).chatPermissions), subtitle: Text( - L10n.of(context)!.whoCanPerformWhichAction, + L10n.of(context).whoCanPerformWhichAction, ), leading: CircleAvatar( backgroundColor: theme.scaffoldBackgroundColor, @@ -290,7 +289,7 @@ class ChatDetailsView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.countParticipants( + L10n.of(context).countParticipants( actualMembersCount.toString(), ), style: TextStyle( @@ -301,7 +300,7 @@ class ChatDetailsView extends StatelessWidget { ), if (!room.isDirectChat && room.canInvite) ListTile( - title: Text(L10n.of(context)!.inviteContact), + title: Text(L10n.of(context).inviteContact), leading: CircleAvatar( backgroundColor: theme.colorScheme.primaryContainer, @@ -319,7 +318,7 @@ class ChatDetailsView extends StatelessWidget { ? ParticipantListItem(members[i - 1]) : ListTile( title: Text( - L10n.of(context)!.loadCountMoreParticipants( + L10n.of(context).loadCountMoreParticipants( (actualMembersCount - members.length).toString(), ), ), diff --git a/lib/pages/chat_details/participant_list_item.dart b/lib/pages/chat_details/participant_list_item.dart index ddacbb7c1..183b3e4fc 100644 --- a/lib/pages/chat_details/participant_list_item.dart +++ b/lib/pages/chat_details/participant_list_item.dart @@ -17,17 +17,17 @@ class ParticipantListItem extends StatelessWidget { final theme = Theme.of(context); final membershipBatch = switch (user.membership) { - Membership.ban => L10n.of(context)!.banned, - Membership.invite => L10n.of(context)!.invited, + Membership.ban => L10n.of(context).banned, + Membership.invite => L10n.of(context).invited, Membership.join => null, - Membership.knock => L10n.of(context)!.knocking, - Membership.leave => L10n.of(context)!.leftTheChat, + Membership.knock => L10n.of(context).knocking, + Membership.leave => L10n.of(context).leftTheChat, }; final permissionBatch = user.powerLevel == 100 - ? L10n.of(context)!.admin + ? L10n.of(context).admin : user.powerLevel >= 50 - ? L10n.of(context)!.moderator + ? L10n.of(context).moderator : ''; return Opacity( diff --git a/lib/pages/chat_encryption_settings/chat_encryption_settings.dart b/lib/pages/chat_encryption_settings/chat_encryption_settings.dart index 559aa2063..c92ae61f7 100644 --- a/lib/pages/chat_encryption_settings/chat_encryption_settings.dart +++ b/lib/pages/chat_encryption_settings/chat_encryption_settings.dart @@ -34,33 +34,33 @@ class ChatEncryptionSettingsController extends State { if (room.encrypted) { showOkAlertDialog( context: context, - title: L10n.of(context)!.sorryThatsNotPossible, - message: L10n.of(context)!.disableEncryptionWarning, + title: L10n.of(context).sorryThatsNotPossible, + message: L10n.of(context).disableEncryptionWarning, ); return; } if (room.joinRules == JoinRules.public) { showOkAlertDialog( context: context, - title: L10n.of(context)!.sorryThatsNotPossible, - message: L10n.of(context)!.noEncryptionForPublicRooms, + title: L10n.of(context).sorryThatsNotPossible, + message: L10n.of(context).noEncryptionForPublicRooms, ); return; } if (!room.canChangeStateEvent(EventTypes.Encryption)) { showOkAlertDialog( context: context, - title: L10n.of(context)!.sorryThatsNotPossible, - message: L10n.of(context)!.noPermission, + title: L10n.of(context).sorryThatsNotPossible, + message: L10n.of(context).noPermission, ); return; } final consent = await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.areYouSure, - message: L10n.of(context)!.enableEncryptionWarning, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).areYouSure, + message: L10n.of(context).enableEncryptionWarning, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, ); if (consent != OkCancelResult.ok) return; await showFutureLoadingDialog( @@ -72,10 +72,10 @@ class ChatEncryptionSettingsController extends State { void startVerification() async { final consent = await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.verifyOtherUser, - message: L10n.of(context)!.verifyOtherUserDescription, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).verifyOtherUser, + message: L10n.of(context).verifyOtherUserDescription, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, fullyCapitalizedForMaterial: false, ); if (consent != OkCancelResult.ok) return; diff --git a/lib/pages/chat_encryption_settings/chat_encryption_settings_view.dart b/lib/pages/chat_encryption_settings/chat_encryption_settings_view.dart index 2a17a5a33..2c39a942e 100644 --- a/lib/pages/chat_encryption_settings/chat_encryption_settings_view.dart +++ b/lib/pages/chat_encryption_settings/chat_encryption_settings_view.dart @@ -31,11 +31,11 @@ class ChatEncryptionSettingsView extends StatelessWidget { icon: const Icon(Icons.close_outlined), onPressed: () => context.go('/rooms/${controller.roomId!}'), ), - title: Text(L10n.of(context)!.encryption), + title: Text(L10n.of(context).encryption), actions: [ TextButton( onPressed: () => launchUrlString(AppConfig.encryptionTutorial), - child: Text(L10n.of(context)!.help), + child: Text(L10n.of(context).help), ), ], ), @@ -49,7 +49,7 @@ class ChatEncryptionSettingsView extends StatelessWidget { backgroundColor: theme.colorScheme.primaryContainer, child: const Icon(Icons.lock_outlined), ), - title: Text(L10n.of(context)!.encryptThisChat), + title: Text(L10n.of(context).encryptThisChat), value: room.encrypted, onChanged: controller.enableEncryption, ), @@ -67,7 +67,7 @@ class ChatEncryptionSettingsView extends StatelessWidget { child: ElevatedButton.icon( onPressed: controller.startVerification, icon: const Icon(Icons.verified_outlined), - label: Text(L10n.of(context)!.verifyStart), + label: Text(L10n.of(context).verifyStart), ), ), ), @@ -75,7 +75,7 @@ class ChatEncryptionSettingsView extends StatelessWidget { const SizedBox(height: 16), ListTile( title: Text( - L10n.of(context)!.deviceKeys, + L10n.of(context).deviceKeys, style: const TextStyle( fontWeight: FontWeight.bold, ), @@ -91,7 +91,7 @@ class ChatEncryptionSettingsView extends StatelessWidget { if (snapshot.hasError) { return Center( child: Text( - '${L10n.of(context)!.oopsSomethingWentWrong}: ${snapshot.error}', + '${L10n.of(context).oopsSomethingWentWrong}: ${snapshot.error}', ), ); } @@ -133,7 +133,7 @@ class ChatEncryptionSettingsView extends StatelessWidget { const SizedBox(width: 4), Text( deviceKeys[i].deviceId ?? - L10n.of(context)!.unknownDevice, + L10n.of(context).unknownDevice, ), const SizedBox(width: 4), Flexible( @@ -167,7 +167,7 @@ class ChatEncryptionSettingsView extends StatelessWidget { ), subtitle: Text( deviceKeys[i].ed25519Key?.beautified ?? - L10n.of(context)!.unknownEncryptionAlgorithm, + L10n.of(context).unknownEncryptionAlgorithm, style: TextStyle( fontFamily: 'RobotoMono', color: theme.colorScheme.secondary, @@ -183,7 +183,7 @@ class ChatEncryptionSettingsView extends StatelessWidget { padding: const EdgeInsets.all(16.0), child: Center( child: Text( - L10n.of(context)!.encryptionNotEnabled, + L10n.of(context).encryptionNotEnabled, style: const TextStyle( fontStyle: FontStyle.italic, ), diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index 581a62b3a..9fe479728 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -62,15 +62,15 @@ extension LocalizedActiveFilter on ActiveFilter { String toLocalizedString(BuildContext context) { switch (this) { case ActiveFilter.allChats: - return L10n.of(context)!.all; + return L10n.of(context).all; case ActiveFilter.messages: - return L10n.of(context)!.messages; + return L10n.of(context).messages; case ActiveFilter.unread: - return L10n.of(context)!.unread; + return L10n.of(context).unread; case ActiveFilter.groups: - return L10n.of(context)!.groups; + return L10n.of(context).groups; case ActiveFilter.spaces: - return L10n.of(context)!.spaces; + return L10n.of(context).spaces; } } } @@ -128,25 +128,25 @@ class ChatListController extends State final inviteAction = await showModalActionSheet( context: context, message: room.isDirectChat - ? L10n.of(context)!.invitePrivateChat - : L10n.of(context)!.inviteGroupChat, - title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), + ? L10n.of(context).invitePrivateChat + : L10n.of(context).inviteGroupChat, + title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))), actions: [ SheetAction( key: InviteActions.accept, - label: L10n.of(context)!.accept, + label: L10n.of(context).accept, icon: Icons.check_outlined, isDefaultAction: true, ), SheetAction( key: InviteActions.decline, - label: L10n.of(context)!.decline, + label: L10n.of(context).decline, icon: Icons.close_outlined, isDestructiveAction: true, ), SheetAction( key: InviteActions.block, - label: L10n.of(context)!.block, + label: L10n.of(context).block, icon: Icons.block_outlined, isDestructiveAction: true, ), @@ -181,7 +181,7 @@ class ChatListController extends State if (room.membership == Membership.ban) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text(L10n.of(context)!.youHaveBeenBannedFromThisChat), + content: Text(L10n.of(context).youHaveBeenBannedFromThisChat), ), ); return; @@ -221,12 +221,12 @@ class ChatListController extends State } else { final consent = await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.forward, - message: L10n.of(context)!.forwardMessageTo( - room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), + title: L10n.of(context).forward, + message: L10n.of(context).forwardMessageTo( + room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))), ), - okLabel: L10n.of(context)!.forward, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).forward, + cancelLabel: L10n.of(context).cancel, ); if (consent == OkCancelResult.cancel) { Matrix.of(context).shareContent = null; @@ -276,10 +276,10 @@ class ChatListController extends State void setServer() async { final newServer = await showTextInputDialog( useRootNavigator: false, - title: L10n.of(context)!.changeTheHomeserver, + title: L10n.of(context).changeTheHomeserver, context: context, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, textFields: [ DialogTextField( prefixText: 'https://', @@ -289,7 +289,7 @@ class ChatListController extends State autocorrect: false, validator: (server) => server?.contains('.') == true ? null - : L10n.of(context)!.invalidServerName, + : L10n.of(context).invalidServerName, ), ], ); @@ -569,7 +569,7 @@ class ChatListController extends State ); final displayname = - room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)); + room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))); final spacesWithPowerLevels = room.client.rooms .where( @@ -618,8 +618,7 @@ class ChatListController extends State const SizedBox(width: 12), Expanded( child: Text( - L10n.of(context)! - .goToSpace(space.getLocalizedDisplayname()), + L10n.of(context).goToSpace(space.getLocalizedDisplayname()), ), ), ], @@ -638,8 +637,8 @@ class ChatListController extends State const SizedBox(width: 12), Text( room.pushRuleState == PushRuleState.notify - ? L10n.of(context)!.muteChat - : L10n.of(context)!.unmuteChat, + ? L10n.of(context).muteChat + : L10n.of(context).unmuteChat, ), ], ), @@ -657,8 +656,8 @@ class ChatListController extends State const SizedBox(width: 12), Text( room.markedUnread - ? L10n.of(context)!.markAsRead - : L10n.of(context)!.markAsUnread, + ? L10n.of(context).markAsRead + : L10n.of(context).markAsUnread, ), ], ), @@ -672,8 +671,8 @@ class ChatListController extends State const SizedBox(width: 12), Text( room.isFavourite - ? L10n.of(context)!.unpin - : L10n.of(context)!.pin, + ? L10n.of(context).unpin + : L10n.of(context).pin, ), ], ), @@ -686,7 +685,7 @@ class ChatListController extends State children: [ const Icon(Icons.group_work_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.addToSpace), + Text(L10n.of(context).addToSpace), ], ), ), @@ -697,7 +696,7 @@ class ChatListController extends State children: [ const Icon(Icons.delete_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.leave), + Text(L10n.of(context).leave), ], ), ), @@ -740,10 +739,10 @@ class ChatListController extends State final confirmed = await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.leave, - cancelLabel: L10n.of(context)!.no, - message: L10n.of(context)!.archiveRoomDescription, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).leave, + cancelLabel: L10n.of(context).no, + message: L10n.of(context).archiveRoomDescription, isDestructiveAction: true, ); if (confirmed == OkCancelResult.cancel) return; @@ -755,13 +754,13 @@ class ChatListController extends State case ChatContextAction.addToSpace: final space = await showConfirmationDialog( context: context, - title: L10n.of(context)!.space, + title: L10n.of(context).space, actions: spacesWithPowerLevels .map( (space) => AlertDialogAction( key: space, label: space - .getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), + .getLocalizedDisplayname(MatrixLocals(L10n.of(context))), ), ) .toList(), @@ -776,7 +775,7 @@ class ChatListController extends State void dismissStatusList() async { final result = await showOkCancelAlertDialog( - title: L10n.of(context)!.hidePresences, + title: L10n.of(context).hidePresences, context: context, ); if (result == OkCancelResult.ok) { @@ -792,13 +791,13 @@ class ChatListController extends State final input = await showTextInputDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.setStatus, - message: L10n.of(context)!.leaveEmptyToClearStatus, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).setStatus, + message: L10n.of(context).leaveEmptyToClearStatus, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, textFields: [ DialogTextField( - hintText: L10n.of(context)!.statusExampleMessage, + hintText: L10n.of(context).statusExampleMessage, maxLines: 6, minLines: 1, maxLength: 255, @@ -880,22 +879,22 @@ class ChatListController extends State } void editBundlesForAccount(String? userId, String? activeBundle) async { - final l10n = L10n.of(context)!; + final l10n = L10n.of(context); final client = Matrix.of(context) .widget .clients[Matrix.of(context).getClientIndexByMatrixId(userId!)]; final action = await showConfirmationDialog( context: context, - title: L10n.of(context)!.editBundlesForAccount, + title: L10n.of(context).editBundlesForAccount, actions: [ AlertDialogAction( key: EditBundleAction.addToBundle, - label: L10n.of(context)!.addToBundle, + label: L10n.of(context).addToBundle, ), if (activeBundle != client.userID) AlertDialogAction( key: EditBundleAction.removeFromBundle, - label: L10n.of(context)!.removeFromBundle, + label: L10n.of(context).removeFromBundle, ), ], ); diff --git a/lib/pages/chat_list/chat_list_body.dart b/lib/pages/chat_list/chat_list_body.dart index bf23e841e..7060bd3f6 100644 --- a/lib/pages/chat_list/chat_list_body.dart +++ b/lib/pages/chat_list/chat_list_body.dart @@ -83,17 +83,17 @@ class ChatListViewBody extends StatelessWidget { [ if (controller.isSearchMode) ...[ SearchTitle( - title: L10n.of(context)!.publicRooms, + title: L10n.of(context).publicRooms, icon: const Icon(Icons.explore_outlined), ), PublicRoomsHorizontalList(publicRooms: publicRooms), SearchTitle( - title: L10n.of(context)!.publicSpaces, + title: L10n.of(context).publicSpaces, icon: const Icon(Icons.workspaces_outlined), ), PublicRoomsHorizontalList(publicRooms: publicSpaces), SearchTitle( - title: L10n.of(context)!.users, + title: L10n.of(context).users, icon: const Icon(Icons.group_outlined), ), AnimatedContainer( @@ -115,7 +115,7 @@ class ChatListViewBody extends StatelessWidget { userSearchResult.results[i].displayName ?? userSearchResult .results[i].userId.localpart ?? - L10n.of(context)!.unknownDevice, + L10n.of(context).unknownDevice, avatar: userSearchResult.results[i].avatarUrl, onPressed: () => showAdaptiveBottomSheet( context: context, @@ -146,8 +146,8 @@ class ChatListViewBody extends StatelessWidget { color: theme.colorScheme.surface, child: ListTile( leading: const Icon(Icons.vpn_key), - title: Text(L10n.of(context)!.dehydrateTor), - subtitle: Text(L10n.of(context)!.dehydrateTorLong), + title: Text(L10n.of(context).dehydrateTor), + subtitle: Text(L10n.of(context).dehydrateTorLong), trailing: const Icon(Icons.chevron_right_outlined), onTap: controller.dehydrate, ), @@ -231,7 +231,7 @@ class ChatListViewBody extends StatelessWidget { ), if (controller.isSearchMode) SearchTitle( - title: L10n.of(context)!.chats, + title: L10n.of(context).chats, icon: const Icon(Icons.forum_outlined), ), if (client.prevBatch != null && @@ -267,8 +267,8 @@ class ChatListViewBody extends StatelessWidget { padding: const EdgeInsets.all(16.0), child: Text( client.rooms.isEmpty - ? L10n.of(context)!.noChatsFoundHere - : L10n.of(context)!.noMoreChatsFound, + ? L10n.of(context).noChatsFoundHere + : L10n.of(context).noMoreChatsFound, textAlign: TextAlign.center, style: TextStyle( fontSize: 18, @@ -343,7 +343,7 @@ class PublicRoomsHorizontalList extends StatelessWidget { itemBuilder: (context, i) => _SearchItem( title: publicRooms[i].name ?? publicRooms[i].canonicalAlias?.localpart ?? - L10n.of(context)!.group, + L10n.of(context).group, avatar: publicRooms[i].avatarUrl, onPressed: () => showAdaptiveBottomSheet( context: context, diff --git a/lib/pages/chat_list/chat_list_header.dart b/lib/pages/chat_list/chat_list_header.dart index f42999042..5d878be9a 100644 --- a/lib/pages/chat_list/chat_list_header.dart +++ b/lib/pages/chat_list/chat_list_header.dart @@ -35,14 +35,14 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget { leading: selectMode == SelectMode.normal ? null : IconButton( - tooltip: L10n.of(context)!.cancel, + tooltip: L10n.of(context).cancel, icon: const Icon(Icons.close_outlined), onPressed: controller.cancelAction, color: theme.colorScheme.primary, ), title: selectMode == SelectMode.share ? Text( - L10n.of(context)!.share, + L10n.of(context).share, key: const ValueKey(SelectMode.share), ) : TextField( @@ -61,7 +61,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget { borderRadius: BorderRadius.circular(99), ), contentPadding: EdgeInsets.zero, - hintText: L10n.of(context)!.searchChatsRooms, + hintText: L10n.of(context).searchChatsRooms, hintStyle: TextStyle( color: theme.colorScheme.onPrimaryContainer, fontWeight: FontWeight.normal, @@ -69,7 +69,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget { floatingLabelBehavior: FloatingLabelBehavior.never, prefixIcon: controller.isSearchMode ? IconButton( - tooltip: L10n.of(context)!.cancel, + tooltip: L10n.of(context).cancel, icon: const Icon(Icons.close_outlined), onPressed: controller.cancelSearch, color: theme.colorScheme.onPrimaryContainer, diff --git a/lib/pages/chat_list/chat_list_item.dart b/lib/pages/chat_list/chat_list_item.dart index dacc6bec0..4e6ba56b7 100644 --- a/lib/pages/chat_list/chat_list_item.dart +++ b/lib/pages/chat_list/chat_list_item.dart @@ -47,10 +47,10 @@ class ChatListItem extends StatelessWidget { final confirmed = await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.no, - message: L10n.of(context)!.archiveRoomDescription, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).no, + message: L10n.of(context).archiveRoomDescription, ); if (confirmed == OkCancelResult.cancel) return; await showFutureLoadingDialog( @@ -81,7 +81,7 @@ class ChatListItem extends StatelessWidget { final backgroundColor = activeChat ? theme.colorScheme.secondaryContainer : null; final displayname = room.getLocalizedDisplayname( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ); final filter = this.filter; if (filter != null && !displayname.toLowerCase().contains(filter)) { @@ -272,7 +272,7 @@ class ChatListItem extends StatelessWidget { Expanded( child: room.isSpace && room.membership == Membership.join ? Text( - L10n.of(context)!.countChatsAndCountParticipants( + L10n.of(context).countChatsAndCountParticipants( room.spaceChildren.length.toString(), (room.summary.mJoinedMemberCount ?? 1).toString(), ), @@ -292,7 +292,7 @@ class ChatListItem extends StatelessWidget { ), future: needLastEventSender ? lastEvent.calcLocalizedBody( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), hideReply: true, hideEdit: true, plaintextBody: true, @@ -304,7 +304,7 @@ class ChatListItem extends StatelessWidget { : null, initialData: lastEvent?.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), hideReply: true, hideEdit: true, plaintextBody: true, @@ -316,10 +316,10 @@ class ChatListItem extends StatelessWidget { builder: (context, snapshot) => Text( room.membership == Membership.invite ? isDirectChat - ? L10n.of(context)!.invitePrivateChat - : L10n.of(context)!.inviteGroupChat + ? L10n.of(context).invitePrivateChat + : L10n.of(context).inviteGroupChat : snapshot.data ?? - L10n.of(context)!.emptyChat, + L10n.of(context).emptyChat, softWrap: false, maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/lib/pages/chat_list/chat_list_view.dart b/lib/pages/chat_list/chat_list_view.dart index 71c559d70..674aa9406 100644 --- a/lib/pages/chat_list/chat_list_view.dart +++ b/lib/pages/chat_list/chat_list_view.dart @@ -85,7 +85,7 @@ class ChatListView extends StatelessWidget { onTap: controller.clearActiveSpace, icon: const Icon(Icons.forum_outlined), selectedIcon: const Icon(Icons.forum), - toolTip: L10n.of(context)!.chats, + toolTip: L10n.of(context).chats, unreadBadgeFilter: (room) => true, ); } @@ -95,13 +95,13 @@ class ChatListView extends StatelessWidget { isSelected: false, onTap: () => context.go('/rooms/newspace'), icon: const Icon(Icons.add), - toolTip: L10n.of(context)!.createNewSpace, + toolTip: L10n.of(context).createNewSpace, ); } final space = rootSpaces[i]; final displayname = rootSpaces[i].getLocalizedDisplayname( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ); final spaceChildrenIds = space.spaceChildren.map((c) => c.roomId).toSet(); @@ -144,7 +144,7 @@ class ChatListView extends StatelessWidget { LogicalKeyboardKey.keyN, }, onKeysPressed: () => context.go('/rooms/newprivatechat'), - helpLabel: L10n.of(context)!.newChat, + helpLabel: L10n.of(context).newChat, child: selectMode == SelectMode.normal && !controller.isSearchMode && controller.activeSpaceId == null @@ -153,7 +153,7 @@ class ChatListView extends StatelessWidget { context.go('/rooms/newprivatechat'), icon: const Icon(Icons.add_outlined), label: Text( - L10n.of(context)!.chat, + L10n.of(context).chat, overflow: TextOverflow.fade, ), ) diff --git a/lib/pages/chat_list/client_chooser_button.dart b/lib/pages/chat_list/client_chooser_button.dart index c004bd167..921ef6b83 100644 --- a/lib/pages/chat_list/client_chooser_button.dart +++ b/lib/pages/chat_list/client_chooser_button.dart @@ -34,7 +34,7 @@ class ClientChooserButton extends StatelessWidget { children: [ const Icon(Icons.group_add_outlined), const SizedBox(width: 18), - Text(L10n.of(context)!.createGroup), + Text(L10n.of(context).createGroup), ], ), ), @@ -44,7 +44,7 @@ class ClientChooserButton extends StatelessWidget { children: [ const Icon(Icons.workspaces_outlined), const SizedBox(width: 18), - Text(L10n.of(context)!.createNewSpace), + Text(L10n.of(context).createNewSpace), ], ), ), @@ -54,7 +54,7 @@ class ClientChooserButton extends StatelessWidget { children: [ const Icon(Icons.edit_outlined), const SizedBox(width: 18), - Text(L10n.of(context)!.setStatus), + Text(L10n.of(context).setStatus), ], ), ), @@ -64,7 +64,7 @@ class ClientChooserButton extends StatelessWidget { children: [ Icon(Icons.adaptive.share_outlined), const SizedBox(width: 18), - Text(L10n.of(context)!.inviteContact), + Text(L10n.of(context).inviteContact), ], ), ), @@ -86,7 +86,7 @@ class ClientChooserButton extends StatelessWidget { children: [ const Icon(Icons.settings_outlined), const SizedBox(width: 18), - Text(L10n.of(context)!.settings), + Text(L10n.of(context).settings), ], ), ), @@ -156,7 +156,7 @@ class ClientChooserButton extends StatelessWidget { children: [ const Icon(Icons.person_add_outlined), const SizedBox(width: 18), - Text(L10n.of(context)!.addAccount), + Text(L10n.of(context).addAccount), ], ), ), @@ -178,7 +178,7 @@ class ClientChooserButton extends StatelessWidget { clientCount, (index) => KeyBoardShortcuts( keysToPress: _buildKeyboardShortcut(index + 1), - helpLabel: L10n.of(context)!.switchToAccount(index + 1), + helpLabel: L10n.of(context).switchToAccount(index + 1), onKeysPressed: () => _handleKeyboardShortcut( matrix, index, @@ -192,7 +192,7 @@ class ClientChooserButton extends StatelessWidget { LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.tab, }, - helpLabel: L10n.of(context)!.nextAccount, + helpLabel: L10n.of(context).nextAccount, onKeysPressed: () => _nextAccount(matrix, context), child: const SizedBox.shrink(), ), @@ -202,7 +202,7 @@ class ClientChooserButton extends StatelessWidget { LogicalKeyboardKey.shiftLeft, LogicalKeyboardKey.tab, }, - helpLabel: L10n.of(context)!.previousAccount, + helpLabel: L10n.of(context).previousAccount, onKeysPressed: () => _previousAccount(matrix, context), child: const SizedBox.shrink(), ), @@ -249,10 +249,10 @@ class ClientChooserButton extends StatelessWidget { case SettingsAction.addAccount: final consent = await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.addAccount, - message: L10n.of(context)!.enableMultiAccounts, - okLabel: L10n.of(context)!.next, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).addAccount, + message: L10n.of(context).enableMultiAccounts, + okLabel: L10n.of(context).next, + cancelLabel: L10n.of(context).cancel, ); if (consent != OkCancelResult.ok) return; context.go('/rooms/settings/addaccount'); diff --git a/lib/pages/chat_list/space_view.dart b/lib/pages/chat_list/space_view.dart index 69d9c9696..a1936c02c 100644 --- a/lib/pages/chat_list/space_view.dart +++ b/lib/pages/chat_list/space_view.dart @@ -132,10 +132,10 @@ class _SpaceViewState extends State { final confirmed = await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, - message: L10n.of(context)!.archiveRoomDescription, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, + message: L10n.of(context).archiveRoomDescription, ); if (!mounted) return; if (confirmed != OkCancelResult.ok) return; @@ -153,15 +153,15 @@ class _SpaceViewState extends State { void _addChatOrSubspace() async { final roomType = await showConfirmationDialog( context: context, - title: L10n.of(context)!.addChatOrSubSpace, + title: L10n.of(context).addChatOrSubSpace, actions: [ AlertDialogAction( key: AddRoomType.subspace, - label: L10n.of(context)!.createNewSpace, + label: L10n.of(context).createNewSpace, ), AlertDialogAction( key: AddRoomType.chat, - label: L10n.of(context)!.createGroup, + label: L10n.of(context).createGroup, ), ], ); @@ -170,32 +170,32 @@ class _SpaceViewState extends State { final names = await showTextInputDialog( context: context, title: roomType == AddRoomType.subspace - ? L10n.of(context)!.createNewSpace - : L10n.of(context)!.createGroup, + ? L10n.of(context).createNewSpace + : L10n.of(context).createGroup, textFields: [ DialogTextField( hintText: roomType == AddRoomType.subspace - ? L10n.of(context)!.spaceName - : L10n.of(context)!.groupName, + ? L10n.of(context).spaceName + : L10n.of(context).groupName, minLines: 1, maxLines: 1, maxLength: 64, validator: (text) { if (text == null || text.isEmpty) { - return L10n.of(context)!.pleaseChoose; + return L10n.of(context).pleaseChoose; } return null; }, ), DialogTextField( - hintText: L10n.of(context)!.chatDescription, + hintText: L10n.of(context).chatDescription, minLines: 4, maxLines: 8, maxLength: 255, ), ], - okLabel: L10n.of(context)!.create, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).create, + cancelLabel: L10n.of(context).cancel, ); if (names == null) return; final client = Matrix.of(context).client; @@ -245,7 +245,7 @@ class _SpaceViewState extends State { final room = Matrix.of(context).client.getRoomById(widget.spaceId); final displayname = - room?.getLocalizedDisplayname() ?? L10n.of(context)!.nothingFound; + room?.getLocalizedDisplayname() ?? L10n.of(context).nothingFound; return Scaffold( appBar: AppBar( leading: Center( @@ -269,7 +269,7 @@ class _SpaceViewState extends State { subtitle: room == null ? null : Text( - L10n.of(context)!.countChatsAndCountParticipants( + L10n.of(context).countChatsAndCountParticipants( room.spaceChildren.length, room.summary.mJoinedMemberCount ?? 1, ), @@ -288,7 +288,7 @@ class _SpaceViewState extends State { children: [ const Icon(Icons.settings_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.settings), + Text(L10n.of(context).settings), ], ), ), @@ -299,7 +299,7 @@ class _SpaceViewState extends State { children: [ const Icon(Icons.person_add_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.invite), + Text(L10n.of(context).invite), ], ), ), @@ -310,7 +310,7 @@ class _SpaceViewState extends State { children: [ const Icon(Icons.delete_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.leave), + Text(L10n.of(context).leave), ], ), ), @@ -368,7 +368,7 @@ class _SpaceViewState extends State { borderRadius: BorderRadius.circular(99), ), contentPadding: EdgeInsets.zero, - hintText: L10n.of(context)!.search, + hintText: L10n.of(context).search, hintStyle: TextStyle( color: theme.colorScheme.onPrimaryContainer, fontWeight: FontWeight.normal, @@ -453,7 +453,7 @@ class _SpaceViewState extends State { child: Icon(Icons.add_outlined), ), title: Text( - L10n.of(context)!.addChatOrSubSpace, + L10n.of(context).addChatOrSubSpace, style: const TextStyle(fontSize: 14), ), ), @@ -461,7 +461,7 @@ class _SpaceViewState extends State { ), ], SearchTitle( - title: L10n.of(context)!.joinedChats, + title: L10n.of(context).joinedChats, icon: const Icon(Icons.chat_outlined), ), ], @@ -486,7 +486,7 @@ class _SpaceViewState extends State { itemBuilder: (context, i) { if (i == 0) { return SearchTitle( - title: L10n.of(context)!.discover, + title: L10n.of(context).discover, icon: const Icon(Icons.explore_outlined), ); } @@ -497,7 +497,7 @@ class _SpaceViewState extends State { padding: const EdgeInsets.all(12.0), child: Center( child: Text( - L10n.of(context)!.noMoreChatsFound, + L10n.of(context).noMoreChatsFound, style: const TextStyle(fontSize: 13), ), ), @@ -516,14 +516,14 @@ class _SpaceViewState extends State { AppConfig.borderRadius, ), ) - : Text(L10n.of(context)!.loadMore), + : Text(L10n.of(context).loadMore), ), ); } final item = _discoveredChildren[i]; final displayname = item.name ?? item.canonicalAlias ?? - L10n.of(context)!.emptyChat; + L10n.of(context).emptyChat; if (!displayname.toLowerCase().contains(filter)) { return const SizedBox.shrink(); } @@ -564,7 +564,7 @@ class _SpaceViewState extends State { ), subtitle: Text( item.topic ?? - L10n.of(context)!.countParticipants( + L10n.of(context).countParticipants( item.numJoinedMembers, ), maxLines: 1, diff --git a/lib/pages/chat_members/chat_members_view.dart b/lib/pages/chat_members/chat_members_view.dart index daa681a52..be53f99c7 100644 --- a/lib/pages/chat_members/chat_members_view.dart +++ b/lib/pages/chat_members/chat_members_view.dart @@ -20,10 +20,10 @@ class ChatMembersView extends StatelessWidget { if (room == null) { return Scaffold( appBar: AppBar( - title: Text(L10n.of(context)!.oopsSomethingWentWrong), + title: Text(L10n.of(context).oopsSomethingWentWrong), ), body: Center( - child: Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat), + child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat), ), ); } @@ -40,7 +40,7 @@ class ChatMembersView extends StatelessWidget { appBar: AppBar( leading: const Center(child: BackButton()), title: Text( - L10n.of(context)!.countParticipants(roomCount), + L10n.of(context).countParticipants(roomCount), ), actions: [ if (room.canInvite) @@ -68,7 +68,7 @@ class ChatMembersView extends StatelessWidget { OutlinedButton.icon( onPressed: controller.refreshMembers, icon: const Icon(Icons.refresh_outlined), - label: Text(L10n.of(context)!.tryAgain), + label: Text(L10n.of(context).tryAgain), ), ], ), @@ -102,7 +102,7 @@ class ChatMembersView extends StatelessWidget { fontWeight: FontWeight.normal, ), prefixIcon: const Icon(Icons.search_outlined), - hintText: L10n.of(context)!.search, + hintText: L10n.of(context).search, ), ), ) diff --git a/lib/pages/chat_permissions_settings/chat_permissions_settings.dart b/lib/pages/chat_permissions_settings/chat_permissions_settings.dart index 6ea94c105..2211a8fac 100644 --- a/lib/pages/chat_permissions_settings/chat_permissions_settings.dart +++ b/lib/pages/chat_permissions_settings/chat_permissions_settings.dart @@ -31,7 +31,7 @@ class ChatPermissionsSettingsController extends State { final room = Matrix.of(context).client.getRoomById(roomId!)!; if (!room.canSendEvent(EventTypes.RoomPowerLevels)) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.noPermission)), + SnackBar(content: Text(L10n.of(context).noPermission)), ); return; } diff --git a/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart b/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart index 458e1c503..b29fa9eed 100644 --- a/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart +++ b/lib/pages/chat_permissions_settings/chat_permissions_settings_view.dart @@ -20,7 +20,7 @@ class ChatPermissionsSettingsView extends StatelessWidget { return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.chatPermissions), + title: Text(L10n.of(context).chatPermissions), ), body: MaxWidthBody( child: StreamBuilder( @@ -31,7 +31,7 @@ class ChatPermissionsSettingsView extends StatelessWidget { ? null : Matrix.of(context).client.getRoomById(roomId); if (room == null) { - return Center(child: Text(L10n.of(context)!.noRoomsFound)); + return Center(child: Text(L10n.of(context).noRoomsFound)); } final powerLevelsContent = Map.from( room.getState(EventTypes.RoomPowerLevels)?.content ?? {}, @@ -46,13 +46,13 @@ class ChatPermissionsSettingsView extends StatelessWidget { ListTile( leading: const Icon(Icons.info_outlined), subtitle: Text( - L10n.of(context)!.chatPermissionsDescription, + L10n.of(context).chatPermissionsDescription, ), ), Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.chatPermissions, + L10n.of(context).chatPermissions, style: TextStyle( color: theme.colorScheme.primary, fontWeight: FontWeight.bold, @@ -77,7 +77,7 @@ class ChatPermissionsSettingsView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.notifications, + L10n.of(context).notifications, style: TextStyle( color: theme.colorScheme.primary, fontWeight: FontWeight.bold, @@ -112,7 +112,7 @@ class ChatPermissionsSettingsView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.configureChat, + L10n.of(context).configureChat, style: TextStyle( color: theme.colorScheme.primary, fontWeight: FontWeight.bold, diff --git a/lib/pages/chat_permissions_settings/permission_list_tile.dart b/lib/pages/chat_permissions_settings/permission_list_tile.dart index 0ca516965..bb5e03dcc 100644 --- a/lib/pages/chat_permissions_settings/permission_list_tile.dart +++ b/lib/pages/chat_permissions_settings/permission_list_tile.dart @@ -25,45 +25,45 @@ class PermissionsListTile extends StatelessWidget { if (category == null) { switch (permissionKey) { case 'users_default': - return L10n.of(context)!.defaultPermissionLevel; + return L10n.of(context).defaultPermissionLevel; case 'events_default': - return L10n.of(context)!.sendMessages; + return L10n.of(context).sendMessages; case 'state_default': - return L10n.of(context)!.changeGeneralChatSettings; + return L10n.of(context).changeGeneralChatSettings; case 'ban': - return L10n.of(context)!.banFromChat; + return L10n.of(context).banFromChat; case 'kick': - return L10n.of(context)!.kickFromChat; + return L10n.of(context).kickFromChat; case 'redact': - return L10n.of(context)!.deleteMessage; + return L10n.of(context).deleteMessage; case 'invite': - return L10n.of(context)!.inviteOtherUsers; + return L10n.of(context).inviteOtherUsers; } } else if (category == 'notifications') { switch (permissionKey) { case 'rooms': - return L10n.of(context)!.sendRoomNotifications; + return L10n.of(context).sendRoomNotifications; } } else if (category == 'events') { switch (permissionKey) { case EventTypes.RoomName: - return L10n.of(context)!.changeTheNameOfTheGroup; + return L10n.of(context).changeTheNameOfTheGroup; case EventTypes.RoomTopic: - return L10n.of(context)!.changeTheDescriptionOfTheGroup; + return L10n.of(context).changeTheDescriptionOfTheGroup; case EventTypes.RoomPowerLevels: - return L10n.of(context)!.changeTheChatPermissions; + return L10n.of(context).changeTheChatPermissions; case EventTypes.HistoryVisibility: - return L10n.of(context)!.changeTheVisibilityOfChatHistory; + return L10n.of(context).changeTheVisibilityOfChatHistory; case EventTypes.RoomCanonicalAlias: - return L10n.of(context)!.changeTheCanonicalRoomAlias; + return L10n.of(context).changeTheCanonicalRoomAlias; case EventTypes.RoomAvatar: - return L10n.of(context)!.editRoomAvatar; + return L10n.of(context).editRoomAvatar; case EventTypes.RoomTombstone: - return L10n.of(context)!.replaceRoomWithNewerVersion; + return L10n.of(context).replaceRoomWithNewerVersion; case EventTypes.Encryption: - return L10n.of(context)!.enableEncryption; + return L10n.of(context).enableEncryption; case 'm.room.server_acl': - return L10n.of(context)!.editBlockedServers; + return L10n.of(context).editBlockedServers; } } return permissionKey; @@ -96,13 +96,13 @@ class PermissionsListTile extends StatelessWidget { DropdownMenuItem( value: permission < 50 ? permission : 0, child: Text( - L10n.of(context)!.userLevel(permission < 50 ? permission : 0), + L10n.of(context).userLevel(permission < 50 ? permission : 0), ), ), DropdownMenuItem( value: permission < 100 && permission >= 50 ? permission : 50, child: Text( - L10n.of(context)!.moderatorLevel( + L10n.of(context).moderatorLevel( permission < 100 && permission >= 50 ? permission : 50, ), ), @@ -110,13 +110,13 @@ class PermissionsListTile extends StatelessWidget { DropdownMenuItem( value: permission >= 100 ? permission : 100, child: Text( - L10n.of(context)! + L10n.of(context) .adminLevel(permission >= 100 ? permission : 100), ), ), DropdownMenuItem( value: null, - child: Text(L10n.of(context)!.custom), + child: Text(L10n.of(context).custom), ), ], ), diff --git a/lib/pages/chat_search/chat_search_files_tab.dart b/lib/pages/chat_search/chat_search_files_tab.dart index e981efb19..59a2f26e2 100644 --- a/lib/pages/chat_search/chat_search_files_tab.dart +++ b/lib/pages/chat_search/chat_search_files_tab.dart @@ -37,9 +37,9 @@ class ChatSearchFilesTab extends StatelessWidget { const CircularProgressIndicator.adaptive(strokeWidth: 2), const SizedBox(height: 8), Text( - L10n.of(context)!.searchIn( + L10n.of(context).searchIn( room.getLocalizedDisplayname( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ), ), ), @@ -53,7 +53,7 @@ class ChatSearchFilesTab extends StatelessWidget { children: [ const Icon(Icons.file_present_outlined, size: 64), const SizedBox(height: 8), - Text(L10n.of(context)!.nothingFound), + Text(L10n.of(context).nothingFound), ], ); } @@ -93,7 +93,7 @@ class ChatSearchFilesTab extends StatelessWidget { icon: const Icon( Icons.arrow_downward_outlined, ), - label: Text(L10n.of(context)!.searchMore), + label: Text(L10n.of(context).searchMore), ), ), ); @@ -101,7 +101,7 @@ class ChatSearchFilesTab extends StatelessWidget { final event = events[i]; final filename = event.content.tryGet('filename') ?? event.content.tryGet('body') ?? - L10n.of(context)!.unknownEvent('File'); + L10n.of(context).unknownEvent('File'); final filetype = (filename.contains('.') ? filename.split('.').last.toUpperCase() : event.content diff --git a/lib/pages/chat_search/chat_search_images_tab.dart b/lib/pages/chat_search/chat_search_images_tab.dart index 90cdc839b..a930ed02d 100644 --- a/lib/pages/chat_search/chat_search_images_tab.dart +++ b/lib/pages/chat_search/chat_search_images_tab.dart @@ -37,9 +37,9 @@ class ChatSearchImagesTab extends StatelessWidget { const CircularProgressIndicator.adaptive(strokeWidth: 2), const SizedBox(height: 8), Text( - L10n.of(context)!.searchIn( + L10n.of(context).searchIn( room.getLocalizedDisplayname( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ), ), ), @@ -52,7 +52,7 @@ class ChatSearchImagesTab extends StatelessWidget { children: [ const Icon(Icons.photo_outlined, size: 64), const SizedBox(height: 8), - Text(L10n.of(context)!.nothingFound), + Text(L10n.of(context).nothingFound), ], ); } @@ -102,7 +102,7 @@ class ChatSearchImagesTab extends StatelessWidget { icon: const Icon( Icons.arrow_downward_outlined, ), - label: Text(L10n.of(context)!.searchMore), + label: Text(L10n.of(context).searchMore), ), ), ); diff --git a/lib/pages/chat_search/chat_search_message_tab.dart b/lib/pages/chat_search/chat_search_message_tab.dart index a2d34fa9e..7c7024e8d 100644 --- a/lib/pages/chat_search/chat_search_message_tab.dart +++ b/lib/pages/chat_search/chat_search_message_tab.dart @@ -41,9 +41,9 @@ class ChatSearchMessageTab extends StatelessWidget { const Icon(Icons.search_outlined, size: 64), const SizedBox(height: 8), Text( - L10n.of(context)!.searchIn( + L10n.of(context).searchIn( room.getLocalizedDisplayname( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ), ), ), @@ -90,7 +90,7 @@ class ChatSearchMessageTab extends StatelessWidget { icon: const Icon( Icons.arrow_downward_outlined, ), - label: Text(L10n.of(context)!.searchMore), + label: Text(L10n.of(context).searchMore), ), ), ); @@ -98,7 +98,7 @@ class ChatSearchMessageTab extends StatelessWidget { final event = events[i]; final sender = event.senderFromMemoryOrFallback; final displayname = sender.calcDisplayname( - i18n: MatrixLocals(L10n.of(context)!), + i18n: MatrixLocals(L10n.of(context)), ); return _MessageSearchResultListTile( sender: sender, @@ -164,7 +164,7 @@ class _MessageSearchResultListTile extends StatelessWidget { plaintextBody: true, removeMarkdown: true, MatrixLocals( - L10n.of(context)!, + L10n.of(context), ), ) .trim(), diff --git a/lib/pages/chat_search/chat_search_view.dart b/lib/pages/chat_search/chat_search_view.dart index e29fa1d01..1f458ca98 100644 --- a/lib/pages/chat_search/chat_search_view.dart +++ b/lib/pages/chat_search/chat_search_view.dart @@ -20,12 +20,11 @@ class ChatSearchView extends StatelessWidget { final room = controller.room; if (room == null) { return Scaffold( - appBar: AppBar(title: Text(L10n.of(context)!.oopsSomethingWentWrong)), + appBar: AppBar(title: Text(L10n.of(context).oopsSomethingWentWrong)), body: Center( child: Padding( padding: const EdgeInsets.all(16), - child: - Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat), + child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat), ), ), ); @@ -38,8 +37,8 @@ class ChatSearchView extends StatelessWidget { leading: const Center(child: BackButton()), titleSpacing: 0, title: Text( - L10n.of(context)!.searchIn( - room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), + L10n.of(context).searchIn( + room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))), ), ), ), @@ -59,7 +58,7 @@ class ChatSearchView extends StatelessWidget { autofocus: true, enabled: controller.tabController.index == 0, decoration: InputDecoration( - hintText: L10n.of(context)!.search, + hintText: L10n.of(context).search, suffixIcon: const Icon(Icons.search_outlined), filled: true, fillColor: theme.colorScheme.secondaryContainer, @@ -77,9 +76,9 @@ class ChatSearchView extends StatelessWidget { TabBar( controller: controller.tabController, tabs: [ - Tab(child: Text(L10n.of(context)!.messages)), - Tab(child: Text(L10n.of(context)!.gallery)), - Tab(child: Text(L10n.of(context)!.files)), + Tab(child: Text(L10n.of(context).messages)), + Tab(child: Text(L10n.of(context).gallery)), + Tab(child: Text(L10n.of(context).files)), ], ), Expanded( diff --git a/lib/pages/device_settings/device_settings.dart b/lib/pages/device_settings/device_settings.dart index d2eb96a42..daff3ad28 100644 --- a/lib/pages/device_settings/device_settings.dart +++ b/lib/pages/device_settings/device_settings.dart @@ -35,10 +35,10 @@ class DevicesSettingsController extends State { void removeDevicesAction(List devices) async { if (await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.cancel, - message: L10n.of(context)!.removeDevicesDescription, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, + message: L10n.of(context).removeDevicesDescription, ) == OkCancelResult.cancel) return; final matrix = Matrix.of(context); @@ -70,9 +70,9 @@ class DevicesSettingsController extends State { void renameDeviceAction(Device device) async { final displayName = await showTextInputDialog( context: context, - title: L10n.of(context)!.changeDeviceName, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).changeDeviceName, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, textFields: [ DialogTextField( hintText: device.displayName, @@ -94,10 +94,10 @@ class DevicesSettingsController extends State { void verifyDeviceAction(Device device) async { final consent = await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.verifyOtherDevice, - message: L10n.of(context)!.verifyOtherDeviceDescription, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).verifyOtherDevice, + message: L10n.of(context).verifyOtherDeviceDescription, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, fullyCapitalizedForMaterial: false, ); if (consent != OkCancelResult.ok) return; diff --git a/lib/pages/device_settings/device_settings_view.dart b/lib/pages/device_settings/device_settings_view.dart index 20fb9e800..32a48b561 100644 --- a/lib/pages/device_settings/device_settings_view.dart +++ b/lib/pages/device_settings/device_settings_view.dart @@ -16,7 +16,7 @@ class DevicesSettingsView extends StatelessWidget { return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.devices), + title: Text(L10n.of(context).devices), ), body: MaxWidthBody( child: FutureBuilder( @@ -56,7 +56,7 @@ class DevicesSettingsView extends StatelessWidget { ), alignment: Alignment.centerLeft, child: Text( - L10n.of(context)!.thisDevice, + L10n.of(context).thisDevice, style: TextStyle( fontWeight: FontWeight.bold, color: theme.colorScheme.primary, @@ -84,7 +84,7 @@ class DevicesSettingsView extends StatelessWidget { child: TextButton.icon( label: Text( controller.errorDeletingDevices ?? - L10n.of(context)!.removeAllOtherDevices, + L10n.of(context).removeAllOtherDevices, ), style: TextButton.styleFrom( foregroundColor: @@ -109,7 +109,7 @@ class DevicesSettingsView extends StatelessWidget { Center( child: Padding( padding: const EdgeInsets.all(16.0), - child: Text(L10n.of(context)!.noOtherDevicesFound), + child: Text(L10n.of(context).noOtherDevicesFound), ), ), ], diff --git a/lib/pages/device_settings/user_device_list_item.dart b/lib/pages/device_settings/user_device_list_item.dart index cf3acd6c9..96be6c787 100644 --- a/lib/pages/device_settings/user_device_list_item.dart +++ b/lib/pages/device_settings/user_device_list_item.dart @@ -55,30 +55,30 @@ class UserDeviceListItem extends StatelessWidget { actions: [ SheetAction( key: UserDeviceListItemAction.rename, - label: L10n.of(context)!.changeDeviceName, + label: L10n.of(context).changeDeviceName, ), if (!isOwnDevice && keys != null) ...{ SheetAction( key: UserDeviceListItemAction.verify, - label: L10n.of(context)!.verifyStart, + label: L10n.of(context).verifyStart, ), if (!keys.blocked) SheetAction( key: UserDeviceListItemAction.block, - label: L10n.of(context)!.blockDevice, + label: L10n.of(context).blockDevice, isDestructiveAction: true, ), if (keys.blocked) SheetAction( key: UserDeviceListItemAction.unblock, - label: L10n.of(context)!.unblockDevice, + label: L10n.of(context).unblockDevice, isDestructiveAction: true, ), }, if (!isOwnDevice) SheetAction( key: UserDeviceListItemAction.remove, - label: L10n.of(context)!.delete, + label: L10n.of(context).delete, isDestructiveAction: true, ), ], @@ -119,7 +119,7 @@ class UserDeviceListItem extends StatelessWidget { overflow: TextOverflow.ellipsis, ), subtitle: Text( - L10n.of(context)!.lastActiveAgo( + L10n.of(context).lastActiveAgo( DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs ?? 0) .localizedTimeShort(context), ), @@ -129,10 +129,10 @@ class UserDeviceListItem extends StatelessWidget { ? null : Text( keys.blocked - ? L10n.of(context)!.blocked + ? L10n.of(context).blocked : keys.verified - ? L10n.of(context)!.verified - : L10n.of(context)!.unverified, + ? L10n.of(context).verified + : L10n.of(context).unverified, style: TextStyle( color: keys.blocked ? Colors.red diff --git a/lib/pages/dialer/dialer.dart b/lib/pages/dialer/dialer.dart index 84e6fe923..edcc6868c 100644 --- a/lib/pages/dialer/dialer.dart +++ b/lib/pages/dialer/dialer.dart @@ -134,7 +134,7 @@ class MyCallingPage extends State { Room? get room => call.room; String get displayName => call.room.getLocalizedDisplayname( - MatrixLocals(L10n.of(widget.context)!), + MatrixLocals(L10n.of(widget.context)), ); String get callId => widget.callId; @@ -296,14 +296,14 @@ class MyCallingPage extends State { channelId: 'notification_channel_id', channelName: 'Foreground Notification', channelDescription: - L10n.of(widget.context)!.foregroundServiceRunning, + L10n.of(widget.context).foregroundServiceRunning, ), iosNotificationOptions: const IOSNotificationOptions(), foregroundTaskOptions: const ForegroundTaskOptions(), ); FlutterForegroundTask.startService( - notificationTitle: L10n.of(widget.context)!.screenSharingTitle, - notificationText: L10n.of(widget.context)!.screenSharingDetail, + notificationTitle: L10n.of(widget.context).screenSharingTitle, + notificationText: L10n.of(widget.context).screenSharingDetail, ); } else { FlutterForegroundTask.stopService(); @@ -457,7 +457,7 @@ class MyCallingPage extends State { var title = ''; if (call.localHold) { title = '${call.room.getLocalizedDisplayname( - MatrixLocals(L10n.of(widget.context)!), + MatrixLocals(L10n.of(widget.context)), )} held the call.'; } else if (call.remoteOnHold) { title = 'You held the call.'; diff --git a/lib/pages/homeserver_picker/homeserver_picker.dart b/lib/pages/homeserver_picker/homeserver_picker.dart index d5fe0700a..81b33aa00 100644 --- a/lib/pages/homeserver_picker/homeserver_picker.dart +++ b/lib/pages/homeserver_picker/homeserver_picker.dart @@ -49,8 +49,8 @@ class HomeserverPickerController extends State { (e, s) async { await showOkAlertDialog( context: context, - title: L10n.of(context)!.indexedDbErrorTitle, - message: L10n.of(context)!.indexedDbErrorLong, + title: L10n.of(context).indexedDbErrorTitle, + message: L10n.of(context).indexedDbErrorLong, ); _checkTorBrowser(); }, diff --git a/lib/pages/homeserver_picker/homeserver_picker_view.dart b/lib/pages/homeserver_picker/homeserver_picker_view.dart index ff89bf4e1..71ca58fd3 100644 --- a/lib/pages/homeserver_picker/homeserver_picker_view.dart +++ b/lib/pages/homeserver_picker/homeserver_picker_view.dart @@ -24,7 +24,7 @@ class HomeserverPickerView extends StatelessWidget { appBar: controller.widget.addMultiAccount ? AppBar( centerTitle: true, - title: Text(L10n.of(context)!.addAccount), + title: Text(L10n.of(context).addAccount), ) : null, body: Column( @@ -46,8 +46,8 @@ class HomeserverPickerView extends StatelessWidget { color: theme.colorScheme.surface, child: ListTile( leading: const Icon(Icons.vpn_key), - title: Text(L10n.of(context)!.hydrateTor), - subtitle: Text(L10n.of(context)!.hydrateTorLong), + title: Text(L10n.of(context).hydrateTor), + subtitle: Text(L10n.of(context).hydrateTorLong), trailing: const Icon(Icons.chevron_right_outlined), onTap: controller.restoreBackup, ), @@ -95,16 +95,16 @@ class HomeserverPickerView extends StatelessWidget { borderRadius: BorderRadius.circular(AppConfig.borderRadius), ), hintText: AppConfig.defaultHomeserver, - labelText: L10n.of(context)!.homeserver, + labelText: L10n.of(context).homeserver, errorText: controller.error, suffixIcon: IconButton( onPressed: () { showDialog( context: context, builder: (context) => AlertDialog.adaptive( - title: Text(L10n.of(context)!.whatIsAHomeserver), + title: Text(L10n.of(context).whatIsAHomeserver), content: Linkify( - text: L10n.of(context)!.homeserverDescription, + text: L10n.of(context).homeserverDescription, ), actions: [ TextButton( @@ -112,12 +112,12 @@ class HomeserverPickerView extends StatelessWidget { Uri.https('servers.joinmatrix.org'), ), child: Text( - L10n.of(context)!.discoverHomeservers, + L10n.of(context).discoverHomeservers, ), ), TextButton( onPressed: Navigator.of(context).pop, - child: Text(L10n.of(context)!.close), + child: Text(L10n.of(context).close), ), ], ), @@ -144,7 +144,7 @@ class HomeserverPickerView extends StatelessWidget { onPressed: controller.isLoggingIn || controller.isLoading ? null : controller.restoreBackup, - child: Text(L10n.of(context)!.hydrate), + child: Text(L10n.of(context).hydrate), ), if (controller.supportsPasswordLogin && controller.supportsSso) TextButton( @@ -155,7 +155,7 @@ class HomeserverPickerView extends StatelessWidget { onPressed: controller.isLoggingIn || controller.isLoading ? null : controller.login, - child: Text(L10n.of(context)!.loginWithMatrixId), + child: Text(L10n.of(context).loginWithMatrixId), ), const SizedBox(height: 8.0), if (controller.supportsPasswordLogin || controller.supportsSso) @@ -169,7 +169,7 @@ class HomeserverPickerView extends StatelessWidget { : controller.supportsSso ? controller.ssoLoginAction : controller.login, - child: Text(L10n.of(context)!.next), + child: Text(L10n.of(context).next), ), ], ), diff --git a/lib/pages/image_viewer/image_viewer_view.dart b/lib/pages/image_viewer/image_viewer_view.dart index fd04183e4..4c29cbc87 100644 --- a/lib/pages/image_viewer/image_viewer_view.dart +++ b/lib/pages/image_viewer/image_viewer_view.dart @@ -25,7 +25,7 @@ class ImageViewerView extends StatelessWidget { icon: const Icon(Icons.close), onPressed: Navigator.of(context).pop, color: Colors.white, - tooltip: L10n.of(context)!.close, + tooltip: L10n.of(context).close, ), backgroundColor: Colors.transparent, actions: [ @@ -36,7 +36,7 @@ class ImageViewerView extends StatelessWidget { icon: const Icon(Icons.reply_outlined), onPressed: controller.forwardAction, color: Colors.white, - tooltip: L10n.of(context)!.share, + tooltip: L10n.of(context).share, ), const SizedBox(width: 8), IconButton( @@ -46,7 +46,7 @@ class ImageViewerView extends StatelessWidget { icon: const Icon(Icons.download_outlined), onPressed: () => controller.saveFileAction(context), color: Colors.white, - tooltip: L10n.of(context)!.downloadFile, + tooltip: L10n.of(context).downloadFile, ), const SizedBox(width: 8), if (PlatformInfos.isMobile) @@ -59,7 +59,7 @@ class ImageViewerView extends StatelessWidget { backgroundColor: Colors.black.withOpacity(0.5), ), onPressed: () => controller.shareFileAction(context), - tooltip: L10n.of(context)!.share, + tooltip: L10n.of(context).share, color: Colors.white, icon: Icon(Icons.adaptive.share_outlined), ), diff --git a/lib/pages/invitation_selection/invitation_selection.dart b/lib/pages/invitation_selection/invitation_selection.dart index 15078735d..102234333 100644 --- a/lib/pages/invitation_selection/invitation_selection.dart +++ b/lib/pages/invitation_selection/invitation_selection.dart @@ -57,15 +57,15 @@ class InvitationSelectionController extends State { if (OkCancelResult.ok != await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.inviteContact, - message: L10n.of(context)!.inviteContactToGroupQuestion( + title: L10n.of(context).inviteContact, + message: L10n.of(context).inviteContactToGroupQuestion( displayname, room.getLocalizedDisplayname( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), ), ), - okLabel: L10n.of(context)!.invite, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).invite, + cancelLabel: L10n.of(context).cancel, )) { return; } @@ -76,7 +76,7 @@ class InvitationSelectionController extends State { if (success.error == null) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text(L10n.of(context)!.contactHasBeenInvitedToTheGroup), + content: Text(L10n.of(context).contactHasBeenInvitedToTheGroup), ), ); } diff --git a/lib/pages/invitation_selection/invitation_selection_view.dart b/lib/pages/invitation_selection/invitation_selection_view.dart index 6ea03d8ed..84fe2ff7b 100644 --- a/lib/pages/invitation_selection/invitation_selection_view.dart +++ b/lib/pages/invitation_selection/invitation_selection_view.dart @@ -20,21 +20,21 @@ class InvitationSelectionView extends StatelessWidget { if (room == null) { return Scaffold( appBar: AppBar( - title: Text(L10n.of(context)!.oopsSomethingWentWrong), + title: Text(L10n.of(context).oopsSomethingWentWrong), ), body: Center( - child: Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat), + child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat), ), ); } - final groupName = room.name.isEmpty ? L10n.of(context)!.group : room.name; + final groupName = room.name.isEmpty ? L10n.of(context).group : room.name; final theme = Theme.of(context); return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), titleSpacing: 0, - title: Text(L10n.of(context)!.inviteContact), + title: Text(L10n.of(context).inviteContact), ), body: MaxWidthBody( innerPadding: const EdgeInsets.symmetric(vertical: 8), @@ -55,7 +55,7 @@ class InvitationSelectionView extends StatelessWidget { color: theme.colorScheme.onPrimaryContainer, fontWeight: FontWeight.normal, ), - hintText: L10n.of(context)!.inviteContactToGroup(groupName), + hintText: L10n.of(context).inviteContactToGroup(groupName), prefixIcon: controller.loading ? const Padding( padding: EdgeInsets.symmetric( @@ -91,7 +91,7 @@ class InvitationSelectionView extends StatelessWidget { displayname: controller .foundProfiles[i].displayName ?? controller.foundProfiles[i].userId.localpart ?? - L10n.of(context)!.user, + L10n.of(context).user, userId: controller.foundProfiles[i].userId, isMember: participants .contains(controller.foundProfiles[i].userId), @@ -100,7 +100,7 @@ class InvitationSelectionView extends StatelessWidget { controller.foundProfiles[i].userId, controller.foundProfiles[i].displayName ?? controller.foundProfiles[i].userId.localpart ?? - L10n.of(context)!.user, + L10n.of(context).user, ), ), ) @@ -124,7 +124,7 @@ class InvitationSelectionView extends StatelessWidget { avatarUrl: contacts[i].avatarUrl, displayname: contacts[i].displayName ?? contacts[i].id.localpart ?? - L10n.of(context)!.user, + L10n.of(context).user, userId: contacts[i].id, isMember: participants.contains(contacts[i].id), onTap: () => controller.inviteAction( @@ -132,7 +132,7 @@ class InvitationSelectionView extends StatelessWidget { contacts[i].id, contacts[i].displayName ?? contacts[i].id.localpart ?? - L10n.of(context)!.user, + L10n.of(context).user, ), ), ); @@ -189,7 +189,7 @@ class _InviteContactListTile extends StatelessWidget { ), onTap: isMember ? null : onTap, trailing: isMember - ? Text(L10n.of(context)!.participant) + ? Text(L10n.of(context).participant) : const Icon(Icons.person_add_outlined), ), ); diff --git a/lib/pages/key_verification/key_verification_dialog.dart b/lib/pages/key_verification/key_verification_dialog.dart index b4e5a91ae..0bbee5ed1 100644 --- a/lib/pages/key_verification/key_verification_dialog.dart +++ b/lib/pages/key_verification/key_verification_dialog.dart @@ -87,7 +87,7 @@ class KeyVerificationPageState extends State { await showOkAlertDialog( useRootNavigator: false, context: context, - message: L10n.of(context)!.incorrectPassphraseOrKey, + message: L10n.of(context).incorrectPassphraseOrKey, ); } } @@ -106,7 +106,7 @@ class KeyVerificationPageState extends State { } final displayName = user?.calcDisplayname() ?? widget.request.userId.localpart!; - var title = Text(L10n.of(context)!.verifyTitle); + var title = Text(L10n.of(context).verifyTitle); Widget body; final buttons = []; @@ -124,7 +124,7 @@ class KeyVerificationPageState extends State { mainAxisSize: MainAxisSize.min, children: [ Text( - L10n.of(context)!.askSSSSSign, + L10n.of(context).askSSSSSign, style: const TextStyle(fontSize: 20), ), Container(height: 10), @@ -140,7 +140,7 @@ class KeyVerificationPageState extends State { maxLines: 1, obscureText: true, decoration: InputDecoration( - hintText: L10n.of(context)!.passphraseOrKey, + hintText: L10n.of(context).passphraseOrKey, prefixStyle: TextStyle(color: theme.colorScheme.primary), suffixStyle: TextStyle(color: theme.colorScheme.primary), border: const OutlineInputBorder(), @@ -152,7 +152,7 @@ class KeyVerificationPageState extends State { buttons.add( TextButton( child: Text( - L10n.of(context)!.submit, + L10n.of(context).submit, ), onPressed: () => checkInput(textEditingController.text), ), @@ -160,14 +160,14 @@ class KeyVerificationPageState extends State { buttons.add( TextButton( child: Text( - L10n.of(context)!.skip, + L10n.of(context).skip, ), onPressed: () => widget.request.openSSSS(skip: true), ), ); break; case KeyVerificationState.askAccept: - title = Text(L10n.of(context)!.newVerificationRequest); + title = Text(L10n.of(context).newVerificationRequest); body = Column( mainAxisSize: MainAxisSize.min, children: [ @@ -179,7 +179,7 @@ class KeyVerificationPageState extends State { ), const SizedBox(height: 16), Text( - L10n.of(context)!.askVerificationRequest(displayName), + L10n.of(context).askVerificationRequest(displayName), ), ], ); @@ -187,7 +187,7 @@ class KeyVerificationPageState extends State { TextButton.icon( icon: const Icon(Icons.close), style: TextButton.styleFrom(foregroundColor: Colors.red), - label: Text(L10n.of(context)!.reject), + label: Text(L10n.of(context).reject), onPressed: () => widget.request .rejectVerification() .then((_) => Navigator.of(context, rootNavigator: false).pop()), @@ -196,7 +196,7 @@ class KeyVerificationPageState extends State { buttons.add( TextButton.icon( icon: const Icon(Icons.check), - label: Text(L10n.of(context)!.accept), + label: Text(L10n.of(context).accept), onPressed: () => widget.request.acceptVerification(), ), ); @@ -222,7 +222,7 @@ class KeyVerificationPageState extends State { ), const SizedBox(height: 16), Text( - L10n.of(context)!.waitingPartnerAcceptRequest, + L10n.of(context).waitingPartnerAcceptRequest, textAlign: TextAlign.center, ), ], @@ -231,7 +231,7 @@ class KeyVerificationPageState extends State { buttons.add( TextButton.icon( icon: const Icon(Icons.close), - label: Text(L10n.of(context)!.cancel), + label: Text(L10n.of(context).cancel), onPressed: () => widget.request.cancel(), ), ); @@ -244,7 +244,7 @@ class KeyVerificationPageState extends State { if (widget.request.sasTypes.contains('emoji')) { title = Text( - L10n.of(context)!.compareEmojiMatch, + L10n.of(context).compareEmojiMatch, maxLines: 1, style: const TextStyle(fontSize: 16), ); @@ -254,7 +254,7 @@ class KeyVerificationPageState extends State { .toList(), ); } else { - title = Text(L10n.of(context)!.compareNumbersMatch); + title = Text(L10n.of(context).compareNumbersMatch); final numbers = widget.request.sasNumbers; final numbstr = '${numbers[0]}-${numbers[1]}-${numbers[2]}'; compareWidget = @@ -275,22 +275,22 @@ class KeyVerificationPageState extends State { style: TextButton.styleFrom( foregroundColor: Colors.red, ), - label: Text(L10n.of(context)!.theyDontMatch), + label: Text(L10n.of(context).theyDontMatch), onPressed: () => widget.request.rejectSas(), ), ); buttons.add( TextButton.icon( icon: const Icon(Icons.check_outlined), - label: Text(L10n.of(context)!.theyMatch), + label: Text(L10n.of(context).theyMatch), onPressed: () => widget.request.acceptSas(), ), ); break; case KeyVerificationState.waitingSas: final acceptText = widget.request.sasTypes.contains('emoji') - ? L10n.of(context)!.waitingPartnerEmoji - : L10n.of(context)!.waitingPartnerNumbers; + ? L10n.of(context).waitingPartnerEmoji + : L10n.of(context).waitingPartnerNumbers; body = Column( mainAxisSize: MainAxisSize.min, children: [ @@ -314,7 +314,7 @@ class KeyVerificationPageState extends State { ), const SizedBox(height: 10), Text( - L10n.of(context)!.verifySuccess, + L10n.of(context).verifySuccess, textAlign: TextAlign.center, ), ], @@ -322,7 +322,7 @@ class KeyVerificationPageState extends State { buttons.add( TextButton( child: Text( - L10n.of(context)!.close, + L10n.of(context).close, ), onPressed: () => Navigator.of(context, rootNavigator: false).pop(), ), @@ -345,7 +345,7 @@ class KeyVerificationPageState extends State { buttons.add( TextButton( child: Text( - L10n.of(context)!.close, + L10n.of(context).close, ), onPressed: () => Navigator.of(context, rootNavigator: false).pop(), ), diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index c62e2100b..d47d2cc09 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -33,12 +33,12 @@ class LoginController extends State { void login() async { final matrix = Matrix.of(context); if (usernameController.text.isEmpty) { - setState(() => usernameError = L10n.of(context)!.pleaseEnterYourUsername); + setState(() => usernameError = L10n.of(context).pleaseEnterYourUsername); } else { setState(() => usernameError = null); } if (passwordController.text.isEmpty) { - setState(() => passwordError = L10n.of(context)!.pleaseEnterYourPassword); + setState(() => passwordError = L10n.of(context).pleaseEnterYourPassword); } else { setState(() => passwordError = null); } @@ -128,10 +128,9 @@ class LoginController extends State { final dialogResult = await showOkCancelAlertDialog( context: context, useRootNavigator: false, - message: - L10n.of(context)!.noMatrixServer(newDomain, oldHomeserver!), - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + message: L10n.of(context).noMatrixServer(newDomain, oldHomeserver!), + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, ); if (dialogResult == OkCancelResult.ok) { if (mounted) setState(() => usernameError = null); @@ -159,16 +158,16 @@ class LoginController extends State { final input = await showTextInputDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.passwordForgotten, - message: L10n.of(context)!.enterAnEmailAddress, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).passwordForgotten, + message: L10n.of(context).enterAnEmailAddress, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, fullyCapitalizedForMaterial: false, textFields: [ DialogTextField( initialText: usernameController.text.isEmail ? usernameController.text : '', - hintText: L10n.of(context)!.enterAnEmailAddress, + hintText: L10n.of(context).enterAnEmailAddress, keyboardType: TextInputType.emailAddress, ), ], @@ -188,10 +187,10 @@ class LoginController extends State { final password = await showTextInputDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.passwordForgotten, - message: L10n.of(context)!.chooseAStrongPassword, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).passwordForgotten, + message: L10n.of(context).chooseAStrongPassword, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, fullyCapitalizedForMaterial: false, textFields: [ const DialogTextField( @@ -206,9 +205,9 @@ class LoginController extends State { final ok = await showOkAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.weSentYouAnEmail, - message: L10n.of(context)!.pleaseClickOnLink, - okLabel: L10n.of(context)!.iHaveClickedOnLink, + title: L10n.of(context).weSentYouAnEmail, + message: L10n.of(context).pleaseClickOnLink, + okLabel: L10n.of(context).iHaveClickedOnLink, fullyCapitalizedForMaterial: false, ); if (ok != OkCancelResult.ok) return; @@ -233,7 +232,7 @@ class LoginController extends State { ); if (success.error == null) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.passwordHasBeenChanged)), + SnackBar(content: Text(L10n.of(context).passwordHasBeenChanged)), ); usernameController.text = input.single; passwordController.text = password.single; diff --git a/lib/pages/login/login_view.dart b/lib/pages/login/login_view.dart index a8ec3f502..7a7dbc953 100644 --- a/lib/pages/login/login_view.dart +++ b/lib/pages/login/login_view.dart @@ -20,7 +20,7 @@ class LoginView extends StatelessWidget { .homeserver .toString() .replaceFirst('https://', ''); - final title = L10n.of(context)!.logInTo(homeserver); + final title = L10n.of(context).logInTo(homeserver); final titleParts = title.split(homeserver); return LoginScaffold( @@ -68,7 +68,7 @@ class LoginView extends StatelessWidget { errorText: controller.usernameError, errorStyle: const TextStyle(color: Colors.orange), hintText: '@username:localpart', - labelText: L10n.of(context)!.emailOrUsername, + labelText: L10n.of(context).emailOrUsername, ), ), ), @@ -98,7 +98,7 @@ class LoginView extends StatelessWidget { ), ), hintText: '******', - labelText: L10n.of(context)!.password, + labelText: L10n.of(context).password, ), ), ), @@ -113,7 +113,7 @@ class LoginView extends StatelessWidget { onPressed: controller.loading ? null : controller.login, child: controller.loading ? const LinearProgressIndicator() - : Text(L10n.of(context)!.login), + : Text(L10n.of(context).login), ), ), const SizedBox(height: 16), @@ -126,7 +126,7 @@ class LoginView extends StatelessWidget { style: TextButton.styleFrom( foregroundColor: theme.colorScheme.error, ), - child: Text(L10n.of(context)!.passwordForgotten), + child: Text(L10n.of(context).passwordForgotten), ), ), const SizedBox(height: 16), diff --git a/lib/pages/new_group/new_group_view.dart b/lib/pages/new_group/new_group_view.dart index 54c9a1286..932fd2958 100644 --- a/lib/pages/new_group/new_group_view.dart +++ b/lib/pages/new_group/new_group_view.dart @@ -26,7 +26,7 @@ class NewGroupView extends StatelessWidget { onPressed: controller.loading ? null : Navigator.of(context).pop, ), ), - title: Text(L10n.of(context)!.createGroup), + title: Text(L10n.of(context).createGroup), ), body: MaxWidthBody( child: Column( @@ -61,7 +61,7 @@ class NewGroupView extends StatelessWidget { readOnly: controller.loading, decoration: InputDecoration( prefixIcon: const Icon(Icons.people_outlined), - labelText: L10n.of(context)!.groupName, + labelText: L10n.of(context).groupName, ), ), ), @@ -69,7 +69,7 @@ class NewGroupView extends StatelessWidget { SwitchListTile.adaptive( contentPadding: const EdgeInsets.symmetric(horizontal: 32), secondary: const Icon(Icons.public_outlined), - title: Text(L10n.of(context)!.groupIsPublic), + title: Text(L10n.of(context).groupIsPublic), value: controller.publicGroup, onChanged: controller.loading ? null : controller.setPublicGroup, ), @@ -80,7 +80,7 @@ class NewGroupView extends StatelessWidget { contentPadding: const EdgeInsets.symmetric(horizontal: 32), secondary: const Icon(Icons.search_outlined), - title: Text(L10n.of(context)!.groupCanBeFoundViaSearch), + title: Text(L10n.of(context).groupCanBeFoundViaSearch), value: controller.groupCanBeFound, onChanged: controller.loading ? null @@ -95,7 +95,7 @@ class NewGroupView extends StatelessWidget { color: theme.colorScheme.onSurface, ), title: Text( - L10n.of(context)!.enableEncryption, + L10n.of(context).enableEncryption, style: TextStyle( color: theme.colorScheme.onSurface, ), @@ -112,7 +112,7 @@ class NewGroupView extends StatelessWidget { controller.loading ? null : controller.submitAction, child: controller.loading ? const LinearProgressIndicator() - : Text(L10n.of(context)!.createGroupAndInviteUsers), + : Text(L10n.of(context).createGroupAndInviteUsers), ), ), ), diff --git a/lib/pages/new_private_chat/new_private_chat.dart b/lib/pages/new_private_chat/new_private_chat.dart index c1d8c649a..7cb177afc 100644 --- a/lib/pages/new_private_chat/new_private_chat.dart +++ b/lib/pages/new_private_chat/new_private_chat.dart @@ -74,7 +74,7 @@ class NewPrivateChatController extends State { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - L10n.of(context)!.unsupportedAndroidVersionLong, + L10n.of(context).unsupportedAndroidVersionLong, ), ), ); @@ -94,7 +94,7 @@ class NewPrivateChatController extends State { ClipboardData(text: Matrix.of(context).client.userID!), ); ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.copiedToClipboard)), + SnackBar(content: Text(L10n.of(context).copiedToClipboard)), ); } diff --git a/lib/pages/new_private_chat/new_private_chat_view.dart b/lib/pages/new_private_chat/new_private_chat_view.dart index f46e8a4c8..db18c61de 100644 --- a/lib/pages/new_private_chat/new_private_chat_view.dart +++ b/lib/pages/new_private_chat/new_private_chat_view.dart @@ -29,13 +29,13 @@ class NewPrivateChatView extends StatelessWidget { appBar: AppBar( scrolledUnderElevation: 0, leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.newChat), + title: Text(L10n.of(context).newChat), backgroundColor: theme.scaffoldBackgroundColor, actions: [ TextButton( onPressed: UrlLauncher(context, AppConfig.startChatTutorial).launchUrl, - child: Text(L10n.of(context)!.help), + child: Text(L10n.of(context).help), ), ], ), @@ -53,7 +53,7 @@ class NewPrivateChatView extends StatelessWidget { controller: controller.controller, onChanged: controller.searchUsers, decoration: InputDecoration( - hintText: L10n.of(context)!.searchForUsers, + hintText: L10n.of(context).searchForUsers, filled: true, fillColor: theme.colorScheme.secondaryContainer, border: OutlineInputBorder( @@ -110,7 +110,7 @@ class NewPrivateChatView extends StatelessWidget { TextSpan( children: [ TextSpan( - text: L10n.of(context)!.yourGlobalUserIdIs, + text: L10n.of(context).yourGlobalUserIdIs, ), TextSpan( text: Matrix.of(context).client.userID, @@ -133,7 +133,7 @@ class NewPrivateChatView extends StatelessWidget { foregroundColor: theme.colorScheme.onSecondaryContainer, child: Icon(Icons.adaptive.share_outlined), ), - title: Text(L10n.of(context)!.shareInviteLink), + title: Text(L10n.of(context).shareInviteLink), onTap: controller.inviteAction, ), ListTile( @@ -142,7 +142,7 @@ class NewPrivateChatView extends StatelessWidget { foregroundColor: theme.colorScheme.onTertiaryContainer, child: const Icon(Icons.group_add_outlined), ), - title: Text(L10n.of(context)!.createGroup), + title: Text(L10n.of(context).createGroup), onTap: () => context.go('/rooms/newgroup'), ), if (PlatformInfos.isMobile) @@ -152,7 +152,7 @@ class NewPrivateChatView extends StatelessWidget { foregroundColor: theme.colorScheme.onPrimaryContainer, child: const Icon(Icons.qr_code_scanner_outlined), ), - title: Text(L10n.of(context)!.scanQrCode), + title: Text(L10n.of(context).scanQrCode), onTap: controller.openScannerAction, ), Center( @@ -207,7 +207,7 @@ class NewPrivateChatView extends StatelessWidget { OutlinedButton.icon( onPressed: controller.searchUsers, icon: const Icon(Icons.refresh_outlined), - label: Text(L10n.of(context)!.tryAgain), + label: Text(L10n.of(context).tryAgain), ), ], ); @@ -225,7 +225,7 @@ class NewPrivateChatView extends StatelessWidget { Padding( padding: const EdgeInsets.all(16.0), child: Text( - L10n.of(context)!.noUsersFoundWithQuery( + L10n.of(context).noUsersFoundWithQuery( controller.controller.text, ), style: TextStyle( diff --git a/lib/pages/new_private_chat/qr_scanner_modal.dart b/lib/pages/new_private_chat/qr_scanner_modal.dart index fbc1d5e4b..f0c571ddd 100644 --- a/lib/pages/new_private_chat/qr_scanner_modal.dart +++ b/lib/pages/new_private_chat/qr_scanner_modal.dart @@ -35,9 +35,9 @@ class QrScannerModalState extends State { leading: IconButton( icon: const Icon(Icons.close_outlined), onPressed: Navigator.of(context).pop, - tooltip: L10n.of(context)!.close, + tooltip: L10n.of(context).close, ), - title: Text(L10n.of(context)!.scanQrCode), + title: Text(L10n.of(context).scanQrCode), ), body: Stack( children: [ diff --git a/lib/pages/new_space/new_space.dart b/lib/pages/new_space/new_space.dart index 1f484cda8..12bb4cc17 100644 --- a/lib/pages/new_space/new_space.dart +++ b/lib/pages/new_space/new_space.dart @@ -52,7 +52,7 @@ class NewSpaceController extends State { }); if (nameController.text.isEmpty) { setState(() { - nameError = L10n.of(context)!.pleaseChoose; + nameError = L10n.of(context).pleaseChoose; }); return; } diff --git a/lib/pages/new_space/new_space_view.dart b/lib/pages/new_space/new_space_view.dart index ed60d670d..0f5813952 100644 --- a/lib/pages/new_space/new_space_view.dart +++ b/lib/pages/new_space/new_space_view.dart @@ -16,7 +16,7 @@ class NewSpaceView extends StatelessWidget { final avatar = controller.avatar; return Scaffold( appBar: AppBar( - title: Text(L10n.of(context)!.createNewSpace), + title: Text(L10n.of(context).createNewSpace), ), body: MaxWidthBody( child: Column( @@ -51,7 +51,7 @@ class NewSpaceView extends StatelessWidget { readOnly: controller.loading, decoration: InputDecoration( prefixIcon: const Icon(Icons.people_outlined), - labelText: L10n.of(context)!.spaceName, + labelText: L10n.of(context).spaceName, errorText: controller.nameError, ), ), @@ -59,7 +59,7 @@ class NewSpaceView extends StatelessWidget { const SizedBox(height: 16), SwitchListTile.adaptive( contentPadding: const EdgeInsets.symmetric(horizontal: 32), - title: Text(L10n.of(context)!.spaceIsPublic), + title: Text(L10n.of(context).spaceIsPublic), value: controller.publicGroup, onChanged: controller.setPublicGroup, ), @@ -69,7 +69,7 @@ class NewSpaceView extends StatelessWidget { padding: EdgeInsets.symmetric(horizontal: 16.0), child: Icon(Icons.info_outlined), ), - subtitle: Text(L10n.of(context)!.newSpaceDescription), + subtitle: Text(L10n.of(context).newSpaceDescription), ), Padding( padding: const EdgeInsets.all(16.0), @@ -80,7 +80,7 @@ class NewSpaceView extends StatelessWidget { controller.loading ? null : controller.submitAction, child: controller.loading ? const LinearProgressIndicator() - : Text(L10n.of(context)!.createNewSpace), + : Text(L10n.of(context).createNewSpace), ), ), ), diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index 1d930910a..ca3e29285 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -36,9 +36,9 @@ class SettingsController extends State { final input = await showTextInputDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.editDisplayname, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).editDisplayname, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, textFields: [ DialogTextField( initialText: profile?.displayName ?? @@ -63,11 +63,11 @@ class SettingsController extends State { if (await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSureYouWantToLogout, - message: L10n.of(context)!.noBackupWarning, + title: L10n.of(context).areYouSureYouWantToLogout, + message: L10n.of(context).noBackupWarning, isDestructiveAction: noBackup, - okLabel: L10n.of(context)!.logout, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).logout, + cancelLabel: L10n.of(context).cancel, ) == OkCancelResult.cancel) { return; @@ -85,19 +85,19 @@ class SettingsController extends State { if (PlatformInfos.isMobile) SheetAction( key: AvatarAction.camera, - label: L10n.of(context)!.openCamera, + label: L10n.of(context).openCamera, isDefaultAction: true, icon: Icons.camera_alt_outlined, ), SheetAction( key: AvatarAction.file, - label: L10n.of(context)!.openGallery, + label: L10n.of(context).openGallery, icon: Icons.photo_outlined, ), if (profile?.avatarUrl != null) SheetAction( key: AvatarAction.remove, - label: L10n.of(context)!.removeYourAvatar, + label: L10n.of(context).removeYourAvatar, isDestructiveAction: true, icon: Icons.delete_outlined, ), @@ -106,7 +106,7 @@ class SettingsController extends State { ? actions.single.key : await showModalActionSheet( context: context, - title: L10n.of(context)!.changeYourAvatar, + title: L10n.of(context).changeYourAvatar, actions: actions, ); if (action == null) return; @@ -189,9 +189,9 @@ class SettingsController extends State { if (showChatBackupBanner != true) { showOkAlertDialog( context: context, - title: L10n.of(context)!.chatBackup, - message: L10n.of(context)!.onlineKeyBackupEnabled, - okLabel: L10n.of(context)!.close, + title: L10n.of(context).chatBackup, + message: L10n.of(context).onlineKeyBackupEnabled, + okLabel: L10n.of(context).close, ); return; } diff --git a/lib/pages/settings/settings_view.dart b/lib/pages/settings/settings_view.dart index 70133433b..f6fbcbed2 100644 --- a/lib/pages/settings/settings_view.dart +++ b/lib/pages/settings/settings_view.dart @@ -28,7 +28,7 @@ class SettingsView extends StatelessWidget { onPressed: () => context.go('/rooms'), ), ), - title: Text(L10n.of(context)!.settings), + title: Text(L10n.of(context).settings), ), body: ListTileTheme( iconColor: theme.colorScheme.onSurface, @@ -40,7 +40,7 @@ class SettingsView extends StatelessWidget { builder: (context, snapshot) { final profile = snapshot.data; final mxid = - Matrix.of(context).client.userID ?? L10n.of(context)!.user; + Matrix.of(context).client.userID ?? L10n.of(context).user; final displayname = profile?.displayName ?? mxid.localpart ?? mxid; return Row( @@ -118,7 +118,7 @@ class SettingsView extends StatelessWidget { if (showChatBackupBanner == null) ListTile( leading: const Icon(Icons.backup_outlined), - title: Text(L10n.of(context)!.chatBackup), + title: Text(L10n.of(context).chatBackup), trailing: const CircularProgressIndicator.adaptive(), ) else @@ -126,7 +126,7 @@ class SettingsView extends StatelessWidget { controlAffinity: ListTileControlAffinity.trailing, value: controller.showChatBackupBanner == false, secondary: const Icon(Icons.backup_outlined), - title: Text(L10n.of(context)!.chatBackup), + title: Text(L10n.of(context).chatBackup), onChanged: controller.firstRunBootstrapAction, ), Divider( @@ -134,49 +134,49 @@ class SettingsView extends StatelessWidget { ), ListTile( leading: const Icon(Icons.format_paint_outlined), - title: Text(L10n.of(context)!.changeTheme), + title: Text(L10n.of(context).changeTheme), onTap: () => context.go('/rooms/settings/style'), ), ListTile( leading: const Icon(Icons.notifications_outlined), - title: Text(L10n.of(context)!.notifications), + title: Text(L10n.of(context).notifications), onTap: () => context.go('/rooms/settings/notifications'), ), ListTile( leading: const Icon(Icons.devices_outlined), - title: Text(L10n.of(context)!.devices), + title: Text(L10n.of(context).devices), onTap: () => context.go('/rooms/settings/devices'), ), ListTile( leading: const Icon(Icons.forum_outlined), - title: Text(L10n.of(context)!.chat), + title: Text(L10n.of(context).chat), onTap: () => context.go('/rooms/settings/chat'), ), ListTile( leading: const Icon(Icons.shield_outlined), - title: Text(L10n.of(context)!.security), + title: Text(L10n.of(context).security), onTap: () => context.go('/rooms/settings/security'), ), Divider(color: theme.dividerColor), ListTile( leading: const Icon(Icons.help_outline_outlined), - title: Text(L10n.of(context)!.help), + title: Text(L10n.of(context).help), onTap: () => launchUrlString(AppConfig.supportUrl), ), ListTile( leading: const Icon(Icons.shield_sharp), - title: Text(L10n.of(context)!.privacy), + title: Text(L10n.of(context).privacy), onTap: () => launchUrlString(AppConfig.privacyUrl), ), ListTile( leading: const Icon(Icons.info_outline_rounded), - title: Text(L10n.of(context)!.about), + title: Text(L10n.of(context).about), onTap: () => PlatformInfos.showDialog(context), ), Divider(color: theme.dividerColor), ListTile( leading: const Icon(Icons.logout_outlined), - title: Text(L10n.of(context)!.logout), + title: Text(L10n.of(context).logout), onTap: controller.logoutAction, ), ], diff --git a/lib/pages/settings_3pid/settings_3pid.dart b/lib/pages/settings_3pid/settings_3pid.dart index d46cac2a9..76dbc50bf 100644 --- a/lib/pages/settings_3pid/settings_3pid.dart +++ b/lib/pages/settings_3pid/settings_3pid.dart @@ -22,12 +22,12 @@ class Settings3PidController extends State { final input = await showTextInputDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.enterAnEmailAddress, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).enterAnEmailAddress, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, textFields: [ DialogTextField( - hintText: L10n.of(context)!.enterAnEmailAddress, + hintText: L10n.of(context).enterAnEmailAddress, keyboardType: TextInputType.emailAddress, ), ], @@ -46,9 +46,9 @@ class Settings3PidController extends State { final ok = await showOkAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.weSentYouAnEmail, - message: L10n.of(context)!.pleaseClickOnLink, - okLabel: L10n.of(context)!.iHaveClickedOnLink, + title: L10n.of(context).weSentYouAnEmail, + message: L10n.of(context).pleaseClickOnLink, + okLabel: L10n.of(context).iHaveClickedOnLink, ); if (ok != OkCancelResult.ok) return; final success = await showFutureLoadingDialog( @@ -71,9 +71,9 @@ class Settings3PidController extends State { if (await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, ) != OkCancelResult.ok) { return; diff --git a/lib/pages/settings_3pid/settings_3pid_view.dart b/lib/pages/settings_3pid/settings_3pid_view.dart index af5e1f757..86b67a1b3 100644 --- a/lib/pages/settings_3pid/settings_3pid_view.dart +++ b/lib/pages/settings_3pid/settings_3pid_view.dart @@ -20,12 +20,12 @@ class Settings3PidView extends StatelessWidget { return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.passwordRecovery), + title: Text(L10n.of(context).passwordRecovery), actions: [ IconButton( icon: const Icon(Icons.add_outlined), onPressed: controller.add3PidAction, - tooltip: L10n.of(context)!.addEmail, + tooltip: L10n.of(context).addEmail, ), ], ), @@ -66,8 +66,8 @@ class Settings3PidView extends StatelessWidget { ), title: Text( identifier.isEmpty - ? L10n.of(context)!.noPasswordRecoveryDescription - : L10n.of(context)! + ? L10n.of(context).noPasswordRecoveryDescription + : L10n.of(context) .withTheseAddressesRecoveryDescription, ), ), @@ -83,7 +83,7 @@ class Settings3PidView extends StatelessWidget { ), title: Text(identifier[i].address), trailing: IconButton( - tooltip: L10n.of(context)!.delete, + tooltip: L10n.of(context).delete, icon: const Icon(Icons.delete_forever_outlined), color: Colors.red, onPressed: () => controller.delete3Pid(identifier[i]), diff --git a/lib/pages/settings_chat/settings_chat_view.dart b/lib/pages/settings_chat/settings_chat_view.dart index e23829d87..7efa65a1e 100644 --- a/lib/pages/settings_chat/settings_chat_view.dart +++ b/lib/pages/settings_chat/settings_chat_view.dart @@ -21,54 +21,54 @@ class SettingsChatView extends StatelessWidget { final theme = Theme.of(context); return Scaffold( - appBar: AppBar(title: Text(L10n.of(context)!.chat)), + appBar: AppBar(title: Text(L10n.of(context).chat)), body: ListTileTheme( iconColor: theme.textTheme.bodyLarge!.color, child: MaxWidthBody( child: Column( children: [ SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.formattedMessages, - subtitle: L10n.of(context)!.formattedMessagesDescription, + title: L10n.of(context).formattedMessages, + subtitle: L10n.of(context).formattedMessagesDescription, onChanged: (b) => AppConfig.renderHtml = b, storeKey: SettingKeys.renderHtml, defaultValue: AppConfig.renderHtml, ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.hideMemberChangesInPublicChats, - subtitle: L10n.of(context)!.hideMemberChangesInPublicChatsBody, + title: L10n.of(context).hideMemberChangesInPublicChats, + subtitle: L10n.of(context).hideMemberChangesInPublicChatsBody, onChanged: (b) => AppConfig.hideUnimportantStateEvents = b, storeKey: SettingKeys.hideUnimportantStateEvents, defaultValue: AppConfig.hideUnimportantStateEvents, ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.hideRedactedMessages, - subtitle: L10n.of(context)!.hideRedactedMessagesBody, + title: L10n.of(context).hideRedactedMessages, + subtitle: L10n.of(context).hideRedactedMessagesBody, onChanged: (b) => AppConfig.hideRedactedEvents = b, storeKey: SettingKeys.hideRedactedEvents, defaultValue: AppConfig.hideRedactedEvents, ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.hideInvalidOrUnknownMessageFormats, + title: L10n.of(context).hideInvalidOrUnknownMessageFormats, onChanged: (b) => AppConfig.hideUnknownEvents = b, storeKey: SettingKeys.hideUnknownEvents, defaultValue: AppConfig.hideUnknownEvents, ), if (PlatformInfos.isMobile) SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.autoplayImages, + title: L10n.of(context).autoplayImages, onChanged: (b) => AppConfig.autoplayImages = b, storeKey: SettingKeys.autoplayImages, defaultValue: AppConfig.autoplayImages, ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.sendOnEnter, + title: L10n.of(context).sendOnEnter, onChanged: (b) => AppConfig.sendOnEnter = b, storeKey: SettingKeys.sendOnEnter, defaultValue: AppConfig.sendOnEnter ?? !PlatformInfos.isMobile, ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.swipeRightToLeftToReply, + title: L10n.of(context).swipeRightToLeftToReply, onChanged: (b) => AppConfig.swipeRightToLeftToReply = b, storeKey: SettingKeys.swipeRightToLeftToReply, defaultValue: AppConfig.swipeRightToLeftToReply, @@ -76,7 +76,7 @@ class SettingsChatView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.customEmojisAndStickers, + L10n.of(context).customEmojisAndStickers, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -84,8 +84,8 @@ class SettingsChatView extends StatelessWidget { ), ), ListTile( - title: Text(L10n.of(context)!.customEmojisAndStickers), - subtitle: Text(L10n.of(context)!.customEmojisAndStickersBody), + title: Text(L10n.of(context).customEmojisAndStickers), + subtitle: Text(L10n.of(context).customEmojisAndStickersBody), onTap: () => context.go('/rooms/settings/chat/emotes'), trailing: const Padding( padding: EdgeInsets.all(16.0), @@ -95,7 +95,7 @@ class SettingsChatView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.calls, + L10n.of(context).calls, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -103,7 +103,7 @@ class SettingsChatView extends StatelessWidget { ), ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.experimentalVideoCalls, + title: L10n.of(context).experimentalVideoCalls, onChanged: (b) { AppConfig.experimentalVoip = b; Matrix.of(context).createVoipPlugin(); @@ -114,7 +114,7 @@ class SettingsChatView extends StatelessWidget { ), if (PlatformInfos.isMobile) ListTile( - title: Text(L10n.of(context)!.callingPermissions), + title: Text(L10n.of(context).callingPermissions), onTap: () => CallKeepManager().checkoutPhoneAccountSetting(context), trailing: const Padding( diff --git a/lib/pages/settings_emotes/import_archive_dialog.dart b/lib/pages/settings_emotes/import_archive_dialog.dart index 5c6361577..02cafad78 100644 --- a/lib/pages/settings_emotes/import_archive_dialog.dart +++ b/lib/pages/settings_emotes/import_archive_dialog.dart @@ -44,7 +44,7 @@ class _ImportEmoteArchiveDialogState extends State { @override Widget build(BuildContext context) { return AlertDialog( - title: Text(L10n.of(context)!.importEmojis), + title: Text(L10n.of(context).importEmojis), content: _loading ? Center( child: CircularProgressIndicator( @@ -73,7 +73,7 @@ class _ImportEmoteArchiveDialogState extends State { actions: [ TextButton( onPressed: _loading ? null : Navigator.of(context).pop, - child: Text(L10n.of(context)!.cancel), + child: Text(L10n.of(context).cancel), ), TextButton( onPressed: _loading @@ -81,7 +81,7 @@ class _ImportEmoteArchiveDialogState extends State { : _importMap.isNotEmpty ? _addEmotePack : null, - child: Text(L10n.of(context)!.importNow), + child: Text(L10n.of(context).importNow), ), ], ); @@ -121,10 +121,10 @@ class _ImportEmoteArchiveDialogState extends State { final result = await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.emoteExists, + title: L10n.of(context).emoteExists, message: imageCode, - cancelLabel: L10n.of(context)!.replace, - okLabel: L10n.of(context)!.skip, + cancelLabel: L10n.of(context).replace, + okLabel: L10n.of(context).skip, ); completer.complete(result); }); @@ -242,7 +242,7 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> { IconButton( onPressed: widget.onRemove, icon: const Icon(Icons.remove_circle), - tooltip: L10n.of(context)!.remove, + tooltip: L10n.of(context).remove, ), ValueListenableBuilder( valueListenable: hasErrorNotifier, @@ -278,7 +278,7 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> { minLines: 1, maxLines: 1, decoration: InputDecoration( - hintText: L10n.of(context)!.emoteShortcode, + hintText: L10n.of(context).emoteShortcode, prefixText: ': ', suffixText: ':', border: const OutlineInputBorder(), @@ -329,7 +329,7 @@ class _ImageFileError extends StatelessWidget { children: [ const Icon(Icons.error), Text( - L10n.of(context)!.notAnImage, + L10n.of(context).notAnImage, textAlign: TextAlign.center, style: theme.textTheme.labelSmall, ), diff --git a/lib/pages/settings_emotes/settings_emotes.dart b/lib/pages/settings_emotes/settings_emotes.dart index 59dade669..37a18d8fc 100644 --- a/lib/pages/settings_emotes/settings_emotes.dart +++ b/lib/pages/settings_emotes/settings_emotes.dart @@ -139,8 +139,8 @@ class EmotesSettingsController extends State { showOkAlertDialog( useRootNavigator: false, context: context, - message: L10n.of(context)!.emoteExists, - okLabel: L10n.of(context)!.ok, + message: L10n.of(context).emoteExists, + okLabel: L10n.of(context).ok, ); return; } @@ -149,8 +149,8 @@ class EmotesSettingsController extends State { showOkAlertDialog( useRootNavigator: false, context: context, - message: L10n.of(context)!.emoteInvalid, - okLabel: L10n.of(context)!.ok, + message: L10n.of(context).emoteInvalid, + okLabel: L10n.of(context).ok, ); return; } @@ -185,8 +185,8 @@ class EmotesSettingsController extends State { await showOkAlertDialog( useRootNavigator: false, context: context, - message: L10n.of(context)!.emoteWarnNeedToPick, - okLabel: L10n.of(context)!.ok, + message: L10n.of(context).emoteWarnNeedToPick, + okLabel: L10n.of(context).ok, ); return; } @@ -195,8 +195,8 @@ class EmotesSettingsController extends State { await showOkAlertDialog( useRootNavigator: false, context: context, - message: L10n.of(context)!.emoteExists, - okLabel: L10n.of(context)!.ok, + message: L10n.of(context).emoteExists, + okLabel: L10n.of(context).ok, ); return; } @@ -204,8 +204,8 @@ class EmotesSettingsController extends State { await showOkAlertDialog( useRootNavigator: false, context: context, - message: L10n.of(context)!.emoteInvalid, - okLabel: L10n.of(context)!.ok, + message: L10n.of(context).emoteInvalid, + okLabel: L10n.of(context).ok, ); return; } diff --git a/lib/pages/settings_emotes/settings_emotes_view.dart b/lib/pages/settings_emotes/settings_emotes_view.dart index 1337873a2..fb94b748c 100644 --- a/lib/pages/settings_emotes/settings_emotes_view.dart +++ b/lib/pages/settings_emotes/settings_emotes_view.dart @@ -26,7 +26,7 @@ class EmotesSettingsView extends StatelessWidget { return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.customEmojisAndStickers), + title: Text(L10n.of(context).customEmojisAndStickers), actions: [ PopupMenuButton( onSelected: (value) { @@ -43,11 +43,11 @@ class EmotesSettingsView extends StatelessWidget { itemBuilder: (context) => [ PopupMenuItem( value: PopupMenuEmojiActions.import, - child: Text(L10n.of(context)!.importFromZipFile), + child: Text(L10n.of(context).importFromZipFile), ), PopupMenuItem( value: PopupMenuEmojiActions.export, - child: Text(L10n.of(context)!.exportEmotePack), + child: Text(L10n.of(context).exportEmotePack), ), ], ), @@ -83,7 +83,7 @@ class EmotesSettingsView extends StatelessWidget { minLines: 1, maxLines: 1, decoration: InputDecoration( - hintText: L10n.of(context)!.emoteShortcode, + hintText: L10n.of(context).emoteShortcode, prefixText: ': ', suffixText: ':', prefixStyle: TextStyle( @@ -114,7 +114,7 @@ class EmotesSettingsView extends StatelessWidget { ), if (controller.room != null) SwitchListTile.adaptive( - title: Text(L10n.of(context)!.enableEmotesGlobally), + title: Text(L10n.of(context).enableEmotesGlobally), value: controller.isGloballyActive(client), onChanged: controller.setIsGloballyActive, ), @@ -125,7 +125,7 @@ class EmotesSettingsView extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(16), child: Text( - L10n.of(context)!.noEmotesFound, + L10n.of(context).noEmotesFound, style: const TextStyle(fontSize: 20), ), ), @@ -186,7 +186,7 @@ class EmotesSettingsView extends StatelessWidget { minLines: 1, maxLines: 1, decoration: InputDecoration( - hintText: L10n.of(context)!.emoteShortcode, + hintText: L10n.of(context).emoteShortcode, prefixText: ': ', suffixText: ':', prefixStyle: TextStyle( @@ -269,7 +269,7 @@ class _ImagePickerState extends State<_ImagePicker> { if (widget.controller.value == null) { return ElevatedButton( onPressed: () => widget.onPressed(widget.controller), - child: Text(L10n.of(context)!.pickImage), + child: Text(L10n.of(context).pickImage), ); } else { return _EmoteImage(widget.controller.value!.url); diff --git a/lib/pages/settings_ignore_list/settings_ignore_list.dart b/lib/pages/settings_ignore_list/settings_ignore_list.dart index 0468d267b..c2ad3404c 100644 --- a/lib/pages/settings_ignore_list/settings_ignore_list.dart +++ b/lib/pages/settings_ignore_list/settings_ignore_list.dart @@ -35,7 +35,7 @@ class SettingsIgnoreListController extends State { if (userId.isEmpty) return; if (!userId.isValidMatrixId || userId.sigil != '@') { setState(() { - errorText = L10n.of(context)!.invalidInput; + errorText = L10n.of(context).invalidInput; }); return; } diff --git a/lib/pages/settings_ignore_list/settings_ignore_list_view.dart b/lib/pages/settings_ignore_list/settings_ignore_list_view.dart index 63466ddbb..09922c308 100644 --- a/lib/pages/settings_ignore_list/settings_ignore_list_view.dart +++ b/lib/pages/settings_ignore_list/settings_ignore_list_view.dart @@ -22,7 +22,7 @@ class SettingsIgnoreListView extends StatelessWidget { return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.blockedUsers), + title: Text(L10n.of(context).blockedUsers), ), body: MaxWidthBody( withScrolling: false, @@ -43,9 +43,9 @@ class SettingsIgnoreListView extends StatelessWidget { errorText: controller.errorText, hintText: '@bad_guy:domain.abc', floatingLabelBehavior: FloatingLabelBehavior.always, - labelText: L10n.of(context)!.blockUsername, + labelText: L10n.of(context).blockUsername, suffixIcon: IconButton( - tooltip: L10n.of(context)!.block, + tooltip: L10n.of(context).block, icon: const Icon(Icons.add), onPressed: () => controller.ignoreUser(context), ), @@ -53,7 +53,7 @@ class SettingsIgnoreListView extends StatelessWidget { ), const SizedBox(height: 16), Text( - L10n.of(context)!.blockListDescription, + L10n.of(context).blockListDescription, style: const TextStyle(color: Colors.orange), ), ], @@ -89,7 +89,7 @@ class SettingsIgnoreListView extends StatelessWidget { subtitle: Text(s.data?.userId ?? client.ignoredUsers[i]), trailing: IconButton( - tooltip: L10n.of(context)!.delete, + tooltip: L10n.of(context).delete, icon: const Icon(Icons.delete_outlined), onPressed: () => showFutureLoadingDialog( context: context, diff --git a/lib/pages/settings_multiple_emotes/settings_multiple_emotes_view.dart b/lib/pages/settings_multiple_emotes/settings_multiple_emotes_view.dart index 5b910a8ba..83b1da436 100644 --- a/lib/pages/settings_multiple_emotes/settings_multiple_emotes_view.dart +++ b/lib/pages/settings_multiple_emotes/settings_multiple_emotes_view.dart @@ -18,7 +18,7 @@ class MultipleEmotesSettingsView extends StatelessWidget { return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.emotePacks), + title: Text(L10n.of(context).emotePacks), ), body: StreamBuilder( stream: room.client.onRoomState.stream diff --git a/lib/pages/settings_notifications/settings_notifications.dart b/lib/pages/settings_notifications/settings_notifications.dart index 2baf14dd0..ca47e8e28 100644 --- a/lib/pages/settings_notifications/settings_notifications.dart +++ b/lib/pages/settings_notifications/settings_notifications.dart @@ -19,37 +19,37 @@ class NotificationSettingsItem { NotificationSettingsItem( PushRuleKind.underride, '.m.rule.message', - (c) => L10n.of(c)!.allRooms, + (c) => L10n.of(c).allRooms, ), NotificationSettingsItem( PushRuleKind.underride, '.m.rule.room_one_to_one', - (c) => L10n.of(c)!.directChats, + (c) => L10n.of(c).directChats, ), NotificationSettingsItem( PushRuleKind.override, '.m.rule.contains_display_name', - (c) => L10n.of(c)!.containsDisplayName, + (c) => L10n.of(c).containsDisplayName, ), NotificationSettingsItem( PushRuleKind.content, '.m.rule.contains_user_name', - (c) => L10n.of(c)!.containsUserName, + (c) => L10n.of(c).containsUserName, ), NotificationSettingsItem( PushRuleKind.override, '.m.rule.invite_for_me', - (c) => L10n.of(c)!.inviteForMe, + (c) => L10n.of(c).inviteForMe, ), NotificationSettingsItem( PushRuleKind.override, '.m.rule.member_event', - (c) => L10n.of(c)!.memberChanges, + (c) => L10n.of(c).memberChanges, ), NotificationSettingsItem( PushRuleKind.override, '.m.rule.suppress_notices', - (c) => L10n.of(c)!.botMessages, + (c) => L10n.of(c).botMessages, ), ]; } @@ -145,7 +145,7 @@ class SettingsNotificationsController extends State { message: '${pusher.appDisplayName} (${pusher.appId})', actions: [ SheetAction( - label: L10n.of(context)!.delete, + label: L10n.of(context).delete, isDestructiveAction: true, key: true, ), diff --git a/lib/pages/settings_notifications/settings_notifications_view.dart b/lib/pages/settings_notifications/settings_notifications_view.dart index 0128b7593..ed934c539 100644 --- a/lib/pages/settings_notifications/settings_notifications_view.dart +++ b/lib/pages/settings_notifications/settings_notifications_view.dart @@ -18,7 +18,7 @@ class SettingsNotificationsView extends StatelessWidget { return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.notifications), + title: Text(L10n.of(context).notifications), ), body: MaxWidthBody( child: StreamBuilder( @@ -36,7 +36,7 @@ class SettingsNotificationsView extends StatelessWidget { SwitchListTile.adaptive( value: !Matrix.of(context).client.allPushNotificationsMuted, title: Text( - L10n.of(context)!.notificationsEnabledForThisAccount, + L10n.of(context).notificationsEnabledForThisAccount, ), onChanged: controller.isLoading ? null @@ -45,7 +45,7 @@ class SettingsNotificationsView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.notifyMeFor, + L10n.of(context).notifyMeFor, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -68,7 +68,7 @@ class SettingsNotificationsView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.devices, + L10n.of(context).devices, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -98,7 +98,7 @@ class SettingsNotificationsView extends StatelessWidget { return Center( child: Padding( padding: const EdgeInsets.only(bottom: 16.0), - child: Text(L10n.of(context)!.noOtherDevicesFound), + child: Text(L10n.of(context).noOtherDevicesFound), ), ); } diff --git a/lib/pages/settings_password/settings_password.dart b/lib/pages/settings_password/settings_password.dart index cb631d7f3..48579d395 100644 --- a/lib/pages/settings_password/settings_password.dart +++ b/lib/pages/settings_password/settings_password.dart @@ -31,20 +31,20 @@ class SettingsPasswordController extends State { }); if (oldPasswordController.text.isEmpty) { setState(() { - oldPasswordError = L10n.of(context)!.pleaseEnterYourPassword; + oldPasswordError = L10n.of(context).pleaseEnterYourPassword; }); return; } if (newPassword1Controller.text.isEmpty || newPassword1Controller.text.length < 6) { setState(() { - newPassword1Error = L10n.of(context)!.pleaseChooseAStrongPassword; + newPassword1Error = L10n.of(context).pleaseChooseAStrongPassword; }); return; } if (newPassword1Controller.text != newPassword2Controller.text) { setState(() { - newPassword2Error = L10n.of(context)!.passwordsDoNotMatch; + newPassword2Error = L10n.of(context).passwordsDoNotMatch; }); return; } @@ -60,7 +60,7 @@ class SettingsPasswordController extends State { ); scaffoldMessenger.showSnackBar( SnackBar( - content: Text(L10n.of(context)!.passwordHasBeenChanged), + content: Text(L10n.of(context).passwordHasBeenChanged), ), ); if (mounted) context.pop(); diff --git a/lib/pages/settings_password/settings_password_view.dart b/lib/pages/settings_password/settings_password_view.dart index 3e9b64f33..023559643 100644 --- a/lib/pages/settings_password/settings_password_view.dart +++ b/lib/pages/settings_password/settings_password_view.dart @@ -16,7 +16,7 @@ class SettingsPasswordView extends StatelessWidget { return Scaffold( appBar: AppBar( - title: Text(L10n.of(context)!.changePassword), + title: Text(L10n.of(context).changePassword), ), body: ListTileTheme( iconColor: theme.colorScheme.onSurface, @@ -35,7 +35,7 @@ class SettingsPasswordView extends StatelessWidget { decoration: InputDecoration( prefixIcon: const Icon(Icons.lock_outlined), hintText: '********', - labelText: L10n.of(context)!.pleaseEnterYourCurrentPassword, + labelText: L10n.of(context).pleaseEnterYourCurrentPassword, errorText: controller.oldPasswordError, ), ), @@ -48,7 +48,7 @@ class SettingsPasswordView extends StatelessWidget { decoration: InputDecoration( prefixIcon: const Icon(Icons.lock_reset_outlined), hintText: '********', - labelText: L10n.of(context)!.newPassword, + labelText: L10n.of(context).newPassword, errorText: controller.newPassword1Error, ), ), @@ -61,7 +61,7 @@ class SettingsPasswordView extends StatelessWidget { decoration: InputDecoration( prefixIcon: const Icon(Icons.repeat_outlined), hintText: '********', - labelText: L10n.of(context)!.repeatPassword, + labelText: L10n.of(context).repeatPassword, errorText: controller.newPassword2Error, ), ), @@ -73,12 +73,12 @@ class SettingsPasswordView extends StatelessWidget { controller.loading ? null : controller.changePassword, child: controller.loading ? const LinearProgressIndicator() - : Text(L10n.of(context)!.changePassword), + : Text(L10n.of(context).changePassword), ), ), const SizedBox(height: 16), TextButton( - child: Text(L10n.of(context)!.passwordRecoverySettings), + child: Text(L10n.of(context).passwordRecoverySettings), onPressed: () => context.go('/rooms/settings/security/3pid'), ), ], diff --git a/lib/pages/settings_security/settings_security.dart b/lib/pages/settings_security/settings_security.dart index a4c1c4a6d..7d08eda47 100644 --- a/lib/pages/settings_security/settings_security.dart +++ b/lib/pages/settings_security/settings_security.dart @@ -25,9 +25,9 @@ class SettingsSecurityController extends State { final newLock = await showTextInputDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.pleaseChooseAPasscode, - message: L10n.of(context)!.pleaseEnter4Digits, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).pleaseChooseAPasscode, + message: L10n.of(context).pleaseEnter4Digits, + cancelLabel: L10n.of(context).cancel, textFields: [ DialogTextField( validator: (text) { @@ -35,7 +35,7 @@ class SettingsSecurityController extends State { (text.length == 4 && int.tryParse(text)! >= 0)) { return null; } - return L10n.of(context)!.pleaseEnter4Digits; + return L10n.of(context).pleaseEnter4Digits; }, keyboardType: TextInputType.number, obscureText: true, @@ -54,10 +54,10 @@ class SettingsSecurityController extends State { if (await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.warning, - message: L10n.of(context)!.deactivateAccountWarning, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).warning, + message: L10n.of(context).deactivateAccountWarning, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, isDestructiveAction: true, ) == OkCancelResult.cancel) { @@ -67,17 +67,17 @@ class SettingsSecurityController extends State { final mxids = await showTextInputDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.confirmMatrixId, + title: L10n.of(context).confirmMatrixId, textFields: [ DialogTextField( validator: (text) => text == supposedMxid ? null - : L10n.of(context)!.supposedMxid(supposedMxid), + : L10n.of(context).supposedMxid(supposedMxid), ), ], isDestructiveAction: true, - okLabel: L10n.of(context)!.delete, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).delete, + cancelLabel: L10n.of(context).cancel, ); if (mxids == null || mxids.length != 1 || mxids.single != supposedMxid) { return; @@ -85,9 +85,9 @@ class SettingsSecurityController extends State { final input = await showTextInputDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.pleaseEnterYourPassword, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, + title: L10n.of(context).pleaseEnterYourPassword, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, isDestructiveAction: true, textFields: [ const DialogTextField( diff --git a/lib/pages/settings_security/settings_security_view.dart b/lib/pages/settings_security/settings_security_view.dart index a805a6e33..28f8908ba 100644 --- a/lib/pages/settings_security/settings_security_view.dart +++ b/lib/pages/settings_security/settings_security_view.dart @@ -21,7 +21,7 @@ class SettingsSecurityView extends StatelessWidget { final theme = Theme.of(context); return Scaffold( - appBar: AppBar(title: Text(L10n.of(context)!.security)), + appBar: AppBar(title: Text(L10n.of(context).security)), body: ListTileTheme( iconColor: theme.colorScheme.onSurface, child: MaxWidthBody( @@ -45,7 +45,7 @@ class SettingsSecurityView extends StatelessWidget { children: [ ListTile( title: Text( - L10n.of(context)!.privacy, + L10n.of(context).privacy, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -53,25 +53,25 @@ class SettingsSecurityView extends StatelessWidget { ), ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.sendTypingNotifications, + title: L10n.of(context).sendTypingNotifications, subtitle: - L10n.of(context)!.sendTypingNotificationsDescription, + L10n.of(context).sendTypingNotificationsDescription, onChanged: (b) => AppConfig.sendTypingNotifications = b, storeKey: SettingKeys.sendTypingNotifications, defaultValue: AppConfig.sendTypingNotifications, ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.sendReadReceipts, - subtitle: L10n.of(context)!.sendReadReceiptsDescription, + title: L10n.of(context).sendReadReceipts, + subtitle: L10n.of(context).sendReadReceiptsDescription, onChanged: (b) => AppConfig.sendPublicReadReceipts = b, storeKey: SettingKeys.sendPublicReadReceipts, defaultValue: AppConfig.sendPublicReadReceipts, ), ListTile( trailing: const Icon(Icons.chevron_right_outlined), - title: Text(L10n.of(context)!.blockedUsers), + title: Text(L10n.of(context).blockedUsers), subtitle: Text( - L10n.of(context)!.thereAreCountUsersBlocked( + L10n.of(context).thereAreCountUsersBlocked( Matrix.of(context).client.ignoredUsers.length, ), ), @@ -82,15 +82,15 @@ class SettingsSecurityView extends StatelessWidget { if (PlatformInfos.isMobile) ListTile( trailing: const Icon(Icons.chevron_right_outlined), - title: Text(L10n.of(context)!.appLock), - subtitle: Text(L10n.of(context)!.appLockDescription), + title: Text(L10n.of(context).appLock), + subtitle: Text(L10n.of(context).appLockDescription), onTap: controller.setAppLockAction, ), }, Divider(color: theme.dividerColor), ListTile( title: Text( - L10n.of(context)!.account, + L10n.of(context).account, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -98,7 +98,7 @@ class SettingsSecurityView extends StatelessWidget { ), ), ListTile( - title: Text(L10n.of(context)!.yourPublicKey), + title: Text(L10n.of(context).yourPublicKey), leading: const Icon(Icons.vpn_key_outlined), subtitle: SelectableText( Matrix.of(context).client.fingerprintKey.beautified, @@ -110,7 +110,7 @@ class SettingsSecurityView extends StatelessWidget { ListTile( leading: const Icon(Icons.password_outlined), trailing: const Icon(Icons.chevron_right_outlined), - title: Text(L10n.of(context)!.changePassword), + title: Text(L10n.of(context).changePassword), onTap: () => context.go('/rooms/settings/security/password'), ), @@ -118,7 +118,7 @@ class SettingsSecurityView extends StatelessWidget { iconColor: Colors.orange, leading: const Icon(Icons.delete_sweep_outlined), title: Text( - L10n.of(context)!.dehydrate, + L10n.of(context).dehydrate, style: const TextStyle(color: Colors.orange), ), onTap: controller.dehydrateAction, @@ -128,7 +128,7 @@ class SettingsSecurityView extends StatelessWidget { iconColor: Colors.red, leading: const Icon(Icons.delete_outlined), title: Text( - L10n.of(context)!.deleteAccount, + L10n.of(context).deleteAccount, style: const TextStyle(color: Colors.red), ), onTap: controller.deleteAccountAction, diff --git a/lib/pages/settings_style/settings_style_view.dart b/lib/pages/settings_style/settings_style_view.dart index fd0a4c4f9..d40315697 100644 --- a/lib/pages/settings_style/settings_style_view.dart +++ b/lib/pages/settings_style/settings_style_view.dart @@ -27,7 +27,7 @@ class SettingsStyleView extends StatelessWidget { return Scaffold( appBar: AppBar( leading: const Center(child: BackButton()), - title: Text(L10n.of(context)!.changeTheme), + title: Text(L10n.of(context).changeTheme), ), backgroundColor: theme.colorScheme.surface, body: MaxWidthBody( @@ -35,7 +35,7 @@ class SettingsStyleView extends StatelessWidget { children: [ ListTile( title: Text( - L10n.of(context)!.setColorTheme, + L10n.of(context).setColorTheme, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -95,7 +95,7 @@ class SettingsStyleView extends StatelessWidget { ), ), Text( - L10n.of(context)!.systemTheme, + L10n.of(context).systemTheme, textAlign: TextAlign.center, style: TextStyle( color: theme @@ -140,7 +140,7 @@ class SettingsStyleView extends StatelessWidget { ), ListTile( title: Text( - L10n.of(context)!.setTheme, + L10n.of(context).setTheme, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -150,19 +150,19 @@ class SettingsStyleView extends StatelessWidget { RadioListTile( groupValue: controller.currentTheme, value: ThemeMode.system, - title: Text(L10n.of(context)!.systemTheme), + title: Text(L10n.of(context).systemTheme), onChanged: controller.switchTheme, ), RadioListTile( groupValue: controller.currentTheme, value: ThemeMode.light, - title: Text(L10n.of(context)!.lightTheme), + title: Text(L10n.of(context).lightTheme), onChanged: controller.switchTheme, ), RadioListTile( groupValue: controller.currentTheme, value: ThemeMode.dark, - title: Text(L10n.of(context)!.darkTheme), + title: Text(L10n.of(context).darkTheme), onChanged: controller.switchTheme, ), Divider( @@ -170,7 +170,7 @@ class SettingsStyleView extends StatelessWidget { ), ListTile( title: Text( - L10n.of(context)!.overview, + L10n.of(context).overview, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -178,13 +178,13 @@ class SettingsStyleView extends StatelessWidget { ), ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.presencesToggle, + title: L10n.of(context).presencesToggle, onChanged: (b) => AppConfig.showPresences = b, storeKey: SettingKeys.showPresences, defaultValue: AppConfig.showPresences, ), SettingsSwitchListTile.adaptive( - title: L10n.of(context)!.separateChatTypes, + title: L10n.of(context).separateChatTypes, onChanged: (b) => AppConfig.separateChatTypes = b, storeKey: SettingKeys.separateChatTypes, defaultValue: AppConfig.separateChatTypes, @@ -194,7 +194,7 @@ class SettingsStyleView extends StatelessWidget { ), ListTile( title: Text( - L10n.of(context)!.messagesStyle, + L10n.of(context).messagesStyle, style: TextStyle( color: theme.colorScheme.secondary, fontWeight: FontWeight.bold, @@ -270,7 +270,7 @@ class SettingsStyleView extends StatelessWidget { ), ), ListTile( - title: Text(L10n.of(context)!.wallpaper), + title: Text(L10n.of(context).wallpaper), leading: const Icon(Icons.photo_outlined), trailing: accountConfig.wallpaperUrl == null ? null @@ -286,7 +286,7 @@ class SettingsStyleView extends StatelessWidget { curve: FluffyThemes.animationCurve, child: accountConfig.wallpaperUrl != null ? SwitchListTile.adaptive( - title: Text(L10n.of(context)!.transparent), + title: Text(L10n.of(context).transparent), secondary: const Icon(Icons.blur_linear_outlined), value: !wallpaperOpacityIsDefault, onChanged: (_) => @@ -301,7 +301,7 @@ class SettingsStyleView extends StatelessWidget { }, ), ListTile( - title: Text(L10n.of(context)!.fontSize), + title: Text(L10n.of(context).fontSize), trailing: Text('× ${AppConfig.fontSizeFactor}'), ), Slider.adaptive( diff --git a/lib/pages/user_bottom_sheet/user_bottom_sheet.dart b/lib/pages/user_bottom_sheet/user_bottom_sheet.dart index 45be5c975..0a2cc267a 100644 --- a/lib/pages/user_bottom_sheet/user_bottom_sheet.dart +++ b/lib/pages/user_bottom_sheet/user_bottom_sheet.dart @@ -98,22 +98,22 @@ class UserBottomSheetController extends State { final score = await showConfirmationDialog( context: context, - title: L10n.of(context)!.reportUser, - message: L10n.of(context)!.howOffensiveIsThisContent, - cancelLabel: L10n.of(context)!.cancel, - okLabel: L10n.of(context)!.ok, + title: L10n.of(context).reportUser, + message: L10n.of(context).howOffensiveIsThisContent, + cancelLabel: L10n.of(context).cancel, + okLabel: L10n.of(context).ok, actions: [ AlertDialogAction( key: -100, - label: L10n.of(context)!.extremeOffensive, + label: L10n.of(context).extremeOffensive, ), AlertDialogAction( key: -50, - label: L10n.of(context)!.offensive, + label: L10n.of(context).offensive, ), AlertDialogAction( key: 0, - label: L10n.of(context)!.inoffensive, + label: L10n.of(context).inoffensive, ), ], ); @@ -121,10 +121,10 @@ class UserBottomSheetController extends State { final reason = await showTextInputDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.whyDoYouWantToReportThis, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, - textFields: [DialogTextField(hintText: L10n.of(context)!.reason)], + title: L10n.of(context).whyDoYouWantToReportThis, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, + textFields: [DialogTextField(hintText: L10n.of(context).reason)], ); if (reason == null || reason.single.isEmpty) return; @@ -139,7 +139,7 @@ class UserBottomSheetController extends State { ); if (result.error != null) return; ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.contentHasBeenReported)), + SnackBar(content: Text(L10n.of(context).contentHasBeenReported)), ); break; case UserBottomSheetAction.mention: @@ -152,10 +152,10 @@ class UserBottomSheetController extends State { if (await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.no, - message: L10n.of(context)!.banUserDescription, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).no, + message: L10n.of(context).banUserDescription, ) == OkCancelResult.ok) { await showFutureLoadingDialog( @@ -170,10 +170,10 @@ class UserBottomSheetController extends State { if (await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.no, - message: L10n.of(context)!.unbanUserDescription, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).no, + message: L10n.of(context).unbanUserDescription, ) == OkCancelResult.ok) { await showFutureLoadingDialog( @@ -188,10 +188,10 @@ class UserBottomSheetController extends State { if (await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.no, - message: L10n.of(context)!.kickUserDescription, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).no, + message: L10n.of(context).kickUserDescription, ) == OkCancelResult.ok) { await showFutureLoadingDialog( @@ -300,10 +300,10 @@ class UserBottomSheetController extends State { final consent = await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.no, - message: L10n.of(context)!.makeAdminDescription, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).no, + message: L10n.of(context).makeAdminDescription, ); if (consent != OkCancelResult.ok) return; } diff --git a/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart b/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart index 16426f871..e44ca47fc 100644 --- a/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart +++ b/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart @@ -79,7 +79,7 @@ class UserBottomSheetView extends StatelessWidget { title: Padding( padding: const EdgeInsets.only(bottom: 12.0), child: Text( - L10n.of(context)! + L10n.of(context) .userWouldLikeToChangeTheChat(displayname), ), ), @@ -92,7 +92,7 @@ class UserBottomSheetView extends StatelessWidget { ), onPressed: controller.knockAccept, icon: const Icon(Icons.check_outlined), - label: Text(L10n.of(context)!.accept), + label: Text(L10n.of(context).accept), ), const SizedBox(width: 12), TextButton.icon( @@ -104,7 +104,7 @@ class UserBottomSheetView extends StatelessWidget { ), onPressed: controller.knockDecline, icon: const Icon(Icons.cancel_outlined), - label: Text(L10n.of(context)!.decline), + label: Text(L10n.of(context).decline), ), ], ), @@ -181,13 +181,13 @@ class UserBottomSheetView extends StatelessWidget { const SizedBox(width: 12), if (presence.currentlyActive == true) Text( - L10n.of(context)!.currentlyActive, + L10n.of(context).currentlyActive, overflow: TextOverflow.ellipsis, style: theme.textTheme.bodySmall, ) else if (lastActiveTimestamp != null) Text( - L10n.of(context)!.lastActiveAgo( + L10n.of(context).lastActiveAgo( lastActiveTimestamp .localizedTimeShort(context), ), @@ -238,7 +238,7 @@ class UserBottomSheetView extends StatelessWidget { UserBottomSheetAction.message, ), icon: const Icon(Icons.chat_outlined), - label: Text(L10n.of(context)!.startConversation), + label: Text(L10n.of(context).startConversation), ) : TextField( controller: controller.sendController, @@ -250,7 +250,7 @@ class UserBottomSheetView extends StatelessWidget { decoration: InputDecoration( errorText: controller.sendError ?.toLocalizedString(context), - hintText: L10n.of(context)!.sendMessages, + hintText: L10n.of(context).sendMessages, suffix: controller.isSending ? const SizedBox( width: 16, @@ -272,7 +272,7 @@ class UserBottomSheetView extends StatelessWidget { if (controller.widget.onMention != null) ListTile( leading: const Icon(Icons.alternate_email_outlined), - title: Text(L10n.of(context)!.mention), + title: Text(L10n.of(context).mention), onTap: () => controller .participantAction(UserBottomSheetAction.mention), ), @@ -280,7 +280,7 @@ class UserBottomSheetView extends StatelessWidget { Divider(color: theme.dividerColor), ListTile( title: Text( - '${L10n.of(context)!.userRole} (${user.powerLevel})', + '${L10n.of(context).userRole} (${user.powerLevel})', ), leading: const Icon(Icons.person_outlined), trailing: Material( @@ -304,19 +304,19 @@ class UserBottomSheetView extends StatelessWidget { items: [ DropdownMenuItem( value: 0, - child: Text(L10n.of(context)!.user), + child: Text(L10n.of(context).user), ), DropdownMenuItem( value: 50, - child: Text(L10n.of(context)!.moderator), + child: Text(L10n.of(context).moderator), ), DropdownMenuItem( value: 100, - child: Text(L10n.of(context)!.admin), + child: Text(L10n.of(context).admin), ), DropdownMenuItem( value: null, - child: Text(L10n.of(context)!.custom), + child: Text(L10n.of(context).custom), ), ], ), @@ -328,7 +328,7 @@ class UserBottomSheetView extends StatelessWidget { ListTile( textColor: theme.colorScheme.error, iconColor: theme.colorScheme.error, - title: Text(L10n.of(context)!.kickFromChat), + title: Text(L10n.of(context).kickFromChat), leading: const Icon(Icons.exit_to_app_outlined), onTap: () => controller .participantAction(UserBottomSheetAction.kick), @@ -339,7 +339,7 @@ class UserBottomSheetView extends StatelessWidget { ListTile( textColor: theme.colorScheme.onErrorContainer, iconColor: theme.colorScheme.onErrorContainer, - title: Text(L10n.of(context)!.banFromChat), + title: Text(L10n.of(context).banFromChat), leading: const Icon(Icons.warning_sharp), onTap: () => controller.participantAction(UserBottomSheetAction.ban), @@ -348,7 +348,7 @@ class UserBottomSheetView extends StatelessWidget { user.canBan && user.membership == Membership.ban) ListTile( - title: Text(L10n.of(context)!.unbanFromChat), + title: Text(L10n.of(context).unbanFromChat), leading: const Icon(Icons.warning_outlined), onTap: () => controller .participantAction(UserBottomSheetAction.unban), @@ -357,7 +357,7 @@ class UserBottomSheetView extends StatelessWidget { ListTile( textColor: theme.colorScheme.onErrorContainer, iconColor: theme.colorScheme.onErrorContainer, - title: Text(L10n.of(context)!.reportUser), + title: Text(L10n.of(context).reportUser), leading: const Icon(Icons.gavel_outlined), onTap: () => controller .participantAction(UserBottomSheetAction.report), @@ -369,7 +369,7 @@ class UserBottomSheetView extends StatelessWidget { color: Colors.orange, ), subtitle: Text( - L10n.of(context)!.profileNotFound, + L10n.of(context).profileNotFound, style: const TextStyle(color: Colors.orange), ), ), @@ -379,7 +379,7 @@ class UserBottomSheetView extends StatelessWidget { textColor: theme.colorScheme.onErrorContainer, iconColor: theme.colorScheme.onErrorContainer, leading: const Icon(Icons.block_outlined), - title: Text(L10n.of(context)!.block), + title: Text(L10n.of(context).block), onTap: () => controller .participantAction(UserBottomSheetAction.ignore), ), diff --git a/lib/utils/client_manager.dart b/lib/utils/client_manager.dart index 3a14e4e79..d6bc69669 100644 --- a/lib/utils/client_manager.dart +++ b/lib/utils/client_manager.dart @@ -48,8 +48,8 @@ abstract class ClientManager { await Future.wait( clients.map( (client) => client.initWithRestore( - onMigration: () { - final l10n = lookupL10n(PlatformDispatcher.instance.locale); + onMigration: () async { + final l10n = await lookupL10n(PlatformDispatcher.instance.locale); sendInitNotification( l10n.databaseMigrationTitle, l10n.databaseMigrationBody, diff --git a/lib/utils/date_time_extension.dart b/lib/utils/date_time_extension.dart index 0346dd289..8043805f0 100644 --- a/lib/utils/date_time_extension.dart +++ b/lib/utils/date_time_extension.dart @@ -35,9 +35,9 @@ extension DateTimeExtension on DateTime { /// Returns a simple time String. String localizedTimeOfDay(BuildContext context) => - L10n.of(context)!.alwaysUse24HourFormat == 'true' - ? DateFormat('HH:mm', L10n.of(context)!.localeName).format(this) - : DateFormat('h:mm a', L10n.of(context)!.localeName).format(this); + L10n.of(context).alwaysUse24HourFormat == 'true' + ? DateFormat('HH:mm', L10n.of(context).localeName).format(this) + : DateFormat('h:mm a', L10n.of(context).localeName).format(this); /// Returns [localizedTimeOfDay()] if the ChatTime is today, the name of the week /// day if the ChatTime is this week and a date string else. @@ -77,7 +77,7 @@ extension DateTimeExtension on DateTime { final sameDay = sameYear && now.month == month && now.day == day; if (sameDay) return localizedTimeOfDay(context); - return L10n.of(context)!.dateAndTimeOfDay( + return L10n.of(context).dateAndTimeOfDay( localizedTimeShort(context), localizedTimeOfDay(context), ); diff --git a/lib/utils/error_reporter.dart b/lib/utils/error_reporter.dart index f9254d351..28e7b374a 100644 --- a/lib/utils/error_reporter.dart +++ b/lib/utils/error_reporter.dart @@ -21,7 +21,7 @@ class ErrorReporter { await showAdaptiveDialog( context: context, builder: (context) => AlertDialog.adaptive( - title: Text(L10n.of(context)!.reportErrorDescription), + title: Text(L10n.of(context).reportErrorDescription), content: SizedBox( height: 256, width: 256, @@ -36,13 +36,13 @@ class ErrorReporter { actions: [ TextButton( onPressed: () => Navigator.of(context).pop(), - child: Text(L10n.of(context)!.close), + child: Text(L10n.of(context).close), ), TextButton( onPressed: () => Clipboard.setData( ClipboardData(text: text), ), - child: Text(L10n.of(context)!.copy), + child: Text(L10n.of(context).copy), ), TextButton( onPressed: () => launchUrl( @@ -56,7 +56,7 @@ class ErrorReporter { ), mode: LaunchMode.externalApplication, ), - child: Text(L10n.of(context)!.report), + child: Text(L10n.of(context).report), ), ], ), diff --git a/lib/utils/fluffy_share.dart b/lib/utils/fluffy_share.dart index fbe533c54..4fd7967c5 100644 --- a/lib/utils/fluffy_share.dart +++ b/lib/utils/fluffy_share.dart @@ -25,7 +25,7 @@ abstract class FluffyShare { ClipboardData(text: text), ); ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.copiedToClipboard)), + SnackBar(content: Text(L10n.of(context).copiedToClipboard)), ); return; } @@ -34,7 +34,7 @@ abstract class FluffyShare { final client = Matrix.of(context).client; final ownProfile = await client.fetchOwnProfile(); await FluffyShare.share( - L10n.of(context)!.inviteText( + L10n.of(context).inviteText( ownProfile.displayName ?? client.userID!, 'https://matrix.to/#/${client.userID}?client=im.fluffychat', ), diff --git a/lib/utils/init_with_restore.dart b/lib/utils/init_with_restore.dart index c99e2ba08..f979adbe8 100644 --- a/lib/utils/init_with_restore.dart +++ b/lib/utils/init_with_restore.dart @@ -101,7 +101,7 @@ extension InitWithRestoreExtension on Client { } } catch (e, s) { Logs().wtf('Client init failed!', e, s); - final l10n = lookupL10n(PlatformDispatcher.instance.locale); + final l10n = await lookupL10n(PlatformDispatcher.instance.locale); final sessionBackupString = await storage?.read(key: storageKey); if (sessionBackupString == null) { ClientManager.sendInitNotification( diff --git a/lib/utils/localized_exception_extension.dart b/lib/utils/localized_exception_extension.dart index c501bcbcb..8c1c3a53a 100644 --- a/lib/utils/localized_exception_extension.dart +++ b/lib/utils/localized_exception_extension.dart @@ -30,7 +30,7 @@ extension LocalizedExceptionExtension on Object { ]) { if (this is FileTooBigMatrixException) { final exception = this as FileTooBigMatrixException; - return L10n.of(context)!.fileIsTooBigForServer( + return L10n.of(context).fileIsTooBigForServer( _formatFileSize(exception.maxFileSize), ); } @@ -38,17 +38,17 @@ extension LocalizedExceptionExtension on Object { switch ((this as MatrixException).error) { case MatrixError.M_FORBIDDEN: if (exceptionContext == ExceptionContext.changePassword) { - return L10n.of(context)!.passwordIsWrong; + return L10n.of(context).passwordIsWrong; } - return L10n.of(context)!.noPermission; + return L10n.of(context).noPermission; case MatrixError.M_LIMIT_EXCEEDED: - return L10n.of(context)!.tooManyRequestsWarning; + return L10n.of(context).tooManyRequestsWarning; default: return (this as MatrixException).errorMessage; } } if (this is InvalidPassphraseException) { - return L10n.of(context)!.wrongRecoveryKey; + return L10n.of(context).wrongRecoveryKey; } if (this is BadServerVersionsException) { final serverVersions = (this as BadServerVersionsException) @@ -61,7 +61,7 @@ extension LocalizedExceptionExtension on Object { .toString() .replaceAll('{', '"') .replaceAll('}', '"'); - return L10n.of(context)!.badServerVersionsException( + return L10n.of(context).badServerVersionsException( serverVersions, supportedVersions, serverVersions, @@ -79,7 +79,7 @@ extension LocalizedExceptionExtension on Object { .toString() .replaceAll('{', '"') .replaceAll('}', '"'); - return L10n.of(context)!.badServerLoginTypesException( + return L10n.of(context).badServerLoginTypesException( serverVersions, supportedVersions, supportedVersions, @@ -89,16 +89,16 @@ extension LocalizedExceptionExtension on Object { this is SocketException || this is SyncConnectionException || this is ClientException) { - return L10n.of(context)!.noConnectionToTheServer; + return L10n.of(context).noConnectionToTheServer; } if (this is FormatException && exceptionContext == ExceptionContext.checkHomeserver) { - return L10n.of(context)!.doesNotSeemToBeAValidHomeserver; + return L10n.of(context).doesNotSeemToBeAValidHomeserver; } if (this is String) return toString(); if (this is UiaException) return toString(); Logs().w('Something went wrong: ', this); - return L10n.of(context)!.oopsSomethingWentWrong; + return L10n.of(context).oopsSomethingWentWrong; } } diff --git a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart index 1add432d2..f149091df 100644 --- a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart +++ b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart @@ -43,7 +43,7 @@ Future flutterMatrixSdkDatabaseBuilder(Client client) async { try { // Send error notification: - final l10n = lookupL10n(PlatformDispatcher.instance.locale); + final l10n = await lookupL10n(PlatformDispatcher.instance.locale); ClientManager.sendInitNotification( l10n.initAppError, l10n.databaseBuildErrorBody( diff --git a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/cipher.dart b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/cipher.dart index a1903018d..021cd4636 100644 --- a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/cipher.dart +++ b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/cipher.dart @@ -57,7 +57,7 @@ void _sendNoEncryptionWarning(Object exception) async { if (isStored == true) return; - final l10n = lookupL10n(PlatformDispatcher.instance.locale); + final l10n = await lookupL10n(PlatformDispatcher.instance.locale); ClientManager.sendInitNotification( l10n.noDatabaseEncryption, exception.toString(), diff --git a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart index 8ffa9201f..e9dd9e21f 100644 --- a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart +++ b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart @@ -20,7 +20,7 @@ extension MatrixFileExtension on MatrixFile { } final downloadPath = await FilePicker.platform.saveFile( - dialogTitle: L10n.of(context)!.saveFile, + dialogTitle: L10n.of(context).saveFile, fileName: name, type: filePickerFileType, bytes: bytes, @@ -38,7 +38,7 @@ extension MatrixFileExtension on MatrixFile { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - L10n.of(context)!.fileHasBeenSavedAt(downloadPath), + L10n.of(context).fileHasBeenSavedAt(downloadPath), ), ), ); diff --git a/lib/utils/platform_infos.dart b/lib/utils/platform_infos.dart index d43176d7a..d36d8ae97 100644 --- a/lib/utils/platform_infos.dart +++ b/lib/utils/platform_infos.dart @@ -52,7 +52,7 @@ abstract class PlatformInfos { TextButton.icon( onPressed: () => launchUrlString(AppConfig.sourceCodeUrl), icon: const Icon(Icons.source_outlined), - label: Text(L10n.of(context)!.sourceCode), + label: Text(L10n.of(context).sourceCode), ), TextButton.icon( onPressed: () => launchUrlString(AppConfig.emojiFontUrl), diff --git a/lib/utils/push_helper.dart b/lib/utils/push_helper.dart index ff6c5934e..05f0e90c7 100644 --- a/lib/utils/push_helper.dart +++ b/lib/utils/push_helper.dart @@ -35,7 +35,7 @@ Future pushHelper( } catch (e, s) { Logs().v('Push Helper has crashed!', e, s); - l10n ??= lookupL10n(const Locale('en')); + l10n ??= await lookupL10n(const Locale('en')); flutterLocalNotificationsPlugin.show( notification.roomId?.hashCode ?? 0, l10n.newMessageInFluffyChat, diff --git a/lib/utils/room_status_extension.dart b/lib/utils/room_status_extension.dart index 02c70b088..4407d8b6a 100644 --- a/lib/utils/room_status_extension.dart +++ b/lib/utils/room_status_extension.dart @@ -12,24 +12,24 @@ extension RoomStatusExtension on Room { typingUsers.removeWhere((User u) => u.id == client.userID); if (AppConfig.hideTypingUsernames) { - typingText = L10n.of(context)!.isTyping; + typingText = L10n.of(context).isTyping; if (typingUsers.first.id != directChatMatrixID) { typingText = - L10n.of(context)!.numUsersTyping(typingUsers.length.toString()); + L10n.of(context).numUsersTyping(typingUsers.length.toString()); } } else if (typingUsers.length == 1) { - typingText = L10n.of(context)!.isTyping; + typingText = L10n.of(context).isTyping; if (typingUsers.first.id != directChatMatrixID) { typingText = - L10n.of(context)!.userIsTyping(typingUsers.first.calcDisplayname()); + L10n.of(context).userIsTyping(typingUsers.first.calcDisplayname()); } } else if (typingUsers.length == 2) { - typingText = L10n.of(context)!.userAndUserAreTyping( + typingText = L10n.of(context).userAndUserAreTyping( typingUsers.first.calcDisplayname(), typingUsers[1].calcDisplayname(), ); } else if (typingUsers.length > 2) { - typingText = L10n.of(context)!.userAndOthersAreTyping( + typingText = L10n.of(context).userAndOthersAreTyping( typingUsers.first.calcDisplayname(), (typingUsers.length - 1).toString(), ); diff --git a/lib/utils/show_update_snackbar.dart b/lib/utils/show_update_snackbar.dart index 38334a508..1c4ee8972 100644 --- a/lib/utils/show_update_snackbar.dart +++ b/lib/utils/show_update_snackbar.dart @@ -35,13 +35,13 @@ abstract class UpdateNotifier { ), Expanded( child: Text( - L10n.of(context)!.updateInstalled(currentVersion), + L10n.of(context).updateInstalled(currentVersion), ), ), ], ), action: SnackBarAction( - label: L10n.of(context)!.changelog, + label: L10n.of(context).changelog, onPressed: () => launchUrlString(AppConfig.changelogUrl), ), ), diff --git a/lib/utils/uia_request_manager.dart b/lib/utils/uia_request_manager.dart index 04c8b4844..440dfda37 100644 --- a/lib/utils/uia_request_manager.dart +++ b/lib/utils/uia_request_manager.dart @@ -9,7 +9,7 @@ import 'package:fluffychat/widgets/matrix.dart'; extension UiaRequestManager on MatrixState { Future uiaRequestHandler(UiaRequest uiaRequest) async { - final l10n = L10n.of(context)!; + final l10n = L10n.of(context); try { if (uiaRequest.state != UiaRequestState.waitForUser || uiaRequest.nextStages.isEmpty) { @@ -49,7 +49,7 @@ extension UiaRequestManager on MatrixState { case AuthenticationTypes.emailIdentity: if (currentThreepidCreds == null) { return uiaRequest.cancel( - UiaException(L10n.of(context)!.serverRequiresEmail), + UiaException(L10n.of(context).serverRequiresEmail), ); } final auth = AuthenticationThreePidCreds( diff --git a/lib/utils/url_launcher.dart b/lib/utils/url_launcher.dart index 53de9b138..a5c006998 100644 --- a/lib/utils/url_launcher.dart +++ b/lib/utils/url_launcher.dart @@ -39,7 +39,7 @@ class UrlLauncher { if (uri == null) { // we can't open this thing ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.cantOpenUri(url!))), + SnackBar(content: Text(L10n.of(context).cantOpenUri(url!))), ); return; } @@ -49,10 +49,10 @@ class UrlLauncher { // that the user can see the actual url before opening the browser. final consent = await showOkCancelAlertDialog( context: context, - title: L10n.of(context)!.openLinkInBrowser, + title: L10n.of(context).openLinkInBrowser, message: url, - okLabel: L10n.of(context)!.yes, - cancelLabel: L10n.of(context)!.cancel, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, ); if (consent != OkCancelResult.ok) return; } @@ -93,7 +93,7 @@ class UrlLauncher { } if (uri.host.isEmpty) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(L10n.of(context)!.cantOpenUri(url!))), + SnackBar(content: Text(L10n.of(context).cantOpenUri(url!))), ); return; } diff --git a/lib/utils/voip/callkeep_manager.dart b/lib/utils/voip/callkeep_manager.dart index a3db3eba1..a66252414 100644 --- a/lib/utils/voip/callkeep_manager.dart +++ b/lib/utils/voip/callkeep_manager.dart @@ -226,14 +226,14 @@ class CallKeepManager { barrierDismissible: true, useRootNavigator: false, builder: (_) => AlertDialog( - title: Text(L10n.of(context)!.callingPermissions), + title: Text(L10n.of(context).callingPermissions), content: Column( mainAxisSize: MainAxisSize.min, children: [ ListTile( onTap: () => openCallingAccountsPage(context), - title: Text(L10n.of(context)!.callingAccount), - subtitle: Text(L10n.of(context)!.callingAccountDetails), + title: Text(L10n.of(context).callingAccount), + subtitle: Text(L10n.of(context).callingAccountDetails), trailing: const Icon(Icons.phone), ), const Divider(), @@ -241,14 +241,14 @@ class CallKeepManager { onTap: () => FlutterForegroundTask.openSystemAlertWindowSettings( forceOpen: true, ), - title: Text(L10n.of(context)!.appearOnTop), - subtitle: Text(L10n.of(context)!.appearOnTopDetails), + title: Text(L10n.of(context).appearOnTop), + subtitle: Text(L10n.of(context).appearOnTopDetails), trailing: const Icon(Icons.file_upload_rounded), ), const Divider(), ListTile( onTap: () => openAppSettings(), - title: Text(L10n.of(context)!.otherCallingPermissions), + title: Text(L10n.of(context).otherCallingPermissions), trailing: const Icon(Icons.mic), ), ], diff --git a/lib/widgets/chat_settings_popup_menu.dart b/lib/widgets/chat_settings_popup_menu.dart index 6d9a4ce57..4139e6bbe 100644 --- a/lib/widgets/chat_settings_popup_menu.dart +++ b/lib/widgets/chat_settings_popup_menu.dart @@ -57,7 +57,7 @@ class ChatSettingsPopupMenuState extends State { LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.keyI, }, - helpLabel: L10n.of(context)!.chatDetails, + helpLabel: L10n.of(context).chatDetails, onKeysPressed: _showChatDetails, child: const SizedBox.shrink(), ), @@ -68,10 +68,10 @@ class ChatSettingsPopupMenuState extends State { final confirmed = await showOkCancelAlertDialog( useRootNavigator: false, context: context, - title: L10n.of(context)!.areYouSure, - okLabel: L10n.of(context)!.ok, - cancelLabel: L10n.of(context)!.cancel, - message: L10n.of(context)!.archiveRoomDescription, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).ok, + cancelLabel: L10n.of(context).cancel, + message: L10n.of(context).archiveRoomDescription, ); if (confirmed == OkCancelResult.ok) { final success = await showFutureLoadingDialog( @@ -113,7 +113,7 @@ class ChatSettingsPopupMenuState extends State { children: [ const Icon(Icons.info_outline_rounded), const SizedBox(width: 12), - Text(L10n.of(context)!.chatDetails), + Text(L10n.of(context).chatDetails), ], ), ), @@ -124,7 +124,7 @@ class ChatSettingsPopupMenuState extends State { children: [ const Icon(Icons.notifications_off_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.muteChat), + Text(L10n.of(context).muteChat), ], ), ) @@ -135,7 +135,7 @@ class ChatSettingsPopupMenuState extends State { children: [ const Icon(Icons.notifications_on_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.unmuteChat), + Text(L10n.of(context).unmuteChat), ], ), ), @@ -145,7 +145,7 @@ class ChatSettingsPopupMenuState extends State { children: [ const Icon(Icons.search_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.search), + Text(L10n.of(context).search), ], ), ), @@ -155,7 +155,7 @@ class ChatSettingsPopupMenuState extends State { children: [ const Icon(Icons.delete_outlined), const SizedBox(width: 12), - Text(L10n.of(context)!.leave), + Text(L10n.of(context).leave), ], ), ), diff --git a/lib/widgets/connection_status_header.dart b/lib/widgets/connection_status_header.dart index eef2b795d..27c393759 100644 --- a/lib/widgets/connection_status_header.dart +++ b/lib/widgets/connection_status_header.dart @@ -79,7 +79,7 @@ extension on SyncStatusUpdate { String toLocalizedString(BuildContext context) { switch (status) { case SyncStatus.waitingForResponse: - return L10n.of(context)!.loadingPleaseWait; + return L10n.of(context).loadingPleaseWait; case SyncStatus.error: return ((error?.exception ?? Object()) as Object) .toLocalizedString(context); @@ -87,7 +87,7 @@ extension on SyncStatusUpdate { case SyncStatus.cleaningUp: case SyncStatus.finished: default: - return L10n.of(context)!.synchronizingPleaseWait; + return L10n.of(context).synchronizingPleaseWait; } } } diff --git a/lib/widgets/layouts/login_scaffold.dart b/lib/widgets/layouts/login_scaffold.dart index 8b9a13739..d2363ced4 100644 --- a/lib/widgets/layouts/login_scaffold.dart +++ b/lib/widgets/layouts/login_scaffold.dart @@ -128,14 +128,14 @@ class _PrivacyButtons extends StatelessWidget { TextButton( onPressed: () => PlatformInfos.showDialog(context), child: Text( - L10n.of(context)!.about, + L10n.of(context).about, style: shadowTextStyle, ), ), TextButton( onPressed: () => launchUrlString(AppConfig.privacyUrl), child: Text( - L10n.of(context)!.privacy, + L10n.of(context).privacy, style: shadowTextStyle, ), ), diff --git a/lib/widgets/local_notifications_extension.dart b/lib/widgets/local_notifications_extension.dart index 0549663f8..a59a540fa 100644 --- a/lib/widgets/local_notifications_extension.dart +++ b/lib/widgets/local_notifications_extension.dart @@ -37,9 +37,9 @@ extension LocalNotificationsExtension on MatrixState { if (room.notificationCount == 0) return; final event = Event.fromJson(eventUpdate.content, room); - final title = room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)); + final title = room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))); final body = await event.calcLocalizedBody( - MatrixLocals(L10n.of(context)!), + MatrixLocals(L10n.of(context)), withSenderNamePrefix: !room.isDirectChat || room.lastEvent?.senderId == client.userID, plaintextBody: true, @@ -91,11 +91,11 @@ extension LocalNotificationsExtension on MatrixState { actions: [ NotificationAction( DesktopNotificationActions.openChat.name, - L10n.of(context)!.openChat, + L10n.of(context).openChat, ), NotificationAction( DesktopNotificationActions.seen.name, - L10n.of(context)!.markAsRead, + L10n.of(context).markAsRead, ), ], hints: [ diff --git a/lib/widgets/lock_screen.dart b/lib/widgets/lock_screen.dart index b756a3954..d8d3d3c63 100644 --- a/lib/widgets/lock_screen.dart +++ b/lib/widgets/lock_screen.dart @@ -30,7 +30,7 @@ class _LockScreenState extends State { final enteredPin = int.tryParse(text); if (enteredPin == null || text.length != 4) { setState(() { - _errorText = L10n.of(context)!.invalidInput; + _errorText = L10n.of(context).invalidInput; }); _textEditingController.clear(); return; @@ -46,7 +46,7 @@ class _LockScreenState extends State { } setState(() { - _errorText = L10n.of(context)!.wrongPinEntered(_coolDownSeconds); + _errorText = L10n.of(context).wrongPinEntered(_coolDownSeconds); _inputBlocked = true; }); Future.delayed(Duration(seconds: _coolDownSeconds)).then((_) { @@ -63,7 +63,7 @@ class _LockScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(L10n.of(context)!.pleaseEnterYourPin), + title: Text(L10n.of(context).pleaseEnterYourPin), centerTitle: true, ), extendBodyBehindAppBar: true, diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index aa3cc2c4c..c425e0688 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -239,8 +239,8 @@ class MatrixState extends State with WidgetsBindingObserver { void initLoadingDialog() { WidgetsBinding.instance.addPostFrameCallback((_) { - LoadingDialog.defaultTitle = L10n.of(context)!.loadingPleaseWait; - LoadingDialog.defaultBackLabel = L10n.of(context)!.close; + LoadingDialog.defaultTitle = L10n.of(context).loadingPleaseWait; + LoadingDialog.defaultBackLabel = L10n.of(context).close; LoadingDialog.defaultOnError = (e) => (e as Object?)!.toLocalizedString(context); }); @@ -312,7 +312,7 @@ class MatrixState extends State with WidgetsBindingObserver { context, ).showSnackBar( SnackBar( - content: Text(L10n.of(context)!.oneClientLoggedOut), + content: Text(L10n.of(context).oneClientLoggedOut), ), ); @@ -371,13 +371,12 @@ class MatrixState extends State with WidgetsBindingObserver { context: FluffyChatApp .router.routerDelegate.navigatorKey.currentContext ?? context, - title: L10n.of(context)!.pushNotificationsNotAvailable, + title: L10n.of(context).pushNotificationsNotAvailable, message: errorMsg, fullyCapitalizedForMaterial: false, - okLabel: link == null - ? L10n.of(context)!.ok - : L10n.of(context)!.learnMore, - cancelLabel: L10n.of(context)!.doNotShowAgain, + okLabel: + link == null ? L10n.of(context).ok : L10n.of(context).learnMore, + cancelLabel: L10n.of(context).doNotShowAgain, ); if (result == OkCancelResult.ok && link != null) { launchUrlString( @@ -495,8 +494,8 @@ class MatrixState extends State with WidgetsBindingObserver { final response = await showOkCancelAlertDialog( context: context, isDestructiveAction: true, - title: L10n.of(context)!.dehydrate, - message: L10n.of(context)!.dehydrateWarning, + title: L10n.of(context).dehydrate, + message: L10n.of(context).dehydrateWarning, ); if (response != OkCancelResult.ok) { return; diff --git a/lib/widgets/permission_slider_dialog.dart b/lib/widgets/permission_slider_dialog.dart index 1e883e123..e568717aa 100644 --- a/lib/widgets/permission_slider_dialog.dart +++ b/lib/widgets/permission_slider_dialog.dart @@ -10,7 +10,7 @@ Future showPermissionChooser( }) async { final customLevel = await showTextInputDialog( context: context, - title: L10n.of(context)!.setPermissionsLevel, + title: L10n.of(context).setPermissionsLevel, textFields: [ DialogTextField( initialText: currentLevel.toString(), @@ -18,11 +18,11 @@ Future showPermissionChooser( autocorrect: false, validator: (text) { if (text == null) { - return L10n.of(context)!.pleaseEnterANumber; + return L10n.of(context).pleaseEnterANumber; } final level = int.tryParse(text); if (level == null) { - return L10n.of(context)!.pleaseEnterANumber; + return L10n.of(context).pleaseEnterANumber; } return null; }, diff --git a/lib/widgets/public_room_bottom_sheet.dart b/lib/widgets/public_room_bottom_sheet.dart index 991739ac6..9acecb3f0 100644 --- a/lib/widgets/public_room_bottom_sheet.dart +++ b/lib/widgets/public_room_bottom_sheet.dart @@ -76,7 +76,7 @@ class PublicRoomBottomSheet extends StatelessWidget { ), ); if (!query.chunk.any(_testRoom)) { - throw (L10n.of(outerContext)!.noRoomsFound); + throw (L10n.of(outerContext).noRoomsFound); } return query.chunk.firstWhere(_testRoom); } @@ -95,7 +95,7 @@ class PublicRoomBottomSheet extends StatelessWidget { leading: IconButton( icon: const Icon(Icons.arrow_downward_outlined), onPressed: Navigator.of(context, rootNavigator: false).pop, - tooltip: L10n.of(context)!.close, + tooltip: L10n.of(context).close, ), actions: [ Padding( @@ -170,7 +170,7 @@ class PublicRoomBottomSheet extends StatelessWidget { foregroundColor: theme.colorScheme.onSurface, ), label: Text( - L10n.of(context)!.countParticipants( + L10n.of(context).countParticipants( profile?.numJoinedMembers ?? 0, ), maxLines: 1, @@ -192,10 +192,10 @@ class PublicRoomBottomSheet extends StatelessWidget { .client .getRoomById(chunk!.roomId) == null - ? L10n.of(context)!.knock + ? L10n.of(context).knock : chunk?.roomType == 'm.space' - ? L10n.of(context)!.joinSpace - : L10n.of(context)!.joinRoom, + ? L10n.of(context).joinSpace + : L10n.of(context).joinRoom, ), icon: const Icon(Icons.navigate_next), ),