diff --git a/Sources/dafl_project_flutter/.metadata b/Sources/dafl_project_flutter/.metadata index 700134a..308a9a8 100644 --- a/Sources/dafl_project_flutter/.metadata +++ b/Sources/dafl_project_flutter/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled. version: - revision: 18a827f3933c19f51862dde3fa472197683249d6 + revision: eb6d86ee27deecba4a83536aa20f366a6044895c channel: stable project_type: app @@ -13,14 +13,14 @@ project_type: app migration: platforms: - platform: root - create_revision: 18a827f3933c19f51862dde3fa472197683249d6 - base_revision: 18a827f3933c19f51862dde3fa472197683249d6 + create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c + base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c - platform: android - create_revision: 18a827f3933c19f51862dde3fa472197683249d6 - base_revision: 18a827f3933c19f51862dde3fa472197683249d6 + create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c + base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c - platform: ios - create_revision: 18a827f3933c19f51862dde3fa472197683249d6 - base_revision: 18a827f3933c19f51862dde3fa472197683249d6 + create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c + base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c # User provided section diff --git a/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml b/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml index 50184a8..9036069 100644 --- a/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml +++ b/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml @@ -24,6 +24,18 @@ + + + + + + + + + diff --git a/Sources/dafl_project_flutter/android/build.gradle b/Sources/dafl_project_flutter/android/build.gradle index 83ae220..4256f91 100644 --- a/Sources/dafl_project_flutter/android/build.gradle +++ b/Sources/dafl_project_flutter/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'com.android.tools.build:gradle:4.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/Sources/dafl_project_flutter/android/gradle/wrapper/gradle-wrapper.properties b/Sources/dafl_project_flutter/android/gradle/wrapper/gradle-wrapper.properties index cb24abd..3c9d085 100644 --- a/Sources/dafl_project_flutter/android/gradle/wrapper/gradle-wrapper.properties +++ b/Sources/dafl_project_flutter/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 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..aee2740 --- /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.23.120/callback/'; + 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/home/p_home.dart b/Sources/dafl_project_flutter/lib/views/pages/home/p_home.dart index 737d33c..7e524af 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/home/p_home.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/home/p_home.dart @@ -14,7 +14,7 @@ class _HomePageState extends State { double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; return Scaffold( - backgroundColor: Color(0xFF141414), + backgroundColor: const Color(0xFF141414), body: Stack( alignment: AlignmentDirectional.topCenter, children: [ @@ -28,100 +28,119 @@ class _HomePageState extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.end, children: [ - Image.asset( 'assets/images/Logo.png', width: 200, ), - SizedBox(height: height*0.04,), + SizedBox( + height: height * 0.04, + ), SizedBox( height: 55, - width: width*0.75, + width: width * 0.75, child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFF24CF5F), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15.0), - ),// background// foreground - ), - onPressed: () { - }, - child: Text("CONTINUER AVEC SPOTIFY", - style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold), - textAlign: TextAlign.center, + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFF24CF5F), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ), // background// foreground + ), + onPressed: () {}, + child: const Text( + "CONTINUER AVEC SPOTIFY", + style: TextStyle( + color: Colors.white, + fontSize: 17, + fontWeight: FontWeight.bold), + textAlign: TextAlign.center, + ), ), - ),), - SizedBox(height: height*0.015,), + ), + SizedBox( + height: height * 0.015, + ), SizedBox( height: 55, - width: width*0.75, + width: width * 0.75, child: ElevatedButton( style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFF5C1DC3), + backgroundColor: const Color(0xFF5C1DC3), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15.0), - ),// background// foreground + ), // background// foreground ), onPressed: () { - Navigator.of(context).push(PageTransition( - duration: Duration(milliseconds: 300), - reverseDuration: Duration(milliseconds: 300), - type: PageTransitionType.rightToLeftJoined, - childCurrent: widget, - child: SignUpPage()), + Navigator.of(context).push( + PageTransition( + duration: const Duration(milliseconds: 300), + reverseDuration: const Duration(milliseconds: 300), + type: PageTransitionType.rightToLeftJoined, + childCurrent: widget, + child: const SignUpPage()), ); }, - child: Text("S’INSCRIRE MAINTENANT", - style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold), + child: const Text( + "S’INSCRIRE MAINTENANT", + style: TextStyle( + color: Colors.white, + fontSize: 17, + fontWeight: FontWeight.bold), textAlign: TextAlign.center, ), - ),), - SizedBox(height: 220,), + ), + ), + const SizedBox( + height: 220, + ), GestureDetector( - onTap: (){ + onTap: () { Navigator.of(context).push( PageTransition( - duration: Duration(milliseconds: 300), - reverseDuration: Duration(milliseconds: 300), + duration: const Duration(milliseconds: 300), + reverseDuration: const Duration(milliseconds: 300), type: PageTransitionType.rightToLeftJoined, childCurrent: widget, - child: SignInPage()), + child: const SignInPage()), ); }, child: Container( - child: Align( + child: const Align( alignment: Alignment.center, - child: Text("SE CONNECTER", - style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold), + child: Text( + "SE CONNECTER", + style: TextStyle( + color: Colors.white, + fontSize: 17, + fontWeight: FontWeight.bold), textAlign: TextAlign.center, ), ), - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + margin: const EdgeInsets.fromLTRB(0, 0, 0, 0), width: double.infinity, height: 80, - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Color(0xFF232123), border: Border( top: BorderSide(width: 1.5, color: Color(0xFF3C3C3C)), - ),// Set rounded corner radius - + ), // Set rounded corner radius ), ), ), - - ], ), Align( alignment: Alignment.topRight, child: Container( - padding: EdgeInsets.fromLTRB(0, 20, 20, 0), - child: Text("v1.0", - style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.5) ,fontSize: 17, fontWeight: FontWeight.w700), + padding: const EdgeInsets.fromLTRB(0, 20, 20, 0), + child: Text( + "v1.0", + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white.withOpacity(0.5), + fontSize: 17, + fontWeight: FontWeight.w700), ), - ) - ), - + )), ], ), ); 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 167928d..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,3 +1,4 @@ +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'; @@ -11,16 +12,18 @@ class SignUpPage extends StatefulWidget { } class _SignUpPageState extends State { - Color boxColor = Colors.white; bool isHovering = false; - @override - TextEditingController passwordconfirm = new TextEditingController(); + TextEditingController passwordconfirm = TextEditingController(); bool isChecked = false; + Api apiSptfy = Api(); + Future? _launched; + @override Widget build(BuildContext context) { + double width = MediaQuery.of(context).size.width; return Scaffold( resizeToAvoidBottomInset: false, - backgroundColor: Color(0xFF141414), + backgroundColor: const Color(0xFF141414), body: Stack( alignment: AlignmentDirectional.topCenter, children: [ @@ -34,40 +37,49 @@ class _SignUpPageState extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.end, children: [ - Image.asset( 'assets/images/Logo.png', width: 250, ), - SizedBox(height: 45,), - Text( + const SizedBox( + height: 45, + ), + const Text( "S'INSCRIRE", - style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 23, fontWeight: FontWeight.w700), + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white, + fontSize: 23, + fontWeight: FontWeight.w700), textAlign: TextAlign.center, ), - SizedBox(height: 10,), + const SizedBox( + height: 10, + ), Container( width: 500, - padding: EdgeInsets.fromLTRB(45, 0, 45, 0), + padding: const EdgeInsets.fromLTRB(45, 0, 45, 0), child: Stack( children: [ Container( height: 43, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(50)), + borderRadius: + const BorderRadius.all(Radius.circular(50)), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius: 5, blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow + offset: const Offset( + 0, 3), // changes position of shadow ), ], ), ), - Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), + const Padding( + padding: EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( decoration: InputDecoration( border: InputBorder.none, @@ -77,7 +89,7 @@ class _SignUpPageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(15, 12, 0, 0), + margin: const EdgeInsets.fromLTRB(15, 12, 0, 0), child: Image.asset( 'assets/images/profil_logo.png', height: 16, @@ -86,31 +98,31 @@ class _SignUpPageState extends State { ), ), ], - ) - ), + )), Container( width: 500, - padding: EdgeInsets.fromLTRB(45, 10, 45, 0), + padding: const EdgeInsets.fromLTRB(45, 10, 45, 0), child: Stack( children: [ Container( height: 43, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(50)), + borderRadius: + const BorderRadius.all(Radius.circular(50)), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius: 5, blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow + offset: const Offset( + 0, 3), // changes position of shadow ), ], - ), - - ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), + ), + const Padding( + padding: EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( decoration: InputDecoration( border: InputBorder.none, @@ -120,7 +132,7 @@ class _SignUpPageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(15, 12, 0, 0), + margin: const EdgeInsets.fromLTRB(15, 12, 0, 0), child: Image.asset( 'assets/images/password_logo.png', height: 16, @@ -129,34 +141,34 @@ class _SignUpPageState extends State { ), ), ], - ) - ), + )), Container( width: 500, - padding: EdgeInsets.fromLTRB(45, 10, 45, 0), + padding: const EdgeInsets.fromLTRB(45, 10, 45, 0), child: Stack( children: [ Container( height: 43, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(50)), + borderRadius: + const BorderRadius.all(Radius.circular(50)), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius: 5, blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow + offset: const Offset( + 0, 3), // changes position of shadow ), ], - ), - - ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), + ), + Padding( + padding: const EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( controller: passwordconfirm, - decoration: InputDecoration( + decoration: const InputDecoration( border: InputBorder.none, ), cursorColor: Colors.purple, @@ -164,7 +176,7 @@ class _SignUpPageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(15, 12, 0, 0), + margin: const EdgeInsets.fromLTRB(15, 12, 0, 0), child: Image.asset( 'assets/images/password_logo.png', height: 16, @@ -173,133 +185,161 @@ class _SignUpPageState extends State { ), ), ], - ) - ), + )), Container( width: 500, - padding: EdgeInsets.fromLTRB(45, 10, 45, 0), + padding: const EdgeInsets.fromLTRB(45, 10, 45, 0), child: Stack( children: [ Container( height: 43, decoration: BoxDecoration( - color: Color(0xFF24CF5F), - borderRadius: BorderRadius.all( - Radius.circular(50)), + color: const Color(0xFF24CF5F), + borderRadius: + const BorderRadius.all(Radius.circular(50)), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius: 5, blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow + offset: const Offset( + 0, 3), // changes position of shadow ), ], - ), ), - Padding( - padding: EdgeInsets.fromLTRB(0, 10, 10, 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Lier compte ", - style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 18, fontWeight: FontWeight.w700), - textAlign: TextAlign.center, - ), - Image.asset( - 'assets/images/spotify_logo.png', - height: 25, - width: 25, - fit: BoxFit.cover, - ), - ], - ),), - + SizedBox( + height: 43, + width: width * 0.75, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xFF24CF5F), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(100), + ), // background// foreground + ), + onPressed: () => setState(() { + _launched = apiSptfy.launchInBrowser(); + }), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Lier compte ", + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white, + fontSize: 18, + fontWeight: FontWeight.w700), + ), + Image.asset( + 'assets/images/spotify_logo.png', + height: 25, + width: 25, + fit: BoxFit.cover, + ), + ], + )), + ), ], - ) + )), + const SizedBox( + height: 30, ), - SizedBox(height: 30,), ClipRRect( borderRadius: BorderRadius.circular(22), - child: Material( - child: InkWell( highlightColor: Colors.grey.shade100, - splashColor: Color(0xFF406DE1), - onTap: (){ + splashColor: const Color(0xFF406DE1), + onTap: () { setState(() { boxColor = Colors.blue; }); Navigator.of(context).push( PageTransition( - duration: Duration(milliseconds: 300), - reverseDuration: Duration(milliseconds: 300), + duration: const Duration(milliseconds: 300), + reverseDuration: const Duration(milliseconds: 300), type: PageTransitionType.leftToRightJoined, childCurrent: widget, child: HomePage()), ); }, - child:Ink( - child: Align( - alignment: Alignment.center, - child: Image.asset( - 'assets/images/valid_logo.png', - width: 47, - ), - ), - padding: EdgeInsets.fromLTRB(0, 10, 0, 0), + child: Ink( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 0), width: 83, height: 83, decoration: BoxDecoration( - color: Colors.white,// Set rounded corner radius + color: Colors.white, // Set rounded corner radius boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius: 5, blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow + offset: const Offset( + 0, 3), // changes position of shadow ), ], ), - + child: Align( + alignment: Alignment.center, + child: Image.asset( + 'assets/images/valid_logo.png', + width: 47, + ), + ), ), ), ), ), - SizedBox(height: 100,), + const SizedBox( + height: 100, + ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text('Tu n’as déjà un compte?', style: TextStyle(color: Colors.white, fontWeight: FontWeight.normal, fontSize: 17)), + const Text('Tu as déjà un compte ?', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.normal, + fontSize: 17)), GestureDetector( onTap: () { Navigator.of(context).push( PageTransition( type: PageTransitionType.fade, childCurrent: widget, - child: SignInPage()), + child: const SignInPage()), ); }, - child: Text(' se connecter', style: TextStyle(color: Color(0xFF406DE1), fontWeight: FontWeight.normal, fontSize: 16), + child: const Text( + ' se connecter', + style: TextStyle( + color: Color(0xFF406DE1), + fontWeight: FontWeight.normal, + fontSize: 16), ), ), ], ), - SizedBox(height: 60,), + const SizedBox( + height: 60, + ), ], ), Align( alignment: Alignment.topRight, child: Container( - padding: EdgeInsets.fromLTRB(0, 20, 20, 0), - child: Text("v1.0", - style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.5) ,fontSize: 17, fontWeight: FontWeight.w700), + padding: const EdgeInsets.fromLTRB(0, 20, 20, 0), + child: Text( + "v1.0", + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white.withOpacity(0.5), + fontSize: 17, + fontWeight: FontWeight.w700), ), - ) - ), - + )), ], ), ); diff --git a/Sources/dafl_project_flutter/pubspec.lock b/Sources/dafl_project_flutter/pubspec.lock index 77f1c3e..6b9d26c 100644 --- a/Sources/dafl_project_flutter/pubspec.lock +++ b/Sources/dafl_project_flutter/pubspec.lock @@ -233,6 +233,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.0.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" provider: dependency: "direct main" description: @@ -301,6 +308,83 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.1" + uni_links: + dependency: "direct main" + description: + name: uni_links + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.1" + uni_links_platform_interface: + dependency: transitive + description: + name: uni_links_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + uni_links_web: + dependency: transitive + description: + name: uni_links_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.6" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.19" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.17" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.13" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" vector_math: dependency: transitive description: diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index 7f5cd52..3ff0c6f 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -42,6 +42,8 @@ dependencies: rive: ^0.9.1 animations: ^2.0.7 fluttertoast: ^8.1.1 + url_launcher: ^6.1.6 + uni_links: ^0.5.1 dev_dependencies: flutter_test: