From a11c2a40efb60e04e80b681f1bb9d14ff69401d0 Mon Sep 17 00:00:00 2001 From: eymeric Date: Mon, 20 Nov 2023 20:15:14 +0100 Subject: [PATCH] remove smallbody useless test and use static --- apps/onyx/lib/app.dart | 8 +- apps/onyx/lib/core/theme/theme.dart | 57 +++---- .../screens/agenda/logic/agenda_logic.dart | 140 +++++++++--------- .../page/agenda_config_page.dart | 5 +- .../screens/izly/pages/izly_login_page.dart | 25 +--- .../izly/pages/izly_recharge_cb_page.dart | 18 +-- .../izly/pages/izly_recharge_tiers_page.dart | 5 +- .../pages/izly_recharge_transfer_page.dart | 16 +- .../widgets/izly_rechage_card_widget.dart | 14 +- .../widgets/izly_recharge_amount_widget.dart | 16 +- .../lib/screens/login/pages/login_page.dart | 8 +- .../screens/mails/pages/email_send_page.dart | 5 +- .../lib/screens/mails/pages/emails_page.dart | 5 +- .../send/email_send_autocomplete_widget.dart | 3 +- .../map/domain/logic/navigation_logic.dart | 3 +- .../screens/settings/pages/settings_page.dart | 44 +++--- .../settings/pages/themes_swap_page.dart | 12 +- .../screens/settings/states/theme_cubit.dart | 4 +- .../screens/settings/states/theme_state.dart | 4 +- .../widgets/agenda_url_parameter_widget.dart | 3 +- .../tomuss_compact_element_widget.dart | 30 ++-- .../compact/grade_compact_widget.dart | 4 +- .../grade/grade_list_widget.dart | 5 +- .../grade/grade_widget.dart | 6 +- .../lyon1agendaclient/example/example.dart | 2 +- .../lib/src/model/model_export.dart | 2 +- .../lyon1tomussclient/lib/src/model/url.dart | 1 - .../lib/src/parser/condition_parser.dart | 4 +- 28 files changed, 206 insertions(+), 243 deletions(-) diff --git a/apps/onyx/lib/app.dart b/apps/onyx/lib/app.dart index c690abde..6a638c71 100644 --- a/apps/onyx/lib/app.dart +++ b/apps/onyx/lib/app.dart @@ -57,7 +57,7 @@ class OnyxAppState extends State { BlocProvider(create: (context) => MapCubit()), BlocProvider(create: (context) => IzlyCubit()), BlocProvider( - create: (context) => ThemeCubit(themesPreset)), + create: (context) => ThemeCubit(OnyxTheme.themesPreset)), ], child: BlocBuilder( builder: (context, themeState) { @@ -141,9 +141,9 @@ class OnyxAppState extends State { 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()), ); diff --git a/apps/onyx/lib/core/theme/theme.dart b/apps/onyx/lib/core/theme/theme.dart index ba849373..aeb8ae6d 100644 --- a/apps/onyx/lib/core/theme/theme.dart +++ b/apps/onyx/lib/core/theme/theme.dart @@ -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), @@ -22,6 +22,7 @@ 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), @@ -29,7 +30,7 @@ class OnyxTheme { ), ); - ThemeData lightTheme = ThemeData( + static ThemeData lightTheme = ThemeData( useMaterial3: true, cardTheme: const CardTheme(color: Color(0xffe5e9f0)), cardColor: const Color(0xffe5e9f0), @@ -49,6 +50,7 @@ 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), @@ -56,7 +58,7 @@ class OnyxTheme { ), ); - 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), @@ -76,6 +78,7 @@ 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), @@ -83,7 +86,7 @@ class OnyxTheme { ), ); - 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), @@ -102,6 +105,7 @@ 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), @@ -109,7 +113,7 @@ class OnyxTheme { ), ); - 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), @@ -129,6 +133,7 @@ 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), @@ -136,7 +141,7 @@ class OnyxTheme { ), ); - 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), @@ -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), @@ -184,6 +189,7 @@ 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), @@ -191,7 +197,7 @@ class OnyxTheme { ), ); - 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), @@ -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 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 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 themesPresetDark = themesPreset - .where((themeInfo) => themeInfo.theme.brightness == Brightness.dark) - .toList(); + static List themesPresetDark = themesPreset + .where((themeInfo) => themeInfo.theme.brightness == Brightness.dark) + .toList(); -List themesPresetLight = themesPreset - .where((themeInfo) => themeInfo.theme.brightness == Brightness.light) - .toList(); + static List themesPresetLight = themesPreset + .where((themeInfo) => themeInfo.theme.brightness == Brightness.light) + .toList(); +} diff --git a/apps/onyx/lib/screens/agenda/logic/agenda_logic.dart b/apps/onyx/lib/screens/agenda/logic/agenda_logic.dart index 35a937a3..45611593 100644 --- a/apps/onyx/lib/screens/agenda/logic/agenda_logic.dart +++ b/apps/onyx/lib/screens/agenda/logic/agenda_logic.dart @@ -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)), + ))); } } } @@ -165,81 +165,81 @@ class AgendaLogic { static final List 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( diff --git a/apps/onyx/lib/screens/agenda_config/page/agenda_config_page.dart b/apps/onyx/lib/screens/agenda_config/page/agenda_config_page.dart index 88367f0e..9bf8debd 100644 --- a/apps/onyx/lib/screens/agenda_config/page/agenda_config_page.dart +++ b/apps/onyx/lib/screens/agenda_config/page/agenda_config_page.dart @@ -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, ), ), diff --git a/apps/onyx/lib/screens/izly/pages/izly_login_page.dart b/apps/onyx/lib/screens/izly/pages/izly_login_page.dart index fb4eca28..85d7ab32 100644 --- a/apps/onyx/lib/screens/izly/pages/izly_login_page.dart +++ b/apps/onyx/lib/screens/izly/pages/izly_login_page.dart @@ -98,12 +98,9 @@ class _IzlyLoginPageState extends State { horizontal: 2.w, vertical: 0.5.h), child: Text( "Confidentialité", - style: (Theme.of(context) + style: Theme.of(context) .textTheme - .bodySmall ?? - Theme.of(context) - .textTheme - .bodyLarge!) + .bodySmall! .copyWith(fontSize: 17.sp), ), ), @@ -141,7 +138,7 @@ class _IzlyLoginPageState extends State { Icons.school_rounded, size: 18.sp, color: - (Theme.of(context).textTheme.bodySmall?.color ?? + (Theme.of(context).textTheme.bodySmall!.color ?? Theme.of(context) .textTheme .bodyLarge! @@ -229,14 +226,8 @@ class _IzlyLoginPageState extends State { child: Text( 'Connexion', style: TextStyle( - 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, fontSize: 18.sp, ), ), @@ -300,14 +291,14 @@ class _PasswordFormFieldState extends State { decoration: widget.decoration.copyWith( labelText: 'Password', labelStyle: Theme.of(context).textTheme.bodyLarge!.copyWith( - color: (Theme.of(context).textTheme.bodySmall?.color ?? + color: (Theme.of(context).textTheme.bodySmall!.color ?? Theme.of(context).textTheme.bodyLarge!.color!) .withOpacity(0.5), ), prefixIcon: Icon( Icons.lock_rounded, size: 18.sp, - color: (Theme.of(context).textTheme.bodySmall?.color ?? + color: (Theme.of(context).textTheme.bodySmall!.color ?? Theme.of(context).textTheme.bodyLarge!.color!) .withOpacity(0.5), ), @@ -316,7 +307,7 @@ class _PasswordFormFieldState extends State { _isObscure ? Icons.visibility_rounded : Icons.visibility_off_rounded, - color: (Theme.of(context).textTheme.bodySmall?.color ?? + color: (Theme.of(context).textTheme.bodySmall!.color ?? Theme.of(context).textTheme.bodyLarge!.color!), ), onPressed: () { diff --git a/apps/onyx/lib/screens/izly/pages/izly_recharge_cb_page.dart b/apps/onyx/lib/screens/izly/pages/izly_recharge_cb_page.dart index 4035bc50..6a85c490 100644 --- a/apps/onyx/lib/screens/izly/pages/izly_recharge_cb_page.dart +++ b/apps/onyx/lib/screens/izly/pages/izly_recharge_cb_page.dart @@ -81,17 +81,13 @@ class _IzlyRechargeCBPageState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), - child: Text("Payer", - style: TextStyle( - 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)))), - ) + child: Text( + "Payer", + style: TextStyle( + color: Theme.of(context).textTheme.bodySmall?.color, + ), + ), + ), ], ), ), diff --git a/apps/onyx/lib/screens/izly/pages/izly_recharge_tiers_page.dart b/apps/onyx/lib/screens/izly/pages/izly_recharge_tiers_page.dart index 44c38475..9cce5e53 100644 --- a/apps/onyx/lib/screens/izly/pages/izly_recharge_tiers_page.dart +++ b/apps/onyx/lib/screens/izly/pages/izly_recharge_tiers_page.dart @@ -70,10 +70,7 @@ class IzlyRechargeTiersPage extends StatelessWidget { child: Text( "Transferer", style: TextStyle( - 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, ), ), ), diff --git a/apps/onyx/lib/screens/izly/pages/izly_recharge_transfer_page.dart b/apps/onyx/lib/screens/izly/pages/izly_recharge_transfer_page.dart index f910c67d..6911f430 100644 --- a/apps/onyx/lib/screens/izly/pages/izly_recharge_transfer_page.dart +++ b/apps/onyx/lib/screens/izly/pages/izly_recharge_transfer_page.dart @@ -35,16 +35,12 @@ class IzlyRechargeTranferPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), - child: Text("Transferer", - style: TextStyle( - 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)))), + child: Text( + "Transferer", + style: TextStyle( + color: Theme.of(context).textTheme.bodySmall?.color, + ), + ), ), ], ), diff --git a/apps/onyx/lib/screens/izly/widgets/izly_rechage_card_widget.dart b/apps/onyx/lib/screens/izly/widgets/izly_rechage_card_widget.dart index 8c87e00e..7c1d2884 100644 --- a/apps/onyx/lib/screens/izly/widgets/izly_rechage_card_widget.dart +++ b/apps/onyx/lib/screens/izly/widgets/izly_rechage_card_widget.dart @@ -43,19 +43,15 @@ class IzlayRechargeCardWidget extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(icon, - 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))), + Icon( + icon, + color: Theme.of(context).textTheme.bodySmall!.color, + ), Text( text, textAlign: TextAlign.center, style: TextStyle( - 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, ), ), ], diff --git a/apps/onyx/lib/screens/izly/widgets/izly_recharge_amount_widget.dart b/apps/onyx/lib/screens/izly/widgets/izly_recharge_amount_widget.dart index e745c592..8b2bab6d 100644 --- a/apps/onyx/lib/screens/izly/widgets/izly_recharge_amount_widget.dart +++ b/apps/onyx/lib/screens/izly/widgets/izly_recharge_amount_widget.dart @@ -35,7 +35,7 @@ class IzlyRechargeAmountWidget extends StatelessWidget { border: InputBorder.none, ), style: TextStyle( - fontSize: 15.sp, + fontSize: 15.sp, color: Theme.of(context).textTheme.bodyLarge!.color), textAlign: TextAlign.center, textAlignVertical: TextAlignVertical.center, @@ -129,13 +129,13 @@ class IzlyRechargeAmountExampleValuesWidget extends StatelessWidget { width: 17.w, height: 17.w, child: Center( - child: Text(value.toStringAsFixed(2), - style: TextStyle( - fontSize: 15.sp, - color: Theme.of(context).textTheme.bodySmall?.color ?? - ((Theme.of(context).brightness == Brightness.light) - ? Color.fromARGB(255, 255, 255, 255) - : const Color.fromARGB(255, 0, 0, 0)))), + child: Text( + value.toStringAsFixed(2), + style: TextStyle( + fontSize: 15.sp, + color: Theme.of(context).textTheme.bodySmall!.color, + ), + ), ), ), ), diff --git a/apps/onyx/lib/screens/login/pages/login_page.dart b/apps/onyx/lib/screens/login/pages/login_page.dart index dba1f868..6d39bb12 100644 --- a/apps/onyx/lib/screens/login/pages/login_page.dart +++ b/apps/onyx/lib/screens/login/pages/login_page.dart @@ -131,10 +131,10 @@ class _LoginPageState extends State { child: TextFormField( autofillHints: const [AutofillHints.username], onSaved: (String? value) => username = - (RegExp(r"^([pP])\d{7}$") - .hasMatch(value!.trim())) - ? value.trim().replaceFirst("p", "P") - : value.trim(), + (RegExp(r"^([pP])\d{7}$") + .hasMatch(value!.trim())) + ? value.trim().replaceFirst("p", "P") + : value.trim(), textInputAction: TextInputAction.next, decoration: InputDecoration( labelText: 'Username', diff --git a/apps/onyx/lib/screens/mails/pages/email_send_page.dart b/apps/onyx/lib/screens/mails/pages/email_send_page.dart index 711415e8..76d9ffd5 100644 --- a/apps/onyx/lib/screens/mails/pages/email_send_page.dart +++ b/apps/onyx/lib/screens/mails/pages/email_send_page.dart @@ -87,10 +87,7 @@ class MailSendPage extends StatelessWidget { padding: EdgeInsets.all(1.5.h), child: Icon(Icons.send_rounded, size: 25.sp, - 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), ), ), ), diff --git a/apps/onyx/lib/screens/mails/pages/emails_page.dart b/apps/onyx/lib/screens/mails/pages/emails_page.dart index f564466f..1ca0b923 100644 --- a/apps/onyx/lib/screens/mails/pages/emails_page.dart +++ b/apps/onyx/lib/screens/mails/pages/emails_page.dart @@ -106,10 +106,7 @@ class MailsPage extends StatelessWidget { padding: EdgeInsets.all(1.5.h), child: Icon( Icons.create_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: 25.sp, ), ), diff --git a/apps/onyx/lib/screens/mails/widgets/send/email_send_autocomplete_widget.dart b/apps/onyx/lib/screens/mails/widgets/send/email_send_autocomplete_widget.dart index 9c263803..7b246af0 100644 --- a/apps/onyx/lib/screens/mails/widgets/send/email_send_autocomplete_widget.dart +++ b/apps/onyx/lib/screens/mails/widgets/send/email_send_autocomplete_widget.dart @@ -8,7 +8,8 @@ import 'package:onyx/screens/settings/states/settings_cubit.dart'; import 'package:responsive_sizer/responsive_sizer.dart'; class MailSendAutocompleteWidget extends StatelessWidget { - const MailSendAutocompleteWidget({super.key, required this.destinationEditor}); + const MailSendAutocompleteWidget( + {super.key, required this.destinationEditor}); final TextEditingController destinationEditor; @override diff --git a/apps/onyx/lib/screens/map/domain/logic/navigation_logic.dart b/apps/onyx/lib/screens/map/domain/logic/navigation_logic.dart index 27269c6d..1bd40fb0 100644 --- a/apps/onyx/lib/screens/map/domain/logic/navigation_logic.dart +++ b/apps/onyx/lib/screens/map/domain/logic/navigation_logic.dart @@ -19,7 +19,8 @@ class NavigationLogic { BuildContext context, List latLngs, {bool useLastLocation = false}) async { List> paths = []; - LatLng position = (await GeolocationLogic.getCurrentLocation(context: context))!; + LatLng position = + (await GeolocationLogic.getCurrentLocation(context: context))!; for (var latLng in latLngs) { if (position.inside(MapRes.minBound, MapRes.maxBound) && latLng.inside(MapRes.minBound, MapRes.maxBound)) { diff --git a/apps/onyx/lib/screens/settings/pages/settings_page.dart b/apps/onyx/lib/screens/settings/pages/settings_page.dart index 136d50ae..923feabc 100644 --- a/apps/onyx/lib/screens/settings/pages/settings_page.dart +++ b/apps/onyx/lib/screens/settings/pages/settings_page.dart @@ -97,30 +97,28 @@ class _SettingsPageState extends State { height: 5, ), MaterialButton( - color: Theme.of(context).primaryColor, - textColor: - Theme.of(context).textTheme.bodyLarge?.color ?? - Colors.black, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + color: Theme.of(context).primaryColor, + textColor: + Theme.of(context).textTheme.bodyLarge?.color ?? + Colors.black, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: Text( + 'Changer les thèmes', + style: TextStyle( + fontSize: 17.sp, + color: Theme.of(context).textTheme.bodySmall?.color, ), - child: Text('Changer les thèmes', - style: TextStyle( - fontSize: 17.sp, - color: Theme.of(context) - .textTheme - .bodySmall - ?.color ?? - ((Theme.of(context).brightness == - Brightness.light) - ? Color.fromARGB(255, 255, 255, 255) - : const Color.fromARGB( - 255, 0, 0, 0)))), - onPressed: () { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => ThemesSwap(), - )); - }), + ), + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => const ThemesSwap(), + ), + ); + }, + ), const SizedBox( height: 5, ), diff --git a/apps/onyx/lib/screens/settings/pages/themes_swap_page.dart b/apps/onyx/lib/screens/settings/pages/themes_swap_page.dart index 0ed0421b..d8e222ae 100644 --- a/apps/onyx/lib/screens/settings/pages/themes_swap_page.dart +++ b/apps/onyx/lib/screens/settings/pages/themes_swap_page.dart @@ -41,11 +41,11 @@ class _ThemesSwapState extends State { "Thèmes favoris", listJsonToThemeInfo(themeState.themesUserData!.favoriteThemes), themeState), - expansionTheme( - context, "Thèmes clairs", themesPresetLight, themeState, + expansionTheme(context, "Thèmes clairs", + OnyxTheme.themesPresetLight, themeState, themesCreated: themeCreatedLight), - expansionTheme( - context, "Thèmes sombres", themesPresetDark, themeState, + expansionTheme(context, "Thèmes sombres", + OnyxTheme.themesPresetDark, themeState, themesCreated: themeCreatedDark), ])); })); @@ -163,9 +163,9 @@ class _ThemesSwapState extends State { theme.name, themeState.themesUserData!.favoriteThemes) != -1) - Positioned( + Positioned( top: 15, - right: 18 - (index+1)%2*2, + right: 18 - (index + 1) % 2 * 2, child: const Icon( Icons.favorite, color: Colors.red, diff --git a/apps/onyx/lib/screens/settings/states/theme_cubit.dart b/apps/onyx/lib/screens/settings/states/theme_cubit.dart index ea66835b..01a2ade7 100644 --- a/apps/onyx/lib/screens/settings/states/theme_cubit.dart +++ b/apps/onyx/lib/screens/settings/states/theme_cubit.dart @@ -28,7 +28,7 @@ class ThemeCubit extends Cubit { if (box.containsKey('data')) { themesUserData = box.get('data'); } else { - themesUserData = ThemesUserData(); + themesUserData = const ThemesUserData(); await box.put('data', themesUserData); } @@ -38,7 +38,7 @@ class ThemeCubit extends Cubit { await loadTheme(themesUserData.darkThemeSelected); emit(state.copyWith( - state: ThemeStateStatus.loaded, themesUserData: themesUserData)); + status: ThemeStateStatus.loaded, themesUserData: themesUserData)); } /// Load the theme from the input. diff --git a/apps/onyx/lib/screens/settings/states/theme_state.dart b/apps/onyx/lib/screens/settings/states/theme_state.dart index 0f7d20e1..f453a519 100644 --- a/apps/onyx/lib/screens/settings/states/theme_state.dart +++ b/apps/onyx/lib/screens/settings/states/theme_state.dart @@ -19,14 +19,14 @@ class ThemeState extends Equatable { // Define a copyWith method for creating a new instance with modified properties ThemeState copyWith({ - ThemeStateStatus? state, + ThemeStateStatus? status, ThemeData? darkTheme, ThemeData? lightTheme, ThemeMode? themeMode, ThemesUserData? themesUserData, }) { return ThemeState( - status: state ?? this.status, + status: status ?? this.status, darkTheme: darkTheme ?? this.darkTheme, lightTheme: lightTheme ?? this.lightTheme, themeMode: themeMode ?? this.themeMode, diff --git a/apps/onyx/lib/screens/settings/widgets/agenda_url_parameter_widget.dart b/apps/onyx/lib/screens/settings/widgets/agenda_url_parameter_widget.dart index c8f02a45..4238c047 100644 --- a/apps/onyx/lib/screens/settings/widgets/agenda_url_parameter_widget.dart +++ b/apps/onyx/lib/screens/settings/widgets/agenda_url_parameter_widget.dart @@ -13,8 +13,7 @@ class AgendaUrlParameterWidget extends StatelessWidget { return BlocBuilder( buildWhen: (previous, current) { if (previous.settings.fetchAgendaAuto != - current.settings.fetchAgendaAuto) { - } + current.settings.fetchAgendaAuto) {} return true; }, builder: (context, state) { diff --git a/apps/onyx/lib/screens/tomuss/widgets/tomuss_compact_element_widget.dart b/apps/onyx/lib/screens/tomuss/widgets/tomuss_compact_element_widget.dart index ada560be..cb224095 100644 --- a/apps/onyx/lib/screens/tomuss/widgets/tomuss_compact_element_widget.dart +++ b/apps/onyx/lib/screens/tomuss/widgets/tomuss_compact_element_widget.dart @@ -63,18 +63,14 @@ class TomussCompactElementWidget extends StatelessWidget { overflow: TextOverflow.clip, color: (Theme.of(context).colorScheme.background == - OnyxTheme() - .darkTheme - .colorScheme + OnyxTheme.darkTheme.colorScheme .background) ? Theme.of(context) .textTheme .bodyMedium! .color - : OnyxTheme() - .darkTheme - .colorScheme - .background, + : OnyxTheme + .darkTheme.colorScheme.background, ), ), ), @@ -98,18 +94,14 @@ class TomussCompactElementWidget extends StatelessWidget { (Theme.of(context) .colorScheme .background == - OnyxTheme() - .darkTheme - .colorScheme + OnyxTheme.darkTheme.colorScheme .background) ? Theme.of(context) .textTheme .bodyMedium! .color - : OnyxTheme() - .darkTheme - .colorScheme - .background, + : OnyxTheme + .darkTheme.colorScheme.background, ), ), ), @@ -131,18 +123,14 @@ class TomussCompactElementWidget extends StatelessWidget { overflow: TextOverflow.clip, color: (Theme.of(context).colorScheme.background == - OnyxTheme() - .darkTheme - .colorScheme + OnyxTheme.darkTheme.colorScheme .background) ? Theme.of(context) .textTheme .bodyMedium! .color - : OnyxTheme() - .darkTheme - .colorScheme - .background, + : OnyxTheme + .darkTheme.colorScheme.background, ), ), ), diff --git a/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/compact/grade_compact_widget.dart b/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/compact/grade_compact_widget.dart index bf00a8d1..c44b1cb0 100644 --- a/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/compact/grade_compact_widget.dart +++ b/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/compact/grade_compact_widget.dart @@ -31,7 +31,7 @@ class GradeCompactWidget extends StatelessWidget { Text( grade.numerator.toString(), style: TextStyle( - color: OnyxTheme().darkTheme.colorScheme.background, + color: OnyxTheme.darkTheme.colorScheme.background, fontSize: 15.sp, fontWeight: FontWeight.bold, ), @@ -39,7 +39,7 @@ class GradeCompactWidget extends StatelessWidget { Text( '/${grade.denominator.toStringAsFixed(0)}', style: TextStyle( - color: OnyxTheme().darkTheme.colorScheme.background, + color: OnyxTheme.darkTheme.colorScheme.background, fontSize: 11.sp, fontWeight: FontWeight.bold, ), diff --git a/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/grade/grade_list_widget.dart b/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/grade/grade_list_widget.dart index f611d3ad..131a4d7b 100644 --- a/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/grade/grade_list_widget.dart +++ b/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/grade/grade_list_widget.dart @@ -5,7 +5,10 @@ import 'package:responsive_sizer/responsive_sizer.dart'; class GradeListWidget extends StatelessWidget { const GradeListWidget( - {super.key, required this.grades, this.depth = 1, this.lastElement = true}); + {super.key, + required this.grades, + this.depth = 1, + this.lastElement = true}); final Grade grades; final int depth; final bool lastElement; diff --git a/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/grade/grade_widget.dart b/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/grade/grade_widget.dart index 2b23dc00..0f7386d6 100644 --- a/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/grade/grade_widget.dart +++ b/apps/onyx/lib/screens/tomuss/widgets/tomuss_element_widgets/grade/grade_widget.dart @@ -92,7 +92,7 @@ class _GradeWidgetState extends State { textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.bold, - color: OnyxTheme().darkTheme.colorScheme.background, + color: OnyxTheme.darkTheme.colorScheme.background, fontSize: 20.sp, ), ), @@ -105,7 +105,7 @@ class _GradeWidgetState extends State { flex: 5, child: Container( height: 0.2.h, - color: OnyxTheme().darkTheme.colorScheme.background, + color: OnyxTheme.darkTheme.colorScheme.background, ), ), const Spacer(), @@ -118,7 +118,7 @@ class _GradeWidgetState extends State { ((widget.grades.isNotEmpty) ? denominator : '-').toString(), textAlign: TextAlign.center, style: TextStyle( - color: OnyxTheme().darkTheme.colorScheme.background, + color: OnyxTheme.darkTheme.colorScheme.background, fontSize: 16.sp), ), ), diff --git a/packages/lyon1agendaclient/example/example.dart b/packages/lyon1agendaclient/example/example.dart index 388701bc..cd721ad9 100755 --- a/packages/lyon1agendaclient/example/example.dart +++ b/packages/lyon1agendaclient/example/example.dart @@ -3,7 +3,7 @@ import 'package:lyon1casclient/lyon1casclient.dart'; void main() async { final Lyon1AgendaClient agendaClient = - Lyon1AgendaClient.useLyon1Cas(Lyon1CasClient()); + Lyon1AgendaClient.useLyon1Cas(Lyon1CasClient()); final Agenda? agendaOpt = await agendaClient.getAgenda(ids: [10069]); if (agendaOpt == null) { // handle gracefully diff --git a/packages/lyon1tomussclient/lib/src/model/model_export.dart b/packages/lyon1tomussclient/lib/src/model/model_export.dart index 63d18a60..e80ad3d5 100644 --- a/packages/lyon1tomussclient/lib/src/model/model_export.dart +++ b/packages/lyon1tomussclient/lib/src/model/model_export.dart @@ -10,4 +10,4 @@ export 'teaching_unit_element.dart'; export 'teaching_unit_list.dart'; export 'tomuss_text.dart'; export 'upload.dart'; -export 'url.dart'; \ No newline at end of file +export 'url.dart'; diff --git a/packages/lyon1tomussclient/lib/src/model/url.dart b/packages/lyon1tomussclient/lib/src/model/url.dart index 7a3c65ce..2d778ebb 100644 --- a/packages/lyon1tomussclient/lib/src/model/url.dart +++ b/packages/lyon1tomussclient/lib/src/model/url.dart @@ -12,7 +12,6 @@ class URL extends TeachingUnitElement { URL.fromJSON(var id, Map json, var stats, var line, var column, String user) : super.fromJson(id, json, stats, line, column, user) { - var props = line[id]; if (props is List && props.isNotEmpty) { value = props[0].toString(); diff --git a/packages/lyon1tomussclient/lib/src/parser/condition_parser.dart b/packages/lyon1tomussclient/lib/src/parser/condition_parser.dart index 6f5e4ed2..203f2cf3 100644 --- a/packages/lyon1tomussclient/lib/src/parser/condition_parser.dart +++ b/packages/lyon1tomussclient/lib/src/parser/condition_parser.dart @@ -15,10 +15,10 @@ extension ConditionParser on String { String cleanCondition = ""; for (var i = 0; i < condition.length; i++) { if (condition[i] == '[') { - if (condition[i+1] == "]") { + if (condition[i + 1] == "]") { return false; } - + int j = condition.indexOf(']', i); if (j > 0) { String query = condition.substring(i + 1, j);