refactor: Remove dart from folder name
This commit is contained in:
parent
d29c6d60a3
commit
5cf18aabbf
40 changed files with 37 additions and 37 deletions
45
lib/utils/matrix_sdk_extensions/device_extension.dart
Normal file
45
lib/utils/matrix_sdk_extensions/device_extension.dart
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
IconData _getIconFromName(String displayname) {
|
||||
final name = displayname.toLowerCase();
|
||||
if ({'android'}.any((s) => name.contains(s))) {
|
||||
return Icons.phone_android_outlined;
|
||||
}
|
||||
if ({'ios', 'ipad', 'iphone', 'ipod'}.any((s) => name.contains(s))) {
|
||||
return Icons.phone_iphone_outlined;
|
||||
}
|
||||
if ({
|
||||
'web',
|
||||
'http://',
|
||||
'https://',
|
||||
'firefox',
|
||||
'chrome',
|
||||
'/_matrix',
|
||||
'safari',
|
||||
'opera',
|
||||
}.any((s) => name.contains(s))) {
|
||||
return Icons.web_outlined;
|
||||
}
|
||||
if ({'desktop', 'windows', 'macos', 'linux', 'ubuntu'}
|
||||
.any((s) => name.contains(s))) {
|
||||
return Icons.desktop_mac_outlined;
|
||||
}
|
||||
return Icons.device_unknown_outlined;
|
||||
}
|
||||
|
||||
extension DeviceExtension on Device {
|
||||
String get displayname =>
|
||||
(displayName?.isNotEmpty ?? false) ? displayName! : 'Unknown device';
|
||||
|
||||
IconData get icon => _getIconFromName(displayname);
|
||||
}
|
||||
|
||||
extension DeviceKeysExtension on DeviceKeys {
|
||||
String get displayname => (deviceDisplayName?.isNotEmpty ?? false)
|
||||
? deviceDisplayName!
|
||||
: 'Unknown device';
|
||||
|
||||
IconData get icon => _getIconFromName(displayname);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue