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

@ -57,15 +57,15 @@ class InvitationSelectionController extends State<InvitationSelection> {
if (OkCancelResult.ok !=
await showOkCancelAlertDialog(
context: context,
title: L10n.of(context)!.inviteContact,
message: L10n.of(context)!.inviteContactToGroupQuestion(
title: L10n.of(context).inviteContact,
message: L10n.of(context).inviteContactToGroupQuestion(
displayname,
room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!),
MatrixLocals(L10n.of(context)),
),
),
okLabel: L10n.of(context)!.invite,
cancelLabel: L10n.of(context)!.cancel,
okLabel: L10n.of(context).invite,
cancelLabel: L10n.of(context).cancel,
)) {
return;
}
@ -76,7 +76,7 @@ class InvitationSelectionController extends State<InvitationSelection> {
if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar(
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) {
return Scaffold(
appBar: AppBar(
title: Text(L10n.of(context)!.oopsSomethingWentWrong),
title: Text(L10n.of(context).oopsSomethingWentWrong),
),
body: Center(
child: Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat),
child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
),
);
}
final groupName = room.name.isEmpty ? L10n.of(context)!.group : room.name;
final groupName = room.name.isEmpty ? L10n.of(context).group : room.name;
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
leading: const Center(child: BackButton()),
titleSpacing: 0,
title: Text(L10n.of(context)!.inviteContact),
title: Text(L10n.of(context).inviteContact),
),
body: MaxWidthBody(
innerPadding: const EdgeInsets.symmetric(vertical: 8),
@ -55,7 +55,7 @@ class InvitationSelectionView extends StatelessWidget {
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
),
hintText: L10n.of(context)!.inviteContactToGroup(groupName),
hintText: L10n.of(context).inviteContactToGroup(groupName),
prefixIcon: controller.loading
? const Padding(
padding: EdgeInsets.symmetric(
@ -91,7 +91,7 @@ class InvitationSelectionView extends StatelessWidget {
displayname: controller
.foundProfiles[i].displayName ??
controller.foundProfiles[i].userId.localpart ??
L10n.of(context)!.user,
L10n.of(context).user,
userId: controller.foundProfiles[i].userId,
isMember: participants
.contains(controller.foundProfiles[i].userId),
@ -100,7 +100,7 @@ class InvitationSelectionView extends StatelessWidget {
controller.foundProfiles[i].userId,
controller.foundProfiles[i].displayName ??
controller.foundProfiles[i].userId.localpart ??
L10n.of(context)!.user,
L10n.of(context).user,
),
),
)
@ -124,7 +124,7 @@ class InvitationSelectionView extends StatelessWidget {
avatarUrl: contacts[i].avatarUrl,
displayname: contacts[i].displayName ??
contacts[i].id.localpart ??
L10n.of(context)!.user,
L10n.of(context).user,
userId: contacts[i].id,
isMember: participants.contains(contacts[i].id),
onTap: () => controller.inviteAction(
@ -132,7 +132,7 @@ class InvitationSelectionView extends StatelessWidget {
contacts[i].id,
contacts[i].displayName ??
contacts[i].id.localpart ??
L10n.of(context)!.user,
L10n.of(context).user,
),
),
);
@ -189,7 +189,7 @@ class _InviteContactListTile extends StatelessWidget {
),
onTap: isMember ? null : onTap,
trailing: isMember
? Text(L10n.of(context)!.participant)
? Text(L10n.of(context).participant)
: const Icon(Icons.person_add_outlined),
),
);