From b933e1e7b88bc1e2cb1997dd41200871ce229064 Mon Sep 17 00:00:00 2001 From: Armand <4831c0@proton.me> Date: Fri, 11 Sep 2026 12:12:31 +0200 Subject: [PATCH] feat(theme): add grade color customization screen --- firka/lib/core/extensions.dart | 12 + firka/lib/core/settings/settings_schema.dart | 17 + .../core/settings/settings_schema.gen.dart | 12 +- firka/lib/routing/app_router.dart | 8 + firka/lib/ui/components/color_slider.dart | 87 +++ .../grade_colors/grade_colors_screen.dart | 539 ++++++++++++++++++ .../settings_personalization_view.dart | 18 +- 7 files changed, 691 insertions(+), 2 deletions(-) create mode 100644 firka/lib/ui/components/color_slider.dart create mode 100644 firka/lib/ui/phone/screens/grade_colors/grade_colors_screen.dart diff --git a/firka/lib/core/extensions.dart b/firka/lib/core/extensions.dart index 40c2c2e4..3eac3c0a 100644 --- a/firka/lib/core/extensions.dart +++ b/firka/lib/core/extensions.dart @@ -1,3 +1,6 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:firka/l10n/app_localizations.dart'; @@ -284,6 +287,15 @@ extension LessonExtension on List { } } +extension RandomColorExtension on Random { + HSVColor nextVividHSVColor() { + final hue = nextDouble() * 360; + final saturation = 0.55 + nextDouble() * 0.45; + final value = 0.7 + nextDouble() * 0.3; + return HSVColor.fromAHSV(1.0, hue, saturation, value); + } +} + extension StringExtension on String { bool isNumeric() { final regex = RegExp(r'^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$'); diff --git a/firka/lib/core/settings/settings_schema.dart b/firka/lib/core/settings/settings_schema.dart index 89d9ae90..57b6bf87 100644 --- a/firka/lib/core/settings/settings_schema.dart +++ b/firka/lib/core/settings/settings_schema.dart @@ -194,4 +194,21 @@ abstract class SettingsSchema { @BoolSetting(id: 1049, defaultValue: false) bool get progressNotificationEnabled; + + // Custom grade colors stored as 0xAARRGGBB hex strings. + // Defaults match the firka grade theme. + @StringSetting(id: 1050, defaultValue: "0xFF22CCAD") + String get customGradeColor5; + + @StringSetting(id: 1051, defaultValue: "0xFF92EA3B") + String get customGradeColor4; + + @StringSetting(id: 1052, defaultValue: "0xFFF9CF00") + String get customGradeColor3; + + @StringSetting(id: 1053, defaultValue: "0xFFFFA046") + String get customGradeColor2; + + @StringSetting(id: 1054, defaultValue: "0xFFFF54A1") + String get customGradeColor1; } diff --git a/firka/lib/core/settings/settings_schema.gen.dart b/firka/lib/core/settings/settings_schema.gen.dart index 6276d8bb..de63b295 100644 --- a/firka/lib/core/settings/settings_schema.gen.dart +++ b/firka/lib/core/settings/settings_schema.gen.dart @@ -47,9 +47,14 @@ class SettingsRegistry { static const notificationDeliveryMethod = EnumSetting(id: 1047, defaultValue: NotificationDeliveryMethod.auto, values: NotificationDeliveryMethod.values); static const lessonCacheKeyMigrationDone = BoolSetting(id: 1048, defaultValue: false); static const progressNotificationEnabled = BoolSetting(id: 1049, defaultValue: false); + static const customGradeColor5 = StringSetting(id: 1050, defaultValue: "0xFF22CCAD"); + static const customGradeColor4 = StringSetting(id: 1051, defaultValue: "0xFF92EA3B"); + static const customGradeColor3 = StringSetting(id: 1052, defaultValue: "0xFFF9CF00"); + static const customGradeColor2 = StringSetting(id: 1053, defaultValue: "0xFFFFA046"); + static const customGradeColor1 = StringSetting(id: 1054, defaultValue: "0xFFFF54A1"); static const all = [ - bellDelay, rounding1, rounding2, rounding3, rounding4, classAvgOnGraph, leftHandedMode, language, appIcon, childProtection, betaWarning, ttToastLessonNo, ttToastTestsAndHw, ttToastBreaks, statsForNerds, developerOptsEnabled, themeBrightness, ttToastSubstitution, ttToastABTimetable, wearOsSupport, titleFont, titleWeight, titleCapitalization, selectedThemeId, selectedCoreThemeId, selectedGradeThemeId, mockBackendEnabled, mockBackendUrl, lastSeen, surpriseGrades, seasonalAppIcons, uwuMode, notifyAll, notifyGrades, notifyHomeworkTests, notifyAbsences, notifyLessons, notifyMessages, notifyMutedSubjects, notifyWakeupInterval, fcmDebugNotifyOnMessage, notificationDeliveryMethod, lessonCacheKeyMigrationDone, progressNotificationEnabled, + bellDelay, rounding1, rounding2, rounding3, rounding4, classAvgOnGraph, leftHandedMode, language, appIcon, childProtection, betaWarning, ttToastLessonNo, ttToastTestsAndHw, ttToastBreaks, statsForNerds, developerOptsEnabled, themeBrightness, ttToastSubstitution, ttToastABTimetable, wearOsSupport, titleFont, titleWeight, titleCapitalization, selectedThemeId, selectedCoreThemeId, selectedGradeThemeId, mockBackendEnabled, mockBackendUrl, lastSeen, surpriseGrades, seasonalAppIcons, uwuMode, notifyAll, notifyGrades, notifyHomeworkTests, notifyAbsences, notifyLessons, notifyMessages, notifyMutedSubjects, notifyWakeupInterval, fcmDebugNotifyOnMessage, notificationDeliveryMethod, lessonCacheKeyMigrationDone, progressNotificationEnabled, customGradeColor5, customGradeColor4, customGradeColor3, customGradeColor2, customGradeColor1, ]; } @@ -98,4 +103,9 @@ extension SettingsAccessors on SettingsRepository { SilentlySettable get notificationDeliveryMethod => SilentlySettable(this, SettingsRegistry.notificationDeliveryMethod); SilentlySettable get lessonCacheKeyMigrationDone => SilentlySettable(this, SettingsRegistry.lessonCacheKeyMigrationDone); SilentlySettable get progressNotificationEnabled => SilentlySettable(this, SettingsRegistry.progressNotificationEnabled); + SilentlySettable get customGradeColor5 => SilentlySettable(this, SettingsRegistry.customGradeColor5); + SilentlySettable get customGradeColor4 => SilentlySettable(this, SettingsRegistry.customGradeColor4); + SilentlySettable get customGradeColor3 => SilentlySettable(this, SettingsRegistry.customGradeColor3); + SilentlySettable get customGradeColor2 => SilentlySettable(this, SettingsRegistry.customGradeColor2); + SilentlySettable get customGradeColor1 => SilentlySettable(this, SettingsRegistry.customGradeColor1); } diff --git a/firka/lib/routing/app_router.dart b/firka/lib/routing/app_router.dart index b838d420..f9c4d5fa 100644 --- a/firka/lib/routing/app_router.dart +++ b/firka/lib/routing/app_router.dart @@ -20,6 +20,7 @@ import 'package:firka/ui/phone/screens/login/login_screen.dart'; import 'package:firka/ui/phone/screens/message/message_screen.dart'; import 'package:firka/ui/phone/screens/home/home_screen.dart'; import 'package:firka/ui/phone/screens/settings/settings_screen.dart'; +import 'package:firka/ui/phone/screens/grade_colors/grade_colors_screen.dart'; import 'package:firka/ui/phone/screens/themes/theme_screen.dart'; import 'package:firka/ui/phone/screens/themes/themes_screen.dart'; import 'package:firka/ui/phone/screens/themes/user_theme.dart'; @@ -115,6 +116,13 @@ GoRouter createAppRouter() { ); }, ), + GoRoute( + path: '/grade-colors', + builder: (context, state) => DefaultAssetBundle( + bundle: FirkaBundle(), + child: GradeColorsScreen(initData, key: state.pageKey), + ), + ), GoRoute( path: '/message', builder: (context, state) { diff --git a/firka/lib/ui/components/color_slider.dart b/firka/lib/ui/components/color_slider.dart new file mode 100644 index 00000000..228f9ab3 --- /dev/null +++ b/firka/lib/ui/components/color_slider.dart @@ -0,0 +1,87 @@ +import "package:flutter/material.dart"; +import "package:firka/ui/theme/style.dart"; +import "package:firka_common/ui/components/firka_card.dart"; + +class ColorSlider extends StatelessWidget { + final double value; + final LinearGradient trackGradient; + final Color thumbColor; + final ValueChanged onChanged; + + const ColorSlider({ + required this.value, + required this.trackGradient, + required this.thumbColor, + required this.onChanged, + super.key, + }); + + static const _trackHeight = 52.0; + static const _thumbSize = 28.0; + static const _thumbRadius = _thumbSize / 2; + static const _edgePad = 16.0; + + void _setFromLocalX(double localX, double width) { + final start = _edgePad + _thumbRadius; + final end = width - _edgePad - _thumbRadius; + if (end <= start) return; + final t = ((localX - start) / (end - start)).clamp(0.0, 1.0); + onChanged(t); + } + + @override + Widget build(BuildContext context) { + return FirkaCard.single( + width: double.infinity, + height: _trackHeight, + padding: EdgeInsets.zero, + child: ClipRRect( + borderRadius: BorderRadius.circular(16), + child: LayoutBuilder( + builder: (context, constraints) { + final width = constraints.maxWidth; + final start = _edgePad + _thumbRadius; + final end = width - _edgePad - _thumbRadius; + final thumbLeft = start + value * (end - start) - _thumbRadius; + + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTapDown: (d) => _setFromLocalX(d.localPosition.dx, width), + onHorizontalDragUpdate: (d) => + _setFromLocalX(d.localPosition.dx, width), + child: Stack( + fit: StackFit.expand, + children: [ + Container(decoration: BoxDecoration(gradient: trackGradient)), + Positioned( + left: thumbLeft, + top: (_trackHeight - _thumbSize) / 2, + child: Container( + width: _thumbSize, + height: _thumbSize, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: thumbColor, + border: Border.all( + color: appStyle.colors.buttonSecondaryFill, + width: 3, + ), + boxShadow: [ + BoxShadow( + color: appStyle.colors.shadowColor, + offset: const Offset(0, 1), + blurRadius: appStyle.isLight ? 3 : 0, + ), + ], + ), + ), + ), + ], + ), + ); + }, + ), + ), + ); + } +} diff --git a/firka/lib/ui/phone/screens/grade_colors/grade_colors_screen.dart b/firka/lib/ui/phone/screens/grade_colors/grade_colors_screen.dart new file mode 100644 index 00000000..2ce1f00b --- /dev/null +++ b/firka/lib/ui/phone/screens/grade_colors/grade_colors_screen.dart @@ -0,0 +1,539 @@ +import "dart:math" as math; + +import "package:firka/app/app_state.dart"; +import "package:firka/core/bloc/theme_cubit.dart"; +import "package:firka/core/extensions.dart"; +import "package:firka/core/settings/setting.dart"; +import "package:firka/core/settings/settings_repository.dart"; +import "package:firka/core/settings/settings_schema.dart"; +import "package:firka/ui/components/color_slider.dart"; +import "package:firka/ui/shared/firka_icon.dart"; +import "package:firka/ui/theme/style.dart"; +import "package:firka_common/ui/components/filled_circle.dart"; +import "package:firka_common/ui/components/firka_card.dart"; +import "package:firka_common/ui/theme/style.dart"; +import "package:flutter/material.dart"; +import "package:flutter/services.dart"; +import "package:flutter_bloc/flutter_bloc.dart"; +import "package:go_router/go_router.dart"; +import "package:majesticons_flutter/majesticons_flutter.dart"; + +class GradeColorsScreen extends StatefulWidget { + final AppInitialization data; + + const GradeColorsScreen(this.data, {super.key}); + + @override + State createState() => _GradeColorsScreenState(); +} + +StringSetting _settingFor(int grade) { + switch (grade) { + case 5: + return SettingsRegistry.customGradeColor5; + case 4: + return SettingsRegistry.customGradeColor4; + case 3: + return SettingsRegistry.customGradeColor3; + case 2: + return SettingsRegistry.customGradeColor2; + default: + return SettingsRegistry.customGradeColor1; + } +} + +Color _defaultFor(int grade) { + switch (grade) { + case 5: + return const Color(0xFF22CCAD); + case 4: + return const Color(0xFF92EA3B); + case 3: + return const Color(0xFFF9CF00); + case 2: + return const Color(0xFFFFA046); + default: + return const Color(0xFFFF54A1); + } +} + +Color _parseColor(String hex) { + final value = int.tryParse(hex) ?? 0xFFFFFFFF; + return Color(value); +} + +String _encodeColor(Color color) => + "0x${color.toARGB32().toRadixString(16).toUpperCase().padLeft(8, '0')}"; + +class _GradeColorsScreenState extends State + with SingleTickerProviderStateMixin { + late int _selectedGrade; + late HSVColor _hsv; + + final _hexController = TextEditingController(); + bool _hexFocused = false; + + late final AnimationController _ringController; + Tween _ringTween = Tween(begin: 0, end: 0); + double _ringRotation = 0; + + SettingsRepository get _settings => widget.data.settings; + + @override + void initState() { + super.initState(); + _selectedGrade = 5; + _hsv = HSVColor.fromColor(_currentColor(_selectedGrade)); + _syncHexField(); + _ringController = AnimationController(vsync: this) + ..addListener(() { + setState(() { + _ringRotation = _ringTween.transform( + Curves.easeInOutCubic.transform(_ringController.value), + ); + }); + }); + } + + @override + void dispose() { + _hexController.dispose(); + _ringController.dispose(); + super.dispose(); + } + + Color _currentColor(int grade) { + final raw = _settings.get(_settingFor(grade)); + return _parseColor(raw); + } + + void _syncHexField() { + if (!_hexFocused) { + final hex = _encodeColor(_hsv.toColor()).substring(4); + _hexController.text = hex.toUpperCase(); + } + } + + Future _applyHsv(HSVColor hsv) async { + setState(() => _hsv = hsv); + _syncHexField(); + await _settings.set( + _settingFor(_selectedGrade), + _encodeColor(hsv.toColor()), + ); + if (!mounted) return; + context.read().refresh(); + } + + Future _selectGrade(int grade) async { + final hubIndex = _roleOrder.indexOf("hub"); + final targetMod = (hubIndex - _ring.indexOf(grade)) % _ring.length; + var delta = (targetMod - _ringRotation) % _ring.length; + if (delta > _ring.length / 2) delta -= _ring.length; + final target = _ringRotation + delta; + + _ringTween = Tween(begin: _ringRotation, end: target); + + _ringController + ..duration = Duration( + milliseconds: (150 * delta.abs()).clamp(180, 420).round(), + ) + ..forward(from: 0); + + setState(() { + _selectedGrade = grade; + _hsv = HSVColor.fromColor(_currentColor(grade)); + }); + _syncHexField(); + } + + Future _reset() async { + final defaultColor = _defaultFor(_selectedGrade); + await _applyHsv(HSVColor.fromColor(defaultColor)); + } + + Future _randomize() async { + await _applyHsv(math.Random().nextVividHSVColor()); + } + + void _onHexSubmit(String value) { + final cleaned = value.replaceAll("#", "").trim(); + if (cleaned.length != 6) return; + final parsed = int.tryParse("0xFF$cleaned"); + if (parsed == null) return; + _applyHsv(HSVColor.fromColor(Color(parsed))); + } + + @override + Widget build(BuildContext context) { + return BlocProvider.value( + value: widget.data.themeCubit, + child: BlocBuilder( + builder: (context, _) { + return Scaffold( + backgroundColor: appStyle.colors.background, + body: SafeArea( + child: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _header(context), + const SizedBox(height: 24), + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _gradeBubbles(), + const SizedBox(height: 28), + _hueSlider(), + const SizedBox(height: 8), + _saturationSlider(), + const SizedBox(height: 8), + _valueSlider(), + const SizedBox(height: 20), + _hexRow(), + const SizedBox(height: 12), + _gradeTabBar(), + const SizedBox(height: 24), + ], + ), + ), + ), + ], + ), + ), + ), + ); + }, + ), + ); + } + + Widget _header(BuildContext context) { + final l10n = widget.data.l10n; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Transform.translate( + offset: const Offset(-4, 0), + child: GestureDetector( + onTap: () => context.pop(), + child: FirkaIconWidget( + FirkaIconType.majesticons, + Majesticon.chevronLeftLine, + color: appStyle.colors.textSecondary, + ), + ), + ), + Text( + l10n.s_customization, + style: appStyle.fonts.B_16R.apply( + color: appStyle.colors.textSecondary, + ), + ), + ], + ), + const SizedBox(height: 4), + Text( + headingText(l10n.s_c_grade_colors_header), + style: appStyle.fonts.H_H1.apply(color: appStyle.colors.textPrimary), + ), + ], + ); + } + + static const _roleSlots = { + "topLeft": (0.39, 0.22, 0.82), + "topRight": (0.625, 0.22, 0.82), + "midRight": (0.80, 0.46, 0.76), + "hub": (0.505, 0.66, 1.0), + "midLeft": (0.22, 0.46, 0.76), + }; + static const _roleOrder = [ + "topLeft", + "topRight", + "midRight", + "hub", + "midLeft", + ]; + + static const _ring = [2, 3, 4, 5, 1]; + + Widget _gradeBubbles() { + const maxCenterSize = 88.0; + const clusterHeight = 190.0; + + return LayoutBuilder( + builder: (context, constraints) { + final width = constraints.maxWidth; + final centerSize = math.min(maxCenterSize, width * 0.24); + + return SizedBox( + height: clusterHeight, + width: width, + child: Stack( + children: [ + for (final grade in _ring) + Builder( + builder: (context) { + final u = _ring.indexOf(grade) + _ringRotation; + final idx0 = u.floor(); + final frac = u - idx0; + final slotA = _roleSlots[_roleOrder[idx0 % _ring.length]]!; + final slotB = + _roleSlots[_roleOrder[(idx0 + 1) % _ring.length]]!; + final dx = slotA.$1 + (slotB.$1 - slotA.$1) * frac; + final dy = slotA.$2 + (slotB.$2 - slotA.$2) * frac; + final sizeFactor = slotA.$3 + (slotB.$3 - slotA.$3) * frac; + final size = centerSize * sizeFactor; + + return Positioned( + left: dx * width - size / 2, + top: dy * clusterHeight - size / 2, + child: _gradeBubble(grade, size: size), + ); + }, + ), + ], + ), + ); + }, + ); + } + + Widget _gradeBubble(int grade, {required double size}) { + final isSelected = grade == _selectedGrade; + final color = isSelected ? _hsv.toColor() : _currentColor(grade); + final pastel = Color.alphaBlend(color.withAlpha(38), appStyle.colors.card); + const ringWidth = 4.0; + + final circle = FilledCircle( + diameter: isSelected ? size - ringWidth * 2 : size, + color: pastel, + child: Text( + "$grade", + style: appStyle.fonts.H_H1.copyWith(color: color, fontSize: size * 0.4), + ), + ); + + return GestureDetector( + onTap: isSelected ? null : () => _selectGrade(grade), + child: Container( + width: size, + height: size, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: isSelected + ? Border.all( + color: appStyle.colors.buttonSecondaryFill, + width: ringWidth, + ) + : null, + boxShadow: isSelected && appStyle.isLight + ? [ + BoxShadow( + color: appStyle.colors.shadowColor, + blurRadius: 8, + offset: const Offset(0, 3), + ), + ] + : null, + ), + child: Center(child: circle), + ), + ); + } + + Widget _hueSlider() { + return ColorSlider( + value: _hsv.hue / 360, + trackGradient: const LinearGradient( + colors: [ + Color(0xFFFF0000), + Color(0xFFFFFF00), + Color(0xFF00FF00), + Color(0xFF00FFFF), + Color(0xFF0000FF), + Color(0xFFFF00FF), + Color(0xFFFF0000), + ], + ), + thumbColor: _hsv.toColor(), + onChanged: (t) => _applyHsv(_hsv.withHue(t * 360)), + ); + } + + Widget _saturationSlider() { + final fullSat = _hsv.withSaturation(1).withValue(1).toColor(); + return ColorSlider( + value: _hsv.saturation, + trackGradient: LinearGradient(colors: [Colors.white, fullSat]), + thumbColor: _hsv.withValue(1).toColor(), + onChanged: (t) => _applyHsv(_hsv.withSaturation(t)), + ); + } + + Widget _valueSlider() { + final fullV = _hsv.withValue(1).toColor(); + return ColorSlider( + value: _hsv.value, + trackGradient: LinearGradient(colors: [Colors.black, fullV]), + thumbColor: _hsv.toColor(), + onChanged: (t) => _applyHsv(_hsv.withValue(t)), + ); + } + + Widget _hexRow() { + return FirkaCard( + left: [ + _iconCircle(icon: Majesticon.reloadLine, onTap: _reset, faded: true), + const SizedBox(width: 12), + Container( + width: 28, + height: 28, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _hsv.toColor(), + boxShadow: [ + BoxShadow( + color: appStyle.colors.shadowColor, + blurRadius: appStyle.isLight ? 3 : 0, + offset: const Offset(0, 1), + ), + ], + ), + ), + const SizedBox(width: 10), + Text( + "HEX", + style: appStyle.fonts.B_14R.apply( + color: appStyle.colors.textSecondary, + ), + ), + const SizedBox(width: 8), + SizedBox( + width: 96, + child: Focus( + onFocusChange: (focused) => setState(() => _hexFocused = focused), + child: TextField( + controller: _hexController, + keyboardType: TextInputType.text, + textCapitalization: TextCapitalization.characters, + maxLength: 6, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9a-fA-F]')), + ], + onSubmitted: _onHexSubmit, + style: appStyle.fonts.B_16SB.apply( + color: appStyle.colors.textPrimary, + ), + decoration: InputDecoration( + counterText: "", + border: InputBorder.none, + isDense: true, + contentPadding: EdgeInsets.zero, + hintText: "FFFFFF", + hintStyle: appStyle.fonts.B_16SB.apply( + color: appStyle.colors.textTertiary, + ), + ), + ), + ), + ), + ], + right: [ + _iconCircle( + icon: Majesticon.repeatCircleLine, + onTap: _randomize, + accent: true, + ), + const SizedBox(width: 4), + ], + ); + } + + Widget _iconCircle({ + required Object icon, + required VoidCallback onTap, + bool faded = false, + bool accent = false, + }) { + final bgColor = accent + ? appStyle.colors.accent + : appStyle.colors.buttonSecondaryFill; + final iconColor = accent + ? appStyle.colors.textPrimary + : appStyle.colors.textSecondary; + + return GestureDetector( + onTap: onTap, + child: Container( + width: 36, + height: 36, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: bgColor, + boxShadow: [ + BoxShadow( + color: appStyle.colors.shadowColor, + blurRadius: appStyle.isLight ? 2 : 0, + offset: const Offset(0, 1), + ), + ], + ), + child: Center( + child: FirkaIconWidget( + FirkaIconType.majesticons, + icon, + size: 18, + color: iconColor, + ), + ), + ), + ); + } + + Widget _gradeTabBar() { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + for (final grade in [1, 2, 3, 4, 5]) ...[ + if (grade != 1) const SizedBox(width: 8), + _gradeTab(grade), + ], + ], + ); + } + + Widget _gradeTab(int grade) { + final isSelected = grade == _selectedGrade; + + return GestureDetector( + onTap: isSelected ? null : () => _selectGrade(grade), + child: AnimatedContainer( + duration: const Duration(milliseconds: 180), + curve: Curves.easeOut, + width: 32, + height: 32, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: isSelected ? appStyle.colors.accent : appStyle.colors.card, + ), + child: Center( + child: Text( + "$grade", + style: appStyle.fonts.B_14SB.apply( + color: isSelected + ? appStyle.colors.textPrimary + : appStyle.colors.textSecondary, + ), + ), + ), + ), + ); + } +} diff --git a/firka/lib/ui/phone/screens/settings/settings_personalization_view.dart b/firka/lib/ui/phone/screens/settings/settings_personalization_view.dart index e9bbdb9a..fb064b86 100644 --- a/firka/lib/ui/phone/screens/settings/settings_personalization_view.dart +++ b/firka/lib/ui/phone/screens/settings/settings_personalization_view.dart @@ -203,6 +203,22 @@ class _SettingsPersonalizationViewState ); } + Widget _customizeButton({required String route}) { + return GestureDetector( + onTap: () => context.push(route), + child: FirkaCard( + left: [ + Text( + _l10n.s_c_customize, + style: appStyle.fonts.B_16SB.apply( + color: appStyle.colors.textPrimary, + ), + ), + ], + ), + ); + } + Widget _checkMark() { return SizedBox( width: 16, @@ -620,7 +636,7 @@ class _SettingsPersonalizationViewState _themeOption(_l10n.s_c_theme_dark, ThemeBrightness.dark), _sectionLabel(_l10n.s_c_grade_colors_header), _gradeThemePager(), - _stubCustomizeButton(), + _customizeButton(route: "/grade-colors"), _sectionLabel(_l10n.s_c_title_style_header), _fontPicker(selectedFont), _weightSlider(),