From f849f4122132ccd94d2f5aa3dcb1dab25a8dec7d Mon Sep 17 00:00:00 2001 From: Samuel Date: Wed, 4 Dec 2024 19:45:14 +0100 Subject: [PATCH] fix(warnings): removed unnecessary comments and warnings --- client_mobile/lib/features/auth/login.dart | 4 ++-- client_mobile/lib/features/auth/register.dart | 5 ++--- client_mobile/lib/main.dart | 3 +-- ...rvice.dart => microsoft_auth_service.dart} | 7 +++---- client_mobile/lib/widgets/button.dart | 2 -- client_mobile/lib/widgets/form_field.dart | 5 ++--- client_mobile/lib/widgets/sign_in_button.dart | 21 +++++++++---------- client_mobile/lib/widgets/simple_text.dart | 1 - 8 files changed, 20 insertions(+), 28 deletions(-) rename client_mobile/lib/services/microsoft/{MicrosoftAuthService.dart => microsoft_auth_service.dart} (84%) diff --git a/client_mobile/lib/features/auth/login.dart b/client_mobile/lib/features/auth/login.dart index ccb35f7..26982eb 100644 --- a/client_mobile/lib/features/auth/login.dart +++ b/client_mobile/lib/features/auth/login.dart @@ -1,5 +1,5 @@ // import 'dart:io'; -import 'package:client_mobile/services/microsoft/MicrosoftAuthService.dart'; +import 'package:client_mobile/services/microsoft/microsoft_auth_service.dart'; import 'package:client_mobile/widgets/button.dart'; import 'package:client_mobile/widgets/clickable_text.dart'; import 'package:client_mobile/widgets/form_field.dart'; @@ -20,7 +20,7 @@ class _LoginPageState extends State { String get spotifyRedirectUrlMobile => '$callbackUrlScheme://callback'; final String clientId = dotenv.env["VITE_SPOTIFY_CLIENT_ID"] ?? ""; - final appAuth = FlutterAppAuth(); + final appAuth = const FlutterAppAuth(); @override Widget build(BuildContext context) { diff --git a/client_mobile/lib/features/auth/register.dart b/client_mobile/lib/features/auth/register.dart index f6391c2..af46783 100644 --- a/client_mobile/lib/features/auth/register.dart +++ b/client_mobile/lib/features/auth/register.dart @@ -1,5 +1,5 @@ // import 'dart:io'; -import 'package:client_mobile/services/microsoft/MicrosoftAuthService.dart'; +import 'package:client_mobile/services/microsoft/microsoft_auth_service.dart'; import 'package:client_mobile/widgets/button.dart'; import 'package:client_mobile/widgets/clickable_text.dart'; import 'package:client_mobile/widgets/form_field.dart'; @@ -8,7 +8,6 @@ import 'package:client_mobile/widgets/simple_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_appauth/flutter_appauth.dart'; import 'package:go_router/go_router.dart'; -import 'package:oauth2/oauth2.dart' as oauth2; import 'package:flutter_dotenv/flutter_dotenv.dart'; class RegisterPage extends StatefulWidget { @@ -21,7 +20,7 @@ class _RegisterPageState extends State { String get spotifyRedirectUrlMobile => '$callbackUrlScheme://callback'; final String clientId = dotenv.env["VITE_SPOTIFY_CLIENT_ID"] ?? ""; - final appAuth = FlutterAppAuth(); + final appAuth = const FlutterAppAuth(); @override Widget build(BuildContext context) { diff --git a/client_mobile/lib/main.dart b/client_mobile/lib/main.dart index 277c609..8f8a249 100644 --- a/client_mobile/lib/main.dart +++ b/client_mobile/lib/main.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:go_router/go_router.dart'; -final GlobalKey navigatorKey = GlobalKey(); // Clé globale - +final GlobalKey navigatorKey = GlobalKey(); Future main() async { await dotenv.load(fileName: ".env"); diff --git a/client_mobile/lib/services/microsoft/MicrosoftAuthService.dart b/client_mobile/lib/services/microsoft/microsoft_auth_service.dart similarity index 84% rename from client_mobile/lib/services/microsoft/MicrosoftAuthService.dart rename to client_mobile/lib/services/microsoft/microsoft_auth_service.dart index ba2d717..fc7eb3a 100644 --- a/client_mobile/lib/services/microsoft/MicrosoftAuthService.dart +++ b/client_mobile/lib/services/microsoft/microsoft_auth_service.dart @@ -1,4 +1,3 @@ -// import 'package:aad_oauth/model/config.dart'; import 'package:aad_oauth/model/config.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; @@ -8,10 +7,10 @@ import '../../main.dart'; class MicrosoftAuthService { static final String clientId = dotenv.env["VITE_MICROSOFT_CLIENT_ID"] ?? ""; - static final String redirectUri = + static const String redirectUri = "msauth://my.area.app/lvGC0B4SWYU8tNPHg%2FbdMjQinZQ%3D"; - static final String authority = "https://login.microsoftonline.com/common"; - static final FlutterSecureStorage secureStorage = FlutterSecureStorage(); + static const String authority = "https://login.microsoftonline.com/common"; + static const FlutterSecureStorage secureStorage = FlutterSecureStorage(); static Future auth(BuildContext context) async { final Config config = Config( diff --git a/client_mobile/lib/widgets/button.dart b/client_mobile/lib/widgets/button.dart index 1389341..3ca9261 100644 --- a/client_mobile/lib/widgets/button.dart +++ b/client_mobile/lib/widgets/button.dart @@ -34,8 +34,6 @@ class AreaButton extends StatelessWidget { fontSize: 24, color: Colors.white, )), - // const Spacer(), - // if (icon != null) FaIcon(size: 25, icon!), ), ); } diff --git a/client_mobile/lib/widgets/form_field.dart b/client_mobile/lib/widgets/form_field.dart index 116cdd3..cafcfb9 100644 --- a/client_mobile/lib/widgets/form_field.dart +++ b/client_mobile/lib/widgets/form_field.dart @@ -48,13 +48,12 @@ class AreaFormField extends StatelessWidget { color: Theme.of(context).colorScheme.onSurface, ), decoration: InputDecoration( - // fillColor: Theme.of(context).colorScheme., labelText: label, // Placeholder text border: const OutlineInputBorder(), enabledBorder: const OutlineInputBorder( borderSide: BorderSide( - color: Color.fromARGB(255, 221, 228, 222), // Couleur de la bordure lorsque le champ est actif - width: 2.0, // Largeur de la bordure + color: Color.fromARGB(255, 221, 228, 222), + width: 2.0, ), ), suffixIcon: suffixIcon, diff --git a/client_mobile/lib/widgets/sign_in_button.dart b/client_mobile/lib/widgets/sign_in_button.dart index a5a1821..827921c 100644 --- a/client_mobile/lib/widgets/sign_in_button.dart +++ b/client_mobile/lib/widgets/sign_in_button.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class SignInButton extends StatelessWidget { const SignInButton( @@ -22,9 +21,8 @@ class SignInButton extends StatelessWidget { RoundedRectangleBorder( borderRadius: BorderRadius.circular(6.0), side: const BorderSide( - color: Color.fromARGB(255, 221, 228, - 222), // Couleur de la bordure lorsque le champ est actif - width: 2.0, // Largeur de la bordure + color: Color.fromARGB(255, 221, 228, 222), + width: 2.0, ), ), ), @@ -36,13 +34,14 @@ class SignInButton extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ if (image != null) image!, - // const SizedBox(width: 5), - Text(label, - style: const TextStyle( - fontFamily: "CoolveticaCondensed", - fontSize: 12, - color: Colors.black, - )), + Text( + label, + style: const TextStyle( + fontFamily: "CoolveticaCondensed", + fontSize: 12, + color: Colors.black, + ), + ), ], ), ), diff --git a/client_mobile/lib/widgets/simple_text.dart b/client_mobile/lib/widgets/simple_text.dart index 6f954ef..002461a 100644 --- a/client_mobile/lib/widgets/simple_text.dart +++ b/client_mobile/lib/widgets/simple_text.dart @@ -22,7 +22,6 @@ class SimpleText extends StatelessWidget { text, textAlign: textAlign, style: TextStyle( - // fontFamily: HodFonts.coolvetica, fontWeight: bold ? FontWeight.bold : null, fontSize: textSize, color: color,