diff --git a/Documentation/Images/MLD.png b/Documentation/Images/MLD.png deleted file mode 100644 index bdf815d..0000000 Binary files a/Documentation/Images/MLD.png and /dev/null differ diff --git a/Documentation/Images/Mld.png b/Documentation/Images/Mld.png new file mode 100644 index 0000000..296ec26 Binary files /dev/null and b/Documentation/Images/Mld.png differ diff --git a/Sources/dafl_project_flutter/README.md b/Sources/dafl_project_flutter/README.md index 284e10d..0e10b97 100644 --- a/Sources/dafl_project_flutter/README.md +++ b/Sources/dafl_project_flutter/README.md @@ -1,5 +1,35 @@ # dafl_project_flutter +*```dafl_project_flutter``` est le nom de notre projet Flutter.* + +## Gestion de Git + +* Ceci est un **ordre** ! + +Faire les commit en ligne de commande car Android Studio déclare des erreurs factices dans des fichiers créés pour les plateformes. + +1. Ajout de tous les fichiers modifiés / ou créés dans la staging area (fichers locaux prêts à être commit) + +```shell +git add -A +``` + +2. Validation des fichiers destinées à être envoyé sur le repo + +```shell +git commit -m "Message corresponding to modifications done in my commmit" +``` + +*Insérer un message entre les doubles quotes après le ```-m```* + +3. Envoi des commit + +```shell +git push origin my_branch +``` + +*Remplacer ```my_branch``` par la branche sur laquelle on a voulu trailler* + ## Convention de nommage des répertoires ``` diff --git a/Sources/dafl_project_flutter/lib/spotify_api/api.dart b/Sources/dafl_project_flutter/lib/spotify_api/api.dart new file mode 100644 index 0000000..0a243e7 --- /dev/null +++ b/Sources/dafl_project_flutter/lib/spotify_api/api.dart @@ -0,0 +1,38 @@ +import 'package:url_launcher/url_launcher.dart'; +import 'dart:math'; + +class Api { + var clientId = '7ceb49d874b9404492246027e4d68cf8'; + var redirectUri='https://192.168.183.120:8888/'; + var state; + var scopes = 'user-read-private'; + var url; + + Api() { + state = generateRandomString(); + url = Uri.https('accounts.spotify.com', 'en/authorize', { + 'client_id': clientId, + 'response_type': 'code', + 'redirect_uri': redirectUri, + 'state': state, + 'scope': scopes, + 'show_dialog': 'true' + }); + } + + Future launchInBrowser() async { + if (!await launchUrl( + url, + mode: LaunchMode.inAppWebView, + )) { + throw 'Could not launch $url'; + } + } + + // for state value + String generateRandomString() { + var r = Random(); + return String.fromCharCodes( + List.generate(16, (index) => r.nextInt(33) + 89)); + } +} diff --git a/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart b/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart index dcccf16..12ec26b 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart @@ -1,4 +1,4 @@ -import 'package:dafl_project_flutter/spotify_api/api_sptfy.dart'; +import 'package:dafl_project_flutter/spotify_api/api.dart'; import 'package:flutter/material.dart'; import 'package:page_transition/page_transition.dart'; import '../home/p_home.dart'; @@ -16,7 +16,7 @@ class _SignUpPageState extends State { bool isHovering = false; TextEditingController passwordconfirm = TextEditingController(); bool isChecked = false; - ApiSptfy apiSptfy = ApiSptfy(); + Api apiSptfy = Api(); Future? _launched; @override Widget build(BuildContext context) { @@ -209,25 +209,22 @@ class _SignUpPageState extends State { ), ), SizedBox( - height: 55, + height: 43, width: width * 0.75, - child: Padding( - padding: EdgeInsets.fromLTRB(0, 10, 10, 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: const Color(0xFF24CF5F), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15.0), - ), - ), - onPressed: () => setState(() { + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xFF24CF5F), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(100), + ), // background// foreground + ), + onPressed: () => setState(() { _launched = apiSptfy.launchInBrowser(); }), - child: const Text( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( "Lier compte ", style: TextStyle( fontFamily: 'DMSans', @@ -235,16 +232,14 @@ class _SignUpPageState extends State { fontSize: 18, fontWeight: FontWeight.w700), ), - ), - Image.asset( - 'assets/images/spotify_logo.png', - height: 25, - width: 25, - fit: BoxFit.cover, - ), - ], - ), - ), + Image.asset( + 'assets/images/spotify_logo.png', + height: 25, + width: 25, + fit: BoxFit.cover, + ), + ], + )), ), ], )), @@ -303,7 +298,7 @@ class _SignUpPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text('Tu n’as déjà un compte?', + const Text('Tu as déjà un compte ?', style: TextStyle( color: Colors.white, fontWeight: FontWeight.normal,