refactor: Use non nullable localizations builder and lazy load on web
This commit is contained in:
parent
8cedd2a45a
commit
0d4b7d67cc
111 changed files with 879 additions and 883 deletions
|
|
@ -43,14 +43,14 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||
final input = await showTextInputDialog(
|
||||
context: context,
|
||||
title: L10n.of(context)!.changeTheNameOfTheGroup,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
cancelLabel: L10n.of(context)!.cancel,
|
||||
title: L10n.of(context).changeTheNameOfTheGroup,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
initialText: room.getLocalizedDisplayname(
|
||||
MatrixLocals(
|
||||
L10n.of(context)!,
|
||||
L10n.of(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -63,7 +63,7 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
);
|
||||
if (success.error == null) {
|
||||
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 input = await showTextInputDialog(
|
||||
context: context,
|
||||
title: L10n.of(context)!.setChatDescription,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
cancelLabel: L10n.of(context)!.cancel,
|
||||
title: L10n.of(context).setChatDescription,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: L10n.of(context)!.noChatDescriptionYet,
|
||||
hintText: L10n.of(context).noChatDescriptionYet,
|
||||
initialText: room.topic,
|
||||
minLines: 4,
|
||||
maxLines: 8,
|
||||
|
|
@ -92,7 +92,7 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
if (success.error == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
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)
|
||||
SheetAction(
|
||||
key: AvatarAction.camera,
|
||||
label: L10n.of(context)!.openCamera,
|
||||
label: L10n.of(context).openCamera,
|
||||
isDefaultAction: true,
|
||||
icon: Icons.camera_alt_outlined,
|
||||
),
|
||||
SheetAction(
|
||||
key: AvatarAction.file,
|
||||
label: L10n.of(context)!.openGallery,
|
||||
label: L10n.of(context).openGallery,
|
||||
icon: Icons.photo_outlined,
|
||||
),
|
||||
if (room?.avatar != null)
|
||||
SheetAction(
|
||||
key: AvatarAction.remove,
|
||||
label: L10n.of(context)!.delete,
|
||||
label: L10n.of(context).delete,
|
||||
isDestructiveAction: true,
|
||||
icon: Icons.delete_outlined,
|
||||
),
|
||||
|
|
@ -139,7 +139,7 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
? actions.single.key
|
||||
: await showModalActionSheet<AvatarAction>(
|
||||
context: context,
|
||||
title: L10n.of(context)!.editRoomAvatar,
|
||||
title: L10n.of(context).editRoomAvatar,
|
||||
actions: actions,
|
||||
);
|
||||
if (action == null) return;
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -17,17 +17,17 @@ class ParticipantListItem extends StatelessWidget {
|
|||
final theme = Theme.of(context);
|
||||
|
||||
final membershipBatch = switch (user.membership) {
|
||||
Membership.ban => L10n.of(context)!.banned,
|
||||
Membership.invite => L10n.of(context)!.invited,
|
||||
Membership.ban => L10n.of(context).banned,
|
||||
Membership.invite => L10n.of(context).invited,
|
||||
Membership.join => null,
|
||||
Membership.knock => L10n.of(context)!.knocking,
|
||||
Membership.leave => L10n.of(context)!.leftTheChat,
|
||||
Membership.knock => L10n.of(context).knocking,
|
||||
Membership.leave => L10n.of(context).leftTheChat,
|
||||
};
|
||||
|
||||
final permissionBatch = user.powerLevel == 100
|
||||
? L10n.of(context)!.admin
|
||||
? L10n.of(context).admin
|
||||
: user.powerLevel >= 50
|
||||
? L10n.of(context)!.moderator
|
||||
? L10n.of(context).moderator
|
||||
: '';
|
||||
|
||||
return Opacity(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue