Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Add the app theme #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions lib/atoms/app_theme.dart
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);
Comment on lines +8 to +14
Copy link

@MysticFragilist MysticFragilist Oct 24, 2022

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 et appletsDarkBlue t'en penses quoi?


// 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));
}
}
48 changes: 48 additions & 0 deletions lib/atoms/ets_colors.dart
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),
);
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down