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
commit 0d4b7d67cc
No known key found for this signature in database
111 changed files with 879 additions and 883 deletions

View file

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

View file

@ -35,9 +35,9 @@ class QrScannerModalState extends State<QrScannerModal> {
leading: IconButton(
icon: const Icon(Icons.close_outlined),
onPressed: Navigator.of(context).pop,
tooltip: L10n.of(context)!.close,
tooltip: L10n.of(context).close,
),
title: Text(L10n.of(context)!.scanQrCode),
title: Text(L10n.of(context).scanQrCode),
),
body: Stack(
children: [