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
|
|
@ -72,19 +72,19 @@ class _CuteContentState extends State<CuteContent> {
|
|||
generateLabel(User? user) {
|
||||
switch (widget.event.content['cute_type']) {
|
||||
case 'googly_eyes':
|
||||
return L10n.of(context)?.googlyEyesContent(
|
||||
return L10n.of(context).googlyEyesContent(
|
||||
user?.displayName ??
|
||||
widget.event.senderFromMemoryOrFallback.displayName ??
|
||||
'',
|
||||
);
|
||||
case 'cuddle':
|
||||
return L10n.of(context)?.cuddleContent(
|
||||
return L10n.of(context).cuddleContent(
|
||||
user?.displayName ??
|
||||
widget.event.senderFromMemoryOrFallback.displayName ??
|
||||
'',
|
||||
);
|
||||
case 'hug':
|
||||
return L10n.of(context)?.hugContent(
|
||||
return L10n.of(context).hugContent(
|
||||
user?.displayName ??
|
||||
widget.event.senderFromMemoryOrFallback.displayName ??
|
||||
'',
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ class Message extends StatelessWidget {
|
|||
horizontal: 8,
|
||||
),
|
||||
child: Text(
|
||||
L10n.of(context)!.readUpToHere,
|
||||
L10n.of(context).readUpToHere,
|
||||
style: TextStyle(color: theme.colorScheme.primary),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class MessageContent extends StatelessWidget {
|
|||
});
|
||||
|
||||
void _verifyOrRequestKey(BuildContext context) async {
|
||||
final l10n = L10n.of(context)!;
|
||||
final l10n = L10n.of(context);
|
||||
if (event.content['can_request_session'] != true) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
|
|
@ -184,7 +184,7 @@ class MessageContent extends StatelessWidget {
|
|||
textColor: buttonTextColor,
|
||||
onPressed: () => _verifyOrRequestKey(context),
|
||||
icon: '🔒',
|
||||
label: L10n.of(context)!.encrypted,
|
||||
label: L10n.of(context).encrypted,
|
||||
fontSize: fontSize,
|
||||
);
|
||||
case MessageTypes.Location:
|
||||
|
|
@ -213,7 +213,7 @@ class MessageContent extends StatelessWidget {
|
|||
onPressed:
|
||||
UrlLauncher(context, geoUri.toString()).launchUrl,
|
||||
label: Text(
|
||||
L10n.of(context)!.openInMaps,
|
||||
L10n.of(context).openInMaps,
|
||||
style: TextStyle(color: textColor),
|
||||
),
|
||||
),
|
||||
|
|
@ -233,11 +233,11 @@ class MessageContent extends StatelessWidget {
|
|||
event.redactedBecause?.content.tryGet<String>('reason');
|
||||
final redactedBy = snapshot.data?.calcDisplayname() ??
|
||||
event.redactedBecause?.senderId.localpart ??
|
||||
L10n.of(context)!.user;
|
||||
L10n.of(context).user;
|
||||
return _ButtonContent(
|
||||
label: reason == null
|
||||
? L10n.of(context)!.redactedBy(redactedBy)
|
||||
: L10n.of(context)!.redactedByBecause(
|
||||
? L10n.of(context).redactedBy(redactedBy)
|
||||
: L10n.of(context).redactedByBecause(
|
||||
redactedBy,
|
||||
reason,
|
||||
),
|
||||
|
|
@ -254,7 +254,7 @@ class MessageContent extends StatelessWidget {
|
|||
event.numberEmotes <= 10;
|
||||
return Linkify(
|
||||
text: event.calcLocalizedBodyFallback(
|
||||
MatrixLocals(L10n.of(context)!),
|
||||
MatrixLocals(L10n.of(context)),
|
||||
hideReply: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
|
|
@ -277,7 +277,7 @@ class MessageContent extends StatelessWidget {
|
|||
future: event.fetchSenderUser(),
|
||||
builder: (context, snapshot) {
|
||||
return _ButtonContent(
|
||||
label: L10n.of(context)!.startedACall(
|
||||
label: L10n.of(context).startedACall(
|
||||
snapshot.data?.calcDisplayname() ??
|
||||
event.senderFromMemoryOrFallback.calcDisplayname(),
|
||||
),
|
||||
|
|
@ -293,7 +293,7 @@ class MessageContent extends StatelessWidget {
|
|||
future: event.fetchSenderUser(),
|
||||
builder: (context, snapshot) {
|
||||
return _ButtonContent(
|
||||
label: L10n.of(context)!.userSentUnknownEvent(
|
||||
label: L10n.of(context).userSentUnknownEvent(
|
||||
snapshot.data?.calcDisplayname() ??
|
||||
event.senderFromMemoryOrFallback.calcDisplayname(),
|
||||
event.type,
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class ReplyContent extends StatelessWidget {
|
|||
),
|
||||
Text(
|
||||
displayEvent.calcLocalizedBodyFallback(
|
||||
MatrixLocals(L10n.of(context)!),
|
||||
MatrixLocals(L10n.of(context)),
|
||||
withSenderNamePrefix: false,
|
||||
hideReply: true,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class StateMessage extends StatelessWidget {
|
|||
padding: const EdgeInsets.all(8),
|
||||
child: Text(
|
||||
event.calcLocalizedBodyFallback(
|
||||
MatrixLocals(L10n.of(context)!),
|
||||
MatrixLocals(L10n.of(context)),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
|
|
|
|||
|
|
@ -58,10 +58,10 @@ class VerificationRequestContent extends StatelessWidget {
|
|||
canceled
|
||||
? 'Error ${cancel.first.content.tryGet<String>('code')}: ${cancel.first.content.tryGet<String>('reason')}'
|
||||
: (fullyDone
|
||||
? L10n.of(context)!.verifySuccess
|
||||
? L10n.of(context).verifySuccess
|
||||
: (started
|
||||
? L10n.of(context)!.loadingPleaseWait
|
||||
: L10n.of(context)!.newVerificationRequest)),
|
||||
? L10n.of(context).loadingPleaseWait
|
||||
: L10n.of(context).newVerificationRequest)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
)
|
||||
: const Icon(Icons.play_circle_outlined),
|
||||
tooltip: _isDownloading
|
||||
? L10n.of(context)!.loadingPleaseWait
|
||||
: L10n.of(context)!.videoWithSize(
|
||||
? L10n.of(context).loadingPleaseWait
|
||||
: L10n.of(context).videoWithSize(
|
||||
widget.event.sizeString ?? '?MB',
|
||||
),
|
||||
onPressed: _isDownloading ? null : _downloadAction,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue