@@ -190,12 +190,22 @@ class FilcAPI {
|
||||
|
||||
static Future<void> sendReport(ErrorReport report) async {
|
||||
try {
|
||||
http.Response res = await http.post(Uri.parse(reportApi), body: {
|
||||
Map body = {
|
||||
"os": report.os,
|
||||
"version": report.version,
|
||||
"error": report.error,
|
||||
"stack_trace": report.stack,
|
||||
});
|
||||
};
|
||||
|
||||
var client = http.Client();
|
||||
|
||||
http.Response res = await client.post(
|
||||
Uri.parse(reportApi),
|
||||
body: body,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
);
|
||||
|
||||
if (res.statusCode != 200) {
|
||||
throw "HTTP ${res.statusCode}: ${res.body}";
|
||||
@@ -213,6 +223,8 @@ class FilcAPI {
|
||||
theme.json['background_color'] = theme.backgroundColor.value.toString();
|
||||
theme.json['panels_color'] = theme.panelsColor.value.toString();
|
||||
theme.json['accent_color'] = theme.accentColor.value.toString();
|
||||
theme.json['icon_color'] = theme.iconColor.value.toString();
|
||||
theme.json['shadow_effect'] = theme.shadowEffect.toString();
|
||||
|
||||
// set linked grade colors
|
||||
theme.json['grade_colors_id'] = theme.gradeColors.id;
|
||||
|
||||
@@ -15,7 +15,8 @@ const settingsDB = DatabaseStruct("settings", {
|
||||
"accent_color": int, "news": int, "seen_news": String,
|
||||
"developer_mode": int,
|
||||
"update_channel": int, "config": String, "custom_accent_color": int,
|
||||
"custom_background_color": int, "custom_highlight_color": int, // general
|
||||
"custom_background_color": int, "custom_highlight_color": int,
|
||||
"custom_icon_color": int, "shadow_effect": int, // general
|
||||
"grade_color1": int, "grade_color2": int, "grade_color3": int,
|
||||
"grade_color4": int, "grade_color5": int, // grade colors
|
||||
"vibration_strength": int, "ab_weeks": int, "swap_ab_weeks": int,
|
||||
|
||||
@@ -22,7 +22,8 @@ class SubjectIconData {
|
||||
});
|
||||
}
|
||||
|
||||
SubjectIconVariants createIcon({required IconData material, required IconData cupertino}) {
|
||||
SubjectIconVariants createIcon(
|
||||
{required IconData material, required IconData cupertino}) {
|
||||
return {
|
||||
IconPack.material: material,
|
||||
IconPack.cupertino: cupertino,
|
||||
@@ -30,88 +31,224 @@ SubjectIconVariants createIcon({required IconData material, required IconData cu
|
||||
}
|
||||
|
||||
class SubjectIcon {
|
||||
static String resolveName({Subject? subject, String? subjectName}) => _resolve(subject: subject, subjectName: subjectName).name;
|
||||
static IconData resolveVariant({Subject? subject, String? subjectName, required BuildContext context}) =>
|
||||
_resolve(subject: subject, subjectName: subjectName).data[Provider.of<SettingsProvider>(context, listen: false).iconPack]!;
|
||||
static String resolveName({GradeSubject? subject, String? subjectName}) =>
|
||||
_resolve(subject: subject, subjectName: subjectName).name;
|
||||
static IconData resolveVariant(
|
||||
{GradeSubject? subject,
|
||||
String? subjectName,
|
||||
required BuildContext context}) =>
|
||||
_resolve(subject: subject, subjectName: subjectName).data[
|
||||
Provider.of<SettingsProvider>(context, listen: false).iconPack]!;
|
||||
|
||||
static SubjectIconData _resolve({Subject? subject, String? subjectName}) {
|
||||
static SubjectIconData _resolve(
|
||||
{GradeSubject? subject, String? subjectName}) {
|
||||
assert(!(subject == null && subjectName == null));
|
||||
|
||||
String name = (subject?.name ?? subjectName ?? "").toLowerCase().specialChars().trim();
|
||||
String category = subject?.category.description.toLowerCase().specialChars() ?? "";
|
||||
String name = (subject?.name ?? subjectName ?? "")
|
||||
.toLowerCase()
|
||||
.specialChars()
|
||||
.trim();
|
||||
String category =
|
||||
subject?.category.description.toLowerCase().specialChars() ?? "";
|
||||
|
||||
// todo: check for categories
|
||||
if (RegExp("mate(k|matika)").hasMatch(name) || category == "matematika") {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.function, material: Icons.calculate_outlined), name: "function");
|
||||
} else if (RegExp("magyar nyelv|nyelvtan").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.textformat_alt, material: Icons.spellcheck_outlined), name: "textformat.alt");
|
||||
} else if (RegExp("irodalom").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.book, material: Icons.menu_book_outlined), name: "book");
|
||||
} else if (RegExp("tor(i|tenelem)").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.compass, material: Icons.hourglass_empty_outlined), name: "safari");
|
||||
} else if (RegExp("foldrajz").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.map, material: Icons.public_outlined), name: "map");
|
||||
} else if (RegExp("rajz|muvtori|muveszet|vizualis").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.paintbrush, material: Icons.palette_outlined), name: "paintbrush");
|
||||
} else if (RegExp("fizika").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.lightbulb, material: Icons.emoji_objects_outlined), name: "lightbulb");
|
||||
} else if (RegExp("^enek|zene|szolfezs|zongora|korus").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.music_note, material: Icons.music_note_outlined), name: "music.note");
|
||||
} else if (RegExp("^tes(i|tneveles)|sport").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.sportscourt, material: Icons.sports_soccer_outlined), name: "sportscourt");
|
||||
} else if (RegExp("kemia").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.lab_flask, material: Icons.science_outlined), name: "testtube.2");
|
||||
} else if (RegExp("biologia").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.paw, material: Icons.pets_outlined), name: "pawprint");
|
||||
} else if (RegExp("kornyezet|termeszet ?(tudomany|ismeret)|hon( es nep)?ismeret").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(cupertino: CupertinoIcons.arrow_3_trianglepath, material: Icons.eco_outlined), name: "arrow.3.trianglepath");
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.function,
|
||||
material: Icons.calculate_outlined),
|
||||
name: "function");
|
||||
} else if (RegExp("magyar nyelv|nyelvtan").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.textformat_alt,
|
||||
material: Icons.spellcheck_outlined),
|
||||
name: "textformat.alt");
|
||||
} else if (RegExp("irodalom").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.book,
|
||||
material: Icons.menu_book_outlined),
|
||||
name: "book");
|
||||
} else if (RegExp("tor(i|tenelem)").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.compass,
|
||||
material: Icons.hourglass_empty_outlined),
|
||||
name: "safari");
|
||||
} else if (RegExp("foldrajz").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.map, material: Icons.public_outlined),
|
||||
name: "map");
|
||||
} else if (RegExp("rajz|muvtori|muveszet|vizualis").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.paintbrush,
|
||||
material: Icons.palette_outlined),
|
||||
name: "paintbrush");
|
||||
} else if (RegExp("fizika").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.lightbulb,
|
||||
material: Icons.emoji_objects_outlined),
|
||||
name: "lightbulb");
|
||||
} else if (RegExp("^enek|zene|szolfezs|zongora|korus").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.music_note,
|
||||
material: Icons.music_note_outlined),
|
||||
name: "music.note");
|
||||
} else if (RegExp("^tes(i|tneveles)|sport").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.sportscourt,
|
||||
material: Icons.sports_soccer_outlined),
|
||||
name: "sportscourt");
|
||||
} else if (RegExp("kemia").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.lab_flask,
|
||||
material: Icons.science_outlined),
|
||||
name: "testtube.2");
|
||||
} else if (RegExp("biologia").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.paw, material: Icons.pets_outlined),
|
||||
name: "pawprint");
|
||||
} else if (RegExp(
|
||||
"kornyezet|termeszet ?(tudomany|ismeret)|hon( es nep)?ismeret")
|
||||
.hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.arrow_3_trianglepath,
|
||||
material: Icons.eco_outlined),
|
||||
name: "arrow.3.trianglepath");
|
||||
} else if (RegExp("(hit|erkolcs)tan|vallas|etika").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.heart, material: Icons.favorite_border_outlined), name: "heart");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.heart,
|
||||
material: Icons.favorite_border_outlined),
|
||||
name: "heart");
|
||||
} else if (RegExp("penzugy").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.money_dollar, material: Icons.savings_outlined), name: "dollarsign");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.money_dollar,
|
||||
material: Icons.savings_outlined),
|
||||
name: "dollarsign");
|
||||
} else if (RegExp("informatika|szoftver|iroda|digitalis").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.device_laptop, material: Icons.computer_outlined), name: "laptopcomputer");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.device_laptop,
|
||||
material: Icons.computer_outlined),
|
||||
name: "laptopcomputer");
|
||||
} else if (RegExp("prog").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(cupertino: CupertinoIcons.chevron_left_slash_chevron_right, material: Icons.code_outlined),
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.chevron_left_slash_chevron_right,
|
||||
material: Icons.code_outlined),
|
||||
name: "chevron.left.forwardslash.chevron.right");
|
||||
} else if (RegExp("halozat").hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(cupertino: CupertinoIcons.antenna_radiowaves_left_right, material: Icons.wifi_tethering_outlined),
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.antenna_radiowaves_left_right,
|
||||
material: Icons.wifi_tethering_outlined),
|
||||
name: "antenna.radiowaves.left.and.right");
|
||||
} else if (RegExp("szinhaz").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.hifispeaker, material: Icons.theater_comedy_outlined), name: "hifispeaker");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.hifispeaker,
|
||||
material: Icons.theater_comedy_outlined),
|
||||
name: "hifispeaker");
|
||||
} else if (RegExp("film|media").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.film, material: Icons.theaters_outlined), name: "film");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.film,
|
||||
material: Icons.theaters_outlined),
|
||||
name: "film");
|
||||
} else if (RegExp("elektro(tech)?nika").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.bolt, material: Icons.electrical_services_outlined), name: "bolt");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.bolt,
|
||||
material: Icons.electrical_services_outlined),
|
||||
name: "bolt");
|
||||
} else if (RegExp("gepesz|mernok|ipar").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.wrench, material: Icons.precision_manufacturing_outlined), name: "wrench");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.wrench,
|
||||
material: Icons.precision_manufacturing_outlined),
|
||||
name: "wrench");
|
||||
} else if (RegExp("technika").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.hammer, material: Icons.build_outlined), name: "hammer");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.hammer, material: Icons.build_outlined),
|
||||
name: "hammer");
|
||||
} else if (RegExp("tanc").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.music_mic, material: Icons.speaker_outlined), name: "music.mic");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.music_mic,
|
||||
material: Icons.speaker_outlined),
|
||||
name: "music.mic");
|
||||
} else if (RegExp("filozofia").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.bubble_left, material: Icons.psychology_outlined), name: "bubble.left");
|
||||
} else if (RegExp("osztaly(fonoki|kozosseg)").hasMatch(name) || name == "ofo") {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.group, material: Icons.groups_outlined), name: "person.3");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.bubble_left,
|
||||
material: Icons.psychology_outlined),
|
||||
name: "bubble.left");
|
||||
} else if (RegExp("osztaly(fonoki|kozosseg)").hasMatch(name) ||
|
||||
name == "ofo") {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.group, material: Icons.groups_outlined),
|
||||
name: "person.3");
|
||||
} else if (RegExp("gazdasag").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.chart_pie, material: Icons.account_balance_outlined), name: "chart.pie");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.chart_pie,
|
||||
material: Icons.account_balance_outlined),
|
||||
name: "chart.pie");
|
||||
} else if (RegExp("szorgalom").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.checkmark_seal, material: Icons.verified_outlined), name: "checkmark.seal");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.checkmark_seal,
|
||||
material: Icons.verified_outlined),
|
||||
name: "checkmark.seal");
|
||||
} else if (RegExp("magatartas").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.smiley, material: Icons.emoji_people_outlined), name: "face.smiling");
|
||||
} else if (RegExp("angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|nyelv").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.globe, material: Icons.translate_outlined), name: "globe");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.smiley,
|
||||
material: Icons.emoji_people_outlined),
|
||||
name: "face.smiling");
|
||||
} else if (RegExp(
|
||||
"angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|nyelv")
|
||||
.hasMatch(name)) {
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.globe,
|
||||
material: Icons.translate_outlined),
|
||||
name: "globe");
|
||||
} else if (RegExp("linux").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(material: FilcIcons.linux, cupertino: FilcIcons.linux));
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
material: FilcIcons.linux, cupertino: FilcIcons.linux));
|
||||
} else if (RegExp("adatbazis").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.table_badge_more, material: Icons.table_chart), name: "table.badge.more");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.table_badge_more,
|
||||
material: Icons.table_chart),
|
||||
name: "table.badge.more");
|
||||
} else if (RegExp("asztali alkalmazasok").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.macwindow, material: Icons.desktop_windows_outlined), name: "macwindow");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.macwindow,
|
||||
material: Icons.desktop_windows_outlined),
|
||||
name: "macwindow");
|
||||
} else if (RegExp("projekt").hasMatch(name)) {
|
||||
return SubjectIconData(data: createIcon(cupertino: CupertinoIcons.person_3_fill, material: Icons.groups_3), name: "person.3.fill");
|
||||
return SubjectIconData(
|
||||
data: createIcon(
|
||||
cupertino: CupertinoIcons.person_3_fill,
|
||||
material: Icons.groups_3),
|
||||
name: "person.3.fill");
|
||||
}
|
||||
|
||||
return SubjectIconData();
|
||||
@@ -119,10 +256,13 @@ class SubjectIcon {
|
||||
}
|
||||
|
||||
class ShortSubject {
|
||||
static String resolve({Subject? subject, String? subjectName}) {
|
||||
static String resolve({GradeSubject? subject, String? subjectName}) {
|
||||
assert(!(subject == null && subjectName == null));
|
||||
|
||||
String name = (subject?.name ?? subjectName ?? "").toLowerCase().specialChars().trim();
|
||||
String name = (subject?.name ?? subjectName ?? "")
|
||||
.toLowerCase()
|
||||
.specialChars()
|
||||
.trim();
|
||||
// String category = subject?.category.description.toLowerCase().specialChars() ?? "";
|
||||
|
||||
if (RegExp("magyar irodalom").hasMatch(name)) {
|
||||
@@ -137,7 +277,9 @@ class ShortSubject {
|
||||
return "Tesi";
|
||||
} else if (RegExp("tortenelem").hasMatch(name)) {
|
||||
return "Töri";
|
||||
} else if (RegExp("(angol|nemet|francia|olasz|orosz|spanyol|latin|kinai) nyelv").hasMatch(name)) {
|
||||
} else if (RegExp(
|
||||
"(angol|nemet|francia|olasz|orosz|spanyol|latin|kinai) nyelv")
|
||||
.hasMatch(name)) {
|
||||
return (subject?.name ?? subjectName ?? "?").replaceAll(" nyelv", "");
|
||||
} else if (RegExp("informatika").hasMatch(name)) {
|
||||
return "Infó";
|
||||
|
||||
@@ -67,6 +67,8 @@ class SettingsProvider extends ChangeNotifier {
|
||||
Color _customAccentColor;
|
||||
Color _customBackgroundColor;
|
||||
Color _customHighlightColor;
|
||||
Color _customIconColor;
|
||||
bool _shadowEffect;
|
||||
List<String> _premiumScopes;
|
||||
String _premiumAccessToken;
|
||||
String _premiumLogin;
|
||||
@@ -112,6 +114,8 @@ class SettingsProvider extends ChangeNotifier {
|
||||
required Color customAccentColor,
|
||||
required Color customBackgroundColor,
|
||||
required Color customHighlightColor,
|
||||
required Color customIconColor,
|
||||
required bool shadowEffect,
|
||||
required List<String> premiumScopes,
|
||||
required String premiumAccessToken,
|
||||
required String premiumLogin,
|
||||
@@ -155,6 +159,8 @@ class SettingsProvider extends ChangeNotifier {
|
||||
_customAccentColor = customAccentColor,
|
||||
_customBackgroundColor = customBackgroundColor,
|
||||
_customHighlightColor = customHighlightColor,
|
||||
_customIconColor = customIconColor,
|
||||
_shadowEffect = shadowEffect,
|
||||
_premiumScopes = premiumScopes,
|
||||
_premiumAccessToken = premiumAccessToken,
|
||||
_premiumLogin = premiumLogin,
|
||||
@@ -217,6 +223,8 @@ class SettingsProvider extends ChangeNotifier {
|
||||
customAccentColor: Color(map["custom_accent_color"]),
|
||||
customBackgroundColor: Color(map["custom_background_color"]),
|
||||
customHighlightColor: Color(map["custom_highlight_color"]),
|
||||
customIconColor: Color(map["custom_icon_color"]),
|
||||
shadowEffect: map["shadow_effect"] == 1,
|
||||
premiumScopes: jsonDecode(map["premium_scopes"]).cast<String>(),
|
||||
premiumAccessToken: map["premium_token"],
|
||||
premiumLogin: map["premium_login"],
|
||||
@@ -267,6 +275,8 @@ class SettingsProvider extends ChangeNotifier {
|
||||
"custom_accent_color": _customAccentColor.value,
|
||||
"custom_background_color": _customBackgroundColor.value,
|
||||
"custom_highlight_color": _customHighlightColor.value,
|
||||
"custom_icon_color": _customIconColor.value,
|
||||
"shadow_effect": _shadowEffect ? 1 : 0,
|
||||
"premium_scopes": jsonEncode(_premiumScopes),
|
||||
"premium_token": _premiumAccessToken,
|
||||
"premium_login": _premiumLogin,
|
||||
@@ -321,6 +331,8 @@ class SettingsProvider extends ChangeNotifier {
|
||||
customAccentColor: const Color(0xff3D7BF4),
|
||||
customBackgroundColor: const Color(0xff000000),
|
||||
customHighlightColor: const Color(0xff222222),
|
||||
customIconColor: const Color(0x00000000),
|
||||
shadowEffect: true,
|
||||
premiumScopes: [PremiumScopes.all],
|
||||
premiumAccessToken: "igen",
|
||||
premiumLogin: "igen",
|
||||
@@ -370,6 +382,8 @@ class SettingsProvider extends ChangeNotifier {
|
||||
: _customAccentColor;
|
||||
Color? get customBackgroundColor => _customBackgroundColor;
|
||||
Color? get customHighlightColor => _customHighlightColor;
|
||||
Color? get customIconColor => _customIconColor;
|
||||
bool get shadowEffect => _shadowEffect;
|
||||
List<String> get premiumScopes => _premiumScopes;
|
||||
String get premiumAccessToken => _premiumAccessToken;
|
||||
String get premiumLogin => _premiumLogin;
|
||||
@@ -415,6 +429,8 @@ class SettingsProvider extends ChangeNotifier {
|
||||
Color? customAccentColor,
|
||||
Color? customBackgroundColor,
|
||||
Color? customHighlightColor,
|
||||
Color? customIconColor,
|
||||
bool? shadowEffect,
|
||||
List<String>? premiumScopes,
|
||||
String? premiumAccessToken,
|
||||
String? premiumLogin,
|
||||
@@ -511,6 +527,12 @@ class SettingsProvider extends ChangeNotifier {
|
||||
customHighlightColor != _customHighlightColor) {
|
||||
_customHighlightColor = customHighlightColor;
|
||||
}
|
||||
if (customIconColor != null && customIconColor != _customIconColor) {
|
||||
_customIconColor = customIconColor;
|
||||
}
|
||||
if (shadowEffect != null && shadowEffect != _shadowEffect) {
|
||||
_shadowEffect = shadowEffect;
|
||||
}
|
||||
if (premiumScopes != null && premiumScopes != _premiumScopes) {
|
||||
_premiumScopes = premiumScopes;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ class SharedTheme {
|
||||
Color backgroundColor;
|
||||
Color panelsColor;
|
||||
Color accentColor;
|
||||
Color iconColor;
|
||||
bool shadowEffect;
|
||||
SharedGradeColors gradeColors;
|
||||
|
||||
SharedTheme({
|
||||
@@ -18,6 +20,8 @@ class SharedTheme {
|
||||
required this.backgroundColor,
|
||||
required this.panelsColor,
|
||||
required this.accentColor,
|
||||
required this.iconColor,
|
||||
required this.shadowEffect,
|
||||
required this.gradeColors,
|
||||
});
|
||||
|
||||
@@ -30,6 +34,8 @@ class SharedTheme {
|
||||
backgroundColor: Color(json['background_color']),
|
||||
panelsColor: Color(json['panels_color']),
|
||||
accentColor: Color(json['accent_color']),
|
||||
iconColor: Color(json['icon_color']),
|
||||
shadowEffect: json['shadow_effect'] ?? true,
|
||||
gradeColors: gradeColors,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,17 +5,21 @@ enum SubjectLessonCountUpdateState { ready, updating }
|
||||
|
||||
class SubjectLessonCount {
|
||||
DateTime lastUpdated;
|
||||
Map<Subject, int> subjects;
|
||||
Map<GradeSubject, int> subjects;
|
||||
SubjectLessonCountUpdateState state;
|
||||
|
||||
SubjectLessonCount({required this.lastUpdated, required this.subjects, this.state = SubjectLessonCountUpdateState.ready});
|
||||
SubjectLessonCount(
|
||||
{required this.lastUpdated,
|
||||
required this.subjects,
|
||||
this.state = SubjectLessonCountUpdateState.ready});
|
||||
|
||||
factory SubjectLessonCount.fromMap(Map json) {
|
||||
return SubjectLessonCount(
|
||||
lastUpdated: DateTime.fromMillisecondsSinceEpoch(json["last_updated"] ?? 0),
|
||||
lastUpdated:
|
||||
DateTime.fromMillisecondsSinceEpoch(json["last_updated"] ?? 0),
|
||||
subjects: ((json["subjects"] as Map?) ?? {}).map(
|
||||
(key, value) => MapEntry(
|
||||
Subject(id: key, name: "", category: Category.fromJson({})),
|
||||
GradeSubject(id: key, name: "", category: Category.fromJson({})),
|
||||
value,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -214,19 +214,21 @@ Widget filterItemBuilder(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
offset: const Offset(0, 21),
|
||||
blurRadius: 23.0,
|
||||
color: Theme.of(context).shadowColor.withOpacity(
|
||||
Theme.of(context).shadowColor.opacity *
|
||||
CurvedAnimation(
|
||||
parent: CurvedAnimation(
|
||||
parent: animation,
|
||||
curve: Curves.easeInOutCubic),
|
||||
curve: const Interval(2 / 3, 1.0),
|
||||
).value,
|
||||
),
|
||||
),
|
||||
if (Provider.of<SettingsProvider>(context, listen: false)
|
||||
.shadowEffect)
|
||||
BoxShadow(
|
||||
offset: const Offset(0, 21),
|
||||
blurRadius: 23.0,
|
||||
color: Theme.of(context).shadowColor.withOpacity(
|
||||
Theme.of(context).shadowColor.opacity *
|
||||
CurvedAnimation(
|
||||
parent: CurvedAnimation(
|
||||
parent: animation,
|
||||
curve: Curves.easeInOutCubic),
|
||||
curve: const Interval(2 / 3, 1.0),
|
||||
).value,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: child,
|
||||
|
||||
@@ -34,8 +34,7 @@ class GradeTile extends StatelessWidget {
|
||||
|
||||
GradeCalculatorProvider calculatorProvider =
|
||||
Provider.of<GradeCalculatorProvider>(context, listen: false);
|
||||
SettingsProvider settingsProvider =
|
||||
Provider.of<SettingsProvider>(context);
|
||||
SettingsProvider settingsProvider = Provider.of<SettingsProvider>(context);
|
||||
// Test order:
|
||||
// description
|
||||
// mode
|
||||
@@ -50,7 +49,8 @@ class GradeTile extends StatelessWidget {
|
||||
}
|
||||
} else {
|
||||
title = subjectName;
|
||||
isTitleItalic = grade.subject.isRenamed && settingsProvider.renamedSubjectsItalics;
|
||||
isTitleItalic =
|
||||
grade.subject.isRenamed && settingsProvider.renamedSubjectsItalics;
|
||||
}
|
||||
|
||||
// Test order:
|
||||
@@ -62,7 +62,9 @@ class GradeTile extends StatelessWidget {
|
||||
? modeDescription
|
||||
: ""
|
||||
: subjectName;
|
||||
isSubtitleItalic = isSubjectView ? false : grade.subject.isRenamed && settingsProvider.renamedSubjectsItalics;
|
||||
isSubtitleItalic = isSubjectView
|
||||
? false
|
||||
: grade.subject.isRenamed && settingsProvider.renamedSubjectsItalics;
|
||||
} else {
|
||||
subtitle = grade.value.valueName.split("(")[0];
|
||||
}
|
||||
@@ -127,9 +129,7 @@ class GradeTile extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontStyle: isTitleItalic
|
||||
? FontStyle.italic
|
||||
: null),
|
||||
fontStyle: isTitleItalic ? FontStyle.italic : null),
|
||||
),
|
||||
subtitle: subtitle != ""
|
||||
? censored
|
||||
@@ -149,7 +149,10 @@ class GradeTile extends StatelessWidget {
|
||||
subtitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontWeight: FontWeight.w500, fontStyle: isSubtitleItalic ? FontStyle.italic : null),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontStyle:
|
||||
isSubtitleItalic ? FontStyle.italic : null),
|
||||
)
|
||||
: null,
|
||||
trailing: isSubjectView
|
||||
@@ -210,8 +213,8 @@ class GradeValueWidget extends StatelessWidget {
|
||||
GradeValue value = this.value;
|
||||
bool isSubjectView = SubjectGradesContainer.of(context) != null;
|
||||
|
||||
Color color =
|
||||
this.color ?? gradeColor(context: context, value: value.value, nocolor: nocolor);
|
||||
Color color = this.color ??
|
||||
gradeColor(context: context, value: value.value, nocolor: nocolor);
|
||||
Widget valueText;
|
||||
final percentage = value.percentage;
|
||||
|
||||
@@ -283,7 +286,9 @@ class GradeValueWidget extends StatelessWidget {
|
||||
color: color.withOpacity(contrast ? 1.0 : .25),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
if (shadow)
|
||||
if (shadow &&
|
||||
Provider.of<SettingsProvider>(context, listen: false)
|
||||
.shadowEffect)
|
||||
BoxShadow(
|
||||
color: color,
|
||||
blurRadius: 62.0,
|
||||
|
||||
Reference in New Issue
Block a user