From c97ac873af12572ff61c47a66e3be0dfb00b3611 Mon Sep 17 00:00:00 2001 From: Antoine Lemelin Date: Fri, 21 Oct 2022 22:28:23 -0400 Subject: [PATCH 1/2] Add the app theme --- lib/atoms/app_theme.dart | 60 +++++++++++++++++++++++++++++++++++++++ lib/atoms/ets_colors.dart | 48 +++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 lib/atoms/app_theme.dart create mode 100644 lib/atoms/ets_colors.dart diff --git a/lib/atoms/app_theme.dart b/lib/atoms/app_theme.dart new file mode 100644 index 0000000..cbfe27a --- /dev/null +++ b/lib/atoms/app_theme.dart @@ -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: >[ + 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: >[ + 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)); + } +} diff --git a/lib/atoms/ets_colors.dart b/lib/atoms/ets_colors.dart new file mode 100644 index 0000000..9db9bc6 --- /dev/null +++ b/lib/atoms/ets_colors.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; + +@immutable +class ETSColors extends ThemeExtension { + // 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? 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), + ); +} From 51756ded25357204975319d0a7973fe31d175879 Mon Sep 17 00:00:00 2001 From: AntoineLemelin Date: Sat, 22 Oct 2022 02:34:36 +0000 Subject: [PATCH 2/2] [BOT] Bump version from 0.0.1 to 0.0.2 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 5e46b2c..668d707 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: modulo description: The design system of the club APP|ETS. -version: 0.0.1 +version: 0.0.2 homepage: https://clubapplets.ca/ repository: https://github.com/ApplETS/Modulo issue_tracker: https://github.com/ApplETS/Modulo/issues