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

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