api-implementation #82

Closed
felix.mielcarek wants to merge 6 commits from api-implementation into api-implementation-v2

@ -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

@ -24,6 +24,18 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- App Links -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with https://YOUR_HOST -->
<data
android:scheme="https"
android:pathPrefix="/callback/"
android:host="192.168.23.120" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

@ -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"
}
}

@ -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

@ -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<void> 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));
}
}

@ -14,7 +14,7 @@ class _HomePageState extends State<HomePage> {
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: <Widget>[
@ -28,100 +28,119 @@ class _HomePageState extends State<HomePage> {
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,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF24CF5F),
backgroundColor: const 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),
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,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF5C1DC3),
backgroundColor: const Color(0xFF5C1DC3),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
), // background// foreground
),
onPressed: () {
Navigator.of(context).push(PageTransition(
duration: Duration(milliseconds: 300),
reverseDuration: Duration(milliseconds: 300),
Navigator.of(context).push(
PageTransition(
duration: const Duration(milliseconds: 300),
reverseDuration: const Duration(milliseconds: 300),
type: PageTransitionType.rightToLeftJoined,
childCurrent: widget,
child: SignUpPage()),
child: const SignUpPage()),
);
},
child: Text("SINSCRIRE MAINTENANT",
style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold),
child: const Text(
"SINSCRIRE MAINTENANT",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
),),
SizedBox(height: 220,),
),
),
const SizedBox(
height: 220,
),
GestureDetector(
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
),
),
),
],
),
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),
),
)
),
)),
],
),
);

@ -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<SignUpPage> {
Color boxColor = Colors.white;
bool isHovering = false;
@override
TextEditingController passwordconfirm = new TextEditingController();
TextEditingController passwordconfirm = TextEditingController();
bool isChecked = false;
Api apiSptfy = Api();
Future<void>? _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: <Widget>[
@ -34,40 +37,49 @@ class _SignUpPageState extends State<SignUpPage> {
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<SignUpPage> {
),
),
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<SignUpPage> {
),
),
],
)
),
)),
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<SignUpPage> {
),
),
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<SignUpPage> {
),
),
],
)
),
)),
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<SignUpPage> {
),
),
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,39 +185,52 @@ class _SignUpPageState extends State<SignUpPage> {
),
),
],
)
),
)),
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),
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),
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'DMSans',
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w700),
),
Image.asset(
'assets/images/spotify_logo.png',
@ -214,42 +239,34 @@ class _SignUpPageState extends State<SignUpPage> {
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),
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),
padding: const EdgeInsets.fromLTRB(0, 10, 0, 0),
width: 83,
height: 83,
decoration: BoxDecoration(
@ -259,47 +276,70 @@ class _SignUpPageState extends State<SignUpPage> {
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 nas 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),
),
)),
],
),
);

@ -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:

@ -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:

Loading…
Cancel
Save