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

@ -62,15 +62,15 @@ extension LocalizedActiveFilter on ActiveFilter {
String toLocalizedString(BuildContext context) {
switch (this) {
case ActiveFilter.allChats:
return L10n.of(context)!.all;
return L10n.of(context).all;
case ActiveFilter.messages:
return L10n.of(context)!.messages;
return L10n.of(context).messages;
case ActiveFilter.unread:
return L10n.of(context)!.unread;
return L10n.of(context).unread;
case ActiveFilter.groups:
return L10n.of(context)!.groups;
return L10n.of(context).groups;
case ActiveFilter.spaces:
return L10n.of(context)!.spaces;
return L10n.of(context).spaces;
}
}
}
@ -128,25 +128,25 @@ class ChatListController extends State<ChatList>
final inviteAction = await showModalActionSheet<InviteActions>(
context: context,
message: room.isDirectChat
? L10n.of(context)!.invitePrivateChat
: L10n.of(context)!.inviteGroupChat,
title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
? L10n.of(context).invitePrivateChat
: L10n.of(context).inviteGroupChat,
title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
actions: [
SheetAction(
key: InviteActions.accept,
label: L10n.of(context)!.accept,
label: L10n.of(context).accept,
icon: Icons.check_outlined,
isDefaultAction: true,
),
SheetAction(
key: InviteActions.decline,
label: L10n.of(context)!.decline,
label: L10n.of(context).decline,
icon: Icons.close_outlined,
isDestructiveAction: true,
),
SheetAction(
key: InviteActions.block,
label: L10n.of(context)!.block,
label: L10n.of(context).block,
icon: Icons.block_outlined,
isDestructiveAction: true,
),
@ -181,7 +181,7 @@ class ChatListController extends State<ChatList>
if (room.membership == Membership.ban) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(L10n.of(context)!.youHaveBeenBannedFromThisChat),
content: Text(L10n.of(context).youHaveBeenBannedFromThisChat),
),
);
return;
@ -221,12 +221,12 @@ class ChatListController extends State<ChatList>
} else {
final consent = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context)!.forward,
message: L10n.of(context)!.forwardMessageTo(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
title: L10n.of(context).forward,
message: L10n.of(context).forwardMessageTo(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
),
okLabel: L10n.of(context)!.forward,
cancelLabel: L10n.of(context)!.cancel,
okLabel: L10n.of(context).forward,
cancelLabel: L10n.of(context).cancel,
);
if (consent == OkCancelResult.cancel) {
Matrix.of(context).shareContent = null;
@ -276,10 +276,10 @@ class ChatListController extends State<ChatList>
void setServer() async {
final newServer = await showTextInputDialog(
useRootNavigator: false,
title: L10n.of(context)!.changeTheHomeserver,
title: L10n.of(context).changeTheHomeserver,
context: context,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
textFields: [
DialogTextField(
prefixText: 'https://',
@ -289,7 +289,7 @@ class ChatListController extends State<ChatList>
autocorrect: false,
validator: (server) => server?.contains('.') == true
? null
: L10n.of(context)!.invalidServerName,
: L10n.of(context).invalidServerName,
),
],
);
@ -569,7 +569,7 @@ class ChatListController extends State<ChatList>
);
final displayname =
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!));
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)));
final spacesWithPowerLevels = room.client.rooms
.where(
@ -618,8 +618,7 @@ class ChatListController extends State<ChatList>
const SizedBox(width: 12),
Expanded(
child: Text(
L10n.of(context)!
.goToSpace(space.getLocalizedDisplayname()),
L10n.of(context).goToSpace(space.getLocalizedDisplayname()),
),
),
],
@ -638,8 +637,8 @@ class ChatListController extends State<ChatList>
const SizedBox(width: 12),
Text(
room.pushRuleState == PushRuleState.notify
? L10n.of(context)!.muteChat
: L10n.of(context)!.unmuteChat,
? L10n.of(context).muteChat
: L10n.of(context).unmuteChat,
),
],
),
@ -657,8 +656,8 @@ class ChatListController extends State<ChatList>
const SizedBox(width: 12),
Text(
room.markedUnread
? L10n.of(context)!.markAsRead
: L10n.of(context)!.markAsUnread,
? L10n.of(context).markAsRead
: L10n.of(context).markAsUnread,
),
],
),
@ -672,8 +671,8 @@ class ChatListController extends State<ChatList>
const SizedBox(width: 12),
Text(
room.isFavourite
? L10n.of(context)!.unpin
: L10n.of(context)!.pin,
? L10n.of(context).unpin
: L10n.of(context).pin,
),
],
),
@ -686,7 +685,7 @@ class ChatListController extends State<ChatList>
children: [
const Icon(Icons.group_work_outlined),
const SizedBox(width: 12),
Text(L10n.of(context)!.addToSpace),
Text(L10n.of(context).addToSpace),
],
),
),
@ -697,7 +696,7 @@ class ChatListController extends State<ChatList>
children: [
const Icon(Icons.delete_outlined),
const SizedBox(width: 12),
Text(L10n.of(context)!.leave),
Text(L10n.of(context).leave),
],
),
),
@ -740,10 +739,10 @@ class ChatListController extends State<ChatList>
final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context)!.areYouSure,
okLabel: L10n.of(context)!.leave,
cancelLabel: L10n.of(context)!.no,
message: L10n.of(context)!.archiveRoomDescription,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).leave,
cancelLabel: L10n.of(context).no,
message: L10n.of(context).archiveRoomDescription,
isDestructiveAction: true,
);
if (confirmed == OkCancelResult.cancel) return;
@ -755,13 +754,13 @@ class ChatListController extends State<ChatList>
case ChatContextAction.addToSpace:
final space = await showConfirmationDialog(
context: context,
title: L10n.of(context)!.space,
title: L10n.of(context).space,
actions: spacesWithPowerLevels
.map(
(space) => AlertDialogAction(
key: space,
label: space
.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
),
)
.toList(),
@ -776,7 +775,7 @@ class ChatListController extends State<ChatList>
void dismissStatusList() async {
final result = await showOkCancelAlertDialog(
title: L10n.of(context)!.hidePresences,
title: L10n.of(context).hidePresences,
context: context,
);
if (result == OkCancelResult.ok) {
@ -792,13 +791,13 @@ class ChatListController extends State<ChatList>
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context)!.setStatus,
message: L10n.of(context)!.leaveEmptyToClearStatus,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
title: L10n.of(context).setStatus,
message: L10n.of(context).leaveEmptyToClearStatus,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
textFields: [
DialogTextField(
hintText: L10n.of(context)!.statusExampleMessage,
hintText: L10n.of(context).statusExampleMessage,
maxLines: 6,
minLines: 1,
maxLength: 255,
@ -880,22 +879,22 @@ class ChatListController extends State<ChatList>
}
void editBundlesForAccount(String? userId, String? activeBundle) async {
final l10n = L10n.of(context)!;
final l10n = L10n.of(context);
final client = Matrix.of(context)
.widget
.clients[Matrix.of(context).getClientIndexByMatrixId(userId!)];
final action = await showConfirmationDialog<EditBundleAction>(
context: context,
title: L10n.of(context)!.editBundlesForAccount,
title: L10n.of(context).editBundlesForAccount,
actions: [
AlertDialogAction(
key: EditBundleAction.addToBundle,
label: L10n.of(context)!.addToBundle,
label: L10n.of(context).addToBundle,
),
if (activeBundle != client.userID)
AlertDialogAction(
key: EditBundleAction.removeFromBundle,
label: L10n.of(context)!.removeFromBundle,
label: L10n.of(context).removeFromBundle,
),
],
);

View file

@ -83,17 +83,17 @@ class ChatListViewBody extends StatelessWidget {
[
if (controller.isSearchMode) ...[
SearchTitle(
title: L10n.of(context)!.publicRooms,
title: L10n.of(context).publicRooms,
icon: const Icon(Icons.explore_outlined),
),
PublicRoomsHorizontalList(publicRooms: publicRooms),
SearchTitle(
title: L10n.of(context)!.publicSpaces,
title: L10n.of(context).publicSpaces,
icon: const Icon(Icons.workspaces_outlined),
),
PublicRoomsHorizontalList(publicRooms: publicSpaces),
SearchTitle(
title: L10n.of(context)!.users,
title: L10n.of(context).users,
icon: const Icon(Icons.group_outlined),
),
AnimatedContainer(
@ -115,7 +115,7 @@ class ChatListViewBody extends StatelessWidget {
userSearchResult.results[i].displayName ??
userSearchResult
.results[i].userId.localpart ??
L10n.of(context)!.unknownDevice,
L10n.of(context).unknownDevice,
avatar: userSearchResult.results[i].avatarUrl,
onPressed: () => showAdaptiveBottomSheet(
context: context,
@ -146,8 +146,8 @@ class ChatListViewBody extends StatelessWidget {
color: theme.colorScheme.surface,
child: ListTile(
leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.dehydrateTor),
subtitle: Text(L10n.of(context)!.dehydrateTorLong),
title: Text(L10n.of(context).dehydrateTor),
subtitle: Text(L10n.of(context).dehydrateTorLong),
trailing: const Icon(Icons.chevron_right_outlined),
onTap: controller.dehydrate,
),
@ -231,7 +231,7 @@ class ChatListViewBody extends StatelessWidget {
),
if (controller.isSearchMode)
SearchTitle(
title: L10n.of(context)!.chats,
title: L10n.of(context).chats,
icon: const Icon(Icons.forum_outlined),
),
if (client.prevBatch != null &&
@ -267,8 +267,8 @@ class ChatListViewBody extends StatelessWidget {
padding: const EdgeInsets.all(16.0),
child: Text(
client.rooms.isEmpty
? L10n.of(context)!.noChatsFoundHere
: L10n.of(context)!.noMoreChatsFound,
? L10n.of(context).noChatsFoundHere
: L10n.of(context).noMoreChatsFound,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
@ -343,7 +343,7 @@ class PublicRoomsHorizontalList extends StatelessWidget {
itemBuilder: (context, i) => _SearchItem(
title: publicRooms[i].name ??
publicRooms[i].canonicalAlias?.localpart ??
L10n.of(context)!.group,
L10n.of(context).group,
avatar: publicRooms[i].avatarUrl,
onPressed: () => showAdaptiveBottomSheet(
context: context,

View file

@ -35,14 +35,14 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
leading: selectMode == SelectMode.normal
? null
: IconButton(
tooltip: L10n.of(context)!.cancel,
tooltip: L10n.of(context).cancel,
icon: const Icon(Icons.close_outlined),
onPressed: controller.cancelAction,
color: theme.colorScheme.primary,
),
title: selectMode == SelectMode.share
? Text(
L10n.of(context)!.share,
L10n.of(context).share,
key: const ValueKey(SelectMode.share),
)
: TextField(
@ -61,7 +61,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
borderRadius: BorderRadius.circular(99),
),
contentPadding: EdgeInsets.zero,
hintText: L10n.of(context)!.searchChatsRooms,
hintText: L10n.of(context).searchChatsRooms,
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
@ -69,7 +69,7 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
floatingLabelBehavior: FloatingLabelBehavior.never,
prefixIcon: controller.isSearchMode
? IconButton(
tooltip: L10n.of(context)!.cancel,
tooltip: L10n.of(context).cancel,
icon: const Icon(Icons.close_outlined),
onPressed: controller.cancelSearch,
color: theme.colorScheme.onPrimaryContainer,

View file

@ -47,10 +47,10 @@ class ChatListItem extends StatelessWidget {
final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context)!.areYouSure,
okLabel: L10n.of(context)!.yes,
cancelLabel: L10n.of(context)!.no,
message: L10n.of(context)!.archiveRoomDescription,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,
cancelLabel: L10n.of(context).no,
message: L10n.of(context).archiveRoomDescription,
);
if (confirmed == OkCancelResult.cancel) return;
await showFutureLoadingDialog(
@ -81,7 +81,7 @@ class ChatListItem extends StatelessWidget {
final backgroundColor =
activeChat ? theme.colorScheme.secondaryContainer : null;
final displayname = room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!),
MatrixLocals(L10n.of(context)),
);
final filter = this.filter;
if (filter != null && !displayname.toLowerCase().contains(filter)) {
@ -272,7 +272,7 @@ class ChatListItem extends StatelessWidget {
Expanded(
child: room.isSpace && room.membership == Membership.join
? Text(
L10n.of(context)!.countChatsAndCountParticipants(
L10n.of(context).countChatsAndCountParticipants(
room.spaceChildren.length.toString(),
(room.summary.mJoinedMemberCount ?? 1).toString(),
),
@ -292,7 +292,7 @@ class ChatListItem extends StatelessWidget {
),
future: needLastEventSender
? lastEvent.calcLocalizedBody(
MatrixLocals(L10n.of(context)!),
MatrixLocals(L10n.of(context)),
hideReply: true,
hideEdit: true,
plaintextBody: true,
@ -304,7 +304,7 @@ class ChatListItem extends StatelessWidget {
: null,
initialData:
lastEvent?.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!),
MatrixLocals(L10n.of(context)),
hideReply: true,
hideEdit: true,
plaintextBody: true,
@ -316,10 +316,10 @@ class ChatListItem extends StatelessWidget {
builder: (context, snapshot) => Text(
room.membership == Membership.invite
? isDirectChat
? L10n.of(context)!.invitePrivateChat
: L10n.of(context)!.inviteGroupChat
? L10n.of(context).invitePrivateChat
: L10n.of(context).inviteGroupChat
: snapshot.data ??
L10n.of(context)!.emptyChat,
L10n.of(context).emptyChat,
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis,

View file

@ -85,7 +85,7 @@ class ChatListView extends StatelessWidget {
onTap: controller.clearActiveSpace,
icon: const Icon(Icons.forum_outlined),
selectedIcon: const Icon(Icons.forum),
toolTip: L10n.of(context)!.chats,
toolTip: L10n.of(context).chats,
unreadBadgeFilter: (room) => true,
);
}
@ -95,13 +95,13 @@ class ChatListView extends StatelessWidget {
isSelected: false,
onTap: () => context.go('/rooms/newspace'),
icon: const Icon(Icons.add),
toolTip: L10n.of(context)!.createNewSpace,
toolTip: L10n.of(context).createNewSpace,
);
}
final space = rootSpaces[i];
final displayname =
rootSpaces[i].getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!),
MatrixLocals(L10n.of(context)),
);
final spaceChildrenIds =
space.spaceChildren.map((c) => c.roomId).toSet();
@ -144,7 +144,7 @@ class ChatListView extends StatelessWidget {
LogicalKeyboardKey.keyN,
},
onKeysPressed: () => context.go('/rooms/newprivatechat'),
helpLabel: L10n.of(context)!.newChat,
helpLabel: L10n.of(context).newChat,
child: selectMode == SelectMode.normal &&
!controller.isSearchMode &&
controller.activeSpaceId == null
@ -153,7 +153,7 @@ class ChatListView extends StatelessWidget {
context.go('/rooms/newprivatechat'),
icon: const Icon(Icons.add_outlined),
label: Text(
L10n.of(context)!.chat,
L10n.of(context).chat,
overflow: TextOverflow.fade,
),
)

View file

@ -34,7 +34,7 @@ class ClientChooserButton extends StatelessWidget {
children: [
const Icon(Icons.group_add_outlined),
const SizedBox(width: 18),
Text(L10n.of(context)!.createGroup),
Text(L10n.of(context).createGroup),
],
),
),
@ -44,7 +44,7 @@ class ClientChooserButton extends StatelessWidget {
children: [
const Icon(Icons.workspaces_outlined),
const SizedBox(width: 18),
Text(L10n.of(context)!.createNewSpace),
Text(L10n.of(context).createNewSpace),
],
),
),
@ -54,7 +54,7 @@ class ClientChooserButton extends StatelessWidget {
children: [
const Icon(Icons.edit_outlined),
const SizedBox(width: 18),
Text(L10n.of(context)!.setStatus),
Text(L10n.of(context).setStatus),
],
),
),
@ -64,7 +64,7 @@ class ClientChooserButton extends StatelessWidget {
children: [
Icon(Icons.adaptive.share_outlined),
const SizedBox(width: 18),
Text(L10n.of(context)!.inviteContact),
Text(L10n.of(context).inviteContact),
],
),
),
@ -86,7 +86,7 @@ class ClientChooserButton extends StatelessWidget {
children: [
const Icon(Icons.settings_outlined),
const SizedBox(width: 18),
Text(L10n.of(context)!.settings),
Text(L10n.of(context).settings),
],
),
),
@ -156,7 +156,7 @@ class ClientChooserButton extends StatelessWidget {
children: [
const Icon(Icons.person_add_outlined),
const SizedBox(width: 18),
Text(L10n.of(context)!.addAccount),
Text(L10n.of(context).addAccount),
],
),
),
@ -178,7 +178,7 @@ class ClientChooserButton extends StatelessWidget {
clientCount,
(index) => KeyBoardShortcuts(
keysToPress: _buildKeyboardShortcut(index + 1),
helpLabel: L10n.of(context)!.switchToAccount(index + 1),
helpLabel: L10n.of(context).switchToAccount(index + 1),
onKeysPressed: () => _handleKeyboardShortcut(
matrix,
index,
@ -192,7 +192,7 @@ class ClientChooserButton extends StatelessWidget {
LogicalKeyboardKey.controlLeft,
LogicalKeyboardKey.tab,
},
helpLabel: L10n.of(context)!.nextAccount,
helpLabel: L10n.of(context).nextAccount,
onKeysPressed: () => _nextAccount(matrix, context),
child: const SizedBox.shrink(),
),
@ -202,7 +202,7 @@ class ClientChooserButton extends StatelessWidget {
LogicalKeyboardKey.shiftLeft,
LogicalKeyboardKey.tab,
},
helpLabel: L10n.of(context)!.previousAccount,
helpLabel: L10n.of(context).previousAccount,
onKeysPressed: () => _previousAccount(matrix, context),
child: const SizedBox.shrink(),
),
@ -249,10 +249,10 @@ class ClientChooserButton extends StatelessWidget {
case SettingsAction.addAccount:
final consent = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context)!.addAccount,
message: L10n.of(context)!.enableMultiAccounts,
okLabel: L10n.of(context)!.next,
cancelLabel: L10n.of(context)!.cancel,
title: L10n.of(context).addAccount,
message: L10n.of(context).enableMultiAccounts,
okLabel: L10n.of(context).next,
cancelLabel: L10n.of(context).cancel,
);
if (consent != OkCancelResult.ok) return;
context.go('/rooms/settings/addaccount');

View file

@ -132,10 +132,10 @@ class _SpaceViewState extends State<SpaceView> {
final confirmed = await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context)!.areYouSure,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
message: L10n.of(context)!.archiveRoomDescription,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
message: L10n.of(context).archiveRoomDescription,
);
if (!mounted) return;
if (confirmed != OkCancelResult.ok) return;
@ -153,15 +153,15 @@ class _SpaceViewState extends State<SpaceView> {
void _addChatOrSubspace() async {
final roomType = await showConfirmationDialog(
context: context,
title: L10n.of(context)!.addChatOrSubSpace,
title: L10n.of(context).addChatOrSubSpace,
actions: [
AlertDialogAction(
key: AddRoomType.subspace,
label: L10n.of(context)!.createNewSpace,
label: L10n.of(context).createNewSpace,
),
AlertDialogAction(
key: AddRoomType.chat,
label: L10n.of(context)!.createGroup,
label: L10n.of(context).createGroup,
),
],
);
@ -170,32 +170,32 @@ class _SpaceViewState extends State<SpaceView> {
final names = await showTextInputDialog(
context: context,
title: roomType == AddRoomType.subspace
? L10n.of(context)!.createNewSpace
: L10n.of(context)!.createGroup,
? L10n.of(context).createNewSpace
: L10n.of(context).createGroup,
textFields: [
DialogTextField(
hintText: roomType == AddRoomType.subspace
? L10n.of(context)!.spaceName
: L10n.of(context)!.groupName,
? L10n.of(context).spaceName
: L10n.of(context).groupName,
minLines: 1,
maxLines: 1,
maxLength: 64,
validator: (text) {
if (text == null || text.isEmpty) {
return L10n.of(context)!.pleaseChoose;
return L10n.of(context).pleaseChoose;
}
return null;
},
),
DialogTextField(
hintText: L10n.of(context)!.chatDescription,
hintText: L10n.of(context).chatDescription,
minLines: 4,
maxLines: 8,
maxLength: 255,
),
],
okLabel: L10n.of(context)!.create,
cancelLabel: L10n.of(context)!.cancel,
okLabel: L10n.of(context).create,
cancelLabel: L10n.of(context).cancel,
);
if (names == null) return;
final client = Matrix.of(context).client;
@ -245,7 +245,7 @@ class _SpaceViewState extends State<SpaceView> {
final room = Matrix.of(context).client.getRoomById(widget.spaceId);
final displayname =
room?.getLocalizedDisplayname() ?? L10n.of(context)!.nothingFound;
room?.getLocalizedDisplayname() ?? L10n.of(context).nothingFound;
return Scaffold(
appBar: AppBar(
leading: Center(
@ -269,7 +269,7 @@ class _SpaceViewState extends State<SpaceView> {
subtitle: room == null
? null
: Text(
L10n.of(context)!.countChatsAndCountParticipants(
L10n.of(context).countChatsAndCountParticipants(
room.spaceChildren.length,
room.summary.mJoinedMemberCount ?? 1,
),
@ -288,7 +288,7 @@ class _SpaceViewState extends State<SpaceView> {
children: [
const Icon(Icons.settings_outlined),
const SizedBox(width: 12),
Text(L10n.of(context)!.settings),
Text(L10n.of(context).settings),
],
),
),
@ -299,7 +299,7 @@ class _SpaceViewState extends State<SpaceView> {
children: [
const Icon(Icons.person_add_outlined),
const SizedBox(width: 12),
Text(L10n.of(context)!.invite),
Text(L10n.of(context).invite),
],
),
),
@ -310,7 +310,7 @@ class _SpaceViewState extends State<SpaceView> {
children: [
const Icon(Icons.delete_outlined),
const SizedBox(width: 12),
Text(L10n.of(context)!.leave),
Text(L10n.of(context).leave),
],
),
),
@ -368,7 +368,7 @@ class _SpaceViewState extends State<SpaceView> {
borderRadius: BorderRadius.circular(99),
),
contentPadding: EdgeInsets.zero,
hintText: L10n.of(context)!.search,
hintText: L10n.of(context).search,
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
@ -453,7 +453,7 @@ class _SpaceViewState extends State<SpaceView> {
child: Icon(Icons.add_outlined),
),
title: Text(
L10n.of(context)!.addChatOrSubSpace,
L10n.of(context).addChatOrSubSpace,
style: const TextStyle(fontSize: 14),
),
),
@ -461,7 +461,7 @@ class _SpaceViewState extends State<SpaceView> {
),
],
SearchTitle(
title: L10n.of(context)!.joinedChats,
title: L10n.of(context).joinedChats,
icon: const Icon(Icons.chat_outlined),
),
],
@ -486,7 +486,7 @@ class _SpaceViewState extends State<SpaceView> {
itemBuilder: (context, i) {
if (i == 0) {
return SearchTitle(
title: L10n.of(context)!.discover,
title: L10n.of(context).discover,
icon: const Icon(Icons.explore_outlined),
);
}
@ -497,7 +497,7 @@ class _SpaceViewState extends State<SpaceView> {
padding: const EdgeInsets.all(12.0),
child: Center(
child: Text(
L10n.of(context)!.noMoreChatsFound,
L10n.of(context).noMoreChatsFound,
style: const TextStyle(fontSize: 13),
),
),
@ -516,14 +516,14 @@ class _SpaceViewState extends State<SpaceView> {
AppConfig.borderRadius,
),
)
: Text(L10n.of(context)!.loadMore),
: Text(L10n.of(context).loadMore),
),
);
}
final item = _discoveredChildren[i];
final displayname = item.name ??
item.canonicalAlias ??
L10n.of(context)!.emptyChat;
L10n.of(context).emptyChat;
if (!displayname.toLowerCase().contains(filter)) {
return const SizedBox.shrink();
}
@ -564,7 +564,7 @@ class _SpaceViewState extends State<SpaceView> {
),
subtitle: Text(
item.topic ??
L10n.of(context)!.countParticipants(
L10n.of(context).countParticipants(
item.numJoinedMembers,
),
maxLines: 1,