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
|
|
@ -44,7 +44,7 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(L10n.of(context)!.importEmojis),
|
||||
title: Text(L10n.of(context).importEmojis),
|
||||
content: _loading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
|
|
@ -73,7 +73,7 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
|
|||
actions: [
|
||||
TextButton(
|
||||
onPressed: _loading ? null : Navigator.of(context).pop,
|
||||
child: Text(L10n.of(context)!.cancel),
|
||||
child: Text(L10n.of(context).cancel),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _loading
|
||||
|
|
@ -81,7 +81,7 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
|
|||
: _importMap.isNotEmpty
|
||||
? _addEmotePack
|
||||
: null,
|
||||
child: Text(L10n.of(context)!.importNow),
|
||||
child: Text(L10n.of(context).importNow),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
@ -121,10 +121,10 @@ class _ImportEmoteArchiveDialogState extends State<ImportEmoteArchiveDialog> {
|
|||
final result = await showOkCancelAlertDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
title: L10n.of(context)!.emoteExists,
|
||||
title: L10n.of(context).emoteExists,
|
||||
message: imageCode,
|
||||
cancelLabel: L10n.of(context)!.replace,
|
||||
okLabel: L10n.of(context)!.skip,
|
||||
cancelLabel: L10n.of(context).replace,
|
||||
okLabel: L10n.of(context).skip,
|
||||
);
|
||||
completer.complete(result);
|
||||
});
|
||||
|
|
@ -242,7 +242,7 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> {
|
|||
IconButton(
|
||||
onPressed: widget.onRemove,
|
||||
icon: const Icon(Icons.remove_circle),
|
||||
tooltip: L10n.of(context)!.remove,
|
||||
tooltip: L10n.of(context).remove,
|
||||
),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: hasErrorNotifier,
|
||||
|
|
@ -278,7 +278,7 @@ class _EmojiImportPreviewState extends State<_EmojiImportPreview> {
|
|||
minLines: 1,
|
||||
maxLines: 1,
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.of(context)!.emoteShortcode,
|
||||
hintText: L10n.of(context).emoteShortcode,
|
||||
prefixText: ': ',
|
||||
suffixText: ':',
|
||||
border: const OutlineInputBorder(),
|
||||
|
|
@ -329,7 +329,7 @@ class _ImageFileError extends StatelessWidget {
|
|||
children: [
|
||||
const Icon(Icons.error),
|
||||
Text(
|
||||
L10n.of(context)!.notAnImage,
|
||||
L10n.of(context).notAnImage,
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.labelSmall,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||
showOkAlertDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
message: L10n.of(context)!.emoteExists,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
message: L10n.of(context).emoteExists,
|
||||
okLabel: L10n.of(context).ok,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
@ -149,8 +149,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||
showOkAlertDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
message: L10n.of(context)!.emoteInvalid,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
message: L10n.of(context).emoteInvalid,
|
||||
okLabel: L10n.of(context).ok,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
@ -185,8 +185,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||
await showOkAlertDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
message: L10n.of(context)!.emoteWarnNeedToPick,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
message: L10n.of(context).emoteWarnNeedToPick,
|
||||
okLabel: L10n.of(context).ok,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
@ -195,8 +195,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||
await showOkAlertDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
message: L10n.of(context)!.emoteExists,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
message: L10n.of(context).emoteExists,
|
||||
okLabel: L10n.of(context).ok,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
@ -204,8 +204,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||
await showOkAlertDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
message: L10n.of(context)!.emoteInvalid,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
message: L10n.of(context).emoteInvalid,
|
||||
okLabel: L10n.of(context).ok,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class EmotesSettingsView extends StatelessWidget {
|
|||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const Center(child: BackButton()),
|
||||
title: Text(L10n.of(context)!.customEmojisAndStickers),
|
||||
title: Text(L10n.of(context).customEmojisAndStickers),
|
||||
actions: [
|
||||
PopupMenuButton<PopupMenuEmojiActions>(
|
||||
onSelected: (value) {
|
||||
|
|
@ -43,11 +43,11 @@ class EmotesSettingsView extends StatelessWidget {
|
|||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
value: PopupMenuEmojiActions.import,
|
||||
child: Text(L10n.of(context)!.importFromZipFile),
|
||||
child: Text(L10n.of(context).importFromZipFile),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: PopupMenuEmojiActions.export,
|
||||
child: Text(L10n.of(context)!.exportEmotePack),
|
||||
child: Text(L10n.of(context).exportEmotePack),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -83,7 +83,7 @@ class EmotesSettingsView extends StatelessWidget {
|
|||
minLines: 1,
|
||||
maxLines: 1,
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.of(context)!.emoteShortcode,
|
||||
hintText: L10n.of(context).emoteShortcode,
|
||||
prefixText: ': ',
|
||||
suffixText: ':',
|
||||
prefixStyle: TextStyle(
|
||||
|
|
@ -114,7 +114,7 @@ class EmotesSettingsView extends StatelessWidget {
|
|||
),
|
||||
if (controller.room != null)
|
||||
SwitchListTile.adaptive(
|
||||
title: Text(L10n.of(context)!.enableEmotesGlobally),
|
||||
title: Text(L10n.of(context).enableEmotesGlobally),
|
||||
value: controller.isGloballyActive(client),
|
||||
onChanged: controller.setIsGloballyActive,
|
||||
),
|
||||
|
|
@ -125,7 +125,7 @@ class EmotesSettingsView extends StatelessWidget {
|
|||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(
|
||||
L10n.of(context)!.noEmotesFound,
|
||||
L10n.of(context).noEmotesFound,
|
||||
style: const TextStyle(fontSize: 20),
|
||||
),
|
||||
),
|
||||
|
|
@ -186,7 +186,7 @@ class EmotesSettingsView extends StatelessWidget {
|
|||
minLines: 1,
|
||||
maxLines: 1,
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.of(context)!.emoteShortcode,
|
||||
hintText: L10n.of(context).emoteShortcode,
|
||||
prefixText: ': ',
|
||||
suffixText: ':',
|
||||
prefixStyle: TextStyle(
|
||||
|
|
@ -269,7 +269,7 @@ class _ImagePickerState extends State<_ImagePicker> {
|
|||
if (widget.controller.value == null) {
|
||||
return ElevatedButton(
|
||||
onPressed: () => widget.onPressed(widget.controller),
|
||||
child: Text(L10n.of(context)!.pickImage),
|
||||
child: Text(L10n.of(context).pickImage),
|
||||
);
|
||||
} else {
|
||||
return _EmoteImage(widget.controller.value!.url);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue