mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 10:06:23 +08:00
23
lib/models/common/theme/theme_color_type.dart
Normal file
23
lib/models/common/theme/theme_color_type.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const List<Map<String, dynamic>> colorThemeTypes = [
|
||||
{'color': Color(0xFF5CB67B), 'label': '默认绿'},
|
||||
{'color': Color(0xFFFF7299), 'label': '粉红色'},
|
||||
{'color': Colors.red, 'label': '红色'},
|
||||
{'color': Colors.orange, 'label': '橙色'},
|
||||
{'color': Colors.amber, 'label': '琥珀色'},
|
||||
{'color': Colors.yellow, 'label': '黄色'},
|
||||
{'color': Colors.lime, 'label': '酸橙色'},
|
||||
{'color': Colors.lightGreen, 'label': '浅绿色'},
|
||||
{'color': Colors.green, 'label': '绿色'},
|
||||
{'color': Colors.teal, 'label': '青色'},
|
||||
{'color': Colors.cyan, 'label': '蓝绿色'},
|
||||
{'color': Colors.lightBlue, 'label': '浅蓝色'},
|
||||
{'color': Colors.blue, 'label': '蓝色'},
|
||||
{'color': Colors.indigo, 'label': '靛蓝色'},
|
||||
{'color': Colors.purple, 'label': '紫色'},
|
||||
{'color': Colors.deepPurple, 'label': '深紫色'},
|
||||
{'color': Colors.blueGrey, 'label': '蓝灰色'},
|
||||
{'color': Colors.brown, 'label': '棕色'},
|
||||
{'color': Colors.grey, 'label': '灰色'},
|
||||
];
|
||||
26
lib/models/common/theme/theme_type.dart
Normal file
26
lib/models/common/theme/theme_type.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
|
||||
enum ThemeType {
|
||||
light,
|
||||
dark,
|
||||
system,
|
||||
}
|
||||
|
||||
extension ThemeTypeExt on ThemeType {
|
||||
String get description => const ['浅色', '深色', '跟随系统'][index];
|
||||
|
||||
int get code => index;
|
||||
|
||||
ThemeMode get toThemeMode => switch (this) {
|
||||
ThemeType.light => ThemeMode.light,
|
||||
ThemeType.dark => ThemeMode.dark,
|
||||
ThemeType.system => ThemeMode.system,
|
||||
};
|
||||
|
||||
IconData get iconData => switch (this) {
|
||||
ThemeType.light => MdiIcons.weatherSunny,
|
||||
ThemeType.dark => MdiIcons.weatherNight,
|
||||
ThemeType.system => MdiIcons.themeLightDark,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user