more theme fix

This commit is contained in:
Peti 2023-05-27 10:53:00 +02:00
parent ba52926d1f
commit d00a7b8787
6 changed files with 53 additions and 29 deletions

View File

@ -24,6 +24,6 @@ Map<AccentColor, Color> accentColorMap = {
AccentColor.red: Colors.red.shade300, AccentColor.red: Colors.red.shade300,
AccentColor.pink: Colors.pink.shade300, AccentColor.pink: Colors.pink.shade300,
AccentColor.purple: Colors.purple.shade300, AccentColor.purple: Colors.purple.shade300,
AccentColor.adaptive: const Color(0x003d7bf4), AccentColor.adaptive: const Color(0xff3d7bf4),
AccentColor.custom: const Color(0x003d7bf4), AccentColor.custom: const Color(0xff3d7bf4),
}; };

View File

@ -19,7 +19,7 @@ class DarkDesktopAppColors implements ThemeAppColors {
@override @override
final green = const Color(0xff32D74B); final green = const Color(0xff32D74B);
@override @override
final filc = const Color(0xff29826F); final filc = const Color(0xff3d7bf4);
@override @override
final teal = const Color(0xff64D2FF); final teal = const Color(0xff64D2FF);
@override @override

View File

@ -19,11 +19,11 @@ class DarkMobileAppColors implements ThemeAppColors {
@override @override
final green = const Color(0xff32D74B); final green = const Color(0xff32D74B);
@override @override
final filc = const Color(0x003d7bf4); final filc = const Color(0xff3d7bf4);
@override @override
final teal = const Color(0xff64D2FF); final teal = const Color(0xff64D2FF);
@override @override
final blue = Color.fromARGB(255, 255, 10, 10); final blue = const Color(0xff0A84FF);
@override @override
final indigo = const Color(0xff5E5CE6); final indigo = const Color(0xff5E5CE6);
@override @override

View File

@ -19,7 +19,7 @@ class LightDesktopAppColors implements ThemeAppColors {
@override @override
final green = const Color(0xff34C759); final green = const Color(0xff34C759);
@override @override
final filc = const Color(0xff247665); final filc = const Color(0xff3d7bf4);
@override @override
final teal = const Color(0xff5AC8FA); final teal = const Color(0xff5AC8FA);
@override @override

View File

@ -5,7 +5,7 @@ class LightMobileAppColors implements ThemeAppColors {
@override @override
final shadow = const Color(0xffE8E8E8); final shadow = const Color(0xffE8E8E8);
@override @override
final text = Colors.black; final text = const Color(0xFF000000);
@override @override
final background = const Color(0xffF4F9FF); final background = const Color(0xffF4F9FF);
@override @override
@ -19,7 +19,7 @@ class LightMobileAppColors implements ThemeAppColors {
@override @override
final green = const Color(0xff34C759); final green = const Color(0xff34C759);
@override @override
final filc = const Color(0x003d7bf4); final filc = const Color(0xff3d7bf4);
@override @override
final teal = const Color(0xff5AC8FA); final teal = const Color(0xff5AC8FA);
@override @override

View File

@ -10,7 +10,9 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class GradeTile extends StatelessWidget { class GradeTile extends StatelessWidget {
const GradeTile(this.grade, {Key? key, this.onTap, this.padding, this.censored = false}) : super(key: key); const GradeTile(this.grade,
{Key? key, this.onTap, this.padding, this.censored = false})
: super(key: key);
final Grade grade; final Grade grade;
final void Function()? onTap; final void Function()? onTap;
@ -23,11 +25,13 @@ class GradeTile extends StatelessWidget {
String subtitle; String subtitle;
EdgeInsets leadingPadding = EdgeInsets.zero; EdgeInsets leadingPadding = EdgeInsets.zero;
bool isSubjectView = SubjectGradesContainer.of(context) != null; bool isSubjectView = SubjectGradesContainer.of(context) != null;
String subjectName = grade.subject.renamedTo ?? grade.subject.name.capital(); String subjectName =
grade.subject.renamedTo ?? grade.subject.name.capital();
String modeDescription = grade.mode.description.capital(); String modeDescription = grade.mode.description.capital();
String description = grade.description.capital(); String description = grade.description.capital();
GradeCalculatorProvider calculatorProvider = Provider.of<GradeCalculatorProvider>(context, listen: false); GradeCalculatorProvider calculatorProvider =
Provider.of<GradeCalculatorProvider>(context, listen: false);
// Test order: // Test order:
// description // description
@ -37,7 +41,9 @@ class GradeTile extends StatelessWidget {
if (grade.description != "") { if (grade.description != "") {
title = description; title = description;
} else { } else {
title = modeDescription != "" ? modeDescription : grade.value.valueName.split("(")[0]; title = modeDescription != ""
? modeDescription
: grade.value.valueName.split("(")[0];
} }
} else { } else {
title = subjectName; title = subjectName;
@ -71,7 +77,8 @@ class GradeTile extends StatelessWidget {
: const EdgeInsets.only(left: 8.0, right: 12.0), : const EdgeInsets.only(left: 8.0, right: 12.0),
onTap: onTap, onTap: onTap,
// onLongPress: kDebugMode ? () => log(jsonEncode(grade.json)) : null, // onLongPress: kDebugMode ? () => log(jsonEncode(grade.json)) : null,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)), shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
leading: isSubjectView leading: isSubjectView
? GradeValueWidget(grade.value) ? GradeValueWidget(grade.value)
: SizedBox( : SizedBox(
@ -80,7 +87,7 @@ class GradeTile extends StatelessWidget {
child: censored child: censored
? Container( ? Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.of(context).text.withOpacity(.55), color: AppColors.of(context).text,
borderRadius: BorderRadius.circular(60.0), borderRadius: BorderRadius.circular(60.0),
), ),
) )
@ -88,9 +95,10 @@ class GradeTile extends StatelessWidget {
child: Padding( child: Padding(
padding: leadingPadding, padding: leadingPadding,
child: Icon( child: Icon(
SubjectIcon.resolveVariant(subject: grade.subject, context: context), SubjectIcon.resolveVariant(
subject: grade.subject, context: context),
size: 28.0, size: 28.0,
color: AppColors.of(context).text.withOpacity(.75), color: AppColors.of(context).text,
), ),
), ),
), ),
@ -102,7 +110,7 @@ class GradeTile extends StatelessWidget {
width: 110, width: 110,
height: 15, height: 15,
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.of(context).text.withOpacity(.85), color: AppColors.of(context).text,
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
), ),
@ -112,7 +120,11 @@ class GradeTile extends StatelessWidget {
title, title,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(fontWeight: FontWeight.w600, fontStyle: grade.subject.isRenamed && title == subjectName ? FontStyle.italic : null), style: TextStyle(
fontWeight: FontWeight.w600,
fontStyle: grade.subject.isRenamed && title == subjectName
? FontStyle.italic
: null),
), ),
subtitle: subtitle != "" subtitle: subtitle != ""
? censored ? censored
@ -122,7 +134,7 @@ class GradeTile extends StatelessWidget {
width: 50, width: 50,
height: 10, height: 10,
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.of(context).text.withOpacity(.45), color: AppColors.of(context).text,
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
), ),
@ -137,10 +149,12 @@ class GradeTile extends StatelessWidget {
: null, : null,
trailing: isSubjectView trailing: isSubjectView
? grade.type != GradeType.ghost ? grade.type != GradeType.ghost
? Text(grade.date.format(context), style: const TextStyle(fontWeight: FontWeight.w500)) ? Text(grade.date.format(context),
style: const TextStyle(fontWeight: FontWeight.w500))
: IconButton( : IconButton(
splashRadius: 24.0, splashRadius: 24.0,
icon: Icon(FeatherIcons.trash2, color: AppColors.of(context).red), icon: Icon(FeatherIcons.trash2,
color: AppColors.of(context).red),
onPressed: () { onPressed: () {
calculatorProvider.removeGrade(grade); calculatorProvider.removeGrade(grade);
}, },
@ -150,7 +164,7 @@ class GradeTile extends StatelessWidget {
width: 15, width: 15,
height: 15, height: 15,
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.of(context).text.withOpacity(.45), color: AppColors.of(context).text,
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
) )
@ -189,7 +203,8 @@ class GradeValueWidget extends StatelessWidget {
GradeValue value = this.value; GradeValue value = this.value;
bool isSubjectView = SubjectGradesContainer.of(context) != null; bool isSubjectView = SubjectGradesContainer.of(context) != null;
Color color = gradeColor(context: context, value: value.value, nocolor: nocolor); Color color =
gradeColor(context: context, value: value.value, nocolor: nocolor);
Widget valueText; Widget valueText;
final percentage = value.percentage; final percentage = value.percentage;
@ -204,10 +219,16 @@ class GradeValueWidget extends StatelessWidget {
children: [ children: [
TextSpan( TextSpan(
text: "\n%", text: "\n%",
style: TextStyle(fontWeight: FontWeight.w700, fontSize: size / 2.5 * multiplier, height: 0.7), style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: size / 2.5 * multiplier,
height: 0.7),
), ),
], ],
style: TextStyle(fontWeight: FontWeight.w700, fontSize: size / 1 * multiplier, height: 1), style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: size / 1 * multiplier,
height: 1),
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
); );
@ -221,7 +242,8 @@ class GradeValueWidget extends StatelessWidget {
value.value.toString(), value.value.toString(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontWeight: value.weight == 50 ? FontWeight.w500 : FontWeight.bold, fontWeight:
value.weight == 50 ? FontWeight.w500 : FontWeight.bold,
fontSize: size, fontSize: size,
color: contrast ? Colors.white : color, color: contrast ? Colors.white : color,
shadows: [ shadows: [
@ -239,7 +261,8 @@ class GradeValueWidget extends StatelessWidget {
offset: const Offset(9, 1), offset: const Offset(9, 1),
child: Text( child: Text(
"*", "*",
style: TextStyle(fontSize: size / 1.6, fontWeight: FontWeight.bold), style:
TextStyle(fontSize: size / 1.6, fontWeight: FontWeight.bold),
), ),
), ),
]); ]);
@ -266,7 +289,8 @@ class GradeValueWidget extends StatelessWidget {
} }
} }
Color gradeColor({required BuildContext context, required num value, bool nocolor = false}) { Color gradeColor(
{required BuildContext context, required num value, bool nocolor = false}) {
int valueInt = 0; int valueInt = 0;
var settings = Provider.of<SettingsProvider>(context, listen: false); var settings = Provider.of<SettingsProvider>(context, listen: false);
@ -287,7 +311,7 @@ Color gradeColor({required BuildContext context, required num value, bool nocolo
switch (valueInt) { switch (valueInt) {
case 5: case 5:
return settings.gradeColors[4]; return Color(0xff3d7bf4);
case 4: case 4:
return settings.gradeColors[3]; return settings.gradeColors[3];
case 3: case 3: