refactor: Update to Dart 3.10 with . shorthands
This commit is contained in:
parent
75a37f3f7c
commit
1ea649f01e
167 changed files with 3351 additions and 3912 deletions
|
|
@ -59,10 +59,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
|||
.tryGetMap<String, Object?>('org.matrix.msc2965.authentication')
|
||||
?.tryGet<String>('account');
|
||||
if (accountManageUrl != null) {
|
||||
launchUrlString(
|
||||
accountManageUrl,
|
||||
mode: LaunchMode.inAppBrowserView,
|
||||
);
|
||||
launchUrlString(accountManageUrl, mode: LaunchMode.inAppBrowserView);
|
||||
return;
|
||||
}
|
||||
if (await showOkCancelAlertDialog(
|
||||
|
|
@ -86,10 +83,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
|||
context: context,
|
||||
delay: false,
|
||||
future: () => matrix.client.uiaRequestBackground(
|
||||
(auth) => matrix.client.deleteDevices(
|
||||
deviceIds,
|
||||
auth: auth,
|
||||
),
|
||||
(auth) => matrix.client.deleteDevices(deviceIds, auth: auth),
|
||||
),
|
||||
);
|
||||
reload();
|
||||
|
|
@ -106,9 +100,9 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
|||
if (displayName == null) return;
|
||||
final success = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context)
|
||||
.client
|
||||
.updateDevice(device.deviceId, displayName: displayName),
|
||||
future: () => Matrix.of(
|
||||
context,
|
||||
).client.updateDevice(device.deviceId, displayName: displayName),
|
||||
);
|
||||
if (success.error == null) {
|
||||
reload();
|
||||
|
|
@ -130,8 +124,10 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
|||
.deviceKeys[device.deviceId]!
|
||||
.startVerification();
|
||||
req.onUpdate = () {
|
||||
if ({KeyVerificationState.error, KeyVerificationState.done}
|
||||
.contains(req.state)) {
|
||||
if ({
|
||||
KeyVerificationState.error,
|
||||
KeyVerificationState.done,
|
||||
}.contains(req.state)) {
|
||||
setState(() {});
|
||||
}
|
||||
};
|
||||
|
|
@ -162,9 +158,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
|||
bool _isOwnDevice(Device userDevice) =>
|
||||
userDevice.deviceId == Matrix.of(context).client.deviceID;
|
||||
|
||||
Device? get thisDevice => devices!.firstWhereOrNull(
|
||||
_isOwnDevice,
|
||||
);
|
||||
Device? get thisDevice => devices!.firstWhereOrNull(_isOwnDevice);
|
||||
|
||||
List<Device> get notThisDevice => List<Device>.from(devices!)
|
||||
..removeWhere(_isOwnDevice)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class DevicesSettingsView extends StatelessWidget {
|
|||
if (snapshot.hasError) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisSize: .min,
|
||||
children: <Widget>[
|
||||
const Icon(Icons.error_outlined),
|
||||
Text(snapshot.error.toString()),
|
||||
|
|
@ -47,7 +47,7 @@ class DevicesSettingsView extends StatelessWidget {
|
|||
itemBuilder: (BuildContext context, int i) {
|
||||
if (i == 0) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
if (controller.chatBackupEnabled == false)
|
||||
Padding(
|
||||
|
|
@ -57,8 +57,9 @@ class DevicesSettingsView extends StatelessWidget {
|
|||
child: Icon(Icons.info_outlined),
|
||||
),
|
||||
subtitle: Text(
|
||||
L10n.of(context)
|
||||
.noticeChatBackupDeviceVerification,
|
||||
L10n.of(
|
||||
context,
|
||||
).noticeChatBackupDeviceVerification,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -9,13 +9,7 @@ import '../../utils/date_time_extension.dart';
|
|||
import '../../utils/matrix_sdk_extensions/device_extension.dart';
|
||||
import '../../widgets/matrix.dart';
|
||||
|
||||
enum UserDeviceListItemAction {
|
||||
rename,
|
||||
remove,
|
||||
verify,
|
||||
block,
|
||||
unblock,
|
||||
}
|
||||
enum UserDeviceListItemAction { rename, remove, verify, block, unblock }
|
||||
|
||||
class UserDeviceListItem extends StatelessWidget {
|
||||
final Device userDevice;
|
||||
|
|
@ -38,7 +32,8 @@ class UserDeviceListItem extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final client = Matrix.of(context).client;
|
||||
final keys = client.userDeviceKeys[Matrix.of(context).client.userID]
|
||||
final keys = client
|
||||
.userDeviceKeys[Matrix.of(context).client.userID]
|
||||
?.deviceKeys[userDevice.deviceId];
|
||||
final isOwnDevice = userDevice.deviceId == client.deviceID;
|
||||
|
||||
|
|
@ -113,10 +108,10 @@ class UserDeviceListItem extends StatelessWidget {
|
|||
backgroundColor: keys == null
|
||||
? Colors.grey[700]
|
||||
: keys.blocked
|
||||
? Colors.red
|
||||
: keys.verified
|
||||
? Colors.green
|
||||
: Colors.orange,
|
||||
? Colors.red
|
||||
: keys.verified
|
||||
? Colors.green
|
||||
: Colors.orange,
|
||||
child: Icon(userDevice.icon),
|
||||
),
|
||||
title: Text(
|
||||
|
|
@ -126,8 +121,9 @@ class UserDeviceListItem extends StatelessWidget {
|
|||
),
|
||||
subtitle: Text(
|
||||
L10n.of(context).lastActiveAgo(
|
||||
DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs ?? 0)
|
||||
.localizedTimeShort(context),
|
||||
DateTime.fromMillisecondsSinceEpoch(
|
||||
userDevice.lastSeenTs ?? 0,
|
||||
).localizedTimeShort(context),
|
||||
),
|
||||
style: const TextStyle(fontWeight: FontWeight.w300),
|
||||
),
|
||||
|
|
@ -137,14 +133,14 @@ class UserDeviceListItem extends StatelessWidget {
|
|||
keys.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
|
||||
: keys.verified
|
||||
? Colors.green
|
||||
: Colors.orange,
|
||||
? Colors.green
|
||||
: Colors.orange,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue