This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Add the app theme #8
Open
AntoineLemelin
wants to merge
2
commits into
main
Choose a base branch
from
feature/App-Theme
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:modulo/atoms/ets_colors.dart'; | ||
|
||
/// Contains all the colors and theme of the ETS, App|ETS and specific to the app | ||
class AppTheme { | ||
AppTheme._(); | ||
|
||
// Backgrounds | ||
static const Color darkThemeBackground = Color(0xff303030); | ||
static const Color lightThemeBackground = Color(0xfffafafa); | ||
|
||
// App|ETS colors | ||
static const Color appletsPurple = Color(0xff19375f); | ||
static const Color appletsDarkPurple = Color(0xff122743); | ||
|
||
// Grade colors | ||
static const Color gradeFailureMin = Color(0xffd32f2f); | ||
static const Color gradeFailureMax = Color(0xffff7043); | ||
static const Color gradePassing = Color(0xfffff176); | ||
static const Color gradeGoodMin = Color(0xffaed581); | ||
static const Color gradeGoodMax = Color(0xff43a047); | ||
|
||
// Primary dark | ||
static const Color primaryDark = Color(0xff121212); | ||
|
||
/// Light theme | ||
static ThemeData lightTheme() { | ||
final ThemeData lightTheme = ThemeData.light(); | ||
return lightTheme.copyWith( | ||
extensions: <ThemeExtension<dynamic>>[ | ||
ETSColors.light, | ||
], | ||
useMaterial3: true, | ||
primaryColor: ETSColors.light.red, | ||
bottomNavigationBarTheme: lightTheme.bottomNavigationBarTheme | ||
.copyWith(selectedItemColor: ETSColors.light.red), | ||
colorScheme: lightTheme.colorScheme | ||
.copyWith( | ||
primary: ETSColors.light.red, secondary: ETSColors.light.red) | ||
.copyWith(secondary: ETSColors.light.red)); | ||
} | ||
|
||
/// Dark theme | ||
static ThemeData darkTheme() { | ||
final ThemeData darkTheme = ThemeData.dark(); | ||
return darkTheme.copyWith( | ||
extensions: <ThemeExtension<dynamic>>[ | ||
ETSColors.dark, | ||
], | ||
useMaterial3: true, | ||
scaffoldBackgroundColor: const Color(0xff121212), | ||
cardColor: const Color(0xff1e1e1e), | ||
bottomNavigationBarTheme: darkTheme.bottomNavigationBarTheme | ||
.copyWith(selectedItemColor: ETSColors.dark.red), | ||
colorScheme: darkTheme.colorScheme | ||
.copyWith( | ||
primary: ETSColors.dark.red, secondary: ETSColors.dark.red) | ||
.copyWith(secondary: ETSColors.dark.red)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
@immutable | ||
class ETSColors extends ThemeExtension<ETSColors> { | ||
// ETS colors | ||
static const Color etsBlack = Color(0xff2e2a25); | ||
|
||
const ETSColors({ | ||
required this.red, | ||
required this.grey, | ||
}); | ||
final Color? red; | ||
final Color? grey; | ||
@override | ||
ETSColors copyWith({Color? red, Color? grey}) { | ||
return ETSColors( | ||
red: red ?? this.red, | ||
grey: grey ?? this.grey, | ||
); | ||
} | ||
|
||
// Controls how the properties change on theme changes | ||
@override | ||
ETSColors lerp(ThemeExtension<ETSColors>? other, double t) { | ||
if (other is! ETSColors) { | ||
return this; | ||
} | ||
return ETSColors( | ||
red: Color.lerp(red, other.red, t), | ||
grey: Color.lerp(grey, other.grey, t), | ||
); | ||
} | ||
|
||
// Controls how it displays when the instance is being passed | ||
// to the `print()` method. | ||
@override | ||
String toString() => 'ETSColors'; | ||
// the light theme | ||
static const light = ETSColors( | ||
red: Color(0xffef3e45), | ||
grey: Color(0xff807f83), | ||
); | ||
// the dark theme | ||
static const dark = ETSColors( | ||
red: Color(0xffbf311a), | ||
grey: Color(0xff636467), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On devrait pas mettre ces couleurs(ThemeBackground et appletsPurple) dans ets_color? (pour toggle entre le dark purple et le light purple) Aussi, Tant qu'à faire ce changement on devrait peut-être les renommer à
appletsBlue
etappletsDarkBlue
t'en penses quoi?