Android Feature Optimization and Updates
Build Android Release / Build Android (push) Failing after 7s
Build Android Release / Build Android (push) Failing after 7s
This commit is contained in:
@@ -19,23 +19,55 @@ class QuickAccessConfig {
|
||||
this.isDefault = false,
|
||||
});
|
||||
|
||||
QuickAccessConfig copyWith({String? label, String? path, IconData? icon, Color? color}) =>
|
||||
QuickAccessConfig(
|
||||
id: id,
|
||||
label: label ?? this.label,
|
||||
icon: icon ?? this.icon,
|
||||
path: path ?? this.path,
|
||||
color: color ?? this.color,
|
||||
isDefault: isDefault,
|
||||
);
|
||||
QuickAccessConfig copyWith({
|
||||
String? label,
|
||||
String? path,
|
||||
IconData? icon,
|
||||
Color? color,
|
||||
}) => QuickAccessConfig(
|
||||
id: id,
|
||||
label: label ?? this.label,
|
||||
icon: icon ?? this.icon,
|
||||
path: path ?? this.path,
|
||||
color: color ?? this.color,
|
||||
isDefault: isDefault,
|
||||
);
|
||||
|
||||
static const storageKey = 'quick_access_shortcuts_v2';
|
||||
|
||||
static const defaults = [
|
||||
QuickAccessConfig(id: 'img', label: '图片', icon: LucideIcons.image, path: '/Images', color: Color(0xFFF0ABFC), isDefault: true),
|
||||
QuickAccessConfig(id: 'vid', label: '视频', icon: LucideIcons.video, path: '/Videos', color: Color(0xFFFCD34D), isDefault: true),
|
||||
QuickAccessConfig(id: 'doc', label: '文档', icon: LucideIcons.fileText, path: '/Documents', color: Color(0xFF93C5FD), isDefault: true),
|
||||
QuickAccessConfig(id: 'mus', label: '音乐', icon: LucideIcons.music, path: '/Music', color: Color(0xFF86EFAC), isDefault: true),
|
||||
QuickAccessConfig(
|
||||
id: 'img',
|
||||
label: '图片',
|
||||
icon: LucideIcons.image,
|
||||
path: 'cloudreve://my?category=image',
|
||||
color: Color(0xFFF0ABFC),
|
||||
isDefault: true,
|
||||
),
|
||||
QuickAccessConfig(
|
||||
id: 'vid',
|
||||
label: '视频',
|
||||
icon: LucideIcons.video,
|
||||
path: 'cloudreve://my?category=video',
|
||||
color: Color(0xFFFCD34D),
|
||||
isDefault: true,
|
||||
),
|
||||
QuickAccessConfig(
|
||||
id: 'doc',
|
||||
label: '文档',
|
||||
icon: LucideIcons.fileText,
|
||||
path: 'cloudreve://my?category=document',
|
||||
color: Color(0xFF93C5FD),
|
||||
isDefault: true,
|
||||
),
|
||||
QuickAccessConfig(
|
||||
id: 'mus',
|
||||
label: '音乐',
|
||||
icon: LucideIcons.music,
|
||||
path: 'cloudreve://my?category=audio',
|
||||
color: Color(0xFF86EFAC),
|
||||
isDefault: true,
|
||||
),
|
||||
];
|
||||
|
||||
static const iconPool = <IconData>[
|
||||
@@ -65,22 +97,24 @@ class QuickAccessConfig {
|
||||
];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'label': label,
|
||||
'iconCode': icon.codePoint,
|
||||
'path': path,
|
||||
'color': color.toARGB32(),
|
||||
'isDefault': isDefault,
|
||||
};
|
||||
'id': id,
|
||||
'label': label,
|
||||
'iconCode': icon.codePoint,
|
||||
'path': path,
|
||||
'color': color.toARGB32(),
|
||||
'isDefault': isDefault,
|
||||
};
|
||||
|
||||
factory QuickAccessConfig.fromJson(Map<String, dynamic> json) {
|
||||
final iconCode = json['iconCode'] as int? ?? LucideIcons.folder.codePoint;
|
||||
final matchedIcon = iconPool.cast<IconData?>().firstWhere(
|
||||
(i) => i!.codePoint == iconCode,
|
||||
orElse: () => LucideIcons.folder,
|
||||
)!;
|
||||
(i) => i!.codePoint == iconCode,
|
||||
orElse: () => LucideIcons.folder,
|
||||
)!;
|
||||
return QuickAccessConfig(
|
||||
id: json['id'] as String? ?? DateTime.now().millisecondsSinceEpoch.toString(),
|
||||
id:
|
||||
json['id'] as String? ??
|
||||
DateTime.now().millisecondsSinceEpoch.toString(),
|
||||
label: json['label'] as String,
|
||||
icon: matchedIcon,
|
||||
path: json['path'] as String,
|
||||
@@ -92,7 +126,9 @@ class QuickAccessConfig {
|
||||
static List<QuickAccessConfig> parseSaved(String saved) {
|
||||
try {
|
||||
final list = jsonDecode(saved) as List<dynamic>;
|
||||
return list.map((e) => QuickAccessConfig.fromJson(e as Map<String, dynamic>)).toList();
|
||||
return list
|
||||
.map((e) => QuickAccessConfig.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
} catch (_) {
|
||||
return List.from(defaults);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user