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

@ -37,9 +37,9 @@ class ChatSearchFilesTab extends StatelessWidget {
const CircularProgressIndicator.adaptive(strokeWidth: 2),
const SizedBox(height: 8),
Text(
L10n.of(context)!.searchIn(
L10n.of(context).searchIn(
room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!),
MatrixLocals(L10n.of(context)),
),
),
),
@ -53,7 +53,7 @@ class ChatSearchFilesTab extends StatelessWidget {
children: [
const Icon(Icons.file_present_outlined, size: 64),
const SizedBox(height: 8),
Text(L10n.of(context)!.nothingFound),
Text(L10n.of(context).nothingFound),
],
);
}
@ -93,7 +93,7 @@ class ChatSearchFilesTab extends StatelessWidget {
icon: const Icon(
Icons.arrow_downward_outlined,
),
label: Text(L10n.of(context)!.searchMore),
label: Text(L10n.of(context).searchMore),
),
),
);
@ -101,7 +101,7 @@ class ChatSearchFilesTab extends StatelessWidget {
final event = events[i];
final filename = event.content.tryGet<String>('filename') ??
event.content.tryGet<String>('body') ??
L10n.of(context)!.unknownEvent('File');
L10n.of(context).unknownEvent('File');
final filetype = (filename.contains('.')
? filename.split('.').last.toUpperCase()
: event.content

View file

@ -37,9 +37,9 @@ class ChatSearchImagesTab extends StatelessWidget {
const CircularProgressIndicator.adaptive(strokeWidth: 2),
const SizedBox(height: 8),
Text(
L10n.of(context)!.searchIn(
L10n.of(context).searchIn(
room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!),
MatrixLocals(L10n.of(context)),
),
),
),
@ -52,7 +52,7 @@ class ChatSearchImagesTab extends StatelessWidget {
children: [
const Icon(Icons.photo_outlined, size: 64),
const SizedBox(height: 8),
Text(L10n.of(context)!.nothingFound),
Text(L10n.of(context).nothingFound),
],
);
}
@ -102,7 +102,7 @@ class ChatSearchImagesTab extends StatelessWidget {
icon: const Icon(
Icons.arrow_downward_outlined,
),
label: Text(L10n.of(context)!.searchMore),
label: Text(L10n.of(context).searchMore),
),
),
);

View file

@ -41,9 +41,9 @@ class ChatSearchMessageTab extends StatelessWidget {
const Icon(Icons.search_outlined, size: 64),
const SizedBox(height: 8),
Text(
L10n.of(context)!.searchIn(
L10n.of(context).searchIn(
room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!),
MatrixLocals(L10n.of(context)),
),
),
),
@ -90,7 +90,7 @@ class ChatSearchMessageTab extends StatelessWidget {
icon: const Icon(
Icons.arrow_downward_outlined,
),
label: Text(L10n.of(context)!.searchMore),
label: Text(L10n.of(context).searchMore),
),
),
);
@ -98,7 +98,7 @@ class ChatSearchMessageTab extends StatelessWidget {
final event = events[i];
final sender = event.senderFromMemoryOrFallback;
final displayname = sender.calcDisplayname(
i18n: MatrixLocals(L10n.of(context)!),
i18n: MatrixLocals(L10n.of(context)),
);
return _MessageSearchResultListTile(
sender: sender,
@ -164,7 +164,7 @@ class _MessageSearchResultListTile extends StatelessWidget {
plaintextBody: true,
removeMarkdown: true,
MatrixLocals(
L10n.of(context)!,
L10n.of(context),
),
)
.trim(),

View file

@ -20,12 +20,11 @@ class ChatSearchView extends StatelessWidget {
final room = controller.room;
if (room == null) {
return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.oopsSomethingWentWrong)),
appBar: AppBar(title: Text(L10n.of(context).oopsSomethingWentWrong)),
body: Center(
child: Padding(
padding: const EdgeInsets.all(16),
child:
Text(L10n.of(context)!.youAreNoLongerParticipatingInThisChat),
child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
),
),
);
@ -38,8 +37,8 @@ class ChatSearchView extends StatelessWidget {
leading: const Center(child: BackButton()),
titleSpacing: 0,
title: Text(
L10n.of(context)!.searchIn(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
L10n.of(context).searchIn(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
),
),
),
@ -59,7 +58,7 @@ class ChatSearchView extends StatelessWidget {
autofocus: true,
enabled: controller.tabController.index == 0,
decoration: InputDecoration(
hintText: L10n.of(context)!.search,
hintText: L10n.of(context).search,
suffixIcon: const Icon(Icons.search_outlined),
filled: true,
fillColor: theme.colorScheme.secondaryContainer,
@ -77,9 +76,9 @@ class ChatSearchView extends StatelessWidget {
TabBar(
controller: controller.tabController,
tabs: [
Tab(child: Text(L10n.of(context)!.messages)),
Tab(child: Text(L10n.of(context)!.gallery)),
Tab(child: Text(L10n.of(context)!.files)),
Tab(child: Text(L10n.of(context).messages)),
Tab(child: Text(L10n.of(context).gallery)),
Tab(child: Text(L10n.of(context).files)),
],
),
Expanded(