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
|
|
@ -35,10 +35,10 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
|||
void removeDevicesAction(List<Device> devices) async {
|
||||
if (await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context)!.areYouSure,
|
||||
okLabel: L10n.of(context)!.yes,
|
||||
cancelLabel: L10n.of(context)!.cancel,
|
||||
message: L10n.of(context)!.removeDevicesDescription,
|
||||
title: L10n.of(context).areYouSure,
|
||||
okLabel: L10n.of(context).yes,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
message: L10n.of(context).removeDevicesDescription,
|
||||
) ==
|
||||
OkCancelResult.cancel) return;
|
||||
final matrix = Matrix.of(context);
|
||||
|
|
@ -70,9 +70,9 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
|||
void renameDeviceAction(Device device) async {
|
||||
final displayName = await showTextInputDialog(
|
||||
context: context,
|
||||
title: L10n.of(context)!.changeDeviceName,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
cancelLabel: L10n.of(context)!.cancel,
|
||||
title: L10n.of(context).changeDeviceName,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
hintText: device.displayName,
|
||||
|
|
@ -94,10 +94,10 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
|||
void verifyDeviceAction(Device device) async {
|
||||
final consent = await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context)!.verifyOtherDevice,
|
||||
message: L10n.of(context)!.verifyOtherDeviceDescription,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
cancelLabel: L10n.of(context)!.cancel,
|
||||
title: L10n.of(context).verifyOtherDevice,
|
||||
message: L10n.of(context).verifyOtherDeviceDescription,
|
||||
okLabel: L10n.of(context).ok,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
fullyCapitalizedForMaterial: false,
|
||||
);
|
||||
if (consent != OkCancelResult.ok) return;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class DevicesSettingsView extends StatelessWidget {
|
|||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const Center(child: BackButton()),
|
||||
title: Text(L10n.of(context)!.devices),
|
||||
title: Text(L10n.of(context).devices),
|
||||
),
|
||||
body: MaxWidthBody(
|
||||
child: FutureBuilder<bool>(
|
||||
|
|
@ -56,7 +56,7 @@ class DevicesSettingsView extends StatelessWidget {
|
|||
),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
L10n.of(context)!.thisDevice,
|
||||
L10n.of(context).thisDevice,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.colorScheme.primary,
|
||||
|
|
@ -84,7 +84,7 @@ class DevicesSettingsView extends StatelessWidget {
|
|||
child: TextButton.icon(
|
||||
label: Text(
|
||||
controller.errorDeletingDevices ??
|
||||
L10n.of(context)!.removeAllOtherDevices,
|
||||
L10n.of(context).removeAllOtherDevices,
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor:
|
||||
|
|
@ -109,7 +109,7 @@ class DevicesSettingsView extends StatelessWidget {
|
|||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Text(L10n.of(context)!.noOtherDevicesFound),
|
||||
child: Text(L10n.of(context).noOtherDevicesFound),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -55,30 +55,30 @@ class UserDeviceListItem extends StatelessWidget {
|
|||
actions: [
|
||||
SheetAction(
|
||||
key: UserDeviceListItemAction.rename,
|
||||
label: L10n.of(context)!.changeDeviceName,
|
||||
label: L10n.of(context).changeDeviceName,
|
||||
),
|
||||
if (!isOwnDevice && keys != null) ...{
|
||||
SheetAction(
|
||||
key: UserDeviceListItemAction.verify,
|
||||
label: L10n.of(context)!.verifyStart,
|
||||
label: L10n.of(context).verifyStart,
|
||||
),
|
||||
if (!keys.blocked)
|
||||
SheetAction(
|
||||
key: UserDeviceListItemAction.block,
|
||||
label: L10n.of(context)!.blockDevice,
|
||||
label: L10n.of(context).blockDevice,
|
||||
isDestructiveAction: true,
|
||||
),
|
||||
if (keys.blocked)
|
||||
SheetAction(
|
||||
key: UserDeviceListItemAction.unblock,
|
||||
label: L10n.of(context)!.unblockDevice,
|
||||
label: L10n.of(context).unblockDevice,
|
||||
isDestructiveAction: true,
|
||||
),
|
||||
},
|
||||
if (!isOwnDevice)
|
||||
SheetAction(
|
||||
key: UserDeviceListItemAction.remove,
|
||||
label: L10n.of(context)!.delete,
|
||||
label: L10n.of(context).delete,
|
||||
isDestructiveAction: true,
|
||||
),
|
||||
],
|
||||
|
|
@ -119,7 +119,7 @@ class UserDeviceListItem extends StatelessWidget {
|
|||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Text(
|
||||
L10n.of(context)!.lastActiveAgo(
|
||||
L10n.of(context).lastActiveAgo(
|
||||
DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs ?? 0)
|
||||
.localizedTimeShort(context),
|
||||
),
|
||||
|
|
@ -129,10 +129,10 @@ class UserDeviceListItem extends StatelessWidget {
|
|||
? null
|
||||
: Text(
|
||||
keys.blocked
|
||||
? L10n.of(context)!.blocked
|
||||
? L10n.of(context).blocked
|
||||
: keys.verified
|
||||
? L10n.of(context)!.verified
|
||||
: L10n.of(context)!.unverified,
|
||||
? L10n.of(context).verified
|
||||
: L10n.of(context).unverified,
|
||||
style: TextStyle(
|
||||
color: keys.blocked
|
||||
? Colors.red
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue