3 Commits

11 changed files with 549 additions and 49 deletions

View File

@@ -6,6 +6,7 @@ import "package:firka/app/app_state.dart";
import "package:firka/app/initialization.dart"; import "package:firka/app/initialization.dart";
import "package:firka/services/live_activity_service.dart"; import "package:firka/services/live_activity_service.dart";
import "package:firka/services/watch_sync_helper.dart"; import "package:firka/services/watch_sync_helper.dart";
import "package:firka/ui/phone/screens/themes/builtin_theme_id.dart";
import "settings_repository.dart"; import "settings_repository.dart";
import "settings_schema.dart"; import "settings_schema.dart";
@@ -37,6 +38,24 @@ void registerSettingsEffects(
repo.onChange(SettingsRegistry.titleWeight, refreshTitleStyle); repo.onChange(SettingsRegistry.titleWeight, refreshTitleStyle);
repo.onChange(SettingsRegistry.titleCapitalization, refreshTitleStyle); repo.onChange(SettingsRegistry.titleCapitalization, refreshTitleStyle);
Future<void> refreshPresetTheme(_) async {
if (isBuiltinThemeId(Settings.selectedThemeId.value)) {
final next = composeBuiltinThemeId(
Settings.selectedCoreThemeId.value,
Settings.selectedGradeThemeId.value,
);
if (next != Settings.selectedThemeId.value) {
await Settings.selectedThemeId.setSilently(next);
}
}
initTheme(initData);
initData.themeCubit.refresh();
initData.homeRefreshCubit.requestRefresh();
}
repo.onChange(SettingsRegistry.selectedCoreThemeId, refreshPresetTheme);
repo.onChange(SettingsRegistry.selectedGradeThemeId, refreshPresetTheme);
repo.onChange(SettingsRegistry.wearOsSupport, (enabled) async { repo.onChange(SettingsRegistry.wearOsSupport, (enabled) async {
if (!Platform.isAndroid) return; if (!Platform.isAndroid) return;
if (enabled && initDone) { if (enabled && initDone) {

View File

@@ -23,6 +23,7 @@ import 'package:firka/core/debug_helper.dart';
import 'package:firka/core/state/firka_state.dart'; import 'package:firka/core/state/firka_state.dart';
import 'package:firka/ui/shared/firka_icon.dart'; import 'package:firka/ui/shared/firka_icon.dart';
import 'package:firka/ui/theme/style.dart'; import 'package:firka/ui/theme/style.dart';
import 'package:firka_common/ui/components/filled_circle.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:home_widget/home_widget.dart'; import 'package:home_widget/home_widget.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
@@ -319,6 +320,16 @@ class _DebugScreen extends FirkaState<DebugScreen> {
}, },
child: const Text('wipe users'), child: const Text('wipe users'),
), ),
const SizedBox(height: 20),
Wrap(
alignment: WrapAlignment.center,
spacing: 16,
runSpacing: 16,
children: [
for (final entry in _themeColorSwatches())
_themeColorSwatch(context, entry.$1, entry.$2),
],
),
SizedBox( SizedBox(
height: 600, height: 600,
child: GridView.count( child: GridView.count(
@@ -362,3 +373,70 @@ class _DebugScreen extends FirkaState<DebugScreen> {
); );
} }
} }
List<(String, Color)> _themeColorSwatches() {
final c = appStyle.colors;
return [
("background", c.background),
("backgroundAmoled", c.backgroundAmoled),
("background0p", c.background0p),
("success", c.success),
("textPrimary", c.textPrimary),
("textSecondary", c.textSecondary),
("textTertiary", c.textTertiary),
if (c.textTeritary != null) ("textTeritary", c.textTeritary!),
("textPrimaryLight", c.textPrimaryLight),
("textSecondaryLight", c.textSecondaryLight),
("textTertiaryLight", c.textTertiaryLight),
("card", c.card),
("cardTranslucent", c.cardTranslucent),
("buttonSecondaryFill", c.buttonSecondaryFill),
("buttonDisabledIcon", c.buttonDisabledIcon),
("accent", c.accent),
("secondary", c.secondary),
("shadowColor", c.shadowColor),
("a10p", c.a10p),
("a15p", c.a15p),
("warningAccent", c.warningAccent),
("warningText", c.warningText),
("warning15p", c.warning15p),
("warningCard", c.warningCard),
("errorAccent", c.errorAccent),
("errorText", c.errorText),
("error15p", c.error15p),
("errorCard", c.errorCard),
("grade5", c.grade5),
("grade4", c.grade4),
("grade3", c.grade3),
("grade2", c.grade2),
("grade1", c.grade1),
];
}
Widget _themeColorSwatch(BuildContext context, String name, Color color) {
final darkBg = color.computeLuminance() > 0.5;
final bg = darkBg ? const Color(0xFF121212) : const Color(0xFFF2F2F2);
final labelColor = darkBg ? const Color(0xFFF2F2F2) : const Color(0xFF121212);
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
decoration: BoxDecoration(
color: bg,
borderRadius: BorderRadius.circular(8),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
name,
style: TextTheme.of(context).bodySmall?.copyWith(color: labelColor),
),
FilledCircle(
diameter: 40,
color: color,
child: const SizedBox(),
),
],
),
);
}

