Skip to content

Commit

Permalink
remove smallbody useless test and use static
Browse files Browse the repository at this point in the history
  • Loading branch information
hatch01 committed Nov 20, 2023
1 parent 4902447 commit a11c2a4
Show file tree
Hide file tree
Showing 28 changed files with 206 additions and 243 deletions.
8 changes: 4 additions & 4 deletions apps/onyx/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class OnyxAppState extends State<OnyxApp> {
BlocProvider<MapCubit>(create: (context) => MapCubit()),
BlocProvider<IzlyCubit>(create: (context) => IzlyCubit()),
BlocProvider<ThemeCubit>(
create: (context) => ThemeCubit(themesPreset)),
create: (context) => ThemeCubit(OnyxTheme.themesPreset)),
],
child: BlocBuilder<ThemeCubit, ThemeState>(
builder: (context, themeState) {
Expand Down Expand Up @@ -141,9 +141,9 @@ class OnyxAppState extends State<OnyxApp> {
theme: themeState.lightTheme,
darkTheme: themeState.darkTheme,
home: Scaffold(
backgroundColor: themeState
.darkTheme?.colorScheme.background ??
OnyxTheme().darkTheme.colorScheme.background,
backgroundColor:
themeState.darkTheme?.colorScheme.background ??
OnyxTheme.darkTheme.colorScheme.background,
body:
const CustomCircularProgressIndicatorWidget()),
);
Expand Down
57 changes: 32 additions & 25 deletions apps/onyx/lib/core/theme/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:onyx/screens/settings/settings_export.dart';
import 'package:flutter/material.dart';

class OnyxTheme {
ThemeData darkTheme = ThemeData(
static ThemeData darkTheme = ThemeData(
useMaterial3: true,
cardTheme: const CardTheme(color: Color(0xff4c566a)),
cardColor: const Color(0xff4c566a),
Expand All @@ -22,14 +22,15 @@ class OnyxTheme {
labelLarge: TextStyle(color: Color(0xffffffff)),
bodyLarge: TextStyle(color: Color(0xffd8dee9)),
bodyMedium: TextStyle(color: Color(0xffc2c8d2)),
bodySmall: TextStyle(color: Colors.black),
),
colorScheme: const ColorScheme.dark(
background: Color(0xff434c5e),
primary: Color(0xffd08770),
),
);

ThemeData lightTheme = ThemeData(
static ThemeData lightTheme = ThemeData(
useMaterial3: true,
cardTheme: const CardTheme(color: Color(0xffe5e9f0)),
cardColor: const Color(0xffe5e9f0),
Expand All @@ -49,14 +50,15 @@ class OnyxTheme {
labelLarge: TextStyle(color: Color(0xff4c566a)),
bodyLarge: TextStyle(color: Color(0xff4c566a)),
bodyMedium: TextStyle(color: Color(0xff4c566a)),
bodySmall: TextStyle(color: Colors.white),
),
colorScheme: const ColorScheme.light(
background: Color(0xffd8dee9),
primary: Color(0xffd08770),
),
);

ThemeData nichihachiTheme = ThemeData(
static ThemeData nichihachiTheme = ThemeData(
useMaterial3: true,
cardTheme: const CardTheme(color: Color.fromARGB(255, 40, 40, 60)),
cardColor: const Color.fromARGB(255, 40, 40, 60),
Expand All @@ -76,14 +78,15 @@ class OnyxTheme {
labelLarge: TextStyle(color: Color.fromARGB(255, 255, 255, 255)),
bodyLarge: TextStyle(color: Color.fromARGB(255, 211, 211, 211)),
bodyMedium: TextStyle(color: Color.fromARGB(255, 211, 211, 211)),
bodySmall: TextStyle(color: Colors.black),
),
colorScheme: const ColorScheme.dark(
background: Color.fromARGB(255, 20, 20, 30),
primary: Color.fromARGB(255, 80, 120, 255),
),
);

ThemeData blueSkyTheme = ThemeData(
static ThemeData blueSkyTheme = ThemeData(
useMaterial3: true,
cardTheme: const CardTheme(color: Color.fromARGB(255, 220, 240, 255)),
cardColor: const Color.fromARGB(255, 220, 240, 255),
Expand All @@ -102,14 +105,15 @@ class OnyxTheme {
labelLarge: TextStyle(color: Color.fromARGB(255, 76, 79, 106)),
bodyLarge: TextStyle(color: Color.fromARGB(255, 76, 79, 106)),
bodyMedium: TextStyle(color: Color.fromARGB(255, 76, 79, 106)),
bodySmall: TextStyle(color: Colors.white),
),
colorScheme: const ColorScheme.light(
background: Color.fromARGB(255, 204, 226, 255),
primary: Color.fromARGB(255, 74, 166, 236),
),
);

ThemeData ultrakillTheme = ThemeData(
static ThemeData ultrakillTheme = ThemeData(
useMaterial3: true,
cardTheme: const CardTheme(color: Color.fromARGB(255, 30, 30, 30)),
cardColor: const Color.fromARGB(255, 30, 30, 30),
Expand All @@ -129,14 +133,15 @@ class OnyxTheme {
labelLarge: TextStyle(color: Color.fromARGB(255, 255, 255, 255)),
bodyLarge: TextStyle(color: Color.fromARGB(255, 200, 200, 200)),
bodyMedium: TextStyle(color: Color.fromARGB(255, 200, 200, 200)),
bodySmall: TextStyle(color: Colors.black),
),
colorScheme: const ColorScheme.dark(
background: Color.fromARGB(255, 20, 20, 20),
primary: Color.fromARGB(255, 255, 87, 34),
),
);

ThemeData badappleTheme = ThemeData(
static ThemeData badappleTheme = ThemeData(
useMaterial3: true,
cardTheme: const CardTheme(color: Color.fromARGB(255, 20, 20, 20)),
cardColor: const Color.fromARGB(255, 20, 20, 20),
Expand Down Expand Up @@ -164,7 +169,7 @@ class OnyxTheme {
),
);

ThemeData moonlightTheme = ThemeData(
static ThemeData moonlightTheme = ThemeData(
useMaterial3: true,
cardTheme: const CardTheme(color: Color.fromARGB(255, 35, 40, 50)),
cardColor: const Color.fromARGB(255, 35, 40, 50),
Expand All @@ -184,14 +189,15 @@ class OnyxTheme {
labelLarge: TextStyle(color: Color.fromARGB(255, 200, 200, 220)),
bodyLarge: TextStyle(color: Color.fromARGB(255, 180, 180, 180)),
bodyMedium: TextStyle(color: Color.fromARGB(255, 180, 180, 180)),
bodySmall: TextStyle(color: Colors.black),
),
colorScheme: const ColorScheme.dark(
background: Color.fromARGB(255, 20, 25, 30),
primary: Color.fromARGB(255, 140, 180, 200),
),
);

ThemeData stardewValleyTheme = ThemeData(
static ThemeData stardewValleyTheme = ThemeData(
useMaterial3: true,
cardTheme: const CardTheme(color: Color.fromARGB(255, 220, 240, 200)),
cardColor: const Color.fromARGB(255, 220, 240, 200),
Expand All @@ -211,29 +217,30 @@ class OnyxTheme {
labelLarge: TextStyle(color: Color.fromARGB(255, 76, 79, 106)),
bodyLarge: TextStyle(color: Color.fromARGB(255, 76, 79, 106)),
bodyMedium: TextStyle(color: Color.fromARGB(255, 76, 79, 106)),
bodySmall: TextStyle(color: Colors.white),
),
colorScheme: const ColorScheme.light(
background: Color.fromARGB(255, 198, 226, 143),
primary: Color.fromARGB(255, 34, 139, 34),
),
);
}

List<ThemeInfo> themesPreset = [
ThemeInfo('Dark Default', OnyxTheme().darkTheme),
ThemeInfo('Light Default', OnyxTheme().lightTheme),
ThemeInfo('Nichi Hachi', OnyxTheme().nichihachiTheme),
ThemeInfo('Blue Sky', OnyxTheme().blueSkyTheme),
ThemeInfo('ULTRAKILL', OnyxTheme().ultrakillTheme),
ThemeInfo('Stardew Valley', OnyxTheme().stardewValleyTheme),
ThemeInfo('Bad Apple', OnyxTheme().badappleTheme),
ThemeInfo('Moon Light', OnyxTheme().moonlightTheme),
];
static List<ThemeInfo> themesPreset = [
ThemeInfo('Dark Default', OnyxTheme.darkTheme),
ThemeInfo('Light Default', OnyxTheme.lightTheme),
ThemeInfo('Nichi Hachi', OnyxTheme.nichihachiTheme),
ThemeInfo('Blue Sky', OnyxTheme.blueSkyTheme),
ThemeInfo('ULTRAKILL', OnyxTheme.ultrakillTheme),
ThemeInfo('Stardew Valley', OnyxTheme.stardewValleyTheme),
ThemeInfo('Bad Apple', OnyxTheme.badappleTheme),
ThemeInfo('Moon Light', OnyxTheme.moonlightTheme),
];

List<ThemeInfo> themesPresetDark = themesPreset
.where((themeInfo) => themeInfo.theme.brightness == Brightness.dark)
.toList();
static List<ThemeInfo> themesPresetDark = themesPreset
.where((themeInfo) => themeInfo.theme.brightness == Brightness.dark)
.toList();

List<ThemeInfo> themesPresetLight = themesPreset
.where((themeInfo) => themeInfo.theme.brightness == Brightness.light)
.toList();
static List<ThemeInfo> themesPresetLight = themesPreset
.where((themeInfo) => themeInfo.theme.brightness == Brightness.light)
.toList();
}
140 changes: 70 additions & 70 deletions apps/onyx/lib/screens/agenda/logic/agenda_logic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ class AgendaLogic {
}
} else {
menuToAdd.add((Event(
location: resto.name,
menuCrous: menu,
teacher: "",
description: "",
name: menu.type.toString(),
start: startLimit.add(const Duration(minutes: 1)),
end: endLimit.subtract(const Duration(minutes: 1)),
)));
location: resto.name,
menuCrous: menu,
teacher: "",
description: "",
name: menu.type.toString(),
start: startLimit.add(const Duration(minutes: 1)),
end: endLimit.subtract(const Duration(minutes: 1)),
)));
}
}
}
Expand All @@ -165,81 +165,81 @@ class AgendaLogic {
static final List<Day> dayListMock = [
Day(DateTime(2022, 9, 1), [
Event(
location: "Déambu",
description: "mockDescription1",
teacher: "mockTeacher1",
name: "mockname1",
start: DateTime(2022, 9, 1, 8),
end: DateTime(2022, 9, 1, 9),
location: "Déambu",
description: "mockDescription1",
teacher: "mockTeacher1",
name: "mockname1",
start: DateTime(2022, 9, 1, 8),
end: DateTime(2022, 9, 1, 9),
),
Event(
location: "Thémis",
description: "mockDescription2",
teacher: "mockTeacher2",
name: "mockname2",
start: DateTime(2022, 9, 1, 9),
end: DateTime(2022, 9, 1, 10),
),
location: "Thémis",
description: "mockDescription2",
teacher: "mockTeacher2",
name: "mockname2",
start: DateTime(2022, 9, 1, 9),
end: DateTime(2022, 9, 1, 10),
),
Event(
location: "Nautibus",
description: "mockDescription3",
teacher: "mockTeacher3",
name: "mockname3",
start: DateTime(2022, 9, 1, 10),
end: DateTime(2022, 9, 1, 11),
),
location: "Nautibus",
description: "mockDescription3",
teacher: "mockTeacher3",
name: "mockname3",
start: DateTime(2022, 9, 1, 10),
end: DateTime(2022, 9, 1, 11),
),
]),
Day(DateTime(2022, 9, 2), [
Event(
location: "quai 43",
description: "mockDescription4",
teacher: "mockTeacher4",
name: "mockname4",
start: DateTime(2022, 9, 1, 11),
end: DateTime(2022, 9, 1, 12),
),
location: "quai 43",
description: "mockDescription4",
teacher: "mockTeacher4",
name: "mockname4",
start: DateTime(2022, 9, 1, 11),
end: DateTime(2022, 9, 1, 12),
),
Event(
location: "ISTIL",
description: "mockDescription5",
teacher: "mockTeacher5",
name: "mockname5",
start: DateTime(2022, 9, 1, 12),
end: DateTime(2022, 9, 1, 13),
),
location: "ISTIL",
description: "mockDescription5",
teacher: "mockTeacher5",
name: "mockname5",
start: DateTime(2022, 9, 1, 12),
end: DateTime(2022, 9, 1, 13),
),
Event(
location: "Forel",
description: "mockDescription6",
teacher: "mockTeacher6",
name: "mockname6",
start: DateTime(2022, 9, 1, 13),
end: DateTime(2022, 9, 1, 14),
),
location: "Forel",
description: "mockDescription6",
teacher: "mockTeacher6",
name: "mockname6",
start: DateTime(2022, 9, 1, 13),
end: DateTime(2022, 9, 1, 14),
),
]),
Day(DateTime(2022, 9, 3), [
Event(
location: "Déambu",
description: "mockDescription7",
teacher: "mockTeacher7",
name: "mockname7",
start: DateTime(2022, 9, 1, 14),
end: DateTime(2022, 9, 1, 15),
),
location: "Déambu",
description: "mockDescription7",
teacher: "mockTeacher7",
name: "mockname7",
start: DateTime(2022, 9, 1, 14),
end: DateTime(2022, 9, 1, 15),
),
Event(
location: "Thémis",
description: "mockDescription8",
teacher: "mockTeacher8",
name: "mockname8",
start: DateTime(2022, 9, 1, 15),
end: DateTime(2022, 9, 1, 16),
),
location: "Thémis",
description: "mockDescription8",
teacher: "mockTeacher8",
name: "mockname8",
start: DateTime(2022, 9, 1, 15),
end: DateTime(2022, 9, 1, 16),
),
Event(
location: "Nautibus",
description: "mockDescription9",
teacher: "mockTeacher9",
name: "mockname9",
start: DateTime(2022, 9, 1, 16),
end: DateTime(2022, 9, 1, 17),
),
location: "Nautibus",
description: "mockDescription9",
teacher: "mockTeacher9",
name: "mockname9",
start: DateTime(2022, 9, 1, 16),
end: DateTime(2022, 9, 1, 17),
),
]),
for (int i = 4; i < 300; i++)
Day(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,7 @@ class AgendaConfigPage extends StatelessWidget {
padding: EdgeInsets.all(0.8.h),
child: Icon(
Icons.qr_code_rounded,
color: Theme.of(context).textTheme.bodySmall?.color ??
((Theme.of(context).brightness == Brightness.light)
? const Color.fromARGB(255, 255, 255, 255)
: const Color.fromARGB(255, 0, 0, 0)),
color: Theme.of(context).textTheme.bodySmall!.color,
size: 30.sp,
),
),
Expand Down
Loading

0 comments on commit a11c2a4

Please sign in to comment.