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

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

View file

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