View File

@@ -10,6 +10,8 @@ import "package:firka/l10n/app_localizations.dart";
import "package:firka/ui/shared/firka_icon.dart"; import "package:firka/ui/shared/firka_icon.dart";
import "package:firka/ui/theme/style.dart"; import "package:firka/ui/theme/style.dart";
import "package:firka_common/ui/components/firka_card.dart"; import "package:firka_common/ui/components/firka_card.dart";
import "package:firka_common/ui/theme/core_theme.dart";
import "package:firka_common/ui/theme/grade_theme.dart";
import "package:flutter/material.dart"; import "package:flutter/material.dart";
import "package:flutter_bloc/flutter_bloc.dart"; import "package:flutter_bloc/flutter_bloc.dart";
import "package:go_router/go_router.dart"; import "package:go_router/go_router.dart";
@@ -125,23 +127,66 @@ class _SettingsPersonalizationViewState
); );
} }
Widget _swatchPreview(List<Color> colors) { List<Color> _coreSwatch(CoreThemeColors colors) {
return FirkaCard.single( return [
width: double.infinity, colors.secondary,
padding: EdgeInsets.zero, colors.accent,
child: ClipRRect( colors.background,
borderRadius: BorderRadius.circular(16), colors.card,
child: SizedBox( ];
height: 88, }
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch, List<Color> _gradeSwatch(GradeThemeColors colors) {
children: [ return [
for (final color in colors) colors.grade5,
Expanded(child: ColoredBox(color: color)), colors.grade4,
], colors.grade3,
), colors.grade2,
), colors.grade1,
), ];
}
Widget _coreThemePager() {
final cores = coreThemes.values.toList(growable: false);
final selectedId = _settings.get(SettingsRegistry.selectedCoreThemeId);
var selectedIndex = cores.indexWhere((theme) => theme.id == selectedId);
if (selectedIndex < 0) selectedIndex = 0;
return _PresetSwatchPager(
key: const ValueKey("core-themes"),
swatches: [
for (final core in cores)
_coreSwatch(core.forBrightness(appStyle.isLight)),
],
selectedIndex: selectedIndex,
onSelected: (index) async {
await _settings.set(
SettingsRegistry.selectedCoreThemeId,
cores[index].id,
);
},
);
}
Widget _gradeThemePager() {
final grades = gradeThemes.values.toList(growable: false);
final selectedId = _settings.get(SettingsRegistry.selectedGradeThemeId);
var selectedIndex = grades.indexWhere((theme) => theme.id == selectedId);
if (selectedIndex < 0) selectedIndex = 0;
return _PresetSwatchPager(
key: const ValueKey("grade-themes"),
swatches: [
for (final grade in grades)
_gradeSwatch(grade.forBrightness(appStyle.isLight)),
],
selectedIndex: selectedIndex,
onSelected: (index) async {
await _settings.set(
SettingsRegistry.selectedGradeThemeId,
grades[index].id,
);
},
); );
} }
@@ -567,25 +612,14 @@ class _SettingsPersonalizationViewState
}, },
), ),
_sectionLabel(_l10n.s_c_colors_header), _sectionLabel(_l10n.s_c_colors_header),
_swatchPreview([ _coreThemePager(),
appStyle.colors.secondary,
appStyle.colors.accent,
appStyle.colors.background,
appStyle.colors.card,
]),
_stubCustomizeButton(), _stubCustomizeButton(),
_sectionLabel(_l10n.s_c_theme_header), _sectionLabel(_l10n.s_c_theme_header),
_themeOption(_l10n.s_c_theme_auto, ThemeBrightness.auto), _themeOption(_l10n.s_c_theme_auto, ThemeBrightness.auto),
_themeOption(_l10n.s_c_theme_light, ThemeBrightness.light), _themeOption(_l10n.s_c_theme_light, ThemeBrightness.light),
_themeOption(_l10n.s_c_theme_dark, ThemeBrightness.dark), _themeOption(_l10n.s_c_theme_dark, ThemeBrightness.dark),
_sectionLabel(_l10n.s_c_grade_colors_header), _sectionLabel(_l10n.s_c_grade_colors_header),
_swatchPreview([ _gradeThemePager(),
appStyle.colors.grade5,
appStyle.colors.grade4,
appStyle.colors.grade3,
appStyle.colors.grade2,
appStyle.colors.grade1,
]),
_stubCustomizeButton(), _stubCustomizeButton(),
_sectionLabel(_l10n.s_c_title_style_header), _sectionLabel(_l10n.s_c_title_style_header),
_fontPicker(selectedFont), _fontPicker(selectedFont),
@@ -599,3 +633,165 @@ class _SettingsPersonalizationViewState
); );
} }
} }
class _PresetSwatchPager extends StatefulWidget {
final List<List<Color>> swatches;
final int selectedIndex;
final ValueChanged<int> onSelected;
const _PresetSwatchPager({
super.key,
required this.swatches,
required this.selectedIndex,
required this.onSelected,
});
@override
State<_PresetSwatchPager> createState() => _PresetSwatchPagerState();
}
class _PresetSwatchPagerState extends State<_PresetSwatchPager> {
late final PageController _controller;
@override
void initState() {
super.initState();
_controller = PageController(initialPage: widget.selectedIndex);
}
@override
void didUpdateWidget(_PresetSwatchPager oldWidget) {
super.didUpdateWidget(oldWidget);
if (!_controller.hasClients) return;
if (widget.selectedIndex == oldWidget.selectedIndex) return;
if (_controller.page?.round() == widget.selectedIndex) return;
_controller.animateToPage(
widget.selectedIndex,
duration: const Duration(milliseconds: 200),
curve: Curves.easeOut,
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
Color _accentFor(double page) {
final index = page.round().clamp(0, widget.swatches.length - 1);
final swatch = widget.swatches[index];
if (swatch.length > 1) return swatch[1];
return appStyle.colors.accent;
}
@override
Widget build(BuildContext context) {
return FirkaCard.single(
width: double.infinity,
height: 88,
padding: EdgeInsets.zero,
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Stack(
fit: StackFit.expand,
children: [
PageView.builder(
controller: _controller,
itemCount: widget.swatches.length,
physics: widget.swatches.length <= 1
? const NeverScrollableScrollPhysics()
: null,
onPageChanged: (index) {
if (index == widget.selectedIndex) return;
widget.onSelected(index);
},
itemBuilder: (context, index) {
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
for (final color in widget.swatches[index])
Expanded(child: ColoredBox(color: color)),
],
);
},
),
if (widget.swatches.length > 1)
Positioned(
left: 0,
right: 0,
bottom: 8,
child: IgnorePointer(
child: AnimatedBuilder(
animation: _controller,
builder: (context, _) {
final page = _controller.hasClients
? (_controller.page ??
widget.selectedIndex.toDouble())
: widget.selectedIndex.toDouble();
return Center(
child: _SwatchPageDots(
count: widget.swatches.length,
page: page,
accent: _accentFor(page),
),
);
},
),
),
),
],
),
),
);
}
}
class _SwatchPageDots extends StatelessWidget {
final int count;
final double page;
final Color accent;
const _SwatchPageDots({
required this.count,
required this.page,
required this.accent,
});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
decoration: BoxDecoration(
color: const Color(0xCCFFFFFF),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
for (var i = 0; i < count; i++) ...[
if (i > 0) const SizedBox(width: 5),
_dot(i),
],
],
),
);
}
Widget _dot(int index) {
final t = (1 - (index - page).abs()).clamp(0.0, 1.0);
final size = 5.0 + 3.0 * t;
return Container(
width: size,
height: size,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color.lerp(
accent.withValues(alpha: 0.28),
accent,
t,
),
),
);
}
}

