refactor: Use non nullable localizations builder and lazy load on web

This commit is contained in:
krille-chan 2024-10-06 08:35:37 +02:00
parent 8cedd2a45a
commit 0d4b7d67cc
No known key found for this signature in database
111 changed files with 879 additions and 883 deletions

View file

@ -3,3 +3,5 @@ template-arb-file: intl_en.arb
output-localization-file: l10n.dart output-localization-file: l10n.dart
output-class: L10n output-class: L10n
preferred-supported-locales: ["en"] preferred-supported-locales: ["en"]
use-deferred-loading: true
nullable-getter: false

View file

@ -42,10 +42,10 @@ class ArchiveController extends State<Archive> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
message: L10n.of(context)!.clearArchive, message: L10n.of(context).clearArchive,
) != ) !=
OkCancelResult.ok) { OkCancelResult.ok) {
return; return;

View file

@ -20,14 +20,14 @@ class ArchiveView extends StatelessWidget {
builder: (BuildContext context, snapshot) => Scaffold( builder: (BuildContext context, snapshot) => Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.archive), title: Text(L10n.of(context).archive),
actions: [ actions: [
if (snapshot.data?.isNotEmpty ?? false) if (snapshot.data?.isNotEmpty ?? false)
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextButton.icon( child: TextButton.icon(
onPressed: controller.forgetAllAction, onPressed: controller.forgetAllAction,
label: Text(L10n.of(context)!.clearArchive), label: Text(L10n.of(context).clearArchive),
icon: const Icon(Icons.cleaning_services_outlined), icon: const Icon(Icons.cleaning_services_outlined),
), ),
), ),
@ -40,7 +40,7 @@ class ArchiveView extends StatelessWidget {
if (snapshot.hasError) { if (snapshot.hasError) {
return Center( return Center(
child: Text( child: Text(
L10n.of(context)!.oopsSomethingWentWrong, L10n.of(context).oopsSomethingWentWrong,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
); );

View file

@ -61,12 +61,12 @@ class BootstrapDialogState extends State<BootstrapDialog> {
String _getSecureStorageLocalizedName() { String _getSecureStorageLocalizedName() {
if (PlatformInfos.isAndroid) { if (PlatformInfos.isAndroid) {
return L10n.of(context)!.storeInAndroidKeystore; return L10n.of(context).storeInAndroidKeystore;
} }
if (PlatformInfos.isIOS || PlatformInfos.isMacOS) { 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 @override
@ -92,12 +92,12 @@ class BootstrapDialogState extends State<BootstrapDialog> {
_wipe ??= widget.wipe; _wipe ??= widget.wipe;
final buttons = <Widget>[]; final buttons = <Widget>[];
Widget body = const CircularProgressIndicator.adaptive(); Widget body = const CircularProgressIndicator.adaptive();
titleText = L10n.of(context)!.loadingPleaseWait; titleText = L10n.of(context).loadingPleaseWait;
if (bootstrap.newSsssKey?.recoveryKey != null && if (bootstrap.newSsssKey?.recoveryKey != null &&
_recoveryKeyStored == false) { _recoveryKeyStored == false) {
final key = bootstrap.newSsssKey!.recoveryKey; final key = bootstrap.newSsssKey!.recoveryKey;
titleText = L10n.of(context)!.recoveryKey; titleText = L10n.of(context).recoveryKey;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
@ -105,7 +105,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop, onPressed: Navigator.of(context).pop,
), ),
title: Text(L10n.of(context)!.recoveryKey), title: Text(L10n.of(context).recoveryKey),
), ),
body: Center( body: Center(
child: ConstrainedBox( child: ConstrainedBox(
@ -123,7 +123,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
), ),
), ),
subtitle: Text(L10n.of(context)!.chatBackupDescription), subtitle: Text(L10n.of(context).chatBackupDescription),
), ),
const Divider( const Divider(
height: 32, height: 32,
@ -153,7 +153,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
}, },
title: Text(_getSecureStorageLocalizedName()), title: Text(_getSecureStorageLocalizedName()),
subtitle: subtitle:
Text(L10n.of(context)!.storeInSecureStorageDescription), Text(L10n.of(context).storeInSecureStorageDescription),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
CheckboxListTile.adaptive( CheckboxListTile.adaptive(
@ -164,13 +164,13 @@ class BootstrapDialogState extends State<BootstrapDialog> {
FluffyShare.share(key!, context); FluffyShare.share(key!, context);
setState(() => _recoveryKeyCopied = true); setState(() => _recoveryKeyCopied = true);
}, },
title: Text(L10n.of(context)!.copyToClipboard), title: Text(L10n.of(context).copyToClipboard),
subtitle: Text(L10n.of(context)!.saveKeyManuallyDescription), subtitle: Text(L10n.of(context).saveKeyManuallyDescription),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
ElevatedButton.icon( ElevatedButton.icon(
icon: const Icon(Icons.check_outlined), icon: const Icon(Icons.check_outlined),
label: Text(L10n.of(context)!.next), label: Text(L10n.of(context).next),
onPressed: onPressed:
(_recoveryKeyCopied || _storeInSecureStorage == true) (_recoveryKeyCopied || _storeInSecureStorage == true)
? () { ? () {
@ -227,7 +227,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop, onPressed: Navigator.of(context).pop,
), ),
title: Text(L10n.of(context)!.chatBackup), title: Text(L10n.of(context).chatBackup),
), ),
body: Center( body: Center(
child: ConstrainedBox( child: ConstrainedBox(
@ -245,7 +245,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.pleaseEnterRecoveryKeyDescription, L10n.of(context).pleaseEnterRecoveryKeyDescription,
), ),
), ),
const Divider(height: 32), const Divider(height: 32),
@ -265,7 +265,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
fontFamily: theme.textTheme.bodyLarge?.fontFamily, fontFamily: theme.textTheme.bodyLarge?.fontFamily,
), ),
prefixIcon: const Icon(Icons.key_outlined), prefixIcon: const Icon(Icons.key_outlined),
labelText: L10n.of(context)!.recoveryKey, labelText: L10n.of(context).recoveryKey,
hintText: 'Es** **** **** ****', hintText: 'Es** **** **** ****',
errorText: _recoveryKeyInputError, errorText: _recoveryKeyInputError,
errorMaxLines: 2, errorMaxLines: 2,
@ -280,7 +280,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
icon: _recoveryKeyInputLoading icon: _recoveryKeyInputLoading
? const CircularProgressIndicator.adaptive() ? const CircularProgressIndicator.adaptive()
: const Icon(Icons.lock_open_outlined), : const Icon(Icons.lock_open_outlined),
label: Text(L10n.of(context)!.unlockOldMessages), label: Text(L10n.of(context).unlockOldMessages),
onPressed: _recoveryKeyInputLoading onPressed: _recoveryKeyInputLoading
? null ? null
: () async { : () async {
@ -323,7 +323,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
} on FormatException catch (_) { } on FormatException catch (_) {
setState( setState(
() => _recoveryKeyInputError = () => _recoveryKeyInputError =
L10n.of(context)!.wrongRecoveryKey, L10n.of(context).wrongRecoveryKey,
); );
} catch (e, s) { } catch (e, s) {
ErrorReporter( ErrorReporter(
@ -347,7 +347,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
const Expanded(child: Divider()), const Expanded(child: Divider()),
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Text(L10n.of(context)!.or), child: Text(L10n.of(context).or),
), ),
const Expanded(child: Divider()), const Expanded(child: Divider()),
], ],
@ -355,17 +355,17 @@ class BootstrapDialogState extends State<BootstrapDialog> {
const SizedBox(height: 16), const SizedBox(height: 16),
ElevatedButton.icon( ElevatedButton.icon(
icon: const Icon(Icons.cast_connected_outlined), icon: const Icon(Icons.cast_connected_outlined),
label: Text(L10n.of(context)!.transferFromAnotherDevice), label: Text(L10n.of(context).transferFromAnotherDevice),
onPressed: _recoveryKeyInputLoading onPressed: _recoveryKeyInputLoading
? null ? null
: () async { : () async {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.verifyOtherDevice, title: L10n.of(context).verifyOtherDevice,
message: L10n.of(context)! message: L10n.of(context)
.verifyOtherDeviceDescription, .verifyOtherDeviceDescription,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;
@ -391,7 +391,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
foregroundColor: theme.colorScheme.onErrorContainer, foregroundColor: theme.colorScheme.onErrorContainer,
), ),
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
label: Text(L10n.of(context)!.recoveryKeyLost), label: Text(L10n.of(context).recoveryKeyLost),
onPressed: _recoveryKeyInputLoading onPressed: _recoveryKeyInputLoading
? null ? null
: () async { : () async {
@ -399,10 +399,10 @@ class BootstrapDialogState extends State<BootstrapDialog> {
await showOkCancelAlertDialog( await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.recoveryKeyLost, title: L10n.of(context).recoveryKeyLost,
message: L10n.of(context)!.wipeChatBackup, message: L10n.of(context).wipeChatBackup,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
isDestructiveAction: true, isDestructiveAction: true,
)) { )) {
setState(() => _createBootstrap(true)); setState(() => _createBootstrap(true));
@ -440,18 +440,18 @@ class BootstrapDialogState extends State<BootstrapDialog> {
); );
break; break;
case BootstrapState.error: case BootstrapState.error:
titleText = L10n.of(context)!.oopsSomethingWentWrong; titleText = L10n.of(context).oopsSomethingWentWrong;
body = const Icon(Icons.error_outline, color: Colors.red, size: 80); body = const Icon(Icons.error_outline, color: Colors.red, size: 80);
buttons.add( buttons.add(
OutlinedButton( OutlinedButton(
onPressed: () => onPressed: () =>
Navigator.of(context, rootNavigator: false).pop<bool>(false), Navigator.of(context, rootNavigator: false).pop<bool>(false),
child: Text(L10n.of(context)!.close), child: Text(L10n.of(context).close),
), ),
); );
break; break;
case BootstrapState.done: case BootstrapState.done:
titleText = L10n.of(context)!.everythingReady; titleText = L10n.of(context).everythingReady;
body = Column( body = Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -462,7 +462,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
L10n.of(context)!.yourChatBackupHasBeenSetUp, L10n.of(context).yourChatBackupHasBeenSetUp,
style: const TextStyle(fontSize: 20), style: const TextStyle(fontSize: 20),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -472,7 +472,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
OutlinedButton( OutlinedButton(
onPressed: () => onPressed: () =>
Navigator.of(context, rootNavigator: false).pop<bool>(false), Navigator.of(context, rootNavigator: false).pop<bool>(false),
child: Text(L10n.of(context)!.close), child: Text(L10n.of(context).close),
), ),
); );
break; break;
@ -487,7 +487,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
Navigator.of(context, rootNavigator: false).pop<bool>(true), Navigator.of(context, rootNavigator: false).pop<bool>(true),
), ),
), ),
title: Text(titleText ?? L10n.of(context)!.loadingPleaseWait), title: Text(titleText ?? L10n.of(context).loadingPleaseWait),
), ),
body: Center( body: Center(
child: Column( child: Column(

View file

@ -43,14 +43,14 @@ class AddWidgetTileState extends State<AddWidgetTile> {
if (name.length < 3) { if (name.length < 3) {
setState(() { setState(() {
nameError = L10n.of(context)!.widgetNameError; nameError = L10n.of(context).widgetNameError;
}); });
return; return;
} }
if (uri == null || uri.scheme != 'https') { if (uri == null || uri.scheme != 'https') {
setState(() { setState(() {
urlError = L10n.of(context)!.widgetUrlError; urlError = L10n.of(context).widgetUrlError;
}); });
return; return;
} }
@ -75,7 +75,7 @@ class AddWidgetTileState extends State<AddWidgetTile> {
Navigator.of(context).pop(); Navigator.of(context).pop();
} catch (e) { } catch (e) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.errorAddingWidget)), SnackBar(content: Text(L10n.of(context).errorAddingWidget)),
); );
} }
} }

View file

@ -13,7 +13,7 @@ class AddWidgetTileView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ExpansionTile( return ExpansionTile(
title: Text(L10n.of(context)!.addWidget), title: Text(L10n.of(context).addWidget),
leading: const Icon(Icons.add), leading: const Icon(Icons.add),
initiallyExpanded: controller.initiallyExpanded, initiallyExpanded: controller.initiallyExpanded,
children: [ children: [
@ -21,10 +21,10 @@ class AddWidgetTileView extends StatelessWidget {
groupValue: controller.widgetType, groupValue: controller.widgetType,
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
children: { children: {
'm.etherpad': Text(L10n.of(context)!.widgetEtherpad), 'm.etherpad': Text(L10n.of(context).widgetEtherpad),
'm.jitsi': Text(L10n.of(context)!.widgetJitsi), 'm.jitsi': Text(L10n.of(context).widgetJitsi),
'm.video': Text(L10n.of(context)!.widgetVideo), 'm.video': Text(L10n.of(context).widgetVideo),
'm.custom': Text(L10n.of(context)!.widgetCustom), 'm.custom': Text(L10n.of(context).widgetCustom),
}.map( }.map(
(key, value) => MapEntry( (key, value) => MapEntry(
key, key,
@ -43,7 +43,7 @@ class AddWidgetTileView extends StatelessWidget {
autofocus: true, autofocus: true,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.label), prefixIcon: const Icon(Icons.label),
label: Text(L10n.of(context)!.widgetName), label: Text(L10n.of(context).widgetName),
errorText: controller.nameError, errorText: controller.nameError,
), ),
), ),
@ -54,7 +54,7 @@ class AddWidgetTileView extends StatelessWidget {
controller: controller.urlController, controller: controller.urlController,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.add_link), prefixIcon: const Icon(Icons.add_link),
label: Text(L10n.of(context)!.link), label: Text(L10n.of(context).link),
errorText: controller.urlError, errorText: controller.urlError,
), ),
), ),
@ -63,7 +63,7 @@ class AddWidgetTileView extends StatelessWidget {
children: [ children: [
TextButton( TextButton(
onPressed: controller.addWidget, onPressed: controller.addWidget,
child: Text(L10n.of(context)!.addWidget), child: Text(L10n.of(context).addWidget),
), ),
], ],
), ),

View file

@ -56,12 +56,11 @@ class ChatPage extends StatelessWidget {
final room = Matrix.of(context).client.getRoomById(roomId); final room = Matrix.of(context).client.getRoomById(roomId);
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.oopsSomethingWentWrong)), appBar: AppBar(title: Text(L10n.of(context).oopsSomethingWentWrong)),
body: Center( body: Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat),
), ),
), ),
); );
@ -446,7 +445,7 @@ class ChatController extends State<ChatPageWithRoom>
final commandMatch = RegExp(r'^\/(\w+)').firstMatch(sendController.text); final commandMatch = RegExp(r'^\/(\w+)').firstMatch(sendController.text);
if (commandMatch != null && if (commandMatch != null &&
!sendingClient.commands.keys.contains(commandMatch[1]!.toLowerCase())) { !sendingClient.commands.keys.contains(commandMatch[1]!.toLowerCase())) {
final l10n = L10n.of(context)!; final l10n = L10n.of(context);
final dialogResult = await showOkCancelAlertDialog( final dialogResult = await showOkCancelAlertDialog(
context: context, context: context,
title: l10n.commandInvalid, title: l10n.commandInvalid,
@ -564,9 +563,9 @@ class ChatController extends State<ChatPageWithRoom>
if (info.version.sdkInt < 19) { if (info.version.sdkInt < 19) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.unsupportedAndroidVersion, title: L10n.of(context).unsupportedAndroidVersion,
message: L10n.of(context)!.unsupportedAndroidVersionLong, message: L10n.of(context).unsupportedAndroidVersionLong,
okLabel: L10n.of(context)!.close, okLabel: L10n.of(context).close,
); );
return; return;
} }
@ -646,12 +645,12 @@ class ChatController extends State<ChatPageWithRoom>
if (selectedEvents.length == 1) { if (selectedEvents.length == 1) {
return selectedEvents.first return selectedEvents.first
.getDisplayEvent(timeline!) .getDisplayEvent(timeline!)
.calcLocalizedBodyFallback(MatrixLocals(L10n.of(context)!)); .calcLocalizedBodyFallback(MatrixLocals(L10n.of(context)));
} }
for (final event in selectedEvents) { for (final event in selectedEvents) {
if (copyString.isNotEmpty) copyString += '\n\n'; if (copyString.isNotEmpty) copyString += '\n\n';
copyString += event.getDisplayEvent(timeline!).calcLocalizedBodyFallback( copyString += event.getDisplayEvent(timeline!).calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: true, withSenderNamePrefix: true,
); );
} }
@ -670,32 +669,32 @@ class ChatController extends State<ChatPageWithRoom>
final event = selectedEvents.single; final event = selectedEvents.single;
final score = await showConfirmationDialog<int>( final score = await showConfirmationDialog<int>(
context: context, context: context,
title: L10n.of(context)!.reportMessage, title: L10n.of(context).reportMessage,
message: L10n.of(context)!.howOffensiveIsThisContent, message: L10n.of(context).howOffensiveIsThisContent,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
actions: [ actions: [
AlertDialogAction( AlertDialogAction(
key: -100, key: -100,
label: L10n.of(context)!.extremeOffensive, label: L10n.of(context).extremeOffensive,
), ),
AlertDialogAction( AlertDialogAction(
key: -50, key: -50,
label: L10n.of(context)!.offensive, label: L10n.of(context).offensive,
), ),
AlertDialogAction( AlertDialogAction(
key: 0, key: 0,
label: L10n.of(context)!.inoffensive, label: L10n.of(context).inoffensive,
), ),
], ],
); );
if (score == null) return; if (score == null) return;
final reason = await showTextInputDialog( final reason = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.whyDoYouWantToReportThis, title: L10n.of(context).whyDoYouWantToReportThis,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)], textFields: [DialogTextField(hintText: L10n.of(context).reason)],
); );
if (reason == null || reason.single.isEmpty) return; if (reason == null || reason.single.isEmpty) return;
final result = await showFutureLoadingDialog( final result = await showFutureLoadingDialog(
@ -713,7 +712,7 @@ class ChatController extends State<ChatPageWithRoom>
selectedEvents.clear(); selectedEvents.clear();
}); });
ScaffoldMessenger.of(context).showSnackBar( 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<ChatPageWithRoom>
final reasonInput = selectedEvents.any((event) => event.status.isSent) final reasonInput = selectedEvents.any((event) => event.status.isSent)
? await showTextInputDialog( ? await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.redactMessage, title: L10n.of(context).redactMessage,
message: L10n.of(context)!.redactMessageDescription, message: L10n.of(context).redactMessageDescription,
isDestructiveAction: true, isDestructiveAction: true,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.optionalRedactReason, hintText: L10n.of(context).optionalRedactReason,
), ),
], ],
okLabel: L10n.of(context)!.remove, okLabel: L10n.of(context).remove,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
) )
: <String>[]; : <String>[];
if (reasonInput == null) return; if (reasonInput == null) return;
@ -1015,7 +1014,7 @@ class ChatController extends State<ChatPageWithRoom>
editEvent = selectedEvents.first; editEvent = selectedEvents.first;
sendController.text = sendController.text =
editEvent!.getDisplayEvent(timeline!).calcLocalizedBodyFallback( editEvent!.getDisplayEvent(timeline!).calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: false, withSenderNamePrefix: false,
hideReply: true, hideReply: true,
); );
@ -1028,13 +1027,13 @@ class ChatController extends State<ChatPageWithRoom>
if (OkCancelResult.ok != if (OkCancelResult.ok !=
await showOkCancelAlertDialog( await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.goToTheNewRoom, title: L10n.of(context).goToTheNewRoom,
message: room message: room
.getState(EventTypes.RoomTombstone)! .getState(EventTypes.RoomTombstone)!
.parsedTombstoneContent .parsedTombstoneContent
.body, .body,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
)) { )) {
return; return;
} }
@ -1117,10 +1116,10 @@ class ChatController extends State<ChatPageWithRoom>
unpinEvent(String eventId) async { unpinEvent(String eventId) async {
final response = await showOkCancelAlertDialog( final response = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.unpin, title: L10n.of(context).unpin,
message: L10n.of(context)!.confirmEventUnpin, message: L10n.of(context).confirmEventUnpin,
okLabel: L10n.of(context)!.unpin, okLabel: L10n.of(context).unpin,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (response == OkCancelResult.ok) { if (response == OkCancelResult.ok) {
final events = room.pinnedEventIds final events = room.pinnedEventIds
@ -1214,26 +1213,26 @@ class ChatController extends State<ChatPageWithRoom>
Navigator.pop(context); Navigator.pop(context);
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.unsupportedAndroidVersion, title: L10n.of(context).unsupportedAndroidVersion,
message: L10n.of(context)!.unsupportedAndroidVersionLong, message: L10n.of(context).unsupportedAndroidVersionLong,
okLabel: L10n.of(context)!.close, okLabel: L10n.of(context).close,
); );
} }
}); });
} }
final callType = await showModalActionSheet<CallType>( final callType = await showModalActionSheet<CallType>(
context: context, context: context,
title: L10n.of(context)!.warning, title: L10n.of(context).warning,
message: L10n.of(context)!.videoCallsBetaWarning, message: L10n.of(context).videoCallsBetaWarning,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
actions: [ actions: [
SheetAction( SheetAction(
label: L10n.of(context)!.voiceCall, label: L10n.of(context).voiceCall,
icon: Icons.phone_outlined, icon: Icons.phone_outlined,
key: CallType.kVoice, key: CallType.kVoice,
), ),
SheetAction( SheetAction(
label: L10n.of(context)!.videoCall, label: L10n.of(context).videoCall,
icon: Icons.video_call_outlined, icon: Icons.video_call_outlined,
key: CallType.kVideo, key: CallType.kVideo,
), ),

View file

@ -36,7 +36,7 @@ class ChatAppBarTitle extends StatelessWidget {
child: Avatar( child: Avatar(
mxContent: room.avatar, mxContent: room.avatar,
name: room.getLocalizedDisplayname( name: room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
size: 32, size: 32,
), ),
@ -47,7 +47,7 @@ class ChatAppBarTitle extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
@ -63,13 +63,13 @@ class ChatAppBarTitle extends StatelessWidget {
final style = Theme.of(context).textTheme.bodySmall; final style = Theme.of(context).textTheme.bodySmall;
if (presence?.currentlyActive == true) { if (presence?.currentlyActive == true) {
return Text( return Text(
L10n.of(context)!.currentlyActive, L10n.of(context).currentlyActive,
style: style, style: style,
); );
} }
if (lastActiveTimestamp != null) { if (lastActiveTimestamp != null) {
return Text( return Text(
L10n.of(context)!.lastActiveAgo( L10n.of(context).lastActiveAgo(
lastActiveTimestamp.localizedTimeShort(context), lastActiveTimestamp.localizedTimeShort(context),
), ),
style: style, style: style,

View file

@ -30,8 +30,8 @@ class ChatEmojiPicker extends StatelessWidget {
children: [ children: [
TabBar( TabBar(
tabs: [ tabs: [
Tab(text: L10n.of(context)!.emojis), Tab(text: L10n.of(context).emojis),
Tab(text: L10n.of(context)!.stickers), Tab(text: L10n.of(context).stickers),
], ],
), ),
Expanded( Expanded(
@ -97,7 +97,7 @@ class NoRecent extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Text( return Text(
L10n.of(context)!.emoteKeyboardNoRecents, L10n.of(context).emoteKeyboardNoRecents,
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge,
); );
} }

View file

@ -44,7 +44,7 @@ class ChatInputRow extends StatelessWidget {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
const Icon(Icons.delete), const Icon(Icons.delete),
Text(L10n.of(context)!.delete), Text(L10n.of(context).delete),
], ],
), ),
), ),
@ -57,7 +57,7 @@ class ChatInputRow extends StatelessWidget {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
const Icon(Icons.keyboard_arrow_left_outlined), 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, onPressed: controller.replyAction,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text(L10n.of(context)!.reply), Text(L10n.of(context).reply),
const Icon(Icons.keyboard_arrow_right), const Icon(Icons.keyboard_arrow_right),
], ],
), ),
@ -85,7 +85,7 @@ class ChatInputRow extends StatelessWidget {
onPressed: controller.sendAgainAction, onPressed: controller.sendAgainAction,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text(L10n.of(context)!.tryToSendAgain), Text(L10n.of(context).tryToSendAgain),
const SizedBox(width: 4), const SizedBox(width: 4),
const Icon(Icons.send_outlined, size: 16), const Icon(Icons.send_outlined, size: 16),
], ],
@ -103,7 +103,7 @@ class ChatInputRow extends StatelessWidget {
}, },
onKeysPressed: () => onKeysPressed: () =>
controller.onAddPopupMenuButtonSelected('file'), controller.onAddPopupMenuButtonSelected('file'),
helpLabel: L10n.of(context)!.sendFile, helpLabel: L10n.of(context).sendFile,
child: AnimatedContainer( child: AnimatedContainer(
duration: FluffyThemes.animationDuration, duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve, curve: FluffyThemes.animationCurve,
@ -125,7 +125,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.attachment_outlined), child: Icon(Icons.attachment_outlined),
), ),
title: Text(L10n.of(context)!.sendFile), title: Text(L10n.of(context).sendFile),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -137,7 +137,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.image_outlined), child: Icon(Icons.image_outlined),
), ),
title: Text(L10n.of(context)!.sendImage), title: Text(L10n.of(context).sendImage),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -150,7 +150,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.camera_alt_outlined), child: Icon(Icons.camera_alt_outlined),
), ),
title: Text(L10n.of(context)!.openCamera), title: Text(L10n.of(context).openCamera),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -163,7 +163,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.videocam_outlined), child: Icon(Icons.videocam_outlined),
), ),
title: Text(L10n.of(context)!.openVideoCamera), title: Text(L10n.of(context).openVideoCamera),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -176,7 +176,7 @@ class ChatInputRow extends StatelessWidget {
foregroundColor: Colors.white, foregroundColor: Colors.white,
child: Icon(Icons.gps_fixed_outlined), child: Icon(Icons.gps_fixed_outlined),
), ),
title: Text(L10n.of(context)!.shareLocation), title: Text(L10n.of(context).shareLocation),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
@ -194,9 +194,9 @@ class ChatInputRow extends StatelessWidget {
LogicalKeyboardKey.keyE, LogicalKeyboardKey.keyE,
}, },
onKeysPressed: controller.emojiPickerAction, onKeysPressed: controller.emojiPickerAction,
helpLabel: L10n.of(context)!.emojis, helpLabel: L10n.of(context).emojis,
child: IconButton( child: IconButton(
tooltip: L10n.of(context)!.emojis, tooltip: L10n.of(context).emojis,
icon: PageTransitionSwitcher( icon: PageTransitionSwitcher(
transitionBuilder: ( transitionBuilder: (
Widget child, Widget child,
@ -255,7 +255,7 @@ class ChatInputRow extends StatelessWidget {
bottom: 6.0, bottom: 6.0,
top: 3.0, top: 3.0,
), ),
hintText: L10n.of(context)!.writeAMessage, hintText: L10n.of(context).writeAMessage,
hintMaxLines: 1, hintMaxLines: 1,
border: InputBorder.none, border: InputBorder.none,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
@ -272,7 +272,7 @@ class ChatInputRow extends StatelessWidget {
child: PlatformInfos.platformCanRecord && child: PlatformInfos.platformCanRecord &&
controller.sendController.text.isEmpty controller.sendController.text.isEmpty
? FloatingActionButton.small( ? FloatingActionButton.small(
tooltip: L10n.of(context)!.voiceMessage, tooltip: L10n.of(context).voiceMessage,
onPressed: controller.voiceMessageAction, onPressed: controller.voiceMessageAction,
elevation: 0, elevation: 0,
heroTag: null, heroTag: null,
@ -284,7 +284,7 @@ class ChatInputRow extends StatelessWidget {
child: const Icon(Icons.mic_none_outlined), child: const Icon(Icons.mic_none_outlined),
) )
: FloatingActionButton.small( : FloatingActionButton.small(
tooltip: L10n.of(context)!.send, tooltip: L10n.of(context).send,
onPressed: controller.send, onPressed: controller.send,
elevation: 0, elevation: 0,
heroTag: null, heroTag: null,

View file

@ -38,12 +38,12 @@ class ChatView extends StatelessWidget {
if (controller.canEditSelectedEvents) if (controller.canEditSelectedEvents)
IconButton( IconButton(
icon: const Icon(Icons.edit_outlined), icon: const Icon(Icons.edit_outlined),
tooltip: L10n.of(context)!.edit, tooltip: L10n.of(context).edit,
onPressed: controller.editSelectedEventAction, onPressed: controller.editSelectedEventAction,
), ),
IconButton( IconButton(
icon: const Icon(Icons.copy_outlined), icon: const Icon(Icons.copy_outlined),
tooltip: L10n.of(context)!.copy, tooltip: L10n.of(context).copy,
onPressed: controller.copyEventsAction, onPressed: controller.copyEventsAction,
), ),
if (controller.canSaveSelectedEvent) if (controller.canSaveSelectedEvent)
@ -51,7 +51,7 @@ class ChatView extends StatelessWidget {
Builder( Builder(
builder: (context) => IconButton( builder: (context) => IconButton(
icon: Icon(Icons.adaptive.share), icon: Icon(Icons.adaptive.share),
tooltip: L10n.of(context)!.share, tooltip: L10n.of(context).share,
onPressed: () => controller.saveSelectedEvent(context), onPressed: () => controller.saveSelectedEvent(context),
), ),
), ),
@ -59,12 +59,12 @@ class ChatView extends StatelessWidget {
IconButton( IconButton(
icon: const Icon(Icons.push_pin_outlined), icon: const Icon(Icons.push_pin_outlined),
onPressed: controller.pinEvent, onPressed: controller.pinEvent,
tooltip: L10n.of(context)!.pinMessage, tooltip: L10n.of(context).pinMessage,
), ),
if (controller.canRedactSelectedEvents) if (controller.canRedactSelectedEvents)
IconButton( IconButton(
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
tooltip: L10n.of(context)!.redactMessage, tooltip: L10n.of(context).redactMessage,
onPressed: controller.redactEventsAction, onPressed: controller.redactEventsAction,
), ),
if (controller.selectedEvents.length == 1) if (controller.selectedEvents.length == 1)
@ -88,7 +88,7 @@ class ChatView extends StatelessWidget {
children: [ children: [
const Icon(Icons.info_outlined), const Icon(Icons.info_outlined),
const SizedBox(width: 12), 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, color: Colors.red,
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.reportMessage), Text(L10n.of(context).reportMessage),
], ],
), ),
), ),
@ -117,7 +117,7 @@ class ChatView extends StatelessWidget {
IconButton( IconButton(
onPressed: controller.onPhoneButtonTap, onPressed: controller.onPhoneButtonTap,
icon: const Icon(Icons.call_outlined), icon: const Icon(Icons.call_outlined),
tooltip: L10n.of(context)!.placeCall, tooltip: L10n.of(context).placeCall,
), ),
EncryptionButton(controller.room), EncryptionButton(controller.room),
ChatSettingsPopupMenu(controller.room, true), ChatSettingsPopupMenu(controller.room, true),
@ -180,7 +180,7 @@ class ChatView extends StatelessWidget {
? IconButton( ? IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: controller.clearSelectedEvents, onPressed: controller.clearSelectedEvents,
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
) )
: StreamBuilder<Object>( : StreamBuilder<Object>(
@ -213,7 +213,7 @@ class ChatView extends StatelessWidget {
), ),
trailing: TextButton( trailing: TextButton(
onPressed: controller.goToNewRoomAction, onPressed: controller.goToNewRoomAction,
child: Text(L10n.of(context)!.goToTheNewRoom), child: Text(L10n.of(context).goToTheNewRoom),
), ),
), ),
if (scrollUpBannerEventId != null) if (scrollUpBannerEventId != null)
@ -221,13 +221,13 @@ class ChatView extends StatelessWidget {
leading: IconButton( leading: IconButton(
color: theme.colorScheme.onSurfaceVariant, color: theme.colorScheme.onSurfaceVariant,
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
onPressed: () { onPressed: () {
controller.discardScrollUpBannerEventId(); controller.discardScrollUpBannerEventId();
controller.setReadMarker(); controller.setReadMarker();
}, },
), ),
title: L10n.of(context)!.jumpToLastReadMessage, title: L10n.of(context).jumpToLastReadMessage,
trailing: TextButton( trailing: TextButton(
onPressed: () { onPressed: () {
controller.scrollToEventId( controller.scrollToEventId(
@ -235,7 +235,7 @@ class ChatView extends StatelessWidget {
); );
controller.discardScrollUpBannerEventId(); 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, onPressed: controller.leaveChat,
label: Text( label: Text(
L10n.of(context)!.leave, L10n.of(context).leave,
), ),
), ),
TextButton.icon( TextButton.icon(
@ -347,7 +347,7 @@ class ChatView extends StatelessWidget {
), ),
onPressed: controller.recreateChat, onPressed: controller.recreateChat,
label: Text( label: Text(
L10n.of(context)!.reopenChat, L10n.of(context).reopenChat,
), ),
), ),
], ],

View file

@ -25,8 +25,8 @@ class EncryptionButton extends StatelessWidget {
: Future.value(EncryptionHealthState.allVerified), : Future.value(EncryptionHealthState.allVerified),
builder: (BuildContext context, snapshot) => IconButton( builder: (BuildContext context, snapshot) => IconButton(
tooltip: room.encrypted tooltip: room.encrypted
? L10n.of(context)!.encrypted ? L10n.of(context).encrypted
: L10n.of(context)!.encryptionNotEnabled, : L10n.of(context).encryptionNotEnabled,
icon: Icon( icon: Icon(
room.encrypted ? Icons.lock_outlined : Icons.lock_open_outlined, room.encrypted ? Icons.lock_outlined : Icons.lock_open_outlined,
size: 20, size: 20,

View file

@ -14,7 +14,7 @@ extension EventInfoDialogExtension on Event {
void showInfoDialog(BuildContext context) => showAdaptiveBottomSheet( void showInfoDialog(BuildContext context) => showAdaptiveBottomSheet(
context: context, context: context,
builder: (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; final originalSource = event.originalSource;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.messageInfo), title: Text(L10n.of(context).messageInfo),
leading: IconButton( leading: IconButton(
icon: const Icon(Icons.arrow_downward_outlined), icon: const Icon(Icons.arrow_downward_outlined),
onPressed: Navigator.of(context, rootNavigator: false).pop, onPressed: Navigator.of(context, rootNavigator: false).pop,
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
), ),
), ),
body: ListView( body: ListView(
@ -56,20 +56,20 @@ class EventInfoDialog extends StatelessWidget {
client: event.room.client, client: event.room.client,
presenceUserId: event.senderId, presenceUserId: event.senderId,
), ),
title: Text(L10n.of(context)!.sender), title: Text(L10n.of(context).sender),
subtitle: Text( subtitle: Text(
'${event.senderFromMemoryOrFallback.calcDisplayname()} [${event.senderId}]', '${event.senderFromMemoryOrFallback.calcDisplayname()} [${event.senderId}]',
), ),
), ),
ListTile( ListTile(
title: Text('${L10n.of(context)!.time}:'), title: Text('${L10n.of(context).time}:'),
subtitle: Text(event.originServerTs.localizedTime(context)), subtitle: Text(event.originServerTs.localizedTime(context)),
), ),
ListTile( ListTile(
title: Text('${L10n.of(context)!.status}:'), title: Text('${L10n.of(context).status}:'),
subtitle: Text(event.status.name), subtitle: Text(event.status.name),
), ),
ListTile(title: Text('${L10n.of(context)!.sourceCode}:')), ListTile(title: Text('${L10n.of(context).sourceCode}:')),
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Material( child: Material(
@ -88,7 +88,7 @@ class EventInfoDialog extends StatelessWidget {
), ),
), ),
if (originalSource != null) ...[ if (originalSource != null) ...[
ListTile(title: Text('${L10n.of(context)!.encrypted}:')), ListTile(title: Text('${L10n.of(context).encrypted}:')),
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Material( child: Material(

View file

@ -72,19 +72,19 @@ class _CuteContentState extends State<CuteContent> {
generateLabel(User? user) { generateLabel(User? user) {
switch (widget.event.content['cute_type']) { switch (widget.event.content['cute_type']) {
case 'googly_eyes': case 'googly_eyes':
return L10n.of(context)?.googlyEyesContent( return L10n.of(context).googlyEyesContent(
user?.displayName ?? user?.displayName ??
widget.event.senderFromMemoryOrFallback.displayName ?? widget.event.senderFromMemoryOrFallback.displayName ??
'', '',
); );
case 'cuddle': case 'cuddle':
return L10n.of(context)?.cuddleContent( return L10n.of(context).cuddleContent(
user?.displayName ?? user?.displayName ??
widget.event.senderFromMemoryOrFallback.displayName ?? widget.event.senderFromMemoryOrFallback.displayName ??
'', '',
); );
case 'hug': case 'hug':
return L10n.of(context)?.hugContent( return L10n.of(context).hugContent(
user?.displayName ?? user?.displayName ??
widget.event.senderFromMemoryOrFallback.displayName ?? widget.event.senderFromMemoryOrFallback.displayName ??
'', '',

View file

@ -484,7 +484,7 @@ class Message extends StatelessWidget {
horizontal: 8, horizontal: 8,
), ),
child: Text( child: Text(
L10n.of(context)!.readUpToHere, L10n.of(context).readUpToHere,
style: TextStyle(color: theme.colorScheme.primary), style: TextStyle(color: theme.colorScheme.primary),
), ),
), ),

View file

@ -38,7 +38,7 @@ class MessageContent extends StatelessWidget {
}); });
void _verifyOrRequestKey(BuildContext context) async { void _verifyOrRequestKey(BuildContext context) async {
final l10n = L10n.of(context)!; final l10n = L10n.of(context);
if (event.content['can_request_session'] != true) { if (event.content['can_request_session'] != true) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
@ -184,7 +184,7 @@ class MessageContent extends StatelessWidget {
textColor: buttonTextColor, textColor: buttonTextColor,
onPressed: () => _verifyOrRequestKey(context), onPressed: () => _verifyOrRequestKey(context),
icon: '🔒', icon: '🔒',
label: L10n.of(context)!.encrypted, label: L10n.of(context).encrypted,
fontSize: fontSize, fontSize: fontSize,
); );
case MessageTypes.Location: case MessageTypes.Location:
@ -213,7 +213,7 @@ class MessageContent extends StatelessWidget {
onPressed: onPressed:
UrlLauncher(context, geoUri.toString()).launchUrl, UrlLauncher(context, geoUri.toString()).launchUrl,
label: Text( label: Text(
L10n.of(context)!.openInMaps, L10n.of(context).openInMaps,
style: TextStyle(color: textColor), style: TextStyle(color: textColor),
), ),
), ),
@ -233,11 +233,11 @@ class MessageContent extends StatelessWidget {
event.redactedBecause?.content.tryGet<String>('reason'); event.redactedBecause?.content.tryGet<String>('reason');
final redactedBy = snapshot.data?.calcDisplayname() ?? final redactedBy = snapshot.data?.calcDisplayname() ??
event.redactedBecause?.senderId.localpart ?? event.redactedBecause?.senderId.localpart ??
L10n.of(context)!.user; L10n.of(context).user;
return _ButtonContent( return _ButtonContent(
label: reason == null label: reason == null
? L10n.of(context)!.redactedBy(redactedBy) ? L10n.of(context).redactedBy(redactedBy)
: L10n.of(context)!.redactedByBecause( : L10n.of(context).redactedByBecause(
redactedBy, redactedBy,
reason, reason,
), ),
@ -254,7 +254,7 @@ class MessageContent extends StatelessWidget {
event.numberEmotes <= 10; event.numberEmotes <= 10;
return Linkify( return Linkify(
text: event.calcLocalizedBodyFallback( text: event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
hideReply: true, hideReply: true,
), ),
style: TextStyle( style: TextStyle(
@ -277,7 +277,7 @@ class MessageContent extends StatelessWidget {
future: event.fetchSenderUser(), future: event.fetchSenderUser(),
builder: (context, snapshot) { builder: (context, snapshot) {
return _ButtonContent( return _ButtonContent(
label: L10n.of(context)!.startedACall( label: L10n.of(context).startedACall(
snapshot.data?.calcDisplayname() ?? snapshot.data?.calcDisplayname() ??
event.senderFromMemoryOrFallback.calcDisplayname(), event.senderFromMemoryOrFallback.calcDisplayname(),
), ),
@ -293,7 +293,7 @@ class MessageContent extends StatelessWidget {
future: event.fetchSenderUser(), future: event.fetchSenderUser(),
builder: (context, snapshot) { builder: (context, snapshot) {
return _ButtonContent( return _ButtonContent(
label: L10n.of(context)!.userSentUnknownEvent( label: L10n.of(context).userSentUnknownEvent(
snapshot.data?.calcDisplayname() ?? snapshot.data?.calcDisplayname() ??
event.senderFromMemoryOrFallback.calcDisplayname(), event.senderFromMemoryOrFallback.calcDisplayname(),
event.type, event.type,

View file

@ -72,7 +72,7 @@ class ReplyContent extends StatelessWidget {
), ),
Text( Text(
displayEvent.calcLocalizedBodyFallback( displayEvent.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: false, withSenderNamePrefix: false,
hideReply: true, hideReply: true,
), ),

View file

@ -21,7 +21,7 @@ class StateMessage extends StatelessWidget {
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: Text( child: Text(
event.calcLocalizedBodyFallback( event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(

View file

@ -58,10 +58,10 @@ class VerificationRequestContent extends StatelessWidget {
canceled canceled
? 'Error ${cancel.first.content.tryGet<String>('code')}: ${cancel.first.content.tryGet<String>('reason')}' ? 'Error ${cancel.first.content.tryGet<String>('code')}: ${cancel.first.content.tryGet<String>('reason')}'
: (fullyDone : (fullyDone
? L10n.of(context)!.verifySuccess ? L10n.of(context).verifySuccess
: (started : (started
? L10n.of(context)!.loadingPleaseWait ? L10n.of(context).loadingPleaseWait
: L10n.of(context)!.newVerificationRequest)), : L10n.of(context).newVerificationRequest)),
), ),
], ],
), ),

View file

@ -137,8 +137,8 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
) )
: const Icon(Icons.play_circle_outlined), : const Icon(Icons.play_circle_outlined),
tooltip: _isDownloading tooltip: _isDownloading
? L10n.of(context)!.loadingPleaseWait ? L10n.of(context).loadingPleaseWait
: L10n.of(context)!.videoWithSize( : L10n.of(context).videoWithSize(
widget.event.sizeString ?? '?MB', widget.event.sizeString ?? '?MB',
), ),
onPressed: _isDownloading ? null : _downloadAction, onPressed: _isDownloading ? null : _downloadAction,

View file

@ -226,7 +226,7 @@ class InputBar extends StatelessWidget {
const padding = EdgeInsets.all(4.0); const padding = EdgeInsets.all(4.0);
if (suggestion['type'] == 'command') { if (suggestion['type'] == 'command') {
final command = suggestion['name']!; final command = suggestion['name']!;
final hint = commandHint(L10n.of(context)!, command); final hint = commandHint(L10n.of(context), command);
return Tooltip( return Tooltip(
message: hint, message: hint,
waitDuration: const Duration(days: 1), // don't show on hover waitDuration: const Duration(days: 1), // don't show on hover

View file

@ -32,13 +32,13 @@ class PinnedEvents extends StatelessWidget {
? events.single?.eventId ? events.single?.eventId
: await showConfirmationDialog<String>( : await showConfirmationDialog<String>(
context: context, context: context,
title: L10n.of(context)!.pinMessage, title: L10n.of(context).pinMessage,
actions: events actions: events
.map( .map(
(event) => AlertDialogAction( (event) => AlertDialogAction(
key: event?.eventId ?? '', key: event?.eventId ?? '',
label: event?.calcLocalizedBodyFallback( label: event?.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: true, withSenderNamePrefix: true,
hideReply: true, hideReply: true,
) ?? ) ??
@ -67,17 +67,17 @@ class PinnedEvents extends StatelessWidget {
final event = snapshot.data; final event = snapshot.data;
return ChatAppBarListTile( return ChatAppBarListTile(
title: event?.calcLocalizedBodyFallback( title: event?.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: true, withSenderNamePrefix: true,
hideReply: true, hideReply: true,
) ?? ) ??
L10n.of(context)!.loadingPleaseWait, L10n.of(context).loadingPleaseWait,
leading: IconButton( leading: IconButton(
splashRadius: 18, splashRadius: 18,
iconSize: 18, iconSize: 18,
color: theme.colorScheme.onSurfaceVariant, color: theme.colorScheme.onSurfaceVariant,
icon: const Icon(Icons.push_pin), icon: const Icon(Icons.push_pin),
tooltip: L10n.of(context)!.unpin, tooltip: L10n.of(context).unpin,
onPressed: controller.room.canSendEvent(EventTypes.RoomPinnedEvents) onPressed: controller.room.canSendEvent(EventTypes.RoomPinnedEvents)
? () => controller.unpinEvent(event!.eventId) ? () => controller.unpinEvent(event!.eventId)
: null, : null,

View file

@ -137,7 +137,7 @@ class RecordingDialogState extends State<RecordingDialog> {
final time = final time =
'${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}'; '${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}';
final content = error final content = error
? Text(L10n.of(context)!.oopsSomethingWentWrong) ? Text(L10n.of(context).oopsSomethingWentWrong)
: Row( : Row(
children: [ children: [
Container( Container(
@ -185,7 +185,7 @@ class RecordingDialogState extends State<RecordingDialog> {
CupertinoDialogAction( CupertinoDialogAction(
onPressed: () => Navigator.of(context, rootNavigator: false).pop(), onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
child: Text( child: Text(
L10n.of(context)!.cancel.toUpperCase(), L10n.of(context).cancel.toUpperCase(),
style: TextStyle( style: TextStyle(
color: theme.textTheme.bodyMedium?.color?.withAlpha(150), color: theme.textTheme.bodyMedium?.color?.withAlpha(150),
), ),
@ -194,7 +194,7 @@ class RecordingDialogState extends State<RecordingDialog> {
if (error != true) if (error != true)
CupertinoDialogAction( CupertinoDialogAction(
onPressed: _stopAndSend, onPressed: _stopAndSend,
child: Text(L10n.of(context)!.send.toUpperCase()), child: Text(L10n.of(context).send.toUpperCase()),
), ),
], ],
); );
@ -205,7 +205,7 @@ class RecordingDialogState extends State<RecordingDialog> {
TextButton( TextButton(
onPressed: () => Navigator.of(context, rootNavigator: false).pop(), onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
child: Text( child: Text(
L10n.of(context)!.cancel.toUpperCase(), L10n.of(context).cancel.toUpperCase(),
style: TextStyle( style: TextStyle(
color: theme.textTheme.bodyMedium?.color?.withAlpha(150), color: theme.textTheme.bodyMedium?.color?.withAlpha(150),
), ),
@ -217,7 +217,7 @@ class RecordingDialogState extends State<RecordingDialog> {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Text(L10n.of(context)!.send.toUpperCase()), Text(L10n.of(context).send.toUpperCase()),
const SizedBox(width: 4), const SizedBox(width: 4),
const Icon(Icons.send_outlined, size: 15), const Icon(Icons.send_outlined, size: 15),
], ],

View file

@ -29,7 +29,7 @@ class ReplyDisplay extends StatelessWidget {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
IconButton( IconButton(
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: controller.cancelReplyEventAction, onPressed: controller.cancelReplyEventAction,
), ),
@ -71,7 +71,7 @@ class _EditContent extends StatelessWidget {
Container(width: 15.0), Container(width: 15.0),
Text( Text(
event.calcLocalizedBodyFallback( event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
withSenderNamePrefix: false, withSenderNamePrefix: false,
hideReply: true, hideReply: true,
), ),

View file

@ -40,7 +40,7 @@ class SendFileDialogState extends State<SendFileDialog> {
Future<void> _send() async { Future<void> _send() async {
final scaffoldMessenger = ScaffoldMessenger.of(widget.outerContext); final scaffoldMessenger = ScaffoldMessenger.of(widget.outerContext);
final l10n = L10n.of(context)!; final l10n = L10n.of(context);
try { try {
scaffoldMessenger.showLoadingSnackBar(l10n.prepareSendingAttachment); scaffoldMessenger.showLoadingSnackBar(l10n.prepareSendingAttachment);
@ -146,7 +146,7 @@ class SendFileDialogState extends State<SendFileDialog> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
var sendStr = L10n.of(context)!.sendFile; var sendStr = L10n.of(context).sendFile;
final uniqueMimeType = widget.files final uniqueMimeType = widget.files
.map((file) => file.mimeType ?? lookupMimeType(file.path)) .map((file) => file.mimeType ?? lookupMimeType(file.path))
.toSet() .toSet()
@ -154,21 +154,21 @@ class SendFileDialogState extends State<SendFileDialog> {
final fileName = widget.files.length == 1 final fileName = widget.files.length == 1
? widget.files.single.name ? 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) { if (uniqueMimeType?.startsWith('image') ?? false) {
sendStr = L10n.of(context)!.sendImage; sendStr = L10n.of(context).sendImage;
} else if (uniqueMimeType?.startsWith('audio') ?? false) { } else if (uniqueMimeType?.startsWith('audio') ?? false) {
sendStr = L10n.of(context)!.sendAudio; sendStr = L10n.of(context).sendAudio;
} else if (uniqueMimeType?.startsWith('video') ?? false) { } else if (uniqueMimeType?.startsWith('video') ?? false) {
sendStr = L10n.of(context)!.sendVideo; sendStr = L10n.of(context).sendVideo;
} }
return FutureBuilder<String>( return FutureBuilder<String>(
future: _calcCombinedFileSize(), future: _calcCombinedFileSize(),
builder: (context, snapshot) { builder: (context, snapshot) {
final sizeString = final sizeString =
snapshot.data ?? L10n.of(context)!.calculatingFileSize; snapshot.data ?? L10n.of(context).calculatingFileSize;
Widget contentWidget; Widget contentWidget;
if (uniqueMimeType?.startsWith('image') ?? false) { if (uniqueMimeType?.startsWith('image') ?? false) {
@ -210,7 +210,7 @@ class SendFileDialogState extends State<SendFileDialog> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
L10n.of(context)!.sendOriginal, L10n.of(context).sendOriginal,
style: const TextStyle(fontWeight: FontWeight.bold), style: const TextStyle(fontWeight: FontWeight.bold),
), ),
Text(sizeString), Text(sizeString),
@ -270,7 +270,7 @@ class SendFileDialogState extends State<SendFileDialog> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
L10n.of(context)!.sendOriginal, L10n.of(context).sendOriginal,
style: style:
const TextStyle(fontWeight: FontWeight.bold), const TextStyle(fontWeight: FontWeight.bold),
), ),
@ -293,11 +293,11 @@ class SendFileDialogState extends State<SendFileDialog> {
// just close the dialog // just close the dialog
Navigator.of(context, rootNavigator: false).pop(); Navigator.of(context, rootNavigator: false).pop();
}, },
child: Text(L10n.of(context)!.cancel), child: Text(L10n.of(context).cancel),
), ),
TextButton( TextButton(
onPressed: _send, onPressed: _send,
child: Text(L10n.of(context)!.send), child: Text(L10n.of(context).send),
), ),
], ],
); );

View file

@ -93,12 +93,12 @@ class SendLocationDialogState extends State<SendLocationDialog> {
longitude: position!.longitude, longitude: position!.longitude,
); );
} else if (disabled) { } else if (disabled) {
contentWidget = Text(L10n.of(context)!.locationDisabledNotice); contentWidget = Text(L10n.of(context).locationDisabledNotice);
} else if (denied) { } else if (denied) {
contentWidget = Text(L10n.of(context)!.locationPermissionDeniedNotice); contentWidget = Text(L10n.of(context).locationPermissionDeniedNotice);
} else if (error != null) { } else if (error != null) {
contentWidget = contentWidget =
Text(L10n.of(context)!.errorObtainingLocation(error.toString())); Text(L10n.of(context).errorObtainingLocation(error.toString()));
} else { } else {
contentWidget = Row( contentWidget = Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -106,22 +106,22 @@ class SendLocationDialogState extends State<SendLocationDialog> {
children: [ children: [
const CupertinoActivityIndicator(), const CupertinoActivityIndicator(),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.obtainingLocation), Text(L10n.of(context).obtainingLocation),
], ],
); );
} }
return AlertDialog.adaptive( return AlertDialog.adaptive(
title: Text(L10n.of(context)!.shareLocation), title: Text(L10n.of(context).shareLocation),
content: contentWidget, content: contentWidget,
actions: [ actions: [
TextButton( TextButton(
onPressed: Navigator.of(context, rootNavigator: false).pop, onPressed: Navigator.of(context, rootNavigator: false).pop,
child: Text(L10n.of(context)!.cancel), child: Text(L10n.of(context).cancel),
), ),
if (position != null) if (position != null)
TextButton( TextButton(
onPressed: isSending ? null : sendAction, onPressed: isSending ? null : sendAction,
child: Text(L10n.of(context)!.send), child: Text(L10n.of(context).send),
), ),
], ],
); );

View file

@ -117,7 +117,7 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
child: TextField( child: TextField(
autofocus: false, autofocus: false,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.search, hintText: L10n.of(context).search,
prefixIcon: const Icon(Icons.search_outlined), prefixIcon: const Icon(Icons.search_outlined),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
), ),
@ -131,7 +131,7 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text(L10n.of(context)!.noEmotesFound), Text(L10n.of(context).noEmotesFound),
const SizedBox(height: 12), const SizedBox(height: 12),
OutlinedButton.icon( OutlinedButton.icon(
onPressed: () => UrlLauncher( onPressed: () => UrlLauncher(
@ -139,7 +139,7 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
'https://matrix.to/#/#fluffychat-stickers:janian.de', 'https://matrix.to/#/#fluffychat-stickers:janian.de',
).launchUrl(), ).launchUrl(),
icon: const Icon(Icons.explore_outlined), icon: const Icon(Icons.explore_outlined),
label: Text(L10n.of(context)!.discover), label: Text(L10n.of(context).discover),
), ),
], ],
), ),

View file

@ -151,7 +151,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
if (capabilities == null) return; if (capabilities == null) return;
final newVersion = await showConfirmationDialog<String>( final newVersion = await showConfirmationDialog<String>(
context: context, context: context,
title: L10n.of(context)!.replaceRoomWithNewerVersion, title: L10n.of(context).replaceRoomWithNewerVersion,
actions: capabilities.mRoomVersions!.available.entries actions: capabilities.mRoomVersions!.available.entries
.where((r) => r.key != roomVersion) .where((r) => r.key != roomVersion)
.map( .map(
@ -168,10 +168,10 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
await showOkCancelAlertDialog( await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
message: L10n.of(context)!.roomUpgradeDescription, message: L10n.of(context).roomUpgradeDescription,
isDestructiveAction: true, isDestructiveAction: true,
)) { )) {
return; return;
@ -190,12 +190,12 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.editRoomAliases, title: L10n.of(context).editRoomAliases,
textFields: [ textFields: [
DialogTextField( DialogTextField(
prefixText: '#', prefixText: '#',
suffixText: domain, suffixText: domain,
hintText: L10n.of(context)!.alias, hintText: L10n.of(context).alias,
), ),
], ],
); );
@ -214,10 +214,10 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
final canonicalAliasConsent = await showOkCancelAlertDialog( final canonicalAliasConsent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.setAsCanonicalAlias, title: L10n.of(context).setAsCanonicalAlias,
message: alias, message: alias,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
); );
final altAliases = room final altAliases = room

View file

@ -20,7 +20,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.accessAndVisibility), title: Text(L10n.of(context).accessAndVisibility),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: StreamBuilder<Object>( child: StreamBuilder<Object>(
@ -38,7 +38,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
children: [ children: [
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.visibilityOfTheChatHistory, L10n.of(context).visibilityOfTheChatHistory,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -49,7 +49,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
RadioListTile<HistoryVisibility>.adaptive( RadioListTile<HistoryVisibility>.adaptive(
title: Text( title: Text(
historyVisibility historyVisibility
.getLocalizedString(MatrixLocals(L10n.of(context)!)), .getLocalizedString(MatrixLocals(L10n.of(context))),
), ),
value: historyVisibility, value: historyVisibility,
groupValue: room.historyVisibility, groupValue: room.historyVisibility,
@ -61,7 +61,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.whoIsAllowedToJoinThisGroup, L10n.of(context).whoIsAllowedToJoinThisGroup,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -72,7 +72,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
if (joinRule != JoinRules.private) if (joinRule != JoinRules.private)
RadioListTile<JoinRules>.adaptive( RadioListTile<JoinRules>.adaptive(
title: Text( title: Text(
joinRule.localizedString(L10n.of(context)!), joinRule.localizedString(L10n.of(context)),
), ),
value: joinRule, value: joinRule,
groupValue: room.joinRules, groupValue: room.joinRules,
@ -86,7 +86,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
.contains(room.joinRules)) ...[ .contains(room.joinRules)) ...[
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.areGuestsAllowedToJoin, L10n.of(context).areGuestsAllowedToJoin,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -97,7 +97,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
RadioListTile<GuestAccess>.adaptive( RadioListTile<GuestAccess>.adaptive(
title: Text( title: Text(
guestAccess.getLocalizedString( guestAccess.getLocalizedString(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
value: guestAccess, value: guestAccess,
@ -110,7 +110,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.publicChatAddresses, L10n.of(context).publicChatAddresses,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -118,7 +118,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
), ),
trailing: IconButton( trailing: IconButton(
icon: const Icon(Icons.add_outlined), icon: const Icon(Icons.add_outlined),
tooltip: L10n.of(context)!.createNewAddress, tooltip: L10n.of(context).createNewAddress,
onPressed: controller.addAlias, onPressed: controller.addAlias,
), ),
), ),
@ -171,7 +171,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
builder: (context, snapshot) => SwitchListTile.adaptive( builder: (context, snapshot) => SwitchListTile.adaptive(
value: snapshot.data == Visibility.public, value: snapshot.data == Visibility.public,
title: Text( title: Text(
L10n.of(context)!.chatCanBeDiscoveredViaSearchOnServer( L10n.of(context).chatCanBeDiscoveredViaSearchOnServer(
room.client.userID!.domain!, room.client.userID!.domain!,
), ),
), ),
@ -180,7 +180,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
), ),
], ],
ListTile( ListTile(
title: Text(L10n.of(context)!.globalChatId), title: Text(L10n.of(context).globalChatId),
subtitle: SelectableText(room.id), subtitle: SelectableText(room.id),
trailing: IconButton( trailing: IconButton(
icon: const Icon(Icons.copy_outlined), icon: const Icon(Icons.copy_outlined),
@ -188,7 +188,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
), ),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.roomVersion), title: Text(L10n.of(context).roomVersion),
subtitle: SelectableText( subtitle: SelectableText(
room room
.getState(EventTypes.RoomCreate)! .getState(EventTypes.RoomCreate)!

View file

@ -43,14 +43,14 @@ class ChatDetailsController extends State<ChatDetails> {
final room = Matrix.of(context).client.getRoomById(roomId!)!; final room = Matrix.of(context).client.getRoomById(roomId!)!;
final input = await showTextInputDialog( final input = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.changeTheNameOfTheGroup, title: L10n.of(context).changeTheNameOfTheGroup,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
initialText: room.getLocalizedDisplayname( initialText: room.getLocalizedDisplayname(
MatrixLocals( MatrixLocals(
L10n.of(context)!, L10n.of(context),
), ),
), ),
), ),
@ -63,7 +63,7 @@ class ChatDetailsController extends State<ChatDetails> {
); );
if (success.error == null) { if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar( 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<ChatDetails> {
final room = Matrix.of(context).client.getRoomById(roomId!)!; final room = Matrix.of(context).client.getRoomById(roomId!)!;
final input = await showTextInputDialog( final input = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.setChatDescription, title: L10n.of(context).setChatDescription,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.noChatDescriptionYet, hintText: L10n.of(context).noChatDescriptionYet,
initialText: room.topic, initialText: room.topic,
minLines: 4, minLines: 4,
maxLines: 8, maxLines: 8,
@ -92,7 +92,7 @@ class ChatDetailsController extends State<ChatDetails> {
if (success.error == null) { if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(L10n.of(context)!.chatDescriptionHasBeenChanged), content: Text(L10n.of(context).chatDescriptionHasBeenChanged),
), ),
); );
} }
@ -118,19 +118,19 @@ class ChatDetailsController extends State<ChatDetails> {
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
SheetAction( SheetAction(
key: AvatarAction.camera, key: AvatarAction.camera,
label: L10n.of(context)!.openCamera, label: L10n.of(context).openCamera,
isDefaultAction: true, isDefaultAction: true,
icon: Icons.camera_alt_outlined, icon: Icons.camera_alt_outlined,
), ),
SheetAction( SheetAction(
key: AvatarAction.file, key: AvatarAction.file,
label: L10n.of(context)!.openGallery, label: L10n.of(context).openGallery,
icon: Icons.photo_outlined, icon: Icons.photo_outlined,
), ),
if (room?.avatar != null) if (room?.avatar != null)
SheetAction( SheetAction(
key: AvatarAction.remove, key: AvatarAction.remove,
label: L10n.of(context)!.delete, label: L10n.of(context).delete,
isDestructiveAction: true, isDestructiveAction: true,
icon: Icons.delete_outlined, icon: Icons.delete_outlined,
), ),
@ -139,7 +139,7 @@ class ChatDetailsController extends State<ChatDetails> {
? actions.single.key ? actions.single.key
: await showModalActionSheet<AvatarAction>( : await showModalActionSheet<AvatarAction>(
context: context, context: context,
title: L10n.of(context)!.editRoomAvatar, title: L10n.of(context).editRoomAvatar,
actions: actions, actions: actions,
); );
if (action == null) return; if (action == null) return;

View file

@ -29,10 +29,10 @@ class ChatDetailsView extends StatelessWidget {
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.oopsSomethingWentWrong), title: Text(L10n.of(context).oopsSomethingWentWrong),
), ),
body: Center( 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 canRequestMoreMembers = members.length < actualMembersCount;
final iconColor = theme.textTheme.bodyLarge!.color; final iconColor = theme.textTheme.bodyLarge!.color;
final displayname = room.getLocalizedDisplayname( final displayname = room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
); );
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@ -59,7 +59,7 @@ class ChatDetailsView extends StatelessWidget {
actions: <Widget>[ actions: <Widget>[
if (room.canonicalAlias.isNotEmpty) if (room.canonicalAlias.isNotEmpty)
IconButton( IconButton(
tooltip: L10n.of(context)!.share, tooltip: L10n.of(context).share,
icon: Icon(Icons.adaptive.share_outlined), icon: Icon(Icons.adaptive.share_outlined),
onPressed: () => FluffyShare.share( onPressed: () => FluffyShare.share(
AppConfig.inviteLinkPrefix + room.canonicalAlias, AppConfig.inviteLinkPrefix + room.canonicalAlias,
@ -69,7 +69,7 @@ class ChatDetailsView extends StatelessWidget {
if (controller.widget.embeddedCloseButton == null) if (controller.widget.embeddedCloseButton == null)
ChatSettingsPopupMenu(room, false), ChatSettingsPopupMenu(room, false),
], ],
title: Text(L10n.of(context)!.chatDetails), title: Text(L10n.of(context).chatDetails),
backgroundColor: theme.appBarTheme.backgroundColor, backgroundColor: theme.appBarTheme.backgroundColor,
), ),
body: MaxWidthBody( body: MaxWidthBody(
@ -150,7 +150,7 @@ class ChatDetailsView extends StatelessWidget {
), ),
label: Text( label: Text(
room.isDirectChat room.isDirectChat
? L10n.of(context)!.directChat ? L10n.of(context).directChat
: displayname, : displayname,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -172,7 +172,7 @@ class ChatDetailsView extends StatelessWidget {
theme.colorScheme.secondary, theme.colorScheme.secondary,
), ),
label: Text( label: Text(
L10n.of(context)!.countParticipants( L10n.of(context).countParticipants(
actualMembersCount, actualMembersCount,
), ),
maxLines: 1, maxLines: 1,
@ -189,7 +189,7 @@ class ChatDetailsView extends StatelessWidget {
if (!room.canChangeStateEvent(EventTypes.RoomTopic)) if (!room.canChangeStateEvent(EventTypes.RoomTopic))
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.chatDescription, L10n.of(context).chatDescription,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -201,7 +201,7 @@ class ChatDetailsView extends StatelessWidget {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: TextButton.icon( child: TextButton.icon(
onPressed: controller.setTopicAction, onPressed: controller.setTopicAction,
label: Text(L10n.of(context)!.setChatDescription), label: Text(L10n.of(context).setChatDescription),
icon: const Icon(Icons.edit_outlined), icon: const Icon(Icons.edit_outlined),
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: backgroundColor:
@ -217,7 +217,7 @@ class ChatDetailsView extends StatelessWidget {
), ),
child: SelectableLinkify( child: SelectableLinkify(
text: room.topic.isEmpty text: room.topic.isEmpty
? L10n.of(context)!.noChatDescriptionYet ? L10n.of(context).noChatDescriptionYet
: room.topic, : room.topic,
options: const LinkifyOptions(humanize: false), options: const LinkifyOptions(humanize: false),
linkStyle: const TextStyle( linkStyle: const TextStyle(
@ -247,9 +247,8 @@ class ChatDetailsView extends StatelessWidget {
Icons.insert_emoticon_outlined, Icons.insert_emoticon_outlined,
), ),
), ),
title: title: Text(L10n.of(context).customEmojisAndStickers),
Text(L10n.of(context)!.customEmojisAndStickers), subtitle: Text(L10n.of(context).setCustomEmotes),
subtitle: Text(L10n.of(context)!.setCustomEmotes),
onTap: controller.goToEmoteSettings, onTap: controller.goToEmoteSettings,
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
), ),
@ -261,10 +260,10 @@ class ChatDetailsView extends StatelessWidget {
child: const Icon(Icons.shield_outlined), child: const Icon(Icons.shield_outlined),
), ),
title: Text( title: Text(
L10n.of(context)!.accessAndVisibility, L10n.of(context).accessAndVisibility,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.accessAndVisibilityDescription, L10n.of(context).accessAndVisibilityDescription,
), ),
onTap: () => context onTap: () => context
.push('/rooms/${room.id}/details/access'), .push('/rooms/${room.id}/details/access'),
@ -272,9 +271,9 @@ class ChatDetailsView extends StatelessWidget {
), ),
if (!room.isDirectChat) if (!room.isDirectChat)
ListTile( ListTile(
title: Text(L10n.of(context)!.chatPermissions), title: Text(L10n.of(context).chatPermissions),
subtitle: Text( subtitle: Text(
L10n.of(context)!.whoCanPerformWhichAction, L10n.of(context).whoCanPerformWhichAction,
), ),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: theme.scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
@ -290,7 +289,7 @@ class ChatDetailsView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.countParticipants( L10n.of(context).countParticipants(
actualMembersCount.toString(), actualMembersCount.toString(),
), ),
style: TextStyle( style: TextStyle(
@ -301,7 +300,7 @@ class ChatDetailsView extends StatelessWidget {
), ),
if (!room.isDirectChat && room.canInvite) if (!room.isDirectChat && room.canInvite)
ListTile( ListTile(
title: Text(L10n.of(context)!.inviteContact), title: Text(L10n.of(context).inviteContact),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: backgroundColor:
theme.colorScheme.primaryContainer, theme.colorScheme.primaryContainer,
@ -319,7 +318,7 @@ class ChatDetailsView extends StatelessWidget {
? ParticipantListItem(members[i - 1]) ? ParticipantListItem(members[i - 1])
: ListTile( : ListTile(
title: Text( title: Text(
L10n.of(context)!.loadCountMoreParticipants( L10n.of(context).loadCountMoreParticipants(
(actualMembersCount - members.length).toString(), (actualMembersCount - members.length).toString(),
), ),
), ),

View file

@ -17,17 +17,17 @@ class ParticipantListItem extends StatelessWidget {
final theme = Theme.of(context); final theme = Theme.of(context);
final membershipBatch = switch (user.membership) { final membershipBatch = switch (user.membership) {
Membership.ban => L10n.of(context)!.banned, Membership.ban => L10n.of(context).banned,
Membership.invite => L10n.of(context)!.invited, Membership.invite => L10n.of(context).invited,
Membership.join => null, Membership.join => null,
Membership.knock => L10n.of(context)!.knocking, Membership.knock => L10n.of(context).knocking,
Membership.leave => L10n.of(context)!.leftTheChat, Membership.leave => L10n.of(context).leftTheChat,
}; };
final permissionBatch = user.powerLevel == 100 final permissionBatch = user.powerLevel == 100
? L10n.of(context)!.admin ? L10n.of(context).admin
: user.powerLevel >= 50 : user.powerLevel >= 50
? L10n.of(context)!.moderator ? L10n.of(context).moderator
: ''; : '';
return Opacity( return Opacity(

View file

@ -34,33 +34,33 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
if (room.encrypted) { if (room.encrypted) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.sorryThatsNotPossible, title: L10n.of(context).sorryThatsNotPossible,
message: L10n.of(context)!.disableEncryptionWarning, message: L10n.of(context).disableEncryptionWarning,
); );
return; return;
} }
if (room.joinRules == JoinRules.public) { if (room.joinRules == JoinRules.public) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.sorryThatsNotPossible, title: L10n.of(context).sorryThatsNotPossible,
message: L10n.of(context)!.noEncryptionForPublicRooms, message: L10n.of(context).noEncryptionForPublicRooms,
); );
return; return;
} }
if (!room.canChangeStateEvent(EventTypes.Encryption)) { if (!room.canChangeStateEvent(EventTypes.Encryption)) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.sorryThatsNotPossible, title: L10n.of(context).sorryThatsNotPossible,
message: L10n.of(context)!.noPermission, message: L10n.of(context).noPermission,
); );
return; return;
} }
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
message: L10n.of(context)!.enableEncryptionWarning, message: L10n.of(context).enableEncryptionWarning,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -72,10 +72,10 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
void startVerification() async { void startVerification() async {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.verifyOtherUser, title: L10n.of(context).verifyOtherUser,
message: L10n.of(context)!.verifyOtherUserDescription, message: L10n.of(context).verifyOtherUserDescription,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;

View file

@ -31,11 +31,11 @@ class ChatEncryptionSettingsView extends StatelessWidget {
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: () => context.go('/rooms/${controller.roomId!}'), onPressed: () => context.go('/rooms/${controller.roomId!}'),
), ),
title: Text(L10n.of(context)!.encryption), title: Text(L10n.of(context).encryption),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => launchUrlString(AppConfig.encryptionTutorial), 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, backgroundColor: theme.colorScheme.primaryContainer,
child: const Icon(Icons.lock_outlined), child: const Icon(Icons.lock_outlined),
), ),
title: Text(L10n.of(context)!.encryptThisChat), title: Text(L10n.of(context).encryptThisChat),
value: room.encrypted, value: room.encrypted,
onChanged: controller.enableEncryption, onChanged: controller.enableEncryption,
), ),
@ -67,7 +67,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
child: ElevatedButton.icon( child: ElevatedButton.icon(
onPressed: controller.startVerification, onPressed: controller.startVerification,
icon: const Icon(Icons.verified_outlined), 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), const SizedBox(height: 16),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.deviceKeys, L10n.of(context).deviceKeys,
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -91,7 +91,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
if (snapshot.hasError) { if (snapshot.hasError) {
return Center( return Center(
child: Text( 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), const SizedBox(width: 4),
Text( Text(
deviceKeys[i].deviceId ?? deviceKeys[i].deviceId ??
L10n.of(context)!.unknownDevice, L10n.of(context).unknownDevice,
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
Flexible( Flexible(
@ -167,7 +167,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
), ),
subtitle: Text( subtitle: Text(
deviceKeys[i].ed25519Key?.beautified ?? deviceKeys[i].ed25519Key?.beautified ??
L10n.of(context)!.unknownEncryptionAlgorithm, L10n.of(context).unknownEncryptionAlgorithm,
style: TextStyle( style: TextStyle(
fontFamily: 'RobotoMono', fontFamily: 'RobotoMono',
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
@ -183,7 +183,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Center( child: Center(
child: Text( child: Text(
L10n.of(context)!.encryptionNotEnabled, L10n.of(context).encryptionNotEnabled,
style: const TextStyle( style: const TextStyle(
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
), ),

View file

@ -62,15 +62,15 @@ extension LocalizedActiveFilter on ActiveFilter {
String toLocalizedString(BuildContext context) { String toLocalizedString(BuildContext context) {
switch (this) { switch (this) {
case ActiveFilter.allChats: case ActiveFilter.allChats:
return L10n.of(context)!.all; return L10n.of(context).all;
case ActiveFilter.messages: case ActiveFilter.messages:
return L10n.of(context)!.messages; return L10n.of(context).messages;
case ActiveFilter.unread: case ActiveFilter.unread:
return L10n.of(context)!.unread; return L10n.of(context).unread;
case ActiveFilter.groups: case ActiveFilter.groups:
return L10n.of(context)!.groups; return L10n.of(context).groups;
case ActiveFilter.spaces: case ActiveFilter.spaces:
return L10n.of(context)!.spaces; return L10n.of(context).spaces;
} }
} }
} }
@ -128,25 +128,25 @@ class ChatListController extends State<ChatList>
final inviteAction = await showModalActionSheet<InviteActions>( final inviteAction = await showModalActionSheet<InviteActions>(
context: context, context: context,
message: room.isDirectChat message: room.isDirectChat
? L10n.of(context)!.invitePrivateChat ? L10n.of(context).invitePrivateChat
: L10n.of(context)!.inviteGroupChat, : L10n.of(context).inviteGroupChat,
title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
actions: [ actions: [
SheetAction( SheetAction(
key: InviteActions.accept, key: InviteActions.accept,
label: L10n.of(context)!.accept, label: L10n.of(context).accept,
icon: Icons.check_outlined, icon: Icons.check_outlined,
isDefaultAction: true, isDefaultAction: true,
), ),
SheetAction( SheetAction(
key: InviteActions.decline, key: InviteActions.decline,
label: L10n.of(context)!.decline, label: L10n.of(context).decline,
icon: Icons.close_outlined, icon: Icons.close_outlined,
isDestructiveAction: true, isDestructiveAction: true,
), ),
SheetAction( SheetAction(
key: InviteActions.block, key: InviteActions.block,
label: L10n.of(context)!.block, label: L10n.of(context).block,
icon: Icons.block_outlined, icon: Icons.block_outlined,
isDestructiveAction: true, isDestructiveAction: true,
), ),
@ -181,7 +181,7 @@ class ChatListController extends State<ChatList>
if (room.membership == Membership.ban) { if (room.membership == Membership.ban) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(L10n.of(context)!.youHaveBeenBannedFromThisChat), content: Text(L10n.of(context).youHaveBeenBannedFromThisChat),
), ),
); );
return; return;
@ -221,12 +221,12 @@ class ChatListController extends State<ChatList>
} else { } else {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.forward, title: L10n.of(context).forward,
message: L10n.of(context)!.forwardMessageTo( message: L10n.of(context).forwardMessageTo(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
), ),
okLabel: L10n.of(context)!.forward, okLabel: L10n.of(context).forward,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (consent == OkCancelResult.cancel) { if (consent == OkCancelResult.cancel) {
Matrix.of(context).shareContent = null; Matrix.of(context).shareContent = null;
@ -276,10 +276,10 @@ class ChatListController extends State<ChatList>
void setServer() async { void setServer() async {
final newServer = await showTextInputDialog( final newServer = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
title: L10n.of(context)!.changeTheHomeserver, title: L10n.of(context).changeTheHomeserver,
context: context, context: context,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
prefixText: 'https://', prefixText: 'https://',
@ -289,7 +289,7 @@ class ChatListController extends State<ChatList>
autocorrect: false, autocorrect: false,
validator: (server) => server?.contains('.') == true validator: (server) => server?.contains('.') == true
? null ? null
: L10n.of(context)!.invalidServerName, : L10n.of(context).invalidServerName,
), ),
], ],
); );
@ -569,7 +569,7 @@ class ChatListController extends State<ChatList>
); );
final displayname = final displayname =
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)); room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)));
final spacesWithPowerLevels = room.client.rooms final spacesWithPowerLevels = room.client.rooms
.where( .where(
@ -618,8 +618,7 @@ class ChatListController extends State<ChatList>
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded( Expanded(
child: Text( child: Text(
L10n.of(context)! L10n.of(context).goToSpace(space.getLocalizedDisplayname()),
.goToSpace(space.getLocalizedDisplayname()),
), ),
), ),
], ],
@ -638,8 +637,8 @@ class ChatListController extends State<ChatList>
const SizedBox(width: 12), const SizedBox(width: 12),
Text( Text(
room.pushRuleState == PushRuleState.notify room.pushRuleState == PushRuleState.notify
? L10n.of(context)!.muteChat ? L10n.of(context).muteChat
: L10n.of(context)!.unmuteChat, : L10n.of(context).unmuteChat,
), ),
], ],
), ),
@ -657,8 +656,8 @@ class ChatListController extends State<ChatList>
const SizedBox(width: 12), const SizedBox(width: 12),
Text( Text(
room.markedUnread room.markedUnread
? L10n.of(context)!.markAsRead ? L10n.of(context).markAsRead
: L10n.of(context)!.markAsUnread, : L10n.of(context).markAsUnread,
), ),
], ],
), ),
@ -672,8 +671,8 @@ class ChatListController extends State<ChatList>
const SizedBox(width: 12), const SizedBox(width: 12),
Text( Text(
room.isFavourite room.isFavourite
? L10n.of(context)!.unpin ? L10n.of(context).unpin
: L10n.of(context)!.pin, : L10n.of(context).pin,
), ),
], ],
), ),
@ -686,7 +685,7 @@ class ChatListController extends State<ChatList>
children: [ children: [
const Icon(Icons.group_work_outlined), const Icon(Icons.group_work_outlined),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.addToSpace), Text(L10n.of(context).addToSpace),
], ],
), ),
), ),
@ -697,7 +696,7 @@ class ChatListController extends State<ChatList>
children: [ children: [
const Icon(Icons.delete_outlined), const Icon(Icons.delete_outlined),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.leave), Text(L10n.of(context).leave),
], ],
), ),
), ),
@ -740,10 +739,10 @@ class ChatListController extends State<ChatList>
final confirmed = await showOkCancelAlertDialog( final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.leave, okLabel: L10n.of(context).leave,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.archiveRoomDescription, message: L10n.of(context).archiveRoomDescription,
isDestructiveAction: true, isDestructiveAction: true,
); );
if (confirmed == OkCancelResult.cancel) return; if (confirmed == OkCancelResult.cancel) return;
@ -755,13 +754,13 @@ class ChatListController extends State<ChatList>
case ChatContextAction.addToSpace: case ChatContextAction.addToSpace:
final space = await showConfirmationDialog( final space = await showConfirmationDialog(
context: context, context: context,
title: L10n.of(context)!.space, title: L10n.of(context).space,
actions: spacesWithPowerLevels actions: spacesWithPowerLevels
.map( .map(
(space) => AlertDialogAction( (space) => AlertDialogAction(
key: space, key: space,
label: space label: space
.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), .getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
), ),
) )
.toList(), .toList(),
@ -776,7 +775,7 @@ class ChatListController extends State<ChatList>
void dismissStatusList() async { void dismissStatusList() async {
final result = await showOkCancelAlertDialog( final result = await showOkCancelAlertDialog(
title: L10n.of(context)!.hidePresences, title: L10n.of(context).hidePresences,
context: context, context: context,
); );
if (result == OkCancelResult.ok) { if (result == OkCancelResult.ok) {
@ -792,13 +791,13 @@ class ChatListController extends State<ChatList>
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.setStatus, title: L10n.of(context).setStatus,
message: L10n.of(context)!.leaveEmptyToClearStatus, message: L10n.of(context).leaveEmptyToClearStatus,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.statusExampleMessage, hintText: L10n.of(context).statusExampleMessage,
maxLines: 6, maxLines: 6,
minLines: 1, minLines: 1,
maxLength: 255, maxLength: 255,
@ -880,22 +879,22 @@ class ChatListController extends State<ChatList>
} }
void editBundlesForAccount(String? userId, String? activeBundle) async { void editBundlesForAccount(String? userId, String? activeBundle) async {
final l10n = L10n.of(context)!; final l10n = L10n.of(context);
final client = Matrix.of(context) final client = Matrix.of(context)
.widget .widget
.clients[Matrix.of(context).getClientIndexByMatrixId(userId!)]; .clients[Matrix.of(context).getClientIndexByMatrixId(userId!)];
final action = await showConfirmationDialog<EditBundleAction>( final action = await showConfirmationDialog<EditBundleAction>(
context: context, context: context,
title: L10n.of(context)!.editBundlesForAccount, title: L10n.of(context).editBundlesForAccount,
actions: [ actions: [
AlertDialogAction( AlertDialogAction(
key: EditBundleAction.addToBundle, key: EditBundleAction.addToBundle,
label: L10n.of(context)!.addToBundle, label: L10n.of(context).addToBundle,
), ),
if (activeBundle != client.userID) if (activeBundle != client.userID)
AlertDialogAction( AlertDialogAction(
key: EditBundleAction.removeFromBundle, key: EditBundleAction.removeFromBundle,
label: L10n.of(context)!.removeFromBundle, label: L10n.of(context).removeFromBundle,
), ),
], ],
); );

View file

@ -83,17 +83,17 @@ class ChatListViewBody extends StatelessWidget {
[ [
if (controller.isSearchMode) ...[ if (controller.isSearchMode) ...[
SearchTitle( SearchTitle(
title: L10n.of(context)!.publicRooms, title: L10n.of(context).publicRooms,
icon: const Icon(Icons.explore_outlined), icon: const Icon(Icons.explore_outlined),
), ),
PublicRoomsHorizontalList(publicRooms: publicRooms), PublicRoomsHorizontalList(publicRooms: publicRooms),
SearchTitle( SearchTitle(
title: L10n.of(context)!.publicSpaces, title: L10n.of(context).publicSpaces,
icon: const Icon(Icons.workspaces_outlined), icon: const Icon(Icons.workspaces_outlined),
), ),
PublicRoomsHorizontalList(publicRooms: publicSpaces), PublicRoomsHorizontalList(publicRooms: publicSpaces),
SearchTitle( SearchTitle(
title: L10n.of(context)!.users, title: L10n.of(context).users,
icon: const Icon(Icons.group_outlined), icon: const Icon(Icons.group_outlined),
), ),
AnimatedContainer( AnimatedContainer(
@ -115,7 +115,7 @@ class ChatListViewBody extends StatelessWidget {
userSearchResult.results[i].displayName ?? userSearchResult.results[i].displayName ??
userSearchResult userSearchResult
.results[i].userId.localpart ?? .results[i].userId.localpart ??
L10n.of(context)!.unknownDevice, L10n.of(context).unknownDevice,
avatar: userSearchResult.results[i].avatarUrl, avatar: userSearchResult.results[i].avatarUrl,
onPressed: () => showAdaptiveBottomSheet( onPressed: () => showAdaptiveBottomSheet(
context: context, context: context,
@ -146,8 +146,8 @@ class ChatListViewBody extends StatelessWidget {
color: theme.colorScheme.surface, color: theme.colorScheme.surface,
child: ListTile( child: ListTile(
leading: const Icon(Icons.vpn_key), leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.dehydrateTor), title: Text(L10n.of(context).dehydrateTor),
subtitle: Text(L10n.of(context)!.dehydrateTorLong), subtitle: Text(L10n.of(context).dehydrateTorLong),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
onTap: controller.dehydrate, onTap: controller.dehydrate,
), ),
@ -231,7 +231,7 @@ class ChatListViewBody extends StatelessWidget {
), ),
if (controller.isSearchMode) if (controller.isSearchMode)
SearchTitle( SearchTitle(
title: L10n.of(context)!.chats, title: L10n.of(context).chats,
icon: const Icon(Icons.forum_outlined), icon: const Icon(Icons.forum_outlined),
), ),
if (client.prevBatch != null && if (client.prevBatch != null &&
@ -267,8 +267,8 @@ class ChatListViewBody extends StatelessWidget {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Text( child: Text(
client.rooms.isEmpty client.rooms.isEmpty
? L10n.of(context)!.noChatsFoundHere ? L10n.of(context).noChatsFoundHere
: L10n.of(context)!.noMoreChatsFound, : L10n.of(context).noMoreChatsFound,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
@ -343,7 +343,7 @@ class PublicRoomsHorizontalList extends StatelessWidget {
itemBuilder: (context, i) => _SearchItem( itemBuilder: (context, i) => _SearchItem(
title: publicRooms[i].name ?? title: publicRooms[i].name ??
publicRooms[i].canonicalAlias?.localpart ?? publicRooms[i].canonicalAlias?.localpart ??
L10n.of(context)!.group, L10n.of(context).group,
avatar: publicRooms[i].avatarUrl, avatar: publicRooms[i].avatarUrl,
onPressed: () => showAdaptiveBottomSheet( onPressed: () => showAdaptiveBottomSheet(
context: context, context: context,

View file

@ -35,14 +35,14 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
leading: selectMode == SelectMode.normal leading: selectMode == SelectMode.normal
? null ? null
: IconButton( : IconButton(
tooltip: L10n.of(context)!.cancel, tooltip: L10n.of(context).cancel,
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: controller.cancelAction, onPressed: controller.cancelAction,
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
), ),
title: selectMode == SelectMode.share title: selectMode == SelectMode.share
? Text( ? Text(
L10n.of(context)!.share, L10n.of(context).share,
key: const ValueKey(SelectMode.share), key: const ValueKey(SelectMode.share),
) )
: TextField( : TextField(
@ -61,7 +61,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
hintText: L10n.of(context)!.searchChatsRooms, hintText: L10n.of(context).searchChatsRooms,
hintStyle: TextStyle( hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer, color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -69,7 +69,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
floatingLabelBehavior: FloatingLabelBehavior.never, floatingLabelBehavior: FloatingLabelBehavior.never,
prefixIcon: controller.isSearchMode prefixIcon: controller.isSearchMode
? IconButton( ? IconButton(
tooltip: L10n.of(context)!.cancel, tooltip: L10n.of(context).cancel,
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: controller.cancelSearch, onPressed: controller.cancelSearch,
color: theme.colorScheme.onPrimaryContainer, color: theme.colorScheme.onPrimaryContainer,

View file

@ -47,10 +47,10 @@ class ChatListItem extends StatelessWidget {
final confirmed = await showOkCancelAlertDialog( final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.archiveRoomDescription, message: L10n.of(context).archiveRoomDescription,
); );
if (confirmed == OkCancelResult.cancel) return; if (confirmed == OkCancelResult.cancel) return;
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -81,7 +81,7 @@ class ChatListItem extends StatelessWidget {
final backgroundColor = final backgroundColor =
activeChat ? theme.colorScheme.secondaryContainer : null; activeChat ? theme.colorScheme.secondaryContainer : null;
final displayname = room.getLocalizedDisplayname( final displayname = room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
); );
final filter = this.filter; final filter = this.filter;
if (filter != null && !displayname.toLowerCase().contains(filter)) { if (filter != null && !displayname.toLowerCase().contains(filter)) {
@ -272,7 +272,7 @@ class ChatListItem extends StatelessWidget {
Expanded( Expanded(
child: room.isSpace && room.membership == Membership.join child: room.isSpace && room.membership == Membership.join
? Text( ? Text(
L10n.of(context)!.countChatsAndCountParticipants( L10n.of(context).countChatsAndCountParticipants(
room.spaceChildren.length.toString(), room.spaceChildren.length.toString(),
(room.summary.mJoinedMemberCount ?? 1).toString(), (room.summary.mJoinedMemberCount ?? 1).toString(),
), ),
@ -292,7 +292,7 @@ class ChatListItem extends StatelessWidget {
), ),
future: needLastEventSender future: needLastEventSender
? lastEvent.calcLocalizedBody( ? lastEvent.calcLocalizedBody(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
hideReply: true, hideReply: true,
hideEdit: true, hideEdit: true,
plaintextBody: true, plaintextBody: true,
@ -304,7 +304,7 @@ class ChatListItem extends StatelessWidget {
: null, : null,
initialData: initialData:
lastEvent?.calcLocalizedBodyFallback( lastEvent?.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
hideReply: true, hideReply: true,
hideEdit: true, hideEdit: true,
plaintextBody: true, plaintextBody: true,
@ -316,10 +316,10 @@ class ChatListItem extends StatelessWidget {
builder: (context, snapshot) => Text( builder: (context, snapshot) => Text(
room.membership == Membership.invite room.membership == Membership.invite
? isDirectChat ? isDirectChat
? L10n.of(context)!.invitePrivateChat ? L10n.of(context).invitePrivateChat
: L10n.of(context)!.inviteGroupChat : L10n.of(context).inviteGroupChat
: snapshot.data ?? : snapshot.data ??
L10n.of(context)!.emptyChat, L10n.of(context).emptyChat,
softWrap: false, softWrap: false,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

View file

@ -85,7 +85,7 @@ class ChatListView extends StatelessWidget {
onTap: controller.clearActiveSpace, onTap: controller.clearActiveSpace,
icon: const Icon(Icons.forum_outlined), icon: const Icon(Icons.forum_outlined),
selectedIcon: const Icon(Icons.forum), selectedIcon: const Icon(Icons.forum),
toolTip: L10n.of(context)!.chats, toolTip: L10n.of(context).chats,
unreadBadgeFilter: (room) => true, unreadBadgeFilter: (room) => true,
); );
} }
@ -95,13 +95,13 @@ class ChatListView extends StatelessWidget {
isSelected: false, isSelected: false,
onTap: () => context.go('/rooms/newspace'), onTap: () => context.go('/rooms/newspace'),
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
toolTip: L10n.of(context)!.createNewSpace, toolTip: L10n.of(context).createNewSpace,
); );
} }
final space = rootSpaces[i]; final space = rootSpaces[i];
final displayname = final displayname =
rootSpaces[i].getLocalizedDisplayname( rootSpaces[i].getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
); );
final spaceChildrenIds = final spaceChildrenIds =
space.spaceChildren.map((c) => c.roomId).toSet(); space.spaceChildren.map((c) => c.roomId).toSet();
@ -144,7 +144,7 @@ class ChatListView extends StatelessWidget {
LogicalKeyboardKey.keyN, LogicalKeyboardKey.keyN,
}, },
onKeysPressed: () => context.go('/rooms/newprivatechat'), onKeysPressed: () => context.go('/rooms/newprivatechat'),
helpLabel: L10n.of(context)!.newChat, helpLabel: L10n.of(context).newChat,
child: selectMode == SelectMode.normal && child: selectMode == SelectMode.normal &&
!controller.isSearchMode && !controller.isSearchMode &&
controller.activeSpaceId == null controller.activeSpaceId == null
@ -153,7 +153,7 @@ class ChatListView extends StatelessWidget {
context.go('/rooms/newprivatechat'), context.go('/rooms/newprivatechat'),
icon: const Icon(Icons.add_outlined), icon: const Icon(Icons.add_outlined),
label: Text( label: Text(
L10n.of(context)!.chat, L10n.of(context).chat,
overflow: TextOverflow.fade, overflow: TextOverflow.fade,
), ),
) )

View file

@ -34,7 +34,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.group_add_outlined), const Icon(Icons.group_add_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.createGroup), Text(L10n.of(context).createGroup),
], ],
), ),
), ),
@ -44,7 +44,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.workspaces_outlined), const Icon(Icons.workspaces_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.createNewSpace), Text(L10n.of(context).createNewSpace),
], ],
), ),
), ),
@ -54,7 +54,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.edit_outlined), const Icon(Icons.edit_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.setStatus), Text(L10n.of(context).setStatus),
], ],
), ),
), ),
@ -64,7 +64,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
Icon(Icons.adaptive.share_outlined), Icon(Icons.adaptive.share_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.inviteContact), Text(L10n.of(context).inviteContact),
], ],
), ),
), ),
@ -86,7 +86,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.settings_outlined), const Icon(Icons.settings_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.settings), Text(L10n.of(context).settings),
], ],
), ),
), ),
@ -156,7 +156,7 @@ class ClientChooserButton extends StatelessWidget {
children: [ children: [
const Icon(Icons.person_add_outlined), const Icon(Icons.person_add_outlined),
const SizedBox(width: 18), const SizedBox(width: 18),
Text(L10n.of(context)!.addAccount), Text(L10n.of(context).addAccount),
], ],
), ),
), ),
@ -178,7 +178,7 @@ class ClientChooserButton extends StatelessWidget {
clientCount, clientCount,
(index) => KeyBoardShortcuts( (index) => KeyBoardShortcuts(
keysToPress: _buildKeyboardShortcut(index + 1), keysToPress: _buildKeyboardShortcut(index + 1),
helpLabel: L10n.of(context)!.switchToAccount(index + 1), helpLabel: L10n.of(context).switchToAccount(index + 1),
onKeysPressed: () => _handleKeyboardShortcut( onKeysPressed: () => _handleKeyboardShortcut(
matrix, matrix,
index, index,
@ -192,7 +192,7 @@ class ClientChooserButton extends StatelessWidget {
LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.controlLeft,
LogicalKeyboardKey.tab, LogicalKeyboardKey.tab,
}, },
helpLabel: L10n.of(context)!.nextAccount, helpLabel: L10n.of(context).nextAccount,
onKeysPressed: () => _nextAccount(matrix, context), onKeysPressed: () => _nextAccount(matrix, context),
child: const SizedBox.shrink(), child: const SizedBox.shrink(),
), ),
@ -202,7 +202,7 @@ class ClientChooserButton extends StatelessWidget {
LogicalKeyboardKey.shiftLeft, LogicalKeyboardKey.shiftLeft,
LogicalKeyboardKey.tab, LogicalKeyboardKey.tab,
}, },
helpLabel: L10n.of(context)!.previousAccount, helpLabel: L10n.of(context).previousAccount,
onKeysPressed: () => _previousAccount(matrix, context), onKeysPressed: () => _previousAccount(matrix, context),
child: const SizedBox.shrink(), child: const SizedBox.shrink(),
), ),
@ -249,10 +249,10 @@ class ClientChooserButton extends StatelessWidget {
case SettingsAction.addAccount: case SettingsAction.addAccount:
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.addAccount, title: L10n.of(context).addAccount,
message: L10n.of(context)!.enableMultiAccounts, message: L10n.of(context).enableMultiAccounts,
okLabel: L10n.of(context)!.next, okLabel: L10n.of(context).next,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;
context.go('/rooms/settings/addaccount'); context.go('/rooms/settings/addaccount');

View file

@ -132,10 +132,10 @@ class _SpaceViewState extends State<SpaceView> {
final confirmed = await showOkCancelAlertDialog( final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
message: L10n.of(context)!.archiveRoomDescription, message: L10n.of(context).archiveRoomDescription,
); );
if (!mounted) return; if (!mounted) return;
if (confirmed != OkCancelResult.ok) return; if (confirmed != OkCancelResult.ok) return;
@ -153,15 +153,15 @@ class _SpaceViewState extends State<SpaceView> {
void _addChatOrSubspace() async { void _addChatOrSubspace() async {
final roomType = await showConfirmationDialog( final roomType = await showConfirmationDialog(
context: context, context: context,
title: L10n.of(context)!.addChatOrSubSpace, title: L10n.of(context).addChatOrSubSpace,
actions: [ actions: [
AlertDialogAction( AlertDialogAction(
key: AddRoomType.subspace, key: AddRoomType.subspace,
label: L10n.of(context)!.createNewSpace, label: L10n.of(context).createNewSpace,
), ),
AlertDialogAction( AlertDialogAction(
key: AddRoomType.chat, key: AddRoomType.chat,
label: L10n.of(context)!.createGroup, label: L10n.of(context).createGroup,
), ),
], ],
); );
@ -170,32 +170,32 @@ class _SpaceViewState extends State<SpaceView> {
final names = await showTextInputDialog( final names = await showTextInputDialog(
context: context, context: context,
title: roomType == AddRoomType.subspace title: roomType == AddRoomType.subspace
? L10n.of(context)!.createNewSpace ? L10n.of(context).createNewSpace
: L10n.of(context)!.createGroup, : L10n.of(context).createGroup,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: roomType == AddRoomType.subspace hintText: roomType == AddRoomType.subspace
? L10n.of(context)!.spaceName ? L10n.of(context).spaceName
: L10n.of(context)!.groupName, : L10n.of(context).groupName,
minLines: 1, minLines: 1,
maxLines: 1, maxLines: 1,
maxLength: 64, maxLength: 64,
validator: (text) { validator: (text) {
if (text == null || text.isEmpty) { if (text == null || text.isEmpty) {
return L10n.of(context)!.pleaseChoose; return L10n.of(context).pleaseChoose;
} }
return null; return null;
}, },
), ),
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.chatDescription, hintText: L10n.of(context).chatDescription,
minLines: 4, minLines: 4,
maxLines: 8, maxLines: 8,
maxLength: 255, maxLength: 255,
), ),
], ],
okLabel: L10n.of(context)!.create, okLabel: L10n.of(context).create,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (names == null) return; if (names == null) return;
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
@ -245,7 +245,7 @@ class _SpaceViewState extends State<SpaceView> {
final room = Matrix.of(context).client.getRoomById(widget.spaceId); final room = Matrix.of(context).client.getRoomById(widget.spaceId);
final displayname = final displayname =
room?.getLocalizedDisplayname() ?? L10n.of(context)!.nothingFound; room?.getLocalizedDisplayname() ?? L10n.of(context).nothingFound;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: Center( leading: Center(
@ -269,7 +269,7 @@ class _SpaceViewState extends State<SpaceView> {
subtitle: room == null subtitle: room == null
? null ? null
: Text( : Text(
L10n.of(context)!.countChatsAndCountParticipants( L10n.of(context).countChatsAndCountParticipants(
room.spaceChildren.length, room.spaceChildren.length,
room.summary.mJoinedMemberCount ?? 1, room.summary.mJoinedMemberCount ?? 1,
), ),
@ -288,7 +288,7 @@ class _SpaceViewState extends State<SpaceView> {
children: [ children: [
const Icon(Icons.settings_outlined), const Icon(Icons.settings_outlined),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.settings), Text(L10n.of(context).settings),
], ],
), ),
), ),
@ -299,7 +299,7 @@ class _SpaceViewState extends State<SpaceView> {
children: [ children: [
const Icon(Icons.person_add_outlined), const Icon(Icons.person_add_outlined),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.invite), Text(L10n.of(context).invite),
], ],
), ),
), ),
@ -310,7 +310,7 @@ class _SpaceViewState extends State<SpaceView> {
children: [ children: [
const Icon(Icons.delete_outlined), const Icon(Icons.delete_outlined),
const SizedBox(width: 12), const SizedBox(width: 12),
Text(L10n.of(context)!.leave), Text(L10n.of(context).leave),
], ],
), ),
), ),
@ -368,7 +368,7 @@ class _SpaceViewState extends State<SpaceView> {
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
hintText: L10n.of(context)!.search, hintText: L10n.of(context).search,
hintStyle: TextStyle( hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer, color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -453,7 +453,7 @@ class _SpaceViewState extends State<SpaceView> {
child: Icon(Icons.add_outlined), child: Icon(Icons.add_outlined),
), ),
title: Text( title: Text(
L10n.of(context)!.addChatOrSubSpace, L10n.of(context).addChatOrSubSpace,
style: const TextStyle(fontSize: 14), style: const TextStyle(fontSize: 14),
), ),
), ),
@ -461,7 +461,7 @@ class _SpaceViewState extends State<SpaceView> {
), ),
], ],
SearchTitle( SearchTitle(
title: L10n.of(context)!.joinedChats, title: L10n.of(context).joinedChats,
icon: const Icon(Icons.chat_outlined), icon: const Icon(Icons.chat_outlined),
), ),
], ],
@ -486,7 +486,7 @@ class _SpaceViewState extends State<SpaceView> {
itemBuilder: (context, i) { itemBuilder: (context, i) {
if (i == 0) { if (i == 0) {
return SearchTitle( return SearchTitle(
title: L10n.of(context)!.discover, title: L10n.of(context).discover,
icon: const Icon(Icons.explore_outlined), icon: const Icon(Icons.explore_outlined),
); );
} }
@ -497,7 +497,7 @@ class _SpaceViewState extends State<SpaceView> {
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Center( child: Center(
child: Text( child: Text(
L10n.of(context)!.noMoreChatsFound, L10n.of(context).noMoreChatsFound,
style: const TextStyle(fontSize: 13), style: const TextStyle(fontSize: 13),
), ),
), ),
@ -516,14 +516,14 @@ class _SpaceViewState extends State<SpaceView> {
AppConfig.borderRadius, AppConfig.borderRadius,
), ),
) )
: Text(L10n.of(context)!.loadMore), : Text(L10n.of(context).loadMore),
), ),
); );
} }
final item = _discoveredChildren[i]; final item = _discoveredChildren[i];
final displayname = item.name ?? final displayname = item.name ??
item.canonicalAlias ?? item.canonicalAlias ??
L10n.of(context)!.emptyChat; L10n.of(context).emptyChat;
if (!displayname.toLowerCase().contains(filter)) { if (!displayname.toLowerCase().contains(filter)) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
@ -564,7 +564,7 @@ class _SpaceViewState extends State<SpaceView> {
), ),
subtitle: Text( subtitle: Text(
item.topic ?? item.topic ??
L10n.of(context)!.countParticipants( L10n.of(context).countParticipants(
item.numJoinedMembers, item.numJoinedMembers,
), ),
maxLines: 1, maxLines: 1,

View file

@ -20,10 +20,10 @@ class ChatMembersView extends StatelessWidget {
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.oopsSomethingWentWrong), title: Text(L10n.of(context).oopsSomethingWentWrong),
), ),
body: Center( body: Center(
child: Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat), child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
), ),
); );
} }
@ -40,7 +40,7 @@ class ChatMembersView extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text( title: Text(
L10n.of(context)!.countParticipants(roomCount), L10n.of(context).countParticipants(roomCount),
), ),
actions: [ actions: [
if (room.canInvite) if (room.canInvite)
@ -68,7 +68,7 @@ class ChatMembersView extends StatelessWidget {
OutlinedButton.icon( OutlinedButton.icon(
onPressed: controller.refreshMembers, onPressed: controller.refreshMembers,
icon: const Icon(Icons.refresh_outlined), 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, fontWeight: FontWeight.normal,
), ),
prefixIcon: const Icon(Icons.search_outlined), prefixIcon: const Icon(Icons.search_outlined),
hintText: L10n.of(context)!.search, hintText: L10n.of(context).search,
), ),
), ),
) )

View file

@ -31,7 +31,7 @@ class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
final room = Matrix.of(context).client.getRoomById(roomId!)!; final room = Matrix.of(context).client.getRoomById(roomId!)!;
if (!room.canSendEvent(EventTypes.RoomPowerLevels)) { if (!room.canSendEvent(EventTypes.RoomPowerLevels)) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.noPermission)), SnackBar(content: Text(L10n.of(context).noPermission)),
); );
return; return;
} }

View file

@ -20,7 +20,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.chatPermissions), title: Text(L10n.of(context).chatPermissions),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: StreamBuilder( child: StreamBuilder(
@ -31,7 +31,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
? null ? null
: Matrix.of(context).client.getRoomById(roomId); : Matrix.of(context).client.getRoomById(roomId);
if (room == null) { if (room == null) {
return Center(child: Text(L10n.of(context)!.noRoomsFound)); return Center(child: Text(L10n.of(context).noRoomsFound));
} }
final powerLevelsContent = Map<String, Object?>.from( final powerLevelsContent = Map<String, Object?>.from(
room.getState(EventTypes.RoomPowerLevels)?.content ?? {}, room.getState(EventTypes.RoomPowerLevels)?.content ?? {},
@ -46,13 +46,13 @@ class ChatPermissionsSettingsView extends StatelessWidget {
ListTile( ListTile(
leading: const Icon(Icons.info_outlined), leading: const Icon(Icons.info_outlined),
subtitle: Text( subtitle: Text(
L10n.of(context)!.chatPermissionsDescription, L10n.of(context).chatPermissionsDescription,
), ),
), ),
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.chatPermissions, L10n.of(context).chatPermissions,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -77,7 +77,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.notifications, L10n.of(context).notifications,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -112,7 +112,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.configureChat, L10n.of(context).configureChat,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,

View file

@ -25,45 +25,45 @@ class PermissionsListTile extends StatelessWidget {
if (category == null) { if (category == null) {
switch (permissionKey) { switch (permissionKey) {
case 'users_default': case 'users_default':
return L10n.of(context)!.defaultPermissionLevel; return L10n.of(context).defaultPermissionLevel;
case 'events_default': case 'events_default':
return L10n.of(context)!.sendMessages; return L10n.of(context).sendMessages;
case 'state_default': case 'state_default':
return L10n.of(context)!.changeGeneralChatSettings; return L10n.of(context).changeGeneralChatSettings;
case 'ban': case 'ban':
return L10n.of(context)!.banFromChat; return L10n.of(context).banFromChat;
case 'kick': case 'kick':
return L10n.of(context)!.kickFromChat; return L10n.of(context).kickFromChat;
case 'redact': case 'redact':
return L10n.of(context)!.deleteMessage; return L10n.of(context).deleteMessage;
case 'invite': case 'invite':
return L10n.of(context)!.inviteOtherUsers; return L10n.of(context).inviteOtherUsers;
} }
} else if (category == 'notifications') { } else if (category == 'notifications') {
switch (permissionKey) { switch (permissionKey) {
case 'rooms': case 'rooms':
return L10n.of(context)!.sendRoomNotifications; return L10n.of(context).sendRoomNotifications;
} }
} else if (category == 'events') { } else if (category == 'events') {
switch (permissionKey) { switch (permissionKey) {
case EventTypes.RoomName: case EventTypes.RoomName:
return L10n.of(context)!.changeTheNameOfTheGroup; return L10n.of(context).changeTheNameOfTheGroup;
case EventTypes.RoomTopic: case EventTypes.RoomTopic:
return L10n.of(context)!.changeTheDescriptionOfTheGroup; return L10n.of(context).changeTheDescriptionOfTheGroup;
case EventTypes.RoomPowerLevels: case EventTypes.RoomPowerLevels:
return L10n.of(context)!.changeTheChatPermissions; return L10n.of(context).changeTheChatPermissions;
case EventTypes.HistoryVisibility: case EventTypes.HistoryVisibility:
return L10n.of(context)!.changeTheVisibilityOfChatHistory; return L10n.of(context).changeTheVisibilityOfChatHistory;
case EventTypes.RoomCanonicalAlias: case EventTypes.RoomCanonicalAlias:
return L10n.of(context)!.changeTheCanonicalRoomAlias; return L10n.of(context).changeTheCanonicalRoomAlias;
case EventTypes.RoomAvatar: case EventTypes.RoomAvatar:
return L10n.of(context)!.editRoomAvatar; return L10n.of(context).editRoomAvatar;
case EventTypes.RoomTombstone: case EventTypes.RoomTombstone:
return L10n.of(context)!.replaceRoomWithNewerVersion; return L10n.of(context).replaceRoomWithNewerVersion;
case EventTypes.Encryption: case EventTypes.Encryption:
return L10n.of(context)!.enableEncryption; return L10n.of(context).enableEncryption;
case 'm.room.server_acl': case 'm.room.server_acl':
return L10n.of(context)!.editBlockedServers; return L10n.of(context).editBlockedServers;
} }
} }
return permissionKey; return permissionKey;
@ -96,13 +96,13 @@ class PermissionsListTile extends StatelessWidget {
DropdownMenuItem( DropdownMenuItem(
value: permission < 50 ? permission : 0, value: permission < 50 ? permission : 0,
child: Text( child: Text(
L10n.of(context)!.userLevel(permission < 50 ? permission : 0), L10n.of(context).userLevel(permission < 50 ? permission : 0),
), ),
), ),
DropdownMenuItem( DropdownMenuItem(
value: permission < 100 && permission >= 50 ? permission : 50, value: permission < 100 && permission >= 50 ? permission : 50,
child: Text( child: Text(
L10n.of(context)!.moderatorLevel( L10n.of(context).moderatorLevel(
permission < 100 && permission >= 50 ? permission : 50, permission < 100 && permission >= 50 ? permission : 50,
), ),
), ),
@ -110,13 +110,13 @@ class PermissionsListTile extends StatelessWidget {
DropdownMenuItem( DropdownMenuItem(
value: permission >= 100 ? permission : 100, value: permission >= 100 ? permission : 100,
child: Text( child: Text(
L10n.of(context)! L10n.of(context)
.adminLevel(permission >= 100 ? permission : 100), .adminLevel(permission >= 100 ? permission : 100),
), ),
), ),
DropdownMenuItem( DropdownMenuItem(
value: null, value: null,
child: Text(L10n.of(context)!.custom), child: Text(L10n.of(context).custom),
), ),
], ],
), ),

View file

@ -37,9 +37,9 @@ class ChatSearchFilesTab extends StatelessWidget {
const CircularProgressIndicator.adaptive(strokeWidth: 2), const CircularProgressIndicator.adaptive(strokeWidth: 2),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
L10n.of(context)!.searchIn( L10n.of(context).searchIn(
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
), ),
@ -53,7 +53,7 @@ class ChatSearchFilesTab extends StatelessWidget {
children: [ children: [
const Icon(Icons.file_present_outlined, size: 64), const Icon(Icons.file_present_outlined, size: 64),
const SizedBox(height: 8), 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( icon: const Icon(
Icons.arrow_downward_outlined, 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 event = events[i];
final filename = event.content.tryGet<String>('filename') ?? final filename = event.content.tryGet<String>('filename') ??
event.content.tryGet<String>('body') ?? event.content.tryGet<String>('body') ??
L10n.of(context)!.unknownEvent('File'); L10n.of(context).unknownEvent('File');
final filetype = (filename.contains('.') final filetype = (filename.contains('.')
? filename.split('.').last.toUpperCase() ? filename.split('.').last.toUpperCase()
: event.content : event.content

View file

@ -37,9 +37,9 @@ class ChatSearchImagesTab extends StatelessWidget {
const CircularProgressIndicator.adaptive(strokeWidth: 2), const CircularProgressIndicator.adaptive(strokeWidth: 2),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
L10n.of(context)!.searchIn( L10n.of(context).searchIn(
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
), ),
@ -52,7 +52,7 @@ class ChatSearchImagesTab extends StatelessWidget {
children: [ children: [
const Icon(Icons.photo_outlined, size: 64), const Icon(Icons.photo_outlined, size: 64),
const SizedBox(height: 8), 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( icon: const Icon(
Icons.arrow_downward_outlined, Icons.arrow_downward_outlined,
), ),
label: Text(L10n.of(context)!.searchMore), label: Text(L10n.of(context).searchMore),
), ),
), ),
); );

View file

@ -41,9 +41,9 @@ class ChatSearchMessageTab extends StatelessWidget {
const Icon(Icons.search_outlined, size: 64), const Icon(Icons.search_outlined, size: 64),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
L10n.of(context)!.searchIn( L10n.of(context).searchIn(
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
), ),
@ -90,7 +90,7 @@ class ChatSearchMessageTab extends StatelessWidget {
icon: const Icon( icon: const Icon(
Icons.arrow_downward_outlined, 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 event = events[i];
final sender = event.senderFromMemoryOrFallback; final sender = event.senderFromMemoryOrFallback;
final displayname = sender.calcDisplayname( final displayname = sender.calcDisplayname(
i18n: MatrixLocals(L10n.of(context)!), i18n: MatrixLocals(L10n.of(context)),
); );
return _MessageSearchResultListTile( return _MessageSearchResultListTile(
sender: sender, sender: sender,
@ -164,7 +164,7 @@ class _MessageSearchResultListTile extends StatelessWidget {
plaintextBody: true, plaintextBody: true,
removeMarkdown: true, removeMarkdown: true,
MatrixLocals( MatrixLocals(
L10n.of(context)!, L10n.of(context),
), ),
) )
.trim(), .trim(),

View file

@ -20,12 +20,11 @@ class ChatSearchView extends StatelessWidget {
final room = controller.room; final room = controller.room;
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.oopsSomethingWentWrong)), appBar: AppBar(title: Text(L10n.of(context).oopsSomethingWentWrong)),
body: Center( body: Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat),
), ),
), ),
); );
@ -38,8 +37,8 @@ class ChatSearchView extends StatelessWidget {
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
titleSpacing: 0, titleSpacing: 0,
title: Text( title: Text(
L10n.of(context)!.searchIn( L10n.of(context).searchIn(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)), room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
), ),
), ),
), ),
@ -59,7 +58,7 @@ class ChatSearchView extends StatelessWidget {
autofocus: true, autofocus: true,
enabled: controller.tabController.index == 0, enabled: controller.tabController.index == 0,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.search, hintText: L10n.of(context).search,
suffixIcon: const Icon(Icons.search_outlined), suffixIcon: const Icon(Icons.search_outlined),
filled: true, filled: true,
fillColor: theme.colorScheme.secondaryContainer, fillColor: theme.colorScheme.secondaryContainer,
@ -77,9 +76,9 @@ class ChatSearchView extends StatelessWidget {
TabBar( TabBar(
controller: controller.tabController, controller: controller.tabController,
tabs: [ tabs: [
Tab(child: Text(L10n.of(context)!.messages)), Tab(child: Text(L10n.of(context).messages)),
Tab(child: Text(L10n.of(context)!.gallery)), Tab(child: Text(L10n.of(context).gallery)),
Tab(child: Text(L10n.of(context)!.files)), Tab(child: Text(L10n.of(context).files)),
], ],
), ),
Expanded( Expanded(

View file

@ -35,10 +35,10 @@ class DevicesSettingsController extends State<DevicesSettings> {
void removeDevicesAction(List<Device> devices) async { void removeDevicesAction(List<Device> devices) async {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
message: L10n.of(context)!.removeDevicesDescription, message: L10n.of(context).removeDevicesDescription,
) == ) ==
OkCancelResult.cancel) return; OkCancelResult.cancel) return;
final matrix = Matrix.of(context); final matrix = Matrix.of(context);
@ -70,9 +70,9 @@ class DevicesSettingsController extends State<DevicesSettings> {
void renameDeviceAction(Device device) async { void renameDeviceAction(Device device) async {
final displayName = await showTextInputDialog( final displayName = await showTextInputDialog(
context: context, context: context,
title: L10n.of(context)!.changeDeviceName, title: L10n.of(context).changeDeviceName,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: device.displayName, hintText: device.displayName,
@ -94,10 +94,10 @@ class DevicesSettingsController extends State<DevicesSettings> {
void verifyDeviceAction(Device device) async { void verifyDeviceAction(Device device) async {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.verifyOtherDevice, title: L10n.of(context).verifyOtherDevice,
message: L10n.of(context)!.verifyOtherDeviceDescription, message: L10n.of(context).verifyOtherDeviceDescription,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;

View file

@ -16,7 +16,7 @@ class DevicesSettingsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.devices), title: Text(L10n.of(context).devices),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: FutureBuilder<bool>( child: FutureBuilder<bool>(
@ -56,7 +56,7 @@ class DevicesSettingsView extends StatelessWidget {
), ),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
L10n.of(context)!.thisDevice, L10n.of(context).thisDevice,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
@ -84,7 +84,7 @@ class DevicesSettingsView extends StatelessWidget {
child: TextButton.icon( child: TextButton.icon(
label: Text( label: Text(
controller.errorDeletingDevices ?? controller.errorDeletingDevices ??
L10n.of(context)!.removeAllOtherDevices, L10n.of(context).removeAllOtherDevices,
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: foregroundColor:
@ -109,7 +109,7 @@ class DevicesSettingsView extends StatelessWidget {
Center( Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Text(L10n.of(context)!.noOtherDevicesFound), child: Text(L10n.of(context).noOtherDevicesFound),
), ),
), ),
], ],

View file

@ -55,30 +55,30 @@ class UserDeviceListItem extends StatelessWidget {
actions: [ actions: [
SheetAction( SheetAction(
key: UserDeviceListItemAction.rename, key: UserDeviceListItemAction.rename,
label: L10n.of(context)!.changeDeviceName, label: L10n.of(context).changeDeviceName,
), ),
if (!isOwnDevice && keys != null) ...{ if (!isOwnDevice && keys != null) ...{
SheetAction( SheetAction(
key: UserDeviceListItemAction.verify, key: UserDeviceListItemAction.verify,
label: L10n.of(context)!.verifyStart, label: L10n.of(context).verifyStart,
), ),
if (!keys.blocked) if (!keys.blocked)
SheetAction( SheetAction(
key: UserDeviceListItemAction.block, key: UserDeviceListItemAction.block,
label: L10n.of(context)!.blockDevice, label: L10n.of(context).blockDevice,
isDestructiveAction: true, isDestructiveAction: true,
), ),
if (keys.blocked) if (keys.blocked)
SheetAction( SheetAction(
key: UserDeviceListItemAction.unblock, key: UserDeviceListItemAction.unblock,
label: L10n.of(context)!.unblockDevice, label: L10n.of(context).unblockDevice,
isDestructiveAction: true, isDestructiveAction: true,
), ),
}, },
if (!isOwnDevice) if (!isOwnDevice)
SheetAction( SheetAction(
key: UserDeviceListItemAction.remove, key: UserDeviceListItemAction.remove,
label: L10n.of(context)!.delete, label: L10n.of(context).delete,
isDestructiveAction: true, isDestructiveAction: true,
), ),
], ],
@ -119,7 +119,7 @@ class UserDeviceListItem extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.lastActiveAgo( L10n.of(context).lastActiveAgo(
DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs ?? 0) DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs ?? 0)
.localizedTimeShort(context), .localizedTimeShort(context),
), ),
@ -129,10 +129,10 @@ class UserDeviceListItem extends StatelessWidget {
? null ? null
: Text( : Text(
keys.blocked keys.blocked
? L10n.of(context)!.blocked ? L10n.of(context).blocked
: keys.verified : keys.verified
? L10n.of(context)!.verified ? L10n.of(context).verified
: L10n.of(context)!.unverified, : L10n.of(context).unverified,
style: TextStyle( style: TextStyle(
color: keys.blocked color: keys.blocked
? Colors.red ? Colors.red

View file

@ -134,7 +134,7 @@ class MyCallingPage extends State<Calling> {
Room? get room => call.room; Room? get room => call.room;
String get displayName => call.room.getLocalizedDisplayname( String get displayName => call.room.getLocalizedDisplayname(
MatrixLocals(L10n.of(widget.context)!), MatrixLocals(L10n.of(widget.context)),
); );
String get callId => widget.callId; String get callId => widget.callId;
@ -296,14 +296,14 @@ class MyCallingPage extends State<Calling> {
channelId: 'notification_channel_id', channelId: 'notification_channel_id',
channelName: 'Foreground Notification', channelName: 'Foreground Notification',
channelDescription: channelDescription:
L10n.of(widget.context)!.foregroundServiceRunning, L10n.of(widget.context).foregroundServiceRunning,
), ),
iosNotificationOptions: const IOSNotificationOptions(), iosNotificationOptions: const IOSNotificationOptions(),
foregroundTaskOptions: const ForegroundTaskOptions(), foregroundTaskOptions: const ForegroundTaskOptions(),
); );
FlutterForegroundTask.startService( FlutterForegroundTask.startService(
notificationTitle: L10n.of(widget.context)!.screenSharingTitle, notificationTitle: L10n.of(widget.context).screenSharingTitle,
notificationText: L10n.of(widget.context)!.screenSharingDetail, notificationText: L10n.of(widget.context).screenSharingDetail,
); );
} else { } else {
FlutterForegroundTask.stopService(); FlutterForegroundTask.stopService();
@ -457,7 +457,7 @@ class MyCallingPage extends State<Calling> {
var title = ''; var title = '';
if (call.localHold) { if (call.localHold) {
title = '${call.room.getLocalizedDisplayname( title = '${call.room.getLocalizedDisplayname(
MatrixLocals(L10n.of(widget.context)!), MatrixLocals(L10n.of(widget.context)),
)} held the call.'; )} held the call.';
} else if (call.remoteOnHold) { } else if (call.remoteOnHold) {
title = 'You held the call.'; title = 'You held the call.';

View file

@ -49,8 +49,8 @@ class HomeserverPickerController extends State<HomeserverPicker> {
(e, s) async { (e, s) async {
await showOkAlertDialog( await showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.indexedDbErrorTitle, title: L10n.of(context).indexedDbErrorTitle,
message: L10n.of(context)!.indexedDbErrorLong, message: L10n.of(context).indexedDbErrorLong,
); );
_checkTorBrowser(); _checkTorBrowser();
}, },

View file

@ -24,7 +24,7 @@ class HomeserverPickerView extends StatelessWidget {
appBar: controller.widget.addMultiAccount appBar: controller.widget.addMultiAccount
? AppBar( ? AppBar(
centerTitle: true, centerTitle: true,
title: Text(L10n.of(context)!.addAccount), title: Text(L10n.of(context).addAccount),
) )
: null, : null,
body: Column( body: Column(
@ -46,8 +46,8 @@ class HomeserverPickerView extends StatelessWidget {
color: theme.colorScheme.surface, color: theme.colorScheme.surface,
child: ListTile( child: ListTile(
leading: const Icon(Icons.vpn_key), leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.hydrateTor), title: Text(L10n.of(context).hydrateTor),
subtitle: Text(L10n.of(context)!.hydrateTorLong), subtitle: Text(L10n.of(context).hydrateTorLong),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
onTap: controller.restoreBackup, onTap: controller.restoreBackup,
), ),
@ -95,16 +95,16 @@ class HomeserverPickerView extends StatelessWidget {
borderRadius: BorderRadius.circular(AppConfig.borderRadius), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
), ),
hintText: AppConfig.defaultHomeserver, hintText: AppConfig.defaultHomeserver,
labelText: L10n.of(context)!.homeserver, labelText: L10n.of(context).homeserver,
errorText: controller.error, errorText: controller.error,
suffixIcon: IconButton( suffixIcon: IconButton(
onPressed: () { onPressed: () {
showDialog( showDialog(
context: context, context: context,
builder: (context) => AlertDialog.adaptive( builder: (context) => AlertDialog.adaptive(
title: Text(L10n.of(context)!.whatIsAHomeserver), title: Text(L10n.of(context).whatIsAHomeserver),
content: Linkify( content: Linkify(
text: L10n.of(context)!.homeserverDescription, text: L10n.of(context).homeserverDescription,
), ),
actions: [ actions: [
TextButton( TextButton(
@ -112,12 +112,12 @@ class HomeserverPickerView extends StatelessWidget {
Uri.https('servers.joinmatrix.org'), Uri.https('servers.joinmatrix.org'),
), ),
child: Text( child: Text(
L10n.of(context)!.discoverHomeservers, L10n.of(context).discoverHomeservers,
), ),
), ),
TextButton( TextButton(
onPressed: Navigator.of(context).pop, 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 onPressed: controller.isLoggingIn || controller.isLoading
? null ? null
: controller.restoreBackup, : controller.restoreBackup,
child: Text(L10n.of(context)!.hydrate), child: Text(L10n.of(context).hydrate),
), ),
if (controller.supportsPasswordLogin && controller.supportsSso) if (controller.supportsPasswordLogin && controller.supportsSso)
TextButton( TextButton(
@ -155,7 +155,7 @@ class HomeserverPickerView extends StatelessWidget {
onPressed: controller.isLoggingIn || controller.isLoading onPressed: controller.isLoggingIn || controller.isLoading
? null ? null
: controller.login, : controller.login,
child: Text(L10n.of(context)!.loginWithMatrixId), child: Text(L10n.of(context).loginWithMatrixId),
), ),
const SizedBox(height: 8.0), const SizedBox(height: 8.0),
if (controller.supportsPasswordLogin || controller.supportsSso) if (controller.supportsPasswordLogin || controller.supportsSso)
@ -169,7 +169,7 @@ class HomeserverPickerView extends StatelessWidget {
: controller.supportsSso : controller.supportsSso
? controller.ssoLoginAction ? controller.ssoLoginAction
: controller.login, : controller.login,
child: Text(L10n.of(context)!.next), child: Text(L10n.of(context).next),
), ),
], ],
), ),

View file

@ -25,7 +25,7 @@ class ImageViewerView extends StatelessWidget {
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop, onPressed: Navigator.of(context).pop,
color: Colors.white, color: Colors.white,
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context).close,
), ),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
actions: [ actions: [
@ -36,7 +36,7 @@ class ImageViewerView extends StatelessWidget {
icon: const Icon(Icons.reply_outlined), icon: const Icon(Icons.reply_outlined),
onPressed: controller.forwardAction, onPressed: controller.forwardAction,
color: Colors.white, color: Colors.white,
tooltip: L10n.of(context)!.share, tooltip: L10n.of(context).share,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
IconButton( IconButton(
@ -46,7 +46,7 @@ class ImageViewerView extends StatelessWidget {
icon: const Icon(Icons.download_outlined), icon: const Icon(Icons.download_outlined),
onPressed: () => controller.saveFileAction(context), onPressed: () => controller.saveFileAction(context),
color: Colors.white, color: Colors.white,
tooltip: L10n.of(context)!.downloadFile, tooltip: L10n.of(context).downloadFile,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
@ -59,7 +59,7 @@ class ImageViewerView extends StatelessWidget {
backgroundColor: Colors.black.withOpacity(0.5), backgroundColor: Colors.black.withOpacity(0.5),
), ),
onPressed: () => controller.shareFileAction(context), onPressed: () => controller.shareFileAction(context),
tooltip: L10n.of(context)!.share, tooltip: L10n.of(context).share,
color: Colors.white, color: Colors.white,
icon: Icon(Icons.adaptive.share_outlined), icon: Icon(Icons.adaptive.share_outlined),
), ),

View file

@ -57,15 +57,15 @@ class InvitationSelectionController extends State<InvitationSelection> {
if (OkCancelResult.ok != if (OkCancelResult.ok !=
await showOkCancelAlertDialog( await showOkCancelAlertDialog(
context: context, context: context,
title: L10n.of(context)!.inviteContact, title: L10n.of(context).inviteContact,
message: L10n.of(context)!.inviteContactToGroupQuestion( message: L10n.of(context).inviteContactToGroupQuestion(
displayname, displayname,
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!), MatrixLocals(L10n.of(context)),
), ),
), ),
okLabel: L10n.of(context)!.invite, okLabel: L10n.of(context).invite,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
)) { )) {
return; return;
} }
@ -76,7 +76,7 @@ class InvitationSelectionController extends State<InvitationSelection> {
if (success.error == null) { if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(L10n.of(context)!.contactHasBeenInvitedToTheGroup), content: Text(L10n.of(context).contactHasBeenInvitedToTheGroup),
), ),
); );
} }

View file

@ -20,21 +20,21 @@ class InvitationSelectionView extends StatelessWidget {
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.oopsSomethingWentWrong), title: Text(L10n.of(context).oopsSomethingWentWrong),
), ),
body: Center( 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); final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
titleSpacing: 0, titleSpacing: 0,
title: Text(L10n.of(context)!.inviteContact), title: Text(L10n.of(context).inviteContact),
), ),
body: MaxWidthBody( body: MaxWidthBody(
innerPadding: const EdgeInsets.symmetric(vertical: 8), innerPadding: const EdgeInsets.symmetric(vertical: 8),
@ -55,7 +55,7 @@ class InvitationSelectionView extends StatelessWidget {
color: theme.colorScheme.onPrimaryContainer, color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
hintText: L10n.of(context)!.inviteContactToGroup(groupName), hintText: L10n.of(context).inviteContactToGroup(groupName),
prefixIcon: controller.loading prefixIcon: controller.loading
? const Padding( ? const Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -91,7 +91,7 @@ class InvitationSelectionView extends StatelessWidget {
displayname: controller displayname: controller
.foundProfiles[i].displayName ?? .foundProfiles[i].displayName ??
controller.foundProfiles[i].userId.localpart ?? controller.foundProfiles[i].userId.localpart ??
L10n.of(context)!.user, L10n.of(context).user,
userId: controller.foundProfiles[i].userId, userId: controller.foundProfiles[i].userId,
isMember: participants isMember: participants
.contains(controller.foundProfiles[i].userId), .contains(controller.foundProfiles[i].userId),
@ -100,7 +100,7 @@ class InvitationSelectionView extends StatelessWidget {
controller.foundProfiles[i].userId, controller.foundProfiles[i].userId,
controller.foundProfiles[i].displayName ?? controller.foundProfiles[i].displayName ??
controller.foundProfiles[i].userId.localpart ?? 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, avatarUrl: contacts[i].avatarUrl,
displayname: contacts[i].displayName ?? displayname: contacts[i].displayName ??
contacts[i].id.localpart ?? contacts[i].id.localpart ??
L10n.of(context)!.user, L10n.of(context).user,
userId: contacts[i].id, userId: contacts[i].id,
isMember: participants.contains(contacts[i].id), isMember: participants.contains(contacts[i].id),
onTap: () => controller.inviteAction( onTap: () => controller.inviteAction(
@ -132,7 +132,7 @@ class InvitationSelectionView extends StatelessWidget {
contacts[i].id, contacts[i].id,
contacts[i].displayName ?? contacts[i].displayName ??
contacts[i].id.localpart ?? contacts[i].id.localpart ??
L10n.of(context)!.user, L10n.of(context).user,
), ),
), ),
); );
@ -189,7 +189,7 @@ class _InviteContactListTile extends StatelessWidget {
), ),
onTap: isMember ? null : onTap, onTap: isMember ? null : onTap,
trailing: isMember trailing: isMember
? Text(L10n.of(context)!.participant) ? Text(L10n.of(context).participant)
: const Icon(Icons.person_add_outlined), : const Icon(Icons.person_add_outlined),
), ),
); );

View file

@ -87,7 +87,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
await showOkAlertDialog( await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.incorrectPassphraseOrKey, message: L10n.of(context).incorrectPassphraseOrKey,
); );
} }
} }
@ -106,7 +106,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
} }
final displayName = final displayName =
user?.calcDisplayname() ?? widget.request.userId.localpart!; user?.calcDisplayname() ?? widget.request.userId.localpart!;
var title = Text(L10n.of(context)!.verifyTitle); var title = Text(L10n.of(context).verifyTitle);
Widget body; Widget body;
final buttons = <Widget>[]; final buttons = <Widget>[];
@ -124,7 +124,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Text( Text(
L10n.of(context)!.askSSSSSign, L10n.of(context).askSSSSSign,
style: const TextStyle(fontSize: 20), style: const TextStyle(fontSize: 20),
), ),
Container(height: 10), Container(height: 10),
@ -140,7 +140,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
maxLines: 1, maxLines: 1,
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.passphraseOrKey, hintText: L10n.of(context).passphraseOrKey,
prefixStyle: TextStyle(color: theme.colorScheme.primary), prefixStyle: TextStyle(color: theme.colorScheme.primary),
suffixStyle: TextStyle(color: theme.colorScheme.primary), suffixStyle: TextStyle(color: theme.colorScheme.primary),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
@ -152,7 +152,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton( TextButton(
child: Text( child: Text(
L10n.of(context)!.submit, L10n.of(context).submit,
), ),
onPressed: () => checkInput(textEditingController.text), onPressed: () => checkInput(textEditingController.text),
), ),
@ -160,14 +160,14 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton( TextButton(
child: Text( child: Text(
L10n.of(context)!.skip, L10n.of(context).skip,
), ),
onPressed: () => widget.request.openSSSS(skip: true), onPressed: () => widget.request.openSSSS(skip: true),
), ),
); );
break; break;
case KeyVerificationState.askAccept: case KeyVerificationState.askAccept:
title = Text(L10n.of(context)!.newVerificationRequest); title = Text(L10n.of(context).newVerificationRequest);
body = Column( body = Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -179,7 +179,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
L10n.of(context)!.askVerificationRequest(displayName), L10n.of(context).askVerificationRequest(displayName),
), ),
], ],
); );
@ -187,7 +187,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
TextButton.icon( TextButton.icon(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
style: TextButton.styleFrom(foregroundColor: Colors.red), style: TextButton.styleFrom(foregroundColor: Colors.red),
label: Text(L10n.of(context)!.reject), label: Text(L10n.of(context).reject),
onPressed: () => widget.request onPressed: () => widget.request
.rejectVerification() .rejectVerification()
.then((_) => Navigator.of(context, rootNavigator: false).pop()), .then((_) => Navigator.of(context, rootNavigator: false).pop()),
@ -196,7 +196,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton.icon( TextButton.icon(
icon: const Icon(Icons.check), icon: const Icon(Icons.check),
label: Text(L10n.of(context)!.accept), label: Text(L10n.of(context).accept),
onPressed: () => widget.request.acceptVerification(), onPressed: () => widget.request.acceptVerification(),
), ),
); );
@ -222,7 +222,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
L10n.of(context)!.waitingPartnerAcceptRequest, L10n.of(context).waitingPartnerAcceptRequest,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
], ],
@ -231,7 +231,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton.icon( TextButton.icon(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
label: Text(L10n.of(context)!.cancel), label: Text(L10n.of(context).cancel),
onPressed: () => widget.request.cancel(), onPressed: () => widget.request.cancel(),
), ),
); );
@ -244,7 +244,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
if (widget.request.sasTypes.contains('emoji')) { if (widget.request.sasTypes.contains('emoji')) {
title = Text( title = Text(
L10n.of(context)!.compareEmojiMatch, L10n.of(context).compareEmojiMatch,
maxLines: 1, maxLines: 1,
style: const TextStyle(fontSize: 16), style: const TextStyle(fontSize: 16),
); );
@ -254,7 +254,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
.toList(), .toList(),
); );
} else { } else {
title = Text(L10n.of(context)!.compareNumbersMatch); title = Text(L10n.of(context).compareNumbersMatch);
final numbers = widget.request.sasNumbers; final numbers = widget.request.sasNumbers;
final numbstr = '${numbers[0]}-${numbers[1]}-${numbers[2]}'; final numbstr = '${numbers[0]}-${numbers[1]}-${numbers[2]}';
compareWidget = compareWidget =
@ -275,22 +275,22 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: Colors.red, foregroundColor: Colors.red,
), ),
label: Text(L10n.of(context)!.theyDontMatch), label: Text(L10n.of(context).theyDontMatch),
onPressed: () => widget.request.rejectSas(), onPressed: () => widget.request.rejectSas(),
), ),
); );
buttons.add( buttons.add(
TextButton.icon( TextButton.icon(
icon: const Icon(Icons.check_outlined), icon: const Icon(Icons.check_outlined),
label: Text(L10n.of(context)!.theyMatch), label: Text(L10n.of(context).theyMatch),
onPressed: () => widget.request.acceptSas(), onPressed: () => widget.request.acceptSas(),
), ),
); );
break; break;
case KeyVerificationState.waitingSas: case KeyVerificationState.waitingSas:
final acceptText = widget.request.sasTypes.contains('emoji') final acceptText = widget.request.sasTypes.contains('emoji')
? L10n.of(context)!.waitingPartnerEmoji ? L10n.of(context).waitingPartnerEmoji
: L10n.of(context)!.waitingPartnerNumbers; : L10n.of(context).waitingPartnerNumbers;
body = Column( body = Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
@ -314,7 +314,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
L10n.of(context)!.verifySuccess, L10n.of(context).verifySuccess,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
], ],
@ -322,7 +322,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton( TextButton(
child: Text( child: Text(
L10n.of(context)!.close, L10n.of(context).close,
), ),
onPressed: () => Navigator.of(context, rootNavigator: false).pop(), onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
), ),
@ -345,7 +345,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
buttons.add( buttons.add(
TextButton( TextButton(
child: Text( child: Text(
L10n.of(context)!.close, L10n.of(context).close,
), ),
onPressed: () => Navigator.of(context, rootNavigator: false).pop(), onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
), ),

View file

@ -33,12 +33,12 @@ class LoginController extends State<Login> {
void login() async { void login() async {
final matrix = Matrix.of(context); final matrix = Matrix.of(context);
if (usernameController.text.isEmpty) { if (usernameController.text.isEmpty) {
setState(() => usernameError = L10n.of(context)!.pleaseEnterYourUsername); setState(() => usernameError = L10n.of(context).pleaseEnterYourUsername);
} else { } else {
setState(() => usernameError = null); setState(() => usernameError = null);
} }
if (passwordController.text.isEmpty) { if (passwordController.text.isEmpty) {
setState(() => passwordError = L10n.of(context)!.pleaseEnterYourPassword); setState(() => passwordError = L10n.of(context).pleaseEnterYourPassword);
} else { } else {
setState(() => passwordError = null); setState(() => passwordError = null);
} }
@ -128,10 +128,9 @@ class LoginController extends State<Login> {
final dialogResult = await showOkCancelAlertDialog( final dialogResult = await showOkCancelAlertDialog(
context: context, context: context,
useRootNavigator: false, useRootNavigator: false,
message: message: L10n.of(context).noMatrixServer(newDomain, oldHomeserver!),
L10n.of(context)!.noMatrixServer(newDomain, oldHomeserver!), okLabel: L10n.of(context).ok,
okLabel: L10n.of(context)!.ok, cancelLabel: L10n.of(context).cancel,
cancelLabel: L10n.of(context)!.cancel,
); );
if (dialogResult == OkCancelResult.ok) { if (dialogResult == OkCancelResult.ok) {
if (mounted) setState(() => usernameError = null); if (mounted) setState(() => usernameError = null);
@ -159,16 +158,16 @@ class LoginController extends State<Login> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.passwordForgotten, title: L10n.of(context).passwordForgotten,
message: L10n.of(context)!.enterAnEmailAddress, message: L10n.of(context).enterAnEmailAddress,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
textFields: [ textFields: [
DialogTextField( DialogTextField(
initialText: initialText:
usernameController.text.isEmail ? usernameController.text : '', usernameController.text.isEmail ? usernameController.text : '',
hintText: L10n.of(context)!.enterAnEmailAddress, hintText: L10n.of(context).enterAnEmailAddress,
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
), ),
], ],
@ -188,10 +187,10 @@ class LoginController extends State<Login> {
final password = await showTextInputDialog( final password = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.passwordForgotten, title: L10n.of(context).passwordForgotten,
message: L10n.of(context)!.chooseAStrongPassword, message: L10n.of(context).chooseAStrongPassword,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
textFields: [ textFields: [
const DialogTextField( const DialogTextField(
@ -206,9 +205,9 @@ class LoginController extends State<Login> {
final ok = await showOkAlertDialog( final ok = await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.weSentYouAnEmail, title: L10n.of(context).weSentYouAnEmail,
message: L10n.of(context)!.pleaseClickOnLink, message: L10n.of(context).pleaseClickOnLink,
okLabel: L10n.of(context)!.iHaveClickedOnLink, okLabel: L10n.of(context).iHaveClickedOnLink,
fullyCapitalizedForMaterial: false, fullyCapitalizedForMaterial: false,
); );
if (ok != OkCancelResult.ok) return; if (ok != OkCancelResult.ok) return;
@ -233,7 +232,7 @@ class LoginController extends State<Login> {
); );
if (success.error == null) { if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.passwordHasBeenChanged)), SnackBar(content: Text(L10n.of(context).passwordHasBeenChanged)),
); );
usernameController.text = input.single; usernameController.text = input.single;
passwordController.text = password.single; passwordController.text = password.single;

View file

@ -20,7 +20,7 @@ class LoginView extends StatelessWidget {
.homeserver .homeserver
.toString() .toString()
.replaceFirst('https://', ''); .replaceFirst('https://', '');
final title = L10n.of(context)!.logInTo(homeserver); final title = L10n.of(context).logInTo(homeserver);
final titleParts = title.split(homeserver); final titleParts = title.split(homeserver);
return LoginScaffold( return LoginScaffold(
@ -68,7 +68,7 @@ class LoginView extends StatelessWidget {
errorText: controller.usernameError, errorText: controller.usernameError,
errorStyle: const TextStyle(color: Colors.orange), errorStyle: const TextStyle(color: Colors.orange),
hintText: '@username:localpart', hintText: '@username:localpart',
labelText: L10n.of(context)!.emailOrUsername, labelText: L10n.of(context).emailOrUsername,
), ),
), ),
), ),
@ -98,7 +98,7 @@ class LoginView extends StatelessWidget {
), ),
), ),
hintText: '******', 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, onPressed: controller.loading ? null : controller.login,
child: controller.loading child: controller.loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Text(L10n.of(context)!.login), : Text(L10n.of(context).login),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -126,7 +126,7 @@ class LoginView extends StatelessWidget {
style: TextButton.styleFrom( style: TextButton.styleFrom(
foregroundColor: theme.colorScheme.error, foregroundColor: theme.colorScheme.error,
), ),
child: Text(L10n.of(context)!.passwordForgotten), child: Text(L10n.of(context).passwordForgotten),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),

View file

@ -26,7 +26,7 @@ class NewGroupView extends StatelessWidget {
onPressed: controller.loading ? null : Navigator.of(context).pop, onPressed: controller.loading ? null : Navigator.of(context).pop,
), ),
), ),
title: Text(L10n.of(context)!.createGroup), title: Text(L10n.of(context).createGroup),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: Column( child: Column(
@ -61,7 +61,7 @@ class NewGroupView extends StatelessWidget {
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.people_outlined), 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( SwitchListTile.adaptive(
contentPadding: const EdgeInsets.symmetric(horizontal: 32), contentPadding: const EdgeInsets.symmetric(horizontal: 32),
secondary: const Icon(Icons.public_outlined), secondary: const Icon(Icons.public_outlined),
title: Text(L10n.of(context)!.groupIsPublic), title: Text(L10n.of(context).groupIsPublic),
value: controller.publicGroup, value: controller.publicGroup,
onChanged: controller.loading ? null : controller.setPublicGroup, onChanged: controller.loading ? null : controller.setPublicGroup,
), ),
@ -80,7 +80,7 @@ class NewGroupView extends StatelessWidget {
contentPadding: contentPadding:
const EdgeInsets.symmetric(horizontal: 32), const EdgeInsets.symmetric(horizontal: 32),
secondary: const Icon(Icons.search_outlined), secondary: const Icon(Icons.search_outlined),
title: Text(L10n.of(context)!.groupCanBeFoundViaSearch), title: Text(L10n.of(context).groupCanBeFoundViaSearch),
value: controller.groupCanBeFound, value: controller.groupCanBeFound,
onChanged: controller.loading onChanged: controller.loading
? null ? null
@ -95,7 +95,7 @@ class NewGroupView extends StatelessWidget {
color: theme.colorScheme.onSurface, color: theme.colorScheme.onSurface,
), ),
title: Text( title: Text(
L10n.of(context)!.enableEncryption, L10n.of(context).enableEncryption,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.onSurface, color: theme.colorScheme.onSurface,
), ),
@ -112,7 +112,7 @@ class NewGroupView extends StatelessWidget {
controller.loading ? null : controller.submitAction, controller.loading ? null : controller.submitAction,
child: controller.loading child: controller.loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Text(L10n.of(context)!.createGroupAndInviteUsers), : Text(L10n.of(context).createGroupAndInviteUsers),
), ),
), ),
), ),

View file

@ -74,7 +74,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
L10n.of(context)!.unsupportedAndroidVersionLong, L10n.of(context).unsupportedAndroidVersionLong,
), ),
), ),
); );
@ -94,7 +94,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
ClipboardData(text: Matrix.of(context).client.userID!), ClipboardData(text: Matrix.of(context).client.userID!),
); );
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.copiedToClipboard)), SnackBar(content: Text(L10n.of(context).copiedToClipboard)),
); );
} }

View file

@ -29,13 +29,13 @@ class NewPrivateChatView extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
scrolledUnderElevation: 0, scrolledUnderElevation: 0,
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.newChat), title: Text(L10n.of(context).newChat),
backgroundColor: theme.scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
actions: [ actions: [
TextButton( TextButton(
onPressed: onPressed:
UrlLauncher(context, AppConfig.startChatTutorial).launchUrl, 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, controller: controller.controller,
onChanged: controller.searchUsers, onChanged: controller.searchUsers,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.searchForUsers, hintText: L10n.of(context).searchForUsers,
filled: true, filled: true,
fillColor: theme.colorScheme.secondaryContainer, fillColor: theme.colorScheme.secondaryContainer,
border: OutlineInputBorder( border: OutlineInputBorder(
@ -110,7 +110,7 @@ class NewPrivateChatView extends StatelessWidget {
TextSpan( TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: L10n.of(context)!.yourGlobalUserIdIs, text: L10n.of(context).yourGlobalUserIdIs,
), ),
TextSpan( TextSpan(
text: Matrix.of(context).client.userID, text: Matrix.of(context).client.userID,
@ -133,7 +133,7 @@ class NewPrivateChatView extends StatelessWidget {
foregroundColor: theme.colorScheme.onSecondaryContainer, foregroundColor: theme.colorScheme.onSecondaryContainer,
child: Icon(Icons.adaptive.share_outlined), child: Icon(Icons.adaptive.share_outlined),
), ),
title: Text(L10n.of(context)!.shareInviteLink), title: Text(L10n.of(context).shareInviteLink),
onTap: controller.inviteAction, onTap: controller.inviteAction,
), ),
ListTile( ListTile(
@ -142,7 +142,7 @@ class NewPrivateChatView extends StatelessWidget {
foregroundColor: theme.colorScheme.onTertiaryContainer, foregroundColor: theme.colorScheme.onTertiaryContainer,
child: const Icon(Icons.group_add_outlined), child: const Icon(Icons.group_add_outlined),
), ),
title: Text(L10n.of(context)!.createGroup), title: Text(L10n.of(context).createGroup),
onTap: () => context.go('/rooms/newgroup'), onTap: () => context.go('/rooms/newgroup'),
), ),
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
@ -152,7 +152,7 @@ class NewPrivateChatView extends StatelessWidget {
foregroundColor: theme.colorScheme.onPrimaryContainer, foregroundColor: theme.colorScheme.onPrimaryContainer,
child: const Icon(Icons.qr_code_scanner_outlined), child: const Icon(Icons.qr_code_scanner_outlined),
), ),
title: Text(L10n.of(context)!.scanQrCode), title: Text(L10n.of(context).scanQrCode),
onTap: controller.openScannerAction, onTap: controller.openScannerAction,
), ),
Center( Center(
@ -207,7 +207,7 @@ class NewPrivateChatView extends StatelessWidget {
OutlinedButton.icon( OutlinedButton.icon(
onPressed: controller.searchUsers, onPressed: controller.searchUsers,
icon: const Icon(Icons.refresh_outlined), 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(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Text( child: Text(
L10n.of(context)!.noUsersFoundWithQuery( L10n.of(context).noUsersFoundWithQuery(
controller.controller.text, controller.controller.text,
), ),
style: TextStyle( style: TextStyle(

View file

@ -35,9 +35,9 @@ class QrScannerModalState extends State<QrScannerModal> {
leading: IconButton( leading: IconButton(
icon: const Icon(Icons.close_outlined), icon: const Icon(Icons.close_outlined),
onPressed: Navigator.of(context).pop, 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( body: Stack(
children: [ children: [

View file

@ -52,7 +52,7 @@ class NewSpaceController extends State<NewSpace> {
}); });
if (nameController.text.isEmpty) { if (nameController.text.isEmpty) {
setState(() { setState(() {
nameError = L10n.of(context)!.pleaseChoose; nameError = L10n.of(context).pleaseChoose;
}); });
return; return;
} }

View file

@ -16,7 +16,7 @@ class NewSpaceView extends StatelessWidget {
final avatar = controller.avatar; final avatar = controller.avatar;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.createNewSpace), title: Text(L10n.of(context).createNewSpace),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: Column( child: Column(
@ -51,7 +51,7 @@ class NewSpaceView extends StatelessWidget {
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.people_outlined), prefixIcon: const Icon(Icons.people_outlined),
labelText: L10n.of(context)!.spaceName, labelText: L10n.of(context).spaceName,
errorText: controller.nameError, errorText: controller.nameError,
), ),
), ),
@ -59,7 +59,7 @@ class NewSpaceView extends StatelessWidget {
const SizedBox(height: 16), const SizedBox(height: 16),
SwitchListTile.adaptive( SwitchListTile.adaptive(
contentPadding: const EdgeInsets.symmetric(horizontal: 32), contentPadding: const EdgeInsets.symmetric(horizontal: 32),
title: Text(L10n.of(context)!.spaceIsPublic), title: Text(L10n.of(context).spaceIsPublic),
value: controller.publicGroup, value: controller.publicGroup,
onChanged: controller.setPublicGroup, onChanged: controller.setPublicGroup,
), ),
@ -69,7 +69,7 @@ class NewSpaceView extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 16.0), padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Icon(Icons.info_outlined), child: Icon(Icons.info_outlined),
), ),
subtitle: Text(L10n.of(context)!.newSpaceDescription), subtitle: Text(L10n.of(context).newSpaceDescription),
), ),
Padding( Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@ -80,7 +80,7 @@ class NewSpaceView extends StatelessWidget {
controller.loading ? null : controller.submitAction, controller.loading ? null : controller.submitAction,
child: controller.loading child: controller.loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Text(L10n.of(context)!.createNewSpace), : Text(L10n.of(context).createNewSpace),
), ),
), ),
), ),

View file

@ -36,9 +36,9 @@ class SettingsController extends State<Settings> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.editDisplayname, title: L10n.of(context).editDisplayname,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
initialText: profile?.displayName ?? initialText: profile?.displayName ??
@ -63,11 +63,11 @@ class SettingsController extends State<Settings> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSureYouWantToLogout, title: L10n.of(context).areYouSureYouWantToLogout,
message: L10n.of(context)!.noBackupWarning, message: L10n.of(context).noBackupWarning,
isDestructiveAction: noBackup, isDestructiveAction: noBackup,
okLabel: L10n.of(context)!.logout, okLabel: L10n.of(context).logout,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
) == ) ==
OkCancelResult.cancel) { OkCancelResult.cancel) {
return; return;
@ -85,19 +85,19 @@ class SettingsController extends State<Settings> {
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
SheetAction( SheetAction(
key: AvatarAction.camera, key: AvatarAction.camera,
label: L10n.of(context)!.openCamera, label: L10n.of(context).openCamera,
isDefaultAction: true, isDefaultAction: true,
icon: Icons.camera_alt_outlined, icon: Icons.camera_alt_outlined,
), ),
SheetAction( SheetAction(
key: AvatarAction.file, key: AvatarAction.file,
label: L10n.of(context)!.openGallery, label: L10n.of(context).openGallery,
icon: Icons.photo_outlined, icon: Icons.photo_outlined,
), ),
if (profile?.avatarUrl != null) if (profile?.avatarUrl != null)
SheetAction( SheetAction(
key: AvatarAction.remove, key: AvatarAction.remove,
label: L10n.of(context)!.removeYourAvatar, label: L10n.of(context).removeYourAvatar,
isDestructiveAction: true, isDestructiveAction: true,
icon: Icons.delete_outlined, icon: Icons.delete_outlined,
), ),
@ -106,7 +106,7 @@ class SettingsController extends State<Settings> {
? actions.single.key ? actions.single.key
: await showModalActionSheet<AvatarAction>( : await showModalActionSheet<AvatarAction>(
context: context, context: context,
title: L10n.of(context)!.changeYourAvatar, title: L10n.of(context).changeYourAvatar,
actions: actions, actions: actions,
); );
if (action == null) return; if (action == null) return;
@ -189,9 +189,9 @@ class SettingsController extends State<Settings> {
if (showChatBackupBanner != true) { if (showChatBackupBanner != true) {
showOkAlertDialog( showOkAlertDialog(
context: context, context: context,
title: L10n.of(context)!.chatBackup, title: L10n.of(context).chatBackup,
message: L10n.of(context)!.onlineKeyBackupEnabled, message: L10n.of(context).onlineKeyBackupEnabled,
okLabel: L10n.of(context)!.close, okLabel: L10n.of(context).close,
); );
return; return;
} }

View file

@ -28,7 +28,7 @@ class SettingsView extends StatelessWidget {
onPressed: () => context.go('/rooms'), onPressed: () => context.go('/rooms'),
), ),
), ),
title: Text(L10n.of(context)!.settings), title: Text(L10n.of(context).settings),
), ),
body: ListTileTheme( body: ListTileTheme(
iconColor: theme.colorScheme.onSurface, iconColor: theme.colorScheme.onSurface,
@ -40,7 +40,7 @@ class SettingsView extends StatelessWidget {
builder: (context, snapshot) { builder: (context, snapshot) {
final profile = snapshot.data; final profile = snapshot.data;
final mxid = final mxid =
Matrix.of(context).client.userID ?? L10n.of(context)!.user; Matrix.of(context).client.userID ?? L10n.of(context).user;
final displayname = final displayname =
profile?.displayName ?? mxid.localpart ?? mxid; profile?.displayName ?? mxid.localpart ?? mxid;
return Row( return Row(
@ -118,7 +118,7 @@ class SettingsView extends StatelessWidget {
if (showChatBackupBanner == null) if (showChatBackupBanner == null)
ListTile( ListTile(
leading: const Icon(Icons.backup_outlined), leading: const Icon(Icons.backup_outlined),
title: Text(L10n.of(context)!.chatBackup), title: Text(L10n.of(context).chatBackup),
trailing: const CircularProgressIndicator.adaptive(), trailing: const CircularProgressIndicator.adaptive(),
) )
else else
@ -126,7 +126,7 @@ class SettingsView extends StatelessWidget {
controlAffinity: ListTileControlAffinity.trailing, controlAffinity: ListTileControlAffinity.trailing,
value: controller.showChatBackupBanner == false, value: controller.showChatBackupBanner == false,
secondary: const Icon(Icons.backup_outlined), secondary: const Icon(Icons.backup_outlined),
title: Text(L10n.of(context)!.chatBackup), title: Text(L10n.of(context).chatBackup),
onChanged: controller.firstRunBootstrapAction, onChanged: controller.firstRunBootstrapAction,
), ),
Divider( Divider(
@ -134,49 +134,49 @@ class SettingsView extends StatelessWidget {
), ),
ListTile( ListTile(
leading: const Icon(Icons.format_paint_outlined), 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'), onTap: () => context.go('/rooms/settings/style'),
), ),
ListTile( ListTile(
leading: const Icon(Icons.notifications_outlined), leading: const Icon(Icons.notifications_outlined),
title: Text(L10n.of(context)!.notifications), title: Text(L10n.of(context).notifications),
onTap: () => context.go('/rooms/settings/notifications'), onTap: () => context.go('/rooms/settings/notifications'),
), ),
ListTile( ListTile(
leading: const Icon(Icons.devices_outlined), leading: const Icon(Icons.devices_outlined),
title: Text(L10n.of(context)!.devices), title: Text(L10n.of(context).devices),
onTap: () => context.go('/rooms/settings/devices'), onTap: () => context.go('/rooms/settings/devices'),
), ),
ListTile( ListTile(
leading: const Icon(Icons.forum_outlined), leading: const Icon(Icons.forum_outlined),
title: Text(L10n.of(context)!.chat), title: Text(L10n.of(context).chat),
onTap: () => context.go('/rooms/settings/chat'), onTap: () => context.go('/rooms/settings/chat'),
), ),
ListTile( ListTile(
leading: const Icon(Icons.shield_outlined), leading: const Icon(Icons.shield_outlined),
title: Text(L10n.of(context)!.security), title: Text(L10n.of(context).security),
onTap: () => context.go('/rooms/settings/security'), onTap: () => context.go('/rooms/settings/security'),
), ),
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
leading: const Icon(Icons.help_outline_outlined), leading: const Icon(Icons.help_outline_outlined),
title: Text(L10n.of(context)!.help), title: Text(L10n.of(context).help),
onTap: () => launchUrlString(AppConfig.supportUrl), onTap: () => launchUrlString(AppConfig.supportUrl),
), ),
ListTile( ListTile(
leading: const Icon(Icons.shield_sharp), leading: const Icon(Icons.shield_sharp),
title: Text(L10n.of(context)!.privacy), title: Text(L10n.of(context).privacy),
onTap: () => launchUrlString(AppConfig.privacyUrl), onTap: () => launchUrlString(AppConfig.privacyUrl),
), ),
ListTile( ListTile(
leading: const Icon(Icons.info_outline_rounded), leading: const Icon(Icons.info_outline_rounded),
title: Text(L10n.of(context)!.about), title: Text(L10n.of(context).about),
onTap: () => PlatformInfos.showDialog(context), onTap: () => PlatformInfos.showDialog(context),
), ),
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
leading: const Icon(Icons.logout_outlined), leading: const Icon(Icons.logout_outlined),
title: Text(L10n.of(context)!.logout), title: Text(L10n.of(context).logout),
onTap: controller.logoutAction, onTap: controller.logoutAction,
), ),
], ],

View file

@ -22,12 +22,12 @@ class Settings3PidController extends State<Settings3Pid> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.enterAnEmailAddress, title: L10n.of(context).enterAnEmailAddress,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
hintText: L10n.of(context)!.enterAnEmailAddress, hintText: L10n.of(context).enterAnEmailAddress,
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
), ),
], ],
@ -46,9 +46,9 @@ class Settings3PidController extends State<Settings3Pid> {
final ok = await showOkAlertDialog( final ok = await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.weSentYouAnEmail, title: L10n.of(context).weSentYouAnEmail,
message: L10n.of(context)!.pleaseClickOnLink, message: L10n.of(context).pleaseClickOnLink,
okLabel: L10n.of(context)!.iHaveClickedOnLink, okLabel: L10n.of(context).iHaveClickedOnLink,
); );
if (ok != OkCancelResult.ok) return; if (ok != OkCancelResult.ok) return;
final success = await showFutureLoadingDialog( final success = await showFutureLoadingDialog(
@ -71,9 +71,9 @@ class Settings3PidController extends State<Settings3Pid> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
) != ) !=
OkCancelResult.ok) { OkCancelResult.ok) {
return; return;

View file

@ -20,12 +20,12 @@ class Settings3PidView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.passwordRecovery), title: Text(L10n.of(context).passwordRecovery),
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Icons.add_outlined), icon: const Icon(Icons.add_outlined),
onPressed: controller.add3PidAction, onPressed: controller.add3PidAction,
tooltip: L10n.of(context)!.addEmail, tooltip: L10n.of(context).addEmail,
), ),
], ],
), ),
@ -66,8 +66,8 @@ class Settings3PidView extends StatelessWidget {
), ),
title: Text( title: Text(
identifier.isEmpty identifier.isEmpty
? L10n.of(context)!.noPasswordRecoveryDescription ? L10n.of(context).noPasswordRecoveryDescription
: L10n.of(context)! : L10n.of(context)
.withTheseAddressesRecoveryDescription, .withTheseAddressesRecoveryDescription,
), ),
), ),
@ -83,7 +83,7 @@ class Settings3PidView extends StatelessWidget {
), ),
title: Text(identifier[i].address), title: Text(identifier[i].address),
trailing: IconButton( trailing: IconButton(
tooltip: L10n.of(context)!.delete, tooltip: L10n.of(context).delete,
icon: const Icon(Icons.delete_forever_outlined), icon: const Icon(Icons.delete_forever_outlined),
color: Colors.red, color: Colors.red,
onPressed: () => controller.delete3Pid(identifier[i]), onPressed: () => controller.delete3Pid(identifier[i]),

View file

@ -21,54 +21,54 @@ class SettingsChatView extends StatelessWidget {
final theme = Theme.of(context); final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.chat)), appBar: AppBar(title: Text(L10n.of(context).chat)),
body: ListTileTheme( body: ListTileTheme(
iconColor: theme.textTheme.bodyLarge!.color, iconColor: theme.textTheme.bodyLarge!.color,
child: MaxWidthBody( child: MaxWidthBody(
child: Column( child: Column(
children: [ children: [
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.formattedMessages, title: L10n.of(context).formattedMessages,
subtitle: L10n.of(context)!.formattedMessagesDescription, subtitle: L10n.of(context).formattedMessagesDescription,
onChanged: (b) => AppConfig.renderHtml = b, onChanged: (b) => AppConfig.renderHtml = b,
storeKey: SettingKeys.renderHtml, storeKey: SettingKeys.renderHtml,
defaultValue: AppConfig.renderHtml, defaultValue: AppConfig.renderHtml,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideMemberChangesInPublicChats, title: L10n.of(context).hideMemberChangesInPublicChats,
subtitle: L10n.of(context)!.hideMemberChangesInPublicChatsBody, subtitle: L10n.of(context).hideMemberChangesInPublicChatsBody,
onChanged: (b) => AppConfig.hideUnimportantStateEvents = b, onChanged: (b) => AppConfig.hideUnimportantStateEvents = b,
storeKey: SettingKeys.hideUnimportantStateEvents, storeKey: SettingKeys.hideUnimportantStateEvents,
defaultValue: AppConfig.hideUnimportantStateEvents, defaultValue: AppConfig.hideUnimportantStateEvents,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideRedactedMessages, title: L10n.of(context).hideRedactedMessages,
subtitle: L10n.of(context)!.hideRedactedMessagesBody, subtitle: L10n.of(context).hideRedactedMessagesBody,
onChanged: (b) => AppConfig.hideRedactedEvents = b, onChanged: (b) => AppConfig.hideRedactedEvents = b,
storeKey: SettingKeys.hideRedactedEvents, storeKey: SettingKeys.hideRedactedEvents,
defaultValue: AppConfig.hideRedactedEvents, defaultValue: AppConfig.hideRedactedEvents,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.hideInvalidOrUnknownMessageFormats, title: L10n.of(context).hideInvalidOrUnknownMessageFormats,
onChanged: (b) => AppConfig.hideUnknownEvents = b, onChanged: (b) => AppConfig.hideUnknownEvents = b,
storeKey: SettingKeys.hideUnknownEvents, storeKey: SettingKeys.hideUnknownEvents,
defaultValue: AppConfig.hideUnknownEvents, defaultValue: AppConfig.hideUnknownEvents,
), ),
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.autoplayImages, title: L10n.of(context).autoplayImages,
onChanged: (b) => AppConfig.autoplayImages = b, onChanged: (b) => AppConfig.autoplayImages = b,
storeKey: SettingKeys.autoplayImages, storeKey: SettingKeys.autoplayImages,
defaultValue: AppConfig.autoplayImages, defaultValue: AppConfig.autoplayImages,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.sendOnEnter, title: L10n.of(context).sendOnEnter,
onChanged: (b) => AppConfig.sendOnEnter = b, onChanged: (b) => AppConfig.sendOnEnter = b,
storeKey: SettingKeys.sendOnEnter, storeKey: SettingKeys.sendOnEnter,
defaultValue: AppConfig.sendOnEnter ?? !PlatformInfos.isMobile, defaultValue: AppConfig.sendOnEnter ?? !PlatformInfos.isMobile,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.swipeRightToLeftToReply, title: L10n.of(context).swipeRightToLeftToReply,
onChanged: (b) => AppConfig.swipeRightToLeftToReply = b, onChanged: (b) => AppConfig.swipeRightToLeftToReply = b,
storeKey: SettingKeys.swipeRightToLeftToReply, storeKey: SettingKeys.swipeRightToLeftToReply,
defaultValue: AppConfig.swipeRightToLeftToReply, defaultValue: AppConfig.swipeRightToLeftToReply,
@ -76,7 +76,7 @@ class SettingsChatView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.customEmojisAndStickers, L10n.of(context).customEmojisAndStickers,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -84,8 +84,8 @@ class SettingsChatView extends StatelessWidget {
), ),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.customEmojisAndStickers), title: Text(L10n.of(context).customEmojisAndStickers),
subtitle: Text(L10n.of(context)!.customEmojisAndStickersBody), subtitle: Text(L10n.of(context).customEmojisAndStickersBody),
onTap: () => context.go('/rooms/settings/chat/emotes'), onTap: () => context.go('/rooms/settings/chat/emotes'),
trailing: const Padding( trailing: const Padding(
padding: EdgeInsets.all(16.0), padding: EdgeInsets.all(16.0),
@ -95,7 +95,7 @@ class SettingsChatView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.calls, L10n.of(context).calls,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -103,7 +103,7 @@ class SettingsChatView extends StatelessWidget {
), ),
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.experimentalVideoCalls, title: L10n.of(context).experimentalVideoCalls,
onChanged: (b) { onChanged: (b) {
AppConfig.experimentalVoip = b; AppConfig.experimentalVoip = b;
Matrix.of(context).createVoipPlugin(); Matrix.of(context).createVoipPlugin();
@ -114,7 +114,7 @@ class SettingsChatView extends StatelessWidget {
), ),
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
ListTile( ListTile(
title: Text(L10n.of(context)!.callingPermissions), title: Text(L10n.of(context).callingPermissions),
onTap: () => onTap: () =>
CallKeepManager().checkoutPhoneAccountSetting(context), CallKeepManager().checkoutPhoneAccountSetting(context),
trailing: const Padding( trailing: const Padding(

View file

@ -44,7 +44,7 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text(L10n.of(context)!.importEmojis), title: Text(L10n.of(context).importEmojis),
content: _loading content: _loading
? Center( ? Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
@ -73,7 +73,7 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
actions: [ actions: [
TextButton( TextButton(
onPressed: _loading ? null : Navigator.of(context).pop, onPressed: _loading ? null : Navigator.of(context).pop,
child: Text(L10n.of(context)!.cancel), child: Text(L10n.of(context).cancel),
), ),
TextButton( TextButton(
onPressed: _loading onPressed: _loading
@ -81,7 +81,7 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
: _importMap.isNotEmpty : _importMap.isNotEmpty
? _addEmotePack ? _addEmotePack
: null, : null,
child: Text(L10n.of(context)!.importNow), child: Text(L10n.of(context).importNow),
), ),
], ],
); );
@ -121,10 +121,10 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
final result = await showOkCancelAlertDialog( final result = await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.emoteExists, title: L10n.of(context).emoteExists,
message: imageCode, message: imageCode,
cancelLabel: L10n.of(context)!.replace, cancelLabel: L10n.of(context).replace,
okLabel: L10n.of(context)!.skip, okLabel: L10n.of(context).skip,
); );
completer.complete(result); completer.complete(result);
}); });
@ -242,7 +242,7 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> {
IconButton( IconButton(
onPressed: widget.onRemove, onPressed: widget.onRemove,
icon: const Icon(Icons.remove_circle), icon: const Icon(Icons.remove_circle),
tooltip: L10n.of(context)!.remove, tooltip: L10n.of(context).remove,
), ),
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: hasErrorNotifier, valueListenable: hasErrorNotifier,
@ -278,7 +278,7 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> {
minLines: 1, minLines: 1,
maxLines: 1, maxLines: 1,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.emoteShortcode, hintText: L10n.of(context).emoteShortcode,
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
@ -329,7 +329,7 @@ class _ImageFileError extends StatelessWidget {
children: [ children: [
const Icon(Icons.error), const Icon(Icons.error),
Text( Text(
L10n.of(context)!.notAnImage, L10n.of(context).notAnImage,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: theme.textTheme.labelSmall, style: theme.textTheme.labelSmall,
), ),

View file

@ -139,8 +139,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
showOkAlertDialog( showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteExists, message: L10n.of(context).emoteExists,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }
@ -149,8 +149,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
showOkAlertDialog( showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteInvalid, message: L10n.of(context).emoteInvalid,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }
@ -185,8 +185,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
await showOkAlertDialog( await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteWarnNeedToPick, message: L10n.of(context).emoteWarnNeedToPick,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }
@ -195,8 +195,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
await showOkAlertDialog( await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteExists, message: L10n.of(context).emoteExists,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }
@ -204,8 +204,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
await showOkAlertDialog( await showOkAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
message: L10n.of(context)!.emoteInvalid, message: L10n.of(context).emoteInvalid,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
); );
return; return;
} }

View file

@ -26,7 +26,7 @@ class EmotesSettingsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.customEmojisAndStickers), title: Text(L10n.of(context).customEmojisAndStickers),
actions: [ actions: [
PopupMenuButton<PopupMenuEmojiActions>( PopupMenuButton<PopupMenuEmojiActions>(
onSelected: (value) { onSelected: (value) {
@ -43,11 +43,11 @@ class EmotesSettingsView extends StatelessWidget {
itemBuilder: (context) => [ itemBuilder: (context) => [
PopupMenuItem( PopupMenuItem(
value: PopupMenuEmojiActions.import, value: PopupMenuEmojiActions.import,
child: Text(L10n.of(context)!.importFromZipFile), child: Text(L10n.of(context).importFromZipFile),
), ),
PopupMenuItem( PopupMenuItem(
value: PopupMenuEmojiActions.export, 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, minLines: 1,
maxLines: 1, maxLines: 1,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.emoteShortcode, hintText: L10n.of(context).emoteShortcode,
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
prefixStyle: TextStyle( prefixStyle: TextStyle(
@ -114,7 +114,7 @@ class EmotesSettingsView extends StatelessWidget {
), ),
if (controller.room != null) if (controller.room != null)
SwitchListTile.adaptive( SwitchListTile.adaptive(
title: Text(L10n.of(context)!.enableEmotesGlobally), title: Text(L10n.of(context).enableEmotesGlobally),
value: controller.isGloballyActive(client), value: controller.isGloballyActive(client),
onChanged: controller.setIsGloballyActive, onChanged: controller.setIsGloballyActive,
), ),
@ -125,7 +125,7 @@ class EmotesSettingsView extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: Text( child: Text(
L10n.of(context)!.noEmotesFound, L10n.of(context).noEmotesFound,
style: const TextStyle(fontSize: 20), style: const TextStyle(fontSize: 20),
), ),
), ),
@ -186,7 +186,7 @@ class EmotesSettingsView extends StatelessWidget {
minLines: 1, minLines: 1,
maxLines: 1, maxLines: 1,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.emoteShortcode, hintText: L10n.of(context).emoteShortcode,
prefixText: ': ', prefixText: ': ',
suffixText: ':', suffixText: ':',
prefixStyle: TextStyle( prefixStyle: TextStyle(
@ -269,7 +269,7 @@ class _ImagePickerState extends State<_ImagePicker> {
if (widget.controller.value == null) { if (widget.controller.value == null) {
return ElevatedButton( return ElevatedButton(
onPressed: () => widget.onPressed(widget.controller), onPressed: () => widget.onPressed(widget.controller),
child: Text(L10n.of(context)!.pickImage), child: Text(L10n.of(context).pickImage),
); );
} else { } else {
return _EmoteImage(widget.controller.value!.url); return _EmoteImage(widget.controller.value!.url);

View file

@ -35,7 +35,7 @@ class SettingsIgnoreListController extends State<SettingsIgnoreList> {
if (userId.isEmpty) return; if (userId.isEmpty) return;
if (!userId.isValidMatrixId || userId.sigil != '@') { if (!userId.isValidMatrixId || userId.sigil != '@') {
setState(() { setState(() {
errorText = L10n.of(context)!.invalidInput; errorText = L10n.of(context).invalidInput;
}); });
return; return;
} }

View file

@ -22,7 +22,7 @@ class SettingsIgnoreListView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.blockedUsers), title: Text(L10n.of(context).blockedUsers),
), ),
body: MaxWidthBody( body: MaxWidthBody(
withScrolling: false, withScrolling: false,
@ -43,9 +43,9 @@ class SettingsIgnoreListView extends StatelessWidget {
errorText: controller.errorText, errorText: controller.errorText,
hintText: '@bad_guy:domain.abc', hintText: '@bad_guy:domain.abc',
floatingLabelBehavior: FloatingLabelBehavior.always, floatingLabelBehavior: FloatingLabelBehavior.always,
labelText: L10n.of(context)!.blockUsername, labelText: L10n.of(context).blockUsername,
suffixIcon: IconButton( suffixIcon: IconButton(
tooltip: L10n.of(context)!.block, tooltip: L10n.of(context).block,
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
onPressed: () => controller.ignoreUser(context), onPressed: () => controller.ignoreUser(context),
), ),
@ -53,7 +53,7 @@ class SettingsIgnoreListView extends StatelessWidget {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
L10n.of(context)!.blockListDescription, L10n.of(context).blockListDescription,
style: const TextStyle(color: Colors.orange), style: const TextStyle(color: Colors.orange),
), ),
], ],
@ -89,7 +89,7 @@ class SettingsIgnoreListView extends StatelessWidget {
subtitle: subtitle:
Text(s.data?.userId ?? client.ignoredUsers[i]), Text(s.data?.userId ?? client.ignoredUsers[i]),
trailing: IconButton( trailing: IconButton(
tooltip: L10n.of(context)!.delete, tooltip: L10n.of(context).delete,
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
onPressed: () => showFutureLoadingDialog( onPressed: () => showFutureLoadingDialog(
context: context, context: context,

View file

@ -18,7 +18,7 @@ class MultipleEmotesSettingsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.emotePacks), title: Text(L10n.of(context).emotePacks),
), ),
body: StreamBuilder( body: StreamBuilder(
stream: room.client.onRoomState.stream stream: room.client.onRoomState.stream

View file

@ -19,37 +19,37 @@ class NotificationSettingsItem {
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.underride, PushRuleKind.underride,
'.m.rule.message', '.m.rule.message',
(c) => L10n.of(c)!.allRooms, (c) => L10n.of(c).allRooms,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.underride, PushRuleKind.underride,
'.m.rule.room_one_to_one', '.m.rule.room_one_to_one',
(c) => L10n.of(c)!.directChats, (c) => L10n.of(c).directChats,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.override, PushRuleKind.override,
'.m.rule.contains_display_name', '.m.rule.contains_display_name',
(c) => L10n.of(c)!.containsDisplayName, (c) => L10n.of(c).containsDisplayName,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.content, PushRuleKind.content,
'.m.rule.contains_user_name', '.m.rule.contains_user_name',
(c) => L10n.of(c)!.containsUserName, (c) => L10n.of(c).containsUserName,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.override, PushRuleKind.override,
'.m.rule.invite_for_me', '.m.rule.invite_for_me',
(c) => L10n.of(c)!.inviteForMe, (c) => L10n.of(c).inviteForMe,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.override, PushRuleKind.override,
'.m.rule.member_event', '.m.rule.member_event',
(c) => L10n.of(c)!.memberChanges, (c) => L10n.of(c).memberChanges,
), ),
NotificationSettingsItem( NotificationSettingsItem(
PushRuleKind.override, PushRuleKind.override,
'.m.rule.suppress_notices', '.m.rule.suppress_notices',
(c) => L10n.of(c)!.botMessages, (c) => L10n.of(c).botMessages,
), ),
]; ];
} }
@ -145,7 +145,7 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
message: '${pusher.appDisplayName} (${pusher.appId})', message: '${pusher.appDisplayName} (${pusher.appId})',
actions: [ actions: [
SheetAction( SheetAction(
label: L10n.of(context)!.delete, label: L10n.of(context).delete,
isDestructiveAction: true, isDestructiveAction: true,
key: true, key: true,
), ),

View file

@ -18,7 +18,7 @@ class SettingsNotificationsView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.notifications), title: Text(L10n.of(context).notifications),
), ),
body: MaxWidthBody( body: MaxWidthBody(
child: StreamBuilder( child: StreamBuilder(
@ -36,7 +36,7 @@ class SettingsNotificationsView extends StatelessWidget {
SwitchListTile.adaptive( SwitchListTile.adaptive(
value: !Matrix.of(context).client.allPushNotificationsMuted, value: !Matrix.of(context).client.allPushNotificationsMuted,
title: Text( title: Text(
L10n.of(context)!.notificationsEnabledForThisAccount, L10n.of(context).notificationsEnabledForThisAccount,
), ),
onChanged: controller.isLoading onChanged: controller.isLoading
? null ? null
@ -45,7 +45,7 @@ class SettingsNotificationsView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.notifyMeFor, L10n.of(context).notifyMeFor,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -68,7 +68,7 @@ class SettingsNotificationsView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.devices, L10n.of(context).devices,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -98,7 +98,7 @@ class SettingsNotificationsView extends StatelessWidget {
return Center( return Center(
child: Padding( child: Padding(
padding: const EdgeInsets.only(bottom: 16.0), padding: const EdgeInsets.only(bottom: 16.0),
child: Text(L10n.of(context)!.noOtherDevicesFound), child: Text(L10n.of(context).noOtherDevicesFound),
), ),
); );
} }

View file

@ -31,20 +31,20 @@ class SettingsPasswordController extends State<SettingsPassword> {
}); });
if (oldPasswordController.text.isEmpty) { if (oldPasswordController.text.isEmpty) {
setState(() { setState(() {
oldPasswordError = L10n.of(context)!.pleaseEnterYourPassword; oldPasswordError = L10n.of(context).pleaseEnterYourPassword;
}); });
return; return;
} }
if (newPassword1Controller.text.isEmpty || if (newPassword1Controller.text.isEmpty ||
newPassword1Controller.text.length < 6) { newPassword1Controller.text.length < 6) {
setState(() { setState(() {
newPassword1Error = L10n.of(context)!.pleaseChooseAStrongPassword; newPassword1Error = L10n.of(context).pleaseChooseAStrongPassword;
}); });
return; return;
} }
if (newPassword1Controller.text != newPassword2Controller.text) { if (newPassword1Controller.text != newPassword2Controller.text) {
setState(() { setState(() {
newPassword2Error = L10n.of(context)!.passwordsDoNotMatch; newPassword2Error = L10n.of(context).passwordsDoNotMatch;
}); });
return; return;
} }
@ -60,7 +60,7 @@ class SettingsPasswordController extends State<SettingsPassword> {
); );
scaffoldMessenger.showSnackBar( scaffoldMessenger.showSnackBar(
SnackBar( SnackBar(
content: Text(L10n.of(context)!.passwordHasBeenChanged), content: Text(L10n.of(context).passwordHasBeenChanged),
), ),
); );
if (mounted) context.pop(); if (mounted) context.pop();

View file

@ -16,7 +16,7 @@ class SettingsPasswordView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.changePassword), title: Text(L10n.of(context).changePassword),
), ),
body: ListTileTheme( body: ListTileTheme(
iconColor: theme.colorScheme.onSurface, iconColor: theme.colorScheme.onSurface,
@ -35,7 +35,7 @@ class SettingsPasswordView extends StatelessWidget {
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.lock_outlined), prefixIcon: const Icon(Icons.lock_outlined),
hintText: '********', hintText: '********',
labelText: L10n.of(context)!.pleaseEnterYourCurrentPassword, labelText: L10n.of(context).pleaseEnterYourCurrentPassword,
errorText: controller.oldPasswordError, errorText: controller.oldPasswordError,
), ),
), ),
@ -48,7 +48,7 @@ class SettingsPasswordView extends StatelessWidget {
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.lock_reset_outlined), prefixIcon: const Icon(Icons.lock_reset_outlined),
hintText: '********', hintText: '********',
labelText: L10n.of(context)!.newPassword, labelText: L10n.of(context).newPassword,
errorText: controller.newPassword1Error, errorText: controller.newPassword1Error,
), ),
), ),
@ -61,7 +61,7 @@ class SettingsPasswordView extends StatelessWidget {
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.repeat_outlined), prefixIcon: const Icon(Icons.repeat_outlined),
hintText: '********', hintText: '********',
labelText: L10n.of(context)!.repeatPassword, labelText: L10n.of(context).repeatPassword,
errorText: controller.newPassword2Error, errorText: controller.newPassword2Error,
), ),
), ),
@ -73,12 +73,12 @@ class SettingsPasswordView extends StatelessWidget {
controller.loading ? null : controller.changePassword, controller.loading ? null : controller.changePassword,
child: controller.loading child: controller.loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Text(L10n.of(context)!.changePassword), : Text(L10n.of(context).changePassword),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
TextButton( TextButton(
child: Text(L10n.of(context)!.passwordRecoverySettings), child: Text(L10n.of(context).passwordRecoverySettings),
onPressed: () => context.go('/rooms/settings/security/3pid'), onPressed: () => context.go('/rooms/settings/security/3pid'),
), ),
], ],

View file

@ -25,9 +25,9 @@ class SettingsSecurityController extends State<SettingsSecurity> {
final newLock = await showTextInputDialog( final newLock = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.pleaseChooseAPasscode, title: L10n.of(context).pleaseChooseAPasscode,
message: L10n.of(context)!.pleaseEnter4Digits, message: L10n.of(context).pleaseEnter4Digits,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [ textFields: [
DialogTextField( DialogTextField(
validator: (text) { validator: (text) {
@ -35,7 +35,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
(text.length == 4 && int.tryParse(text)! >= 0)) { (text.length == 4 && int.tryParse(text)! >= 0)) {
return null; return null;
} }
return L10n.of(context)!.pleaseEnter4Digits; return L10n.of(context).pleaseEnter4Digits;
}, },
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
obscureText: true, obscureText: true,
@ -54,10 +54,10 @@ class SettingsSecurityController extends State<SettingsSecurity> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.warning, title: L10n.of(context).warning,
message: L10n.of(context)!.deactivateAccountWarning, message: L10n.of(context).deactivateAccountWarning,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
isDestructiveAction: true, isDestructiveAction: true,
) == ) ==
OkCancelResult.cancel) { OkCancelResult.cancel) {
@ -67,17 +67,17 @@ class SettingsSecurityController extends State<SettingsSecurity> {
final mxids = await showTextInputDialog( final mxids = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.confirmMatrixId, title: L10n.of(context).confirmMatrixId,
textFields: [ textFields: [
DialogTextField( DialogTextField(
validator: (text) => text == supposedMxid validator: (text) => text == supposedMxid
? null ? null
: L10n.of(context)!.supposedMxid(supposedMxid), : L10n.of(context).supposedMxid(supposedMxid),
), ),
], ],
isDestructiveAction: true, isDestructiveAction: true,
okLabel: L10n.of(context)!.delete, okLabel: L10n.of(context).delete,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
); );
if (mxids == null || mxids.length != 1 || mxids.single != supposedMxid) { if (mxids == null || mxids.length != 1 || mxids.single != supposedMxid) {
return; return;
@ -85,9 +85,9 @@ class SettingsSecurityController extends State<SettingsSecurity> {
final input = await showTextInputDialog( final input = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.pleaseEnterYourPassword, title: L10n.of(context).pleaseEnterYourPassword,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
isDestructiveAction: true, isDestructiveAction: true,
textFields: [ textFields: [
const DialogTextField( const DialogTextField(

View file

@ -21,7 +21,7 @@ class SettingsSecurityView extends StatelessWidget {
final theme = Theme.of(context); final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.security)), appBar: AppBar(title: Text(L10n.of(context).security)),
body: ListTileTheme( body: ListTileTheme(
iconColor: theme.colorScheme.onSurface, iconColor: theme.colorScheme.onSurface,
child: MaxWidthBody( child: MaxWidthBody(
@ -45,7 +45,7 @@ class SettingsSecurityView extends StatelessWidget {
children: [ children: [
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.privacy, L10n.of(context).privacy,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -53,25 +53,25 @@ class SettingsSecurityView extends StatelessWidget {
), ),
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.sendTypingNotifications, title: L10n.of(context).sendTypingNotifications,
subtitle: subtitle:
L10n.of(context)!.sendTypingNotificationsDescription, L10n.of(context).sendTypingNotificationsDescription,
onChanged: (b) => AppConfig.sendTypingNotifications = b, onChanged: (b) => AppConfig.sendTypingNotifications = b,
storeKey: SettingKeys.sendTypingNotifications, storeKey: SettingKeys.sendTypingNotifications,
defaultValue: AppConfig.sendTypingNotifications, defaultValue: AppConfig.sendTypingNotifications,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.sendReadReceipts, title: L10n.of(context).sendReadReceipts,
subtitle: L10n.of(context)!.sendReadReceiptsDescription, subtitle: L10n.of(context).sendReadReceiptsDescription,
onChanged: (b) => AppConfig.sendPublicReadReceipts = b, onChanged: (b) => AppConfig.sendPublicReadReceipts = b,
storeKey: SettingKeys.sendPublicReadReceipts, storeKey: SettingKeys.sendPublicReadReceipts,
defaultValue: AppConfig.sendPublicReadReceipts, defaultValue: AppConfig.sendPublicReadReceipts,
), ),
ListTile( ListTile(
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.blockedUsers), title: Text(L10n.of(context).blockedUsers),
subtitle: Text( subtitle: Text(
L10n.of(context)!.thereAreCountUsersBlocked( L10n.of(context).thereAreCountUsersBlocked(
Matrix.of(context).client.ignoredUsers.length, Matrix.of(context).client.ignoredUsers.length,
), ),
), ),
@ -82,15 +82,15 @@ class SettingsSecurityView extends StatelessWidget {
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
ListTile( ListTile(
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.appLock), title: Text(L10n.of(context).appLock),
subtitle: Text(L10n.of(context)!.appLockDescription), subtitle: Text(L10n.of(context).appLockDescription),
onTap: controller.setAppLockAction, onTap: controller.setAppLockAction,
), ),
}, },
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.account, L10n.of(context).account,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -98,7 +98,7 @@ class SettingsSecurityView extends StatelessWidget {
), ),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.yourPublicKey), title: Text(L10n.of(context).yourPublicKey),
leading: const Icon(Icons.vpn_key_outlined), leading: const Icon(Icons.vpn_key_outlined),
subtitle: SelectableText( subtitle: SelectableText(
Matrix.of(context).client.fingerprintKey.beautified, Matrix.of(context).client.fingerprintKey.beautified,
@ -110,7 +110,7 @@ class SettingsSecurityView extends StatelessWidget {
ListTile( ListTile(
leading: const Icon(Icons.password_outlined), leading: const Icon(Icons.password_outlined),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
title: Text(L10n.of(context)!.changePassword), title: Text(L10n.of(context).changePassword),
onTap: () => onTap: () =>
context.go('/rooms/settings/security/password'), context.go('/rooms/settings/security/password'),
), ),
@ -118,7 +118,7 @@ class SettingsSecurityView extends StatelessWidget {
iconColor: Colors.orange, iconColor: Colors.orange,
leading: const Icon(Icons.delete_sweep_outlined), leading: const Icon(Icons.delete_sweep_outlined),
title: Text( title: Text(
L10n.of(context)!.dehydrate, L10n.of(context).dehydrate,
style: const TextStyle(color: Colors.orange), style: const TextStyle(color: Colors.orange),
), ),
onTap: controller.dehydrateAction, onTap: controller.dehydrateAction,
@ -128,7 +128,7 @@ class SettingsSecurityView extends StatelessWidget {
iconColor: Colors.red, iconColor: Colors.red,
leading: const Icon(Icons.delete_outlined), leading: const Icon(Icons.delete_outlined),
title: Text( title: Text(
L10n.of(context)!.deleteAccount, L10n.of(context).deleteAccount,
style: const TextStyle(color: Colors.red), style: const TextStyle(color: Colors.red),
), ),
onTap: controller.deleteAccountAction, onTap: controller.deleteAccountAction,

View file

@ -27,7 +27,7 @@ class SettingsStyleView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
title: Text(L10n.of(context)!.changeTheme), title: Text(L10n.of(context).changeTheme),
), ),
backgroundColor: theme.colorScheme.surface, backgroundColor: theme.colorScheme.surface,
body: MaxWidthBody( body: MaxWidthBody(
@ -35,7 +35,7 @@ class SettingsStyleView extends StatelessWidget {
children: [ children: [
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.setColorTheme, L10n.of(context).setColorTheme,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -95,7 +95,7 @@ class SettingsStyleView extends StatelessWidget {
), ),
), ),
Text( Text(
L10n.of(context)!.systemTheme, L10n.of(context).systemTheme,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: theme color: theme
@ -140,7 +140,7 @@ class SettingsStyleView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.setTheme, L10n.of(context).setTheme,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -150,19 +150,19 @@ class SettingsStyleView extends StatelessWidget {
RadioListTile<ThemeMode>( RadioListTile<ThemeMode>(
groupValue: controller.currentTheme, groupValue: controller.currentTheme,
value: ThemeMode.system, value: ThemeMode.system,
title: Text(L10n.of(context)!.systemTheme), title: Text(L10n.of(context).systemTheme),
onChanged: controller.switchTheme, onChanged: controller.switchTheme,
), ),
RadioListTile<ThemeMode>( RadioListTile<ThemeMode>(
groupValue: controller.currentTheme, groupValue: controller.currentTheme,
value: ThemeMode.light, value: ThemeMode.light,
title: Text(L10n.of(context)!.lightTheme), title: Text(L10n.of(context).lightTheme),
onChanged: controller.switchTheme, onChanged: controller.switchTheme,
), ),
RadioListTile<ThemeMode>( RadioListTile<ThemeMode>(
groupValue: controller.currentTheme, groupValue: controller.currentTheme,
value: ThemeMode.dark, value: ThemeMode.dark,
title: Text(L10n.of(context)!.darkTheme), title: Text(L10n.of(context).darkTheme),
onChanged: controller.switchTheme, onChanged: controller.switchTheme,
), ),
Divider( Divider(
@ -170,7 +170,7 @@ class SettingsStyleView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.overview, L10n.of(context).overview,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -178,13 +178,13 @@ class SettingsStyleView extends StatelessWidget {
), ),
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.presencesToggle, title: L10n.of(context).presencesToggle,
onChanged: (b) => AppConfig.showPresences = b, onChanged: (b) => AppConfig.showPresences = b,
storeKey: SettingKeys.showPresences, storeKey: SettingKeys.showPresences,
defaultValue: AppConfig.showPresences, defaultValue: AppConfig.showPresences,
), ),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.separateChatTypes, title: L10n.of(context).separateChatTypes,
onChanged: (b) => AppConfig.separateChatTypes = b, onChanged: (b) => AppConfig.separateChatTypes = b,
storeKey: SettingKeys.separateChatTypes, storeKey: SettingKeys.separateChatTypes,
defaultValue: AppConfig.separateChatTypes, defaultValue: AppConfig.separateChatTypes,
@ -194,7 +194,7 @@ class SettingsStyleView extends StatelessWidget {
), ),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.messagesStyle, L10n.of(context).messagesStyle,
style: TextStyle( style: TextStyle(
color: theme.colorScheme.secondary, color: theme.colorScheme.secondary,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -270,7 +270,7 @@ class SettingsStyleView extends StatelessWidget {
), ),
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.wallpaper), title: Text(L10n.of(context).wallpaper),
leading: const Icon(Icons.photo_outlined), leading: const Icon(Icons.photo_outlined),
trailing: accountConfig.wallpaperUrl == null trailing: accountConfig.wallpaperUrl == null
? null ? null
@ -286,7 +286,7 @@ class SettingsStyleView extends StatelessWidget {
curve: FluffyThemes.animationCurve, curve: FluffyThemes.animationCurve,
child: accountConfig.wallpaperUrl != null child: accountConfig.wallpaperUrl != null
? SwitchListTile.adaptive( ? SwitchListTile.adaptive(
title: Text(L10n.of(context)!.transparent), title: Text(L10n.of(context).transparent),
secondary: const Icon(Icons.blur_linear_outlined), secondary: const Icon(Icons.blur_linear_outlined),
value: !wallpaperOpacityIsDefault, value: !wallpaperOpacityIsDefault,
onChanged: (_) => onChanged: (_) =>
@ -301,7 +301,7 @@ class SettingsStyleView extends StatelessWidget {
}, },
), ),
ListTile( ListTile(
title: Text(L10n.of(context)!.fontSize), title: Text(L10n.of(context).fontSize),
trailing: Text('× ${AppConfig.fontSizeFactor}'), trailing: Text('× ${AppConfig.fontSizeFactor}'),
), ),
Slider.adaptive( Slider.adaptive(

View file

@ -98,22 +98,22 @@ class UserBottomSheetController extends State<UserBottomSheet> {
final score = await showConfirmationDialog<int>( final score = await showConfirmationDialog<int>(
context: context, context: context,
title: L10n.of(context)!.reportUser, title: L10n.of(context).reportUser,
message: L10n.of(context)!.howOffensiveIsThisContent, message: L10n.of(context).howOffensiveIsThisContent,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
actions: [ actions: [
AlertDialogAction( AlertDialogAction(
key: -100, key: -100,
label: L10n.of(context)!.extremeOffensive, label: L10n.of(context).extremeOffensive,
), ),
AlertDialogAction( AlertDialogAction(
key: -50, key: -50,
label: L10n.of(context)!.offensive, label: L10n.of(context).offensive,
), ),
AlertDialogAction( AlertDialogAction(
key: 0, key: 0,
label: L10n.of(context)!.inoffensive, label: L10n.of(context).inoffensive,
), ),
], ],
); );
@ -121,10 +121,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
final reason = await showTextInputDialog( final reason = await showTextInputDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.whyDoYouWantToReportThis, title: L10n.of(context).whyDoYouWantToReportThis,
okLabel: L10n.of(context)!.ok, okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context).cancel,
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)], textFields: [DialogTextField(hintText: L10n.of(context).reason)],
); );
if (reason == null || reason.single.isEmpty) return; if (reason == null || reason.single.isEmpty) return;
@ -139,7 +139,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
); );
if (result.error != null) return; if (result.error != null) return;
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.contentHasBeenReported)), SnackBar(content: Text(L10n.of(context).contentHasBeenReported)),
); );
break; break;
case UserBottomSheetAction.mention: case UserBottomSheetAction.mention:
@ -152,10 +152,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.banUserDescription, message: L10n.of(context).banUserDescription,
) == ) ==
OkCancelResult.ok) { OkCancelResult.ok) {
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -170,10 +170,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.unbanUserDescription, message: L10n.of(context).unbanUserDescription,
) == ) ==
OkCancelResult.ok) { OkCancelResult.ok) {
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -188,10 +188,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.kickUserDescription, message: L10n.of(context).kickUserDescription,
) == ) ==
OkCancelResult.ok) { OkCancelResult.ok) {
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -300,10 +300,10 @@ class UserBottomSheetController extends State<UserBottomSheet> {
final consent = await showOkCancelAlertDialog( final consent = await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSure, title: L10n.of(context).areYouSure,
okLabel: L10n.of(context)!.yes, okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context)!.no, cancelLabel: L10n.of(context).no,
message: L10n.of(context)!.makeAdminDescription, message: L10n.of(context).makeAdminDescription,
); );
if (consent != OkCancelResult.ok) return; if (consent != OkCancelResult.ok) return;
} }

View file

@ -79,7 +79,7 @@ class UserBottomSheetView extends StatelessWidget {
title: Padding( title: Padding(
padding: const EdgeInsets.only(bottom: 12.0), padding: const EdgeInsets.only(bottom: 12.0),
child: Text( child: Text(
L10n.of(context)! L10n.of(context)
.userWouldLikeToChangeTheChat(displayname), .userWouldLikeToChangeTheChat(displayname),
), ),
), ),
@ -92,7 +92,7 @@ class UserBottomSheetView extends StatelessWidget {
), ),
onPressed: controller.knockAccept, onPressed: controller.knockAccept,
icon: const Icon(Icons.check_outlined), icon: const Icon(Icons.check_outlined),
label: Text(L10n.of(context)!.accept), label: Text(L10n.of(context).accept),
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
TextButton.icon( TextButton.icon(
@ -104,7 +104,7 @@ class UserBottomSheetView extends StatelessWidget {
), ),
onPressed: controller.knockDecline, onPressed: controller.knockDecline,
icon: const Icon(Icons.cancel_outlined), 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), const SizedBox(width: 12),
if (presence.currentlyActive == true) if (presence.currentlyActive == true)
Text( Text(
L10n.of(context)!.currentlyActive, L10n.of(context).currentlyActive,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: theme.textTheme.bodySmall, style: theme.textTheme.bodySmall,
) )
else if (lastActiveTimestamp != null) else if (lastActiveTimestamp != null)
Text( Text(
L10n.of(context)!.lastActiveAgo( L10n.of(context).lastActiveAgo(
lastActiveTimestamp lastActiveTimestamp
.localizedTimeShort(context), .localizedTimeShort(context),
), ),
@ -238,7 +238,7 @@ class UserBottomSheetView extends StatelessWidget {
UserBottomSheetAction.message, UserBottomSheetAction.message,
), ),
icon: const Icon(Icons.chat_outlined), icon: const Icon(Icons.chat_outlined),
label: Text(L10n.of(context)!.startConversation), label: Text(L10n.of(context).startConversation),
) )
: TextField( : TextField(
controller: controller.sendController, controller: controller.sendController,
@ -250,7 +250,7 @@ class UserBottomSheetView extends StatelessWidget {
decoration: InputDecoration( decoration: InputDecoration(
errorText: controller.sendError errorText: controller.sendError
?.toLocalizedString(context), ?.toLocalizedString(context),
hintText: L10n.of(context)!.sendMessages, hintText: L10n.of(context).sendMessages,
suffix: controller.isSending suffix: controller.isSending
? const SizedBox( ? const SizedBox(
width: 16, width: 16,
@ -272,7 +272,7 @@ class UserBottomSheetView extends StatelessWidget {
if (controller.widget.onMention != null) if (controller.widget.onMention != null)
ListTile( ListTile(
leading: const Icon(Icons.alternate_email_outlined), leading: const Icon(Icons.alternate_email_outlined),
title: Text(L10n.of(context)!.mention), title: Text(L10n.of(context).mention),
onTap: () => controller onTap: () => controller
.participantAction(UserBottomSheetAction.mention), .participantAction(UserBottomSheetAction.mention),
), ),
@ -280,7 +280,7 @@ class UserBottomSheetView extends StatelessWidget {
Divider(color: theme.dividerColor), Divider(color: theme.dividerColor),
ListTile( ListTile(
title: Text( title: Text(
'${L10n.of(context)!.userRole} (${user.powerLevel})', '${L10n.of(context).userRole} (${user.powerLevel})',
), ),
leading: const Icon(Icons.person_outlined), leading: const Icon(Icons.person_outlined),
trailing: Material( trailing: Material(
@ -304,19 +304,19 @@ class UserBottomSheetView extends StatelessWidget {
items: [ items: [
DropdownMenuItem( DropdownMenuItem(
value: 0, value: 0,
child: Text(L10n.of(context)!.user), child: Text(L10n.of(context).user),
), ),
DropdownMenuItem( DropdownMenuItem(
value: 50, value: 50,
child: Text(L10n.of(context)!.moderator), child: Text(L10n.of(context).moderator),
), ),
DropdownMenuItem( DropdownMenuItem(
value: 100, value: 100,
child: Text(L10n.of(context)!.admin), child: Text(L10n.of(context).admin),
), ),
DropdownMenuItem( DropdownMenuItem(
value: null, value: null,
child: Text(L10n.of(context)!.custom), child: Text(L10n.of(context).custom),
), ),
], ],
), ),
@ -328,7 +328,7 @@ class UserBottomSheetView extends StatelessWidget {
ListTile( ListTile(
textColor: theme.colorScheme.error, textColor: theme.colorScheme.error,
iconColor: 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), leading: const Icon(Icons.exit_to_app_outlined),
onTap: () => controller onTap: () => controller
.participantAction(UserBottomSheetAction.kick), .participantAction(UserBottomSheetAction.kick),
@ -339,7 +339,7 @@ class UserBottomSheetView extends StatelessWidget {
ListTile( ListTile(
textColor: theme.colorScheme.onErrorContainer, textColor: theme.colorScheme.onErrorContainer,
iconColor: 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), leading: const Icon(Icons.warning_sharp),
onTap: () => onTap: () =>
controller.participantAction(UserBottomSheetAction.ban), controller.participantAction(UserBottomSheetAction.ban),
@ -348,7 +348,7 @@ class UserBottomSheetView extends StatelessWidget {
user.canBan && user.canBan &&
user.membership == Membership.ban) user.membership == Membership.ban)
ListTile( ListTile(
title: Text(L10n.of(context)!.unbanFromChat), title: Text(L10n.of(context).unbanFromChat),
leading: const Icon(Icons.warning_outlined), leading: const Icon(Icons.warning_outlined),
onTap: () => controller onTap: () => controller
.participantAction(UserBottomSheetAction.unban), .participantAction(UserBottomSheetAction.unban),
@ -357,7 +357,7 @@ class UserBottomSheetView extends StatelessWidget {
ListTile( ListTile(
textColor: theme.colorScheme.onErrorContainer, textColor: theme.colorScheme.onErrorContainer,
iconColor: 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), leading: const Icon(Icons.gavel_outlined),
onTap: () => controller onTap: () => controller
.participantAction(UserBottomSheetAction.report), .participantAction(UserBottomSheetAction.report),
@ -369,7 +369,7 @@ class UserBottomSheetView extends StatelessWidget {
color: Colors.orange, color: Colors.orange,
), ),
subtitle: Text( subtitle: Text(
L10n.of(context)!.profileNotFound, L10n.of(context).profileNotFound,
style: const TextStyle(color: Colors.orange), style: const TextStyle(color: Colors.orange),
), ),
), ),
@ -379,7 +379,7 @@ class UserBottomSheetView extends StatelessWidget {
textColor: theme.colorScheme.onErrorContainer, textColor: theme.colorScheme.onErrorContainer,
iconColor: theme.colorScheme.onErrorContainer, iconColor: theme.colorScheme.onErrorContainer,
leading: const Icon(Icons.block_outlined), leading: const Icon(Icons.block_outlined),
title: Text(L10n.of(context)!.block), title: Text(L10n.of(context).block),
onTap: () => controller onTap: () => controller
.participantAction(UserBottomSheetAction.ignore), .participantAction(UserBottomSheetAction.ignore),
), ),

View file

@ -48,8 +48,8 @@ abstract class ClientManager {
await Future.wait( await Future.wait(
clients.map( clients.map(
(client) => client.initWithRestore( (client) => client.initWithRestore(
onMigration: () { onMigration: () async {
final l10n = lookupL10n(PlatformDispatcher.instance.locale); final l10n = await lookupL10n(PlatformDispatcher.instance.locale);
sendInitNotification( sendInitNotification(
l10n.databaseMigrationTitle, l10n.databaseMigrationTitle,
l10n.databaseMigrationBody, l10n.databaseMigrationBody,

View file

@ -35,9 +35,9 @@ extension DateTimeExtension on DateTime {
/// Returns a simple time String. /// Returns a simple time String.
String localizedTimeOfDay(BuildContext context) => String localizedTimeOfDay(BuildContext context) =>
L10n.of(context)!.alwaysUse24HourFormat == 'true' L10n.of(context).alwaysUse24HourFormat == 'true'
? DateFormat('HH:mm', L10n.of(context)!.localeName).format(this) ? DateFormat('HH:mm', L10n.of(context).localeName).format(this)
: DateFormat('h:mm a', 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 /// Returns [localizedTimeOfDay()] if the ChatTime is today, the name of the week
/// day if the ChatTime is this week and a date string else. /// 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; final sameDay = sameYear && now.month == month && now.day == day;
if (sameDay) return localizedTimeOfDay(context); if (sameDay) return localizedTimeOfDay(context);
return L10n.of(context)!.dateAndTimeOfDay( return L10n.of(context).dateAndTimeOfDay(
localizedTimeShort(context), localizedTimeShort(context),
localizedTimeOfDay(context), localizedTimeOfDay(context),
); );

View file

@ -21,7 +21,7 @@ class ErrorReporter {
await showAdaptiveDialog( await showAdaptiveDialog(
context: context, context: context,
builder: (context) => AlertDialog.adaptive( builder: (context) => AlertDialog.adaptive(
title: Text(L10n.of(context)!.reportErrorDescription), title: Text(L10n.of(context).reportErrorDescription),
content: SizedBox( content: SizedBox(
height: 256, height: 256,
width: 256, width: 256,
@ -36,13 +36,13 @@ class ErrorReporter {
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: Text(L10n.of(context)!.close), child: Text(L10n.of(context).close),
), ),
TextButton( TextButton(
onPressed: () => Clipboard.setData( onPressed: () => Clipboard.setData(
ClipboardData(text: text), ClipboardData(text: text),
), ),
child: Text(L10n.of(context)!.copy), child: Text(L10n.of(context).copy),
), ),
TextButton( TextButton(
onPressed: () => launchUrl( onPressed: () => launchUrl(
@ -56,7 +56,7 @@ class ErrorReporter {
), ),
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
), ),
child: Text(L10n.of(context)!.report), child: Text(L10n.of(context).report),
), ),
], ],
), ),

View file

@ -25,7 +25,7 @@ abstract class FluffyShare {
ClipboardData(text: text), ClipboardData(text: text),
); );
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.copiedToClipboard)), SnackBar(content: Text(L10n.of(context).copiedToClipboard)),
); );
return; return;
} }
@ -34,7 +34,7 @@ abstract class FluffyShare {
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
final ownProfile = await client.fetchOwnProfile(); final ownProfile = await client.fetchOwnProfile();
await FluffyShare.share( await FluffyShare.share(
L10n.of(context)!.inviteText( L10n.of(context).inviteText(
ownProfile.displayName ?? client.userID!, ownProfile.displayName ?? client.userID!,
'https://matrix.to/#/${client.userID}?client=im.fluffychat', 'https://matrix.to/#/${client.userID}?client=im.fluffychat',
), ),

View file

@ -101,7 +101,7 @@ extension InitWithRestoreExtension on Client {
} }
} catch (e, s) { } catch (e, s) {
Logs().wtf('Client init failed!', 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); final sessionBackupString = await storage?.read(key: storageKey);
if (sessionBackupString == null) { if (sessionBackupString == null) {
ClientManager.sendInitNotification( ClientManager.sendInitNotification(

View file

@ -30,7 +30,7 @@ extension LocalizedExceptionExtension on Object {
]) { ]) {
if (this is FileTooBigMatrixException) { if (this is FileTooBigMatrixException) {
final exception = this as FileTooBigMatrixException; final exception = this as FileTooBigMatrixException;
return L10n.of(context)!.fileIsTooBigForServer( return L10n.of(context).fileIsTooBigForServer(
_formatFileSize(exception.maxFileSize), _formatFileSize(exception.maxFileSize),
); );
} }
@ -38,17 +38,17 @@ extension LocalizedExceptionExtension on Object {
switch ((this as MatrixException).error) { switch ((this as MatrixException).error) {
case MatrixError.M_FORBIDDEN: case MatrixError.M_FORBIDDEN:
if (exceptionContext == ExceptionContext.changePassword) { 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: case MatrixError.M_LIMIT_EXCEEDED:
return L10n.of(context)!.tooManyRequestsWarning; return L10n.of(context).tooManyRequestsWarning;
default: default:
return (this as MatrixException).errorMessage; return (this as MatrixException).errorMessage;
} }
} }
if (this is InvalidPassphraseException) { if (this is InvalidPassphraseException) {
return L10n.of(context)!.wrongRecoveryKey; return L10n.of(context).wrongRecoveryKey;
} }
if (this is BadServerVersionsException) { if (this is BadServerVersionsException) {
final serverVersions = (this as BadServerVersionsException) final serverVersions = (this as BadServerVersionsException)
@ -61,7 +61,7 @@ extension LocalizedExceptionExtension on Object {
.toString() .toString()
.replaceAll('{', '"') .replaceAll('{', '"')
.replaceAll('}', '"'); .replaceAll('}', '"');
return L10n.of(context)!.badServerVersionsException( return L10n.of(context).badServerVersionsException(
serverVersions, serverVersions,
supportedVersions, supportedVersions,
serverVersions, serverVersions,
@ -79,7 +79,7 @@ extension LocalizedExceptionExtension on Object {
.toString() .toString()
.replaceAll('{', '"') .replaceAll('{', '"')
.replaceAll('}', '"'); .replaceAll('}', '"');
return L10n.of(context)!.badServerLoginTypesException( return L10n.of(context).badServerLoginTypesException(
serverVersions, serverVersions,
supportedVersions, supportedVersions,
supportedVersions, supportedVersions,
@ -89,16 +89,16 @@ extension LocalizedExceptionExtension on Object {
this is SocketException || this is SocketException ||
this is SyncConnectionException || this is SyncConnectionException ||
this is ClientException) { this is ClientException) {
return L10n.of(context)!.noConnectionToTheServer; return L10n.of(context).noConnectionToTheServer;
} }
if (this is FormatException && if (this is FormatException &&
exceptionContext == ExceptionContext.checkHomeserver) { exceptionContext == ExceptionContext.checkHomeserver) {
return L10n.of(context)!.doesNotSeemToBeAValidHomeserver; return L10n.of(context).doesNotSeemToBeAValidHomeserver;
} }
if (this is String) return toString(); if (this is String) return toString();
if (this is UiaException) return toString(); if (this is UiaException) return toString();
Logs().w('Something went wrong: ', this); Logs().w('Something went wrong: ', this);
return L10n.of(context)!.oopsSomethingWentWrong; return L10n.of(context).oopsSomethingWentWrong;
} }
} }

View file

@ -43,7 +43,7 @@ Future<DatabaseApi> flutterMatrixSdkDatabaseBuilder(Client client) async {
try { try {
// Send error notification: // Send error notification:
final l10n = lookupL10n(PlatformDispatcher.instance.locale); final l10n = await lookupL10n(PlatformDispatcher.instance.locale);
ClientManager.sendInitNotification( ClientManager.sendInitNotification(
l10n.initAppError, l10n.initAppError,
l10n.databaseBuildErrorBody( l10n.databaseBuildErrorBody(

View file

@ -57,7 +57,7 @@ void _sendNoEncryptionWarning(Object exception) async {
if (isStored == true) return; if (isStored == true) return;
final l10n = lookupL10n(PlatformDispatcher.instance.locale); final l10n = await lookupL10n(PlatformDispatcher.instance.locale);
ClientManager.sendInitNotification( ClientManager.sendInitNotification(
l10n.noDatabaseEncryption, l10n.noDatabaseEncryption,
exception.toString(), exception.toString(),

View file

@ -20,7 +20,7 @@ extension MatrixFileExtension on MatrixFile {
} }
final downloadPath = await FilePicker.platform.saveFile( final downloadPath = await FilePicker.platform.saveFile(
dialogTitle: L10n.of(context)!.saveFile, dialogTitle: L10n.of(context).saveFile,
fileName: name, fileName: name,
type: filePickerFileType, type: filePickerFileType,
bytes: bytes, bytes: bytes,
@ -38,7 +38,7 @@ extension MatrixFileExtension on MatrixFile {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
L10n.of(context)!.fileHasBeenSavedAt(downloadPath), L10n.of(context).fileHasBeenSavedAt(downloadPath),
), ),
), ),
); );

View file

@ -52,7 +52,7 @@ abstract class PlatformInfos {
TextButton.icon( TextButton.icon(
onPressed: () => launchUrlString(AppConfig.sourceCodeUrl), onPressed: () => launchUrlString(AppConfig.sourceCodeUrl),
icon: const Icon(Icons.source_outlined), icon: const Icon(Icons.source_outlined),
label: Text(L10n.of(context)!.sourceCode), label: Text(L10n.of(context).sourceCode),
), ),
TextButton.icon( TextButton.icon(
onPressed: () => launchUrlString(AppConfig.emojiFontUrl), onPressed: () => launchUrlString(AppConfig.emojiFontUrl),

View file

@ -35,7 +35,7 @@ Future<void> pushHelper(
} catch (e, s) { } catch (e, s) {
Logs().v('Push Helper has crashed!', e, s); Logs().v('Push Helper has crashed!', e, s);
l10n ??= lookupL10n(const Locale('en')); l10n ??= await lookupL10n(const Locale('en'));
flutterLocalNotificationsPlugin.show( flutterLocalNotificationsPlugin.show(
notification.roomId?.hashCode ?? 0, notification.roomId?.hashCode ?? 0,
l10n.newMessageInFluffyChat, l10n.newMessageInFluffyChat,

View file

@ -12,24 +12,24 @@ extension RoomStatusExtension on Room {
typingUsers.removeWhere((User u) => u.id == client.userID); typingUsers.removeWhere((User u) => u.id == client.userID);
if (AppConfig.hideTypingUsernames) { if (AppConfig.hideTypingUsernames) {
typingText = L10n.of(context)!.isTyping; typingText = L10n.of(context).isTyping;
if (typingUsers.first.id != directChatMatrixID) { if (typingUsers.first.id != directChatMatrixID) {
typingText = typingText =
L10n.of(context)!.numUsersTyping(typingUsers.length.toString()); L10n.of(context).numUsersTyping(typingUsers.length.toString());
} }
} else if (typingUsers.length == 1) { } else if (typingUsers.length == 1) {
typingText = L10n.of(context)!.isTyping; typingText = L10n.of(context).isTyping;
if (typingUsers.first.id != directChatMatrixID) { if (typingUsers.first.id != directChatMatrixID) {
typingText = typingText =
L10n.of(context)!.userIsTyping(typingUsers.first.calcDisplayname()); L10n.of(context).userIsTyping(typingUsers.first.calcDisplayname());
} }
} else if (typingUsers.length == 2) { } else if (typingUsers.length == 2) {
typingText = L10n.of(context)!.userAndUserAreTyping( typingText = L10n.of(context).userAndUserAreTyping(
typingUsers.first.calcDisplayname(), typingUsers.first.calcDisplayname(),
typingUsers[1].calcDisplayname(), typingUsers[1].calcDisplayname(),
); );
} else if (typingUsers.length > 2) { } else if (typingUsers.length > 2) {
typingText = L10n.of(context)!.userAndOthersAreTyping( typingText = L10n.of(context).userAndOthersAreTyping(
typingUsers.first.calcDisplayname(), typingUsers.first.calcDisplayname(),
(typingUsers.length - 1).toString(), (typingUsers.length - 1).toString(),
); );

View file

@ -35,13 +35,13 @@ abstract class UpdateNotifier {
), ),
Expanded( Expanded(
child: Text( child: Text(
L10n.of(context)!.updateInstalled(currentVersion), L10n.of(context).updateInstalled(currentVersion),
), ),
), ),
], ],
), ),
action: SnackBarAction( action: SnackBarAction(
label: L10n.of(context)!.changelog, label: L10n.of(context).changelog,
onPressed: () => launchUrlString(AppConfig.changelogUrl), onPressed: () => launchUrlString(AppConfig.changelogUrl),
), ),
), ),

Some files were not shown because too many files have changed in this diff Show more