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

@ -38,12 +38,12 @@ class ChatView extends StatelessWidget {
if (controller.canEditSelectedEvents)
IconButton(
icon: const Icon(Icons.edit_outlined),
tooltip: L10n.of(context)!.edit,
tooltip: L10n.of(context).edit,
onPressed: controller.editSelectedEventAction,
),
IconButton(
icon: const Icon(Icons.copy_outlined),
tooltip: L10n.of(context)!.copy,
tooltip: L10n.of(context).copy,
onPressed: controller.copyEventsAction,
),
if (controller.canSaveSelectedEvent)
@ -51,7 +51,7 @@ class ChatView extends StatelessWidget {
Builder(
builder: (context) => IconButton(
icon: Icon(Icons.adaptive.share),
tooltip: L10n.of(context)!.share,
tooltip: L10n.of(context).share,
onPressed: () => controller.saveSelectedEvent(context),
),
),
@ -59,12 +59,12 @@ class ChatView extends StatelessWidget {
IconButton(
icon: const Icon(Icons.push_pin_outlined),
onPressed: controller.pinEvent,
tooltip: L10n.of(context)!.pinMessage,
tooltip: L10n.of(context).pinMessage,
),
if (controller.canRedactSelectedEvents)
IconButton(
icon: const Icon(Icons.delete_outlined),
tooltip: L10n.of(context)!.redactMessage,
tooltip: L10n.of(context).redactMessage,
onPressed: controller.redactEventsAction,
),
if (controller.selectedEvents.length == 1)
@ -88,7 +88,7 @@ class ChatView extends StatelessWidget {
children: [
const Icon(Icons.info_outlined),
const SizedBox(width: 12),
Text(L10n.of(context)!.messageInfo),
Text(L10n.of(context).messageInfo),
],
),
),
@ -103,7 +103,7 @@ class ChatView extends StatelessWidget {
color: Colors.red,
),
const SizedBox(width: 12),
Text(L10n.of(context)!.reportMessage),
Text(L10n.of(context).reportMessage),
],
),
),
@ -117,7 +117,7 @@ class ChatView extends StatelessWidget {
IconButton(
onPressed: controller.onPhoneButtonTap,
icon: const Icon(Icons.call_outlined),
tooltip: L10n.of(context)!.placeCall,
tooltip: L10n.of(context).placeCall,
),
EncryptionButton(controller.room),
ChatSettingsPopupMenu(controller.room, true),
@ -180,7 +180,7 @@ class ChatView extends StatelessWidget {
? IconButton(
icon: const Icon(Icons.close),
onPressed: controller.clearSelectedEvents,
tooltip: L10n.of(context)!.close,
tooltip: L10n.of(context).close,
color: theme.colorScheme.primary,
)
: StreamBuilder<Object>(
@ -213,7 +213,7 @@ class ChatView extends StatelessWidget {
),
trailing: TextButton(
onPressed: controller.goToNewRoomAction,
child: Text(L10n.of(context)!.goToTheNewRoom),
child: Text(L10n.of(context).goToTheNewRoom),
),
),
if (scrollUpBannerEventId != null)
@ -221,13 +221,13 @@ class ChatView extends StatelessWidget {
leading: IconButton(
color: theme.colorScheme.onSurfaceVariant,
icon: const Icon(Icons.close),
tooltip: L10n.of(context)!.close,
tooltip: L10n.of(context).close,
onPressed: () {
controller.discardScrollUpBannerEventId();
controller.setReadMarker();
},
),
title: L10n.of(context)!.jumpToLastReadMessage,
title: L10n.of(context).jumpToLastReadMessage,
trailing: TextButton(
onPressed: () {
controller.scrollToEventId(
@ -235,7 +235,7 @@ class ChatView extends StatelessWidget {
);
controller.discardScrollUpBannerEventId();
},
child: Text(L10n.of(context)!.jump),
child: Text(L10n.of(context).jump),
),
),
],
@ -333,7 +333,7 @@ class ChatView extends StatelessWidget {
),
onPressed: controller.leaveChat,
label: Text(
L10n.of(context)!.leave,
L10n.of(context).leave,
),
),
TextButton.icon(
@ -347,7 +347,7 @@ class ChatView extends StatelessWidget {
),
onPressed: controller.recreateChat,
label: Text(
L10n.of(context)!.reopenChat,
L10n.of(context).reopenChat,
),
),
],