View File

@@ -19,6 +19,7 @@ class ThemePreviewData {
required this.messages, required this.messages,
required this.tests, required this.tests,
required this.grades, required this.grades,
required this.chartGrades,
required this.omissions, required this.omissions,
required this.omissionBarSegments, required this.omissionBarSegments,
required this.omissionExcusedCount, required this.omissionExcusedCount,
@@ -38,6 +39,7 @@ class ThemePreviewData {
final List<MessageCacheModel> messages; final List<MessageCacheModel> messages;
final List<TestCacheModel> tests; final List<TestCacheModel> tests;
final List<GradeCacheModel> grades; final List<GradeCacheModel> grades;
final List<GradeCacheModel> chartGrades;
final List<OmissionCacheModel> omissions; final List<OmissionCacheModel> omissions;
final List<OmissionState?> omissionBarSegments; final List<OmissionState?> omissionBarSegments;
final int omissionExcusedCount; final int omissionExcusedCount;
@@ -143,6 +145,7 @@ class ThemePreviewData {
start: ttBase.add(const Duration(minutes: 55)), start: ttBase.add(const Duration(minutes: 55)),
end: ttBase.add(const Duration(minutes: 100)), end: ttBase.add(const Duration(minutes: 100)),
roomName: "123", roomName: "123",
type: "UresOra",
test: testLektion, test: testLektion,
), ),
_lesson( _lesson(
@@ -207,6 +210,31 @@ class ThemePreviewData {
_grade(509, matematika, 5, midnight.subtract(const Duration(days: 15))), _grade(509, matematika, 5, midnight.subtract(const Duration(days: 15))),
]; ];
final sept = DateTime(
day.month >= DateTime.september ? day.year : day.year - 1,
DateTime.september,
15,
);
final chartSpanDays = day.difference(sept).inDays.clamp(1, 365);
const chartValues = [
1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
4, 4, 3, 3, 4, 4, 4, 4, 5, 5,
5, 4, 4, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
];
final chartGrades = [
for (var i = 0; i < chartValues.length; i++)
_grade(
700 + i,
matematika,
chartValues[i],
sept.add(
Duration(days: (i * chartSpanDays / (chartValues.length - 1)).round()),
),
),
];
final omissions = [ final omissions = [
_omission( _omission(
601, 601,
@@ -317,6 +345,7 @@ class ThemePreviewData {
messages: messages, messages: messages,
tests: [homeTest], tests: [homeTest],
grades: grades, grades: grades,
chartGrades: chartGrades,
omissions: omissions, omissions: omissions,
omissionBarSegments: omissionBarSegments, omissionBarSegments: omissionBarSegments,
omissionExcusedCount: 2, omissionExcusedCount: 2,
@@ -346,6 +375,7 @@ class ThemePreviewData {
required DateTime end, required DateTime end,
required String roomName, required String roomName,
String? substituteTeacher, String? substituteTeacher,
String type = "OrarendiOra",
TestCacheModel? test, TestCacheModel? test,
}) { }) {
final lesson = LessonCacheModel() final lesson = LessonCacheModel()
@@ -358,7 +388,7 @@ class ThemePreviewData {
..name = subject.name ..name = subject.name
..roomName = roomName ..roomName = roomName
..state = "Naplozott" ..state = "Naplozott"
..type = "OrarendiOra" ..type = type
..teacher = "Tanár" ..teacher = "Tanár"
..substituteTeacher = substituteTeacher; ..substituteTeacher = substituteTeacher;
lesson.subject.value = subject; lesson.subject.value = subject;
@@ -378,8 +408,9 @@ class ThemePreviewData {
int id, int id,
SubjectCacheModel subject, SubjectCacheModel subject,
int value, int value,
DateTime at, DateTime at, {
) { int? weightPercentage = 100,
}) {
final grade = GradeCacheModel() final grade = GradeCacheModel()
..cacheKey = id ..cacheKey = id
..createdAt = at ..createdAt = at
@@ -389,7 +420,7 @@ class ThemePreviewData {
..valueType = "Osztalyzat" ..valueType = "Osztalyzat"
..writtenAt = at ..writtenAt = at
..numericValue = value ..numericValue = value
..weightPercentage = 100 ..weightPercentage = weightPercentage
..textValue = value.toString() ..textValue = value.toString()
..teacherName = "Tanár"; ..teacherName = "Tanár";
grade.subject.value = subject; grade.subject.value = subject;

View File

@@ -167,9 +167,9 @@ class ThemePreviewHomeGrades extends StatelessWidget {
), ),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
GradeChart(grades: allGrades), GradeChart(grades: preview.chartGrades, plotRawValues: true),
const SizedBox(height: 10), const SizedBox(height: 10),
GradeSummaryBar(grades: allGrades, l10n: data.l10n), GradeSummaryBar(grades: preview.chartGrades, l10n: data.l10n),
const SizedBox(height: 20), const SizedBox(height: 20),
Expanded( Expanded(
child: ListView( child: ListView(

View File

@@ -13,10 +13,12 @@ import 'package:flutter/material.dart';
class GradeChart extends StatefulWidget { class GradeChart extends StatefulWidget {
final List<GradeCacheModel> grades; final List<GradeCacheModel> grades;
final bool halfYearFallback; final bool halfYearFallback;
final bool plotRawValues;
GradeChart({ GradeChart({
super.key, super.key,
required List<GradeCacheModel> grades, required List<GradeCacheModel> grades,
this.halfYearFallback = true, this.halfYearFallback = true,
this.plotRawValues = false,
}) : grades = grades.where((g) => g.hasClassicValue()).toList() }) : grades = grades.where((g) => g.hasClassicValue()).toList()
..sort((a, b) => a.writtenAt.compareTo(b.writtenAt)); ..sort((a, b) => a.writtenAt.compareTo(b.writtenAt));
@@ -49,19 +51,21 @@ class _GradeChartState extends State<GradeChart> {
void _computeSpots() { void _computeSpots() {
spots = []; spots = [];
for (var i = 0; i < widget.grades.length; i++) { if (!widget.plotRawValues) {
final grade = widget.grades[i]; for (var i = 0; i < widget.grades.length; i++) {
if (!grade.shouldIncludeInAverage()) { final grade = widget.grades[i];
continue; if (!grade.shouldIncludeInAverage()) {
continue;
}
final partialAvg = widget.grades
.take(i + 1)
.getSubjectAverage(halfYearFallback: widget.halfYearFallback);
spots.add(
DateSpot(spots.length.toDouble(), partialAvg!, grade.writtenAt),
);
} }
final partialAvg = widget.grades
.take(i + 1)
.getSubjectAverage(halfYearFallback: widget.halfYearFallback);
spots.add(
DateSpot(spots.length.toDouble(), partialAvg!, grade.writtenAt),
);
} }
if (spots.isEmpty) { if (spots.isEmpty) {

View File

@@ -0,0 +1,67 @@
part of "../core_theme.dart";
const butcherVanityCore = CoreTheme(
id: "butcher_vanity",
light: CoreThemeColors(
background: Color(0xFFF2F2F2),
backgroundAmoled: Colors.black,
background0p: Color(0x00F2F2F2),
success: Color(0xFF92EA3B),
shadowBlur: 2,
textPrimary: Color(0xFF0D0D0D),
textSecondary: Color(0xCC0D0D0D),
textTertiary: Color(0x800D0D0D),
textTeritary: Color(0xFFF23838),
textPrimaryLight: Color(0xFF0D0D0D),
textSecondaryLight: Color(0xCC0D0D0D),
textTertiaryLight: Color(0x800D0D0D),
card: Color(0xFFE8E8E8),
cardTranslucent: Color(0x80E8E8E8),
buttonSecondaryFill: Color(0xFFFFFFFF),
buttonDisabledIcon: Color(0xFFC2C2C2),
accent: Color(0xFFF2E205),
secondary: Color(0xFFF2CB05),
shadowColor: Color(0x330D0D0D),
a10p: Color(0x1AF2E205),
a15p: Color(0x26F2E205),
warningAccent: Color(0xFFF28D1F),
warningText: Color(0xFF8F4A0C),
warning15p: Color(0x26F28D1F),
warningCard: Color(0xFFFAE6D4),
errorAccent: Color(0xFFF23838),
errorText: Color(0xFF8F1B1B),
error15p: Color(0x26F23838),
errorCard: Color(0xFFFADCDC),
),
dark: CoreThemeColors(
background: Color(0xFF0D0D0D),
backgroundAmoled: Colors.black,
background0p: Color(0x00F2F2F2),
success: Color(0xFF92EA3B),
shadowBlur: 0,
textPrimary: Color(0xFFF2F2F2),
textSecondary: Color(0xB3F2F2F2),
textTertiary: Color(0x80F2F2F2),
textTeritary: Color(0xFFF23838),
textPrimaryLight: Color(0xFF0D0D0D),
textSecondaryLight: Color(0xCC0D0D0D),
textTertiaryLight: Color(0x800D0D0D),
card: Color(0xFF171717),
cardTranslucent: Color(0x80171717),
buttonSecondaryFill: Color(0xFF222222),
buttonDisabledIcon: Color(0xFF4A4A4A),
accent: Color(0xFFF2E205),
secondary: Color(0xFFF2CB05),
shadowColor: Color(0x26F2CB05),
a10p: Color(0x1AF2E205),
a15p: Color(0x26F2E205),
warningAccent: Color(0xFFF28D1F),
warningText: Color(0xFFF0B36A),
warning15p: Color(0x26F28D1F),
warningCard: Color(0xFF201403),
errorAccent: Color(0xFFF23838),
errorText: Color(0xFFF59E9E),
error15p: Color(0x26F23838),
errorCard: Color(0xFF1E0303),
),
);

View File

@@ -0,0 +1,67 @@
part of "../core_theme.dart";
const refilcCore = CoreTheme(
id: "refilc",
light: CoreThemeColors(
background: Color(0xFFD9E4F6),
backgroundAmoled: Colors.black,
background0p: Color(0x00D9E4F6),
success: Color(0xFF34C759),
shadowBlur: 2,
textPrimary: Color(0xFF0B121F),
textSecondary: Color(0xCC0B121F),
textTertiary: Color(0x800B121F),
textTeritary: Color(0xFF545C68),
textPrimaryLight: Color(0xFF0B121F),
textSecondaryLight: Color(0xCC0B121F),
textTertiaryLight: Color(0x800B121F),
card: Color(0xFFEDF3FF),
cardTranslucent: Color(0x80EDF3FF),
buttonSecondaryFill: Color(0xFFFFFFFF),
buttonDisabledIcon: Color(0xFFBCC7DA),
accent: Color(0xFF3C5AF5),
secondary: Color(0xFF2436A8),
shadowColor: Color(0x330B121F),
a10p: Color(0x1A3C5AF5),
a15p: Color(0x263C5AF5),
warningAccent: Color(0xFFFFA046),
warningText: Color(0xFF8F531B),
warning15p: Color(0x26FFA046),
warningCard: Color(0xFFFAEBDC),
errorAccent: Color(0xFFFF54A1),
errorText: Color(0xFF8F1B4F),
error15p: Color(0x26FF54A1),
errorCard: Color(0xFFFADCE9),
),
dark: CoreThemeColors(
background: Color(0xFF000000),
backgroundAmoled: Colors.black,
background0p: Color(0x00D9E4F6),
success: Color(0xFF32D74B),
shadowBlur: 0,
textPrimary: Color(0xFFF5F6FA),
textSecondary: Color(0xB3F5F6FA),
textTertiary: Color(0x80F5F6FA),
textTeritary: Color(0xFF9D9FA0),
textPrimaryLight: Color(0xFF0B121F),
textSecondaryLight: Color(0xCC0B121F),
textTertiaryLight: Color(0x800B121F),
card: Color(0xFF121619),
cardTranslucent: Color(0x80121619),
buttonSecondaryFill: Color(0xFF1C2228),
buttonDisabledIcon: Color(0xFF3A424D),
accent: Color(0xFF3C5AF5),
secondary: Color(0xFF8BA3FF),
shadowColor: Color(0x263C5AF5),
a10p: Color(0x1A3C5AF5),
a15p: Color(0x263C5AF5),
warningAccent: Color(0xFFFFA046),
warningText: Color(0xFFF0B37A),
warning15p: Color(0x26FFA046),
warningCard: Color(0xFF201203),
errorAccent: Color(0xFFFF54A1),
errorText: Color(0xFFF59EC5),
error15p: Color(0x26FF54A1),
errorCard: Color(0xFF1E030F),
),
);

View File

@@ -1,9 +1,13 @@
import "package:flutter/material.dart"; import "package:flutter/material.dart";
part "core/butcher_vanity.dart";
part "core/firka.dart"; part "core/firka.dart";
part "core/refilc.dart";
const Map<String, CoreTheme> coreThemes = { const Map<String, CoreTheme> coreThemes = {
"firka": firkaCore, "firka": firkaCore,
"refilc": refilcCore,
"butcher_vanity": butcherVanityCore,
}; };
/// App chrome colors (everything except grade colors) /// App chrome colors (everything except grade colors)

View File

@@ -0,0 +1,25 @@
part of "../grade_theme.dart";
GradeThemeColors _materialShades(MaterialColor color) {
return GradeThemeColors(
grade5: color.shade500,
grade4: color.shade400,
grade3: color.shade300,
grade2: color.shade200,
grade1: color.shade100,
);
}
GradeTheme _materialRainbowGrade(String id, MaterialColor color) {
final colors = _materialShades(color);
return GradeTheme(id: id, light: colors, dark: colors);
}
final redGrade = _materialRainbowGrade("red", Colors.red);
final orangeGrade = _materialRainbowGrade("orange", Colors.orange);
final yellowGrade = _materialRainbowGrade("yellow", Colors.yellow);
final greenGrade = _materialRainbowGrade("green", Colors.green);
final blueGrade = _materialRainbowGrade("blue", Colors.blue);
final indigoGrade = _materialRainbowGrade("indigo", Colors.indigo);
final pinkGrade = _materialRainbowGrade("pink", Colors.pink);
final purpleGrade = _materialRainbowGrade("purple", Colors.purple);

View File

@@ -1,6 +1,7 @@
import "package:flutter/material.dart"; import "package:flutter/material.dart";
part "grade/firka.dart"; part "grade/firka.dart";
part "grade/rainbow.dart";
class GradeThemeColors { class GradeThemeColors {
final Color grade5; final Color grade5;
@@ -32,8 +33,16 @@ class GradeTheme {
GradeThemeColors forBrightness(bool isLight) => isLight ? light : dark; GradeThemeColors forBrightness(bool isLight) => isLight ? light : dark;
} }
const Map<String, GradeTheme> gradeThemes = { final Map<String, GradeTheme> gradeThemes = {
"firka": firkaGrade, "firka": firkaGrade,
"red": redGrade,
"orange": orangeGrade,
"yellow": yellowGrade,
"green": greenGrade,
"blue": blueGrade,
"indigo": indigoGrade,
"pink": pinkGrade,
"purple": purpleGrade,
}; };
GradeTheme resolveGrade(String id) => gradeThemes[id] ?? firkaGrade; GradeTheme resolveGrade(String id) => gradeThemes[id] ?? firkaGrade;