color (theme) fixes, NOT FINISHED

This commit is contained in:
Kima 2024-03-05 23:08:47 +01:00
parent 0dc9a0640a
commit e2ac4303f3
17 changed files with 57 additions and 39 deletions

View File

@ -62,27 +62,32 @@ class AppTheme {
: _paletteHighlightLight(palette)) ?? : _paletteHighlightLight(palette)) ??
lightColors.highlight; lightColors.highlight;
Color newPrimary = ColorsUtils().darken(accent, amount: 0.4); Color newSecondary = ColorsUtils().darken(accent, amount: 0.4);
// Color newScaffoldBg = ColorsUtils().lighten(accent, amount: 0.4); // Color newScaffoldBg = ColorsUtils().lighten(accent, amount: 0.4);
Color newScaffoldBg = backgroundColor; Color newTertiary = ColorsUtils().darken(accent, amount: 0.5);
return ThemeData( return ThemeData(
brightness: Brightness.light, brightness: Brightness.light,
useMaterial3: true, useMaterial3: true,
fontFamily: _defaultFontFamily, fontFamily: _defaultFontFamily,
textTheme: googleFontsMap[settings.fontFamily], textTheme: googleFontsMap[settings.fontFamily],
scaffoldBackgroundColor: newScaffoldBg, scaffoldBackgroundColor: backgroundColor,
primaryColor: lightColors.filc, primaryColor: lightColors.filc,
dividerColor: const Color(0x00000000), dividerColor: const Color(0x00000000),
colorScheme: ColorScheme( colorScheme: ColorScheme(
primary: newPrimary, primary: accent,
onPrimary: onPrimary:
(newPrimary.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withOpacity(.9),
secondary: accent,
onSecondary:
(accent.computeLuminance() > 0.5 ? Colors.black : Colors.white) (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withOpacity(.9), .withOpacity(.9),
secondary: newSecondary,
onSecondary: (newSecondary.computeLuminance() > 0.5
? Colors.black
: Colors.white)
.withOpacity(.9),
tertiary: newTertiary,
onTertiary:
(newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withOpacity(.9),
background: highlightColor, background: highlightColor,
onBackground: Colors.black.withOpacity(.9), onBackground: Colors.black.withOpacity(.9),
brightness: Brightness.light, brightness: Brightness.light,
@ -150,6 +155,9 @@ class AppTheme {
: _paletteHighlightDark(palette)) ?? : _paletteHighlightDark(palette)) ??
darkColors.highlight; darkColors.highlight;
Color newSecondary = ColorsUtils().lighten(accent, amount: 0.4);
Color newTertiary = ColorsUtils().lighten(accent, amount: 0.5);
return ThemeData( return ThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,
useMaterial3: true, useMaterial3: true,
@ -163,9 +171,14 @@ class AppTheme {
onPrimary: onPrimary:
(accent.computeLuminance() > 0.5 ? Colors.black : Colors.white) (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withOpacity(.9), .withOpacity(.9),
secondary: accent, secondary: newSecondary,
onSecondary: onSecondary: (newSecondary.computeLuminance() > 0.5
(accent.computeLuminance() > 0.5 ? Colors.black : Colors.white) ? Colors.black
: Colors.white)
.withOpacity(.9),
tertiary: newTertiary,
onTertiary:
(newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withOpacity(.9), .withOpacity(.9),
background: highlightColor, background: highlightColor,
onBackground: Colors.white.withOpacity(.9), onBackground: Colors.white.withOpacity(.9),

View File

@ -98,7 +98,7 @@ class _SettingsScreenState extends State<SettingsScreen>
name: _firstName, name: _firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.primary, //!settings.presentationMode .secondary, //!settings.presentationMode
//? ColorUtils.stringToColor(account.name) //? ColorUtils.stringToColor(account.name)
//: Theme.of(context).colorScheme.secondary, //: Theme.of(context).colorScheme.secondary,
role: account.role, role: account.role,

View File

@ -61,7 +61,7 @@ class _FilterBarState extends State<FilterBar> {
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
indicatorPadding: const EdgeInsets.symmetric(vertical: 8.0), indicatorPadding: const EdgeInsets.symmetric(vertical: 8.0),
indicator: BoxDecoration( indicator: BoxDecoration(
color: Theme.of(context).colorScheme.secondary.withOpacity(0.25), color: Theme.of(context).colorScheme.secondary.withOpacity(.2),
borderRadius: BorderRadius.circular(45.0), borderRadius: BorderRadius.circular(45.0),
), ),
overlayColor: MaterialStateProperty.all(const Color(0x00000000)), overlayColor: MaterialStateProperty.all(const Color(0x00000000)),

View File

@ -1,4 +1,3 @@
import 'package:refilc/theme/colors/colors.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class RoundBorderIcon extends StatelessWidget { class RoundBorderIcon extends StatelessWidget {
@ -19,7 +18,9 @@ class RoundBorderIcon extends StatelessWidget {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: color ?? AppColors.of(context).text, width: width), color: color ??
Theme.of(context).colorScheme.secondary.withOpacity(0.25),
width: width),
borderRadius: BorderRadius.circular(50.0), borderRadius: BorderRadius.circular(50.0),
), ),
child: Padding( child: Padding(

View File

@ -53,8 +53,10 @@ class SplittedPanel extends StatelessWidget {
), ),
border: hasBorder border: hasBorder
? Border.all( ? Border.all(
color: color: Theme.of(context)
Theme.of(context).colorScheme.primary.withOpacity(.25), .colorScheme
.secondary
.withOpacity(.25),
width: 1.0) width: 1.0)
: null, : null,
), ),

View File

@ -91,7 +91,7 @@ class MessageViewTile extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.0), borderRadius: BorderRadius.circular(16.0),
border: Border.all( border: Border.all(
color: Theme.of(context).colorScheme.primary.withOpacity(.25), color: Theme.of(context).colorScheme.secondary.withOpacity(.25),
width: 1.0, width: 1.0,
), ),
), ),

View File

@ -1,4 +1,3 @@
import 'package:refilc/utils/color.dart';
import 'package:refilc_kreta_api/models/note.dart'; import 'package:refilc_kreta_api/models/note.dart';
import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart'; import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart';
import 'package:refilc/utils/format.dart'; import 'package:refilc/utils/format.dart';
@ -31,12 +30,13 @@ class NoteView extends StatelessWidget {
: note.teacher.name) ?? : note.teacher.name) ??
'', '',
radius: 22.0, radius: 22.0,
backgroundColor: ColorUtils.stringToColor( backgroundColor: Theme.of(context).colorScheme.secondary,
(note.teacher.isRenamed // backgroundColor: ColorUtils.stringToColor(
? note.teacher.renamedTo // (note.teacher.isRenamed
: note.teacher.name) ?? // ? note.teacher.renamedTo
'', // : note.teacher.name) ??
), // '',
// ),
), ),
title: Text( title: Text(
note.title, note.title,

View File

@ -58,7 +58,7 @@ class TickTileState extends State<TickTile> {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
border: Border.all( border: Border.all(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.secondary,
width: 2.0, width: 2.0,
), ),
), ),
@ -67,7 +67,7 @@ class TickTileState extends State<TickTile> {
: Icon( : Icon(
FeatherIcons.checkCircle, FeatherIcons.checkCircle,
size: 22.0, size: 22.0,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.secondary,
), ),
title: Row( title: Row(
children: [ children: [

View File

@ -164,7 +164,7 @@ class AbsencesPageState extends State<AbsencesPage>
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.primary, //ColorUtils.stringToColor(user.displayName ?? "?"), .secondary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,
@ -423,7 +423,9 @@ class AbsencesPageState extends State<AbsencesPage>
child: filterWidgets[index - (activeData <= 1 ? 1 : 0)], child: filterWidgets[index - (activeData <= 1 ? 1 : 0)],
); );
} else { } else {
return _tabController.index == 1 ? Empty(subtitle: "emptyDelays".i18n) : Empty(subtitle: "emptyMisses".i18n); return _tabController.index == 1
? Empty(subtitle: "emptyDelays".i18n)
: Empty(subtitle: "emptyMisses".i18n);
} }
}, },
), ),

View File

@ -540,7 +540,7 @@ class GradesPageState extends State<GradesPage> {
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.primary, //ColorUtils.stringToColor(user.displayName ?? "?"), .secondary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,

View File

@ -252,7 +252,7 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.primary, //!settings.presentationMode .secondary, //!settings.presentationMode
//? ColorUtils.stringToColor(user.displayName ?? "?") //? ColorUtils.stringToColor(user.displayName ?? "?")
//: Theme.of(context).colorScheme.secondary, //: Theme.of(context).colorScheme.secondary,
badge: updateProvider.available, badge: updateProvider.available,

View File

@ -105,7 +105,7 @@ class MessagesPageState extends State<MessagesPage>
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.primary, //ColorUtils.stringToColor(user.displayName ?? "?"), .secondary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,

View File

@ -250,7 +250,7 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.primary, //ColorUtils.stringToColor(user.displayName ?? "?"), .secondary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,

View File

@ -271,7 +271,7 @@ class TimetablePageState extends State<TimetablePage>
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.primary, //ColorUtils.stringToColor(user.displayName ?? "?"), .secondary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,
@ -523,7 +523,7 @@ class TimetablePageState extends State<TimetablePage>
border: Border.all( border: Border.all(
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.primary .secondary
.withOpacity(0.25), .withOpacity(0.25),
), ),
borderRadius: borderRadius:

View File

@ -34,7 +34,7 @@ class NavbarItem extends StatelessWidget {
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: active color: active
? Theme.of(context).colorScheme.secondary.withOpacity(.4) ? Theme.of(context).colorScheme.secondary.withOpacity(.2)
: null, : null,
borderRadius: BorderRadius.circular(14.0), borderRadius: BorderRadius.circular(14.0),
), ),

View File

@ -30,7 +30,7 @@ class AccountView extends StatelessWidget {
AccountTile( AccountTile(
profileImage: ProfileImage( profileImage: ProfileImage(
name: _firstName, name: _firstName,
backgroundColor: Theme.of(context).colorScheme.primary, backgroundColor: Theme.of(context).colorScheme.secondary,
role: user.role, role: user.role,
), ),
name: SelectableText( name: SelectableText(

View File

@ -133,7 +133,7 @@ class SettingsScreenState extends State<SettingsScreen>
profilePictureString: account.picture, profilePictureString: account.picture,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.primary, //!settings.presentationMode .secondary, //!settings.presentationMode
//? ColorUtils.stringToColor(account.name) //? ColorUtils.stringToColor(account.name)
//: Theme.of(context).colorScheme.secondary, //: Theme.of(context).colorScheme.secondary,
), ),
@ -319,7 +319,7 @@ class SettingsScreenState extends State<SettingsScreen>
profilePictureString: user.picture, profilePictureString: user.picture,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.primary, //!settings.presentationMode .secondary, //!settings.presentationMode
//? ColorUtils.stringToColor(user.displayName ?? "?") //? ColorUtils.stringToColor(user.displayName ?? "?")
//: Theme.of(context).colorScheme.secondary, //: Theme.of(context).colorScheme.secondary,
), ),