Résolution d'erreurs.
continuous-integration/drone/push Build is failing Details

/!\ Il y en a encore !
remotes/origin/mvc-implementation
Félix MIELCAREK 2 years ago
parent b085106f28
commit 2e2e818013

@ -12,6 +12,8 @@ class Controller {
late User _currentUser; late User _currentUser;
Area _area = Area(); Area _area = Area();
late BuildContext navigatorKey;
Uri getApiUrlAuthorize() { Uri getApiUrlAuthorize() {
return _api.identification.urlAuthorize; return _api.identification.urlAuthorize;
} }
@ -49,6 +51,29 @@ class Controller {
return _area.spots; return _area.spots;
} }
Future<List<Spot>> getArea() async {
await _area.sendCurrentLocation();
await _area.getData();
return _area.spots;
}
playTrack(String id) {
_api.requests.playTrack(id);
}
Future<Map<String, DateTime>> getDiscoveries() async {
_currentUser.discoveries = await _api.requests.getPlaylistTracks();
return _currentUser.discoveries;
}
removeFromPlaylist(String id) {
_api.requests.removeFromPlaylist(id);
}
addToPlaylist(String id) {
_api.requests.addToPlaylist(id);
}
/* /*
static Saver saver = DatabaseSaver(); static Saver saver = DatabaseSaver();
static Loader loader = DatabaseLoader(); static Loader loader = DatabaseLoader();

@ -157,7 +157,7 @@ class CardProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
void discovery(BuildContext context) { void discovery(BuildContext context) async {
dev.log("discovery"); dev.log("discovery");
_angle = 0; _angle = 0;
_position -= Offset(0, -_screenSize.height); _position -= Offset(0, -_screenSize.height);
@ -178,7 +178,7 @@ class CardProvider extends ChangeNotifier {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
MyApp.controller.currentUser.discovery.contains( await MyApp.controller.getDiscoveries().containsKey(
MyApp.controller.currentUser.spots.last.music) MyApp.controller.currentUser.spots.last.music)
? const Icon( ? const Icon(
Icons.info_rounded, Icons.info_rounded,
@ -193,7 +193,7 @@ class CardProvider extends ChangeNotifier {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
MyApp.controller.currentUser.discovery.contains( MyApp.controller.getDiscoveries().contains(
MyApp.controller.getSpots().last.music) MyApp.controller.getSpots().last.music)
? const Text( ? const Text(
"Déjà dans vos discovery", "Déjà dans vos discovery",
@ -217,11 +217,10 @@ class CardProvider extends ChangeNotifier {
curve: Curves.linear, curve: Curves.linear,
reverseCurve: Curves.linear, reverseCurve: Curves.linear,
); );
if (!MyApp.controller.currentUser.discovery if (!MyApp.controller
.getDiscoveries()
.contains(MyApp.controller.getSpots().last.music)) { .contains(MyApp.controller.getSpots().last.music)) {
MyApp.controller.getSpots().last.music.defineDate(); MyApp.controller.addToPlaylist(MyApp.controller.getSpots().last.music.id);
MyApp.controller.currentUser
.addDiscovery(MyApp.controller.getSpots().last.music);
notifyListeners(); notifyListeners();
} }
} }

@ -11,12 +11,9 @@ class User {
late int idDafl; late int idDafl;
late String usernameDafl; late String usernameDafl;
late String passwDafl; late String passwDafl;
List<Music> discovery = []; Map<String, DateTime> discoveries = {};
List<Spot> spots = [];
//attributes with Spotify API
final String _idSpotify; final String _idSpotify;
late String currentMusic; late String currentMusic;
bool sortChoise = true; bool sortChoise = true;
@ -24,29 +21,4 @@ class User {
User(this.usernameDafl, this._idSpotify); User(this.usernameDafl, this._idSpotify);
String get idSpotify => _idSpotify; String get idSpotify => _idSpotify;
addDiscovery(Music music) {
discovery.add(music);
}
listSpots() {
int verif = 0;
Future<Map<String, dynamic>> rep = Location.sendCurrentLocation();
//ex : dorian : 2d2s52a15d2a5 , audric : 2x5s2az3d1s5wx5s1 , lucas : s2a5d25a2a25d
rep.then((Map<String, dynamic> result) {
if (result.isNotEmpty) {
result.forEach((key, value) {
for (var element in spots) {
if (element.userId == key) {
verif = 1;
}
}
if (verif == 0) {
spots.add(Spot(key, Music(value)));
}
verif = 0;
});
}
});
}
} }

@ -54,43 +54,31 @@ class ApiSpotifyRequests extends HttpResponseVerification {
return infos; return infos;
} }
Future<bool> _isInPlaylist(String idTrack, String idPlaylist) async { Future<String> getIdUser() async {
var url = Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks', var url = Uri.https('api.spotify.com', 'v1/me');
{'limit': '50', 'fields': 'items(track(id))'});
var token = await _token.getAccessToken(); var token = await _token.getAccessToken();
setResponse(await http.get(url, headers: <String, String>{ setResponse(await http.get(url, headers: <String, String>{
'Authorization': '$_tokenType $token', 'Authorization': '$_tokenType $token',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
})); }));
var decodedResponse = jsonDecode(utf8.decode(response.bodyBytes)) as Map; var decodedResponse = jsonDecode(utf8.decode(response.bodyBytes)) as Map;
var res = decodedResponse['items'] return decodedResponse['id'];
.where((element) => element['track']['id'] == idTrack)
.toList();
if (res.length >= 1) {
return true;
}
return false;
} }
addToPLaylist(String idTrack) async { playTrack(String idTrack) async {
var idPlaylist = await _getPlaylist();
if (idPlaylist == null) {
idPlaylist = await _createPlaylist();
} else {
if (await _isInPlaylist(idTrack, idPlaylist)) {
return;
}
}
var token = await _token.getAccessToken(); var token = await _token.getAccessToken();
var url = Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks', var url = Uri.https('api.spotify.com', 'v1/me/player/play');
{'uris': 'spotify:track:$idTrack'}); setResponse(await http.put(url,
setResponse(await http.post(url, headers: <String, String>{ headers: <String, String>{
'Authorization': '$_tokenType $token', 'Authorization': '$_tokenType $token',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
})); },
body: jsonEncode(<String, List>{
'uris': ['spotify:track:$idTrack']
})));
} }
Future<String?> _getPlaylist() async { Future<String> _getPlaylistId() async {
var url = Uri.https('api.spotify.com', 'v1/me/playlists', {'limit': '50'}); var url = Uri.https('api.spotify.com', 'v1/me/playlists', {'limit': '50'});
var token = await _token.getAccessToken(); var token = await _token.getAccessToken();
setResponse(await http.get(url, headers: <String, String>{ setResponse(await http.get(url, headers: <String, String>{
@ -105,7 +93,7 @@ class ApiSpotifyRequests extends HttpResponseVerification {
return daflplaylist[0]['uri'].substring( return daflplaylist[0]['uri'].substring(
17); //17 char because format is 'spotify:playlist:MYPLAYLISTID' 17); //17 char because format is 'spotify:playlist:MYPLAYLISTID'
} }
return null; return await _createPlaylist();
} }
Future<String> _createPlaylist() async { Future<String> _createPlaylist() async {
@ -129,21 +117,37 @@ class ApiSpotifyRequests extends HttpResponseVerification {
return idPlaylist; return idPlaylist;
} }
playTrack(String idTrack) async { addToPlaylist(String idTrack) async {
var idPlaylist = await _getPlaylistId();
if (await _isInPlaylist(idTrack, idPlaylist)) {
return;
}
var token = await _token.getAccessToken(); var token = await _token.getAccessToken();
var url = Uri.https('api.spotify.com', 'v1/me/player/play'); var url = Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks',
setResponse(await http.put(url, {'uris': 'spotify:track:$idTrack'});
headers: <String, String>{ setResponse(await http.post(url, headers: <String, String>{
'Authorization': '$_tokenType $token', 'Authorization': '$_tokenType $token',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, }));
body: jsonEncode(<String, List>{ }
'uris': ['spotify:track:$idTrack']
}))); Future<bool> _isInPlaylist(String idTrack, String idPlaylist) async {
var url = Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks',
{'limit': '50', 'fields': 'items(track(id))'});
var token = await _token.getAccessToken();
setResponse(await http.get(url, headers: <String, String>{
'Authorization': '$_tokenType $token',
'Content-Type': 'application/json'
}));
var decodedResponse = jsonDecode(utf8.decode(response.bodyBytes)) as Map;
var res = decodedResponse['items']
.where((element) => element['track']['id'] == idTrack)
.toList();
return (res.length >= 1) ? true : false;
} }
removeFromPlaylist(String idTrack) async { removeFromPlaylist(String idTrack) async {
var idPlaylist = await _getPlaylist(); var idPlaylist = await _getPlaylistId();
if (idPlaylist != null) { if (idPlaylist != null) {
if (await _isInPlaylist(idTrack, idPlaylist)) { if (await _isInPlaylist(idTrack, idPlaylist)) {
var token = await _token.getAccessToken(); var token = await _token.getAccessToken();
@ -164,14 +168,19 @@ class ApiSpotifyRequests extends HttpResponseVerification {
} }
} }
Future<String> getIdUser() async { Future<Map<String, DateTime>> getPlaylistTracks() async {
var url = Uri.https('api.spotify.com', 'v1/me'); var idPlaylist = _getPlaylistId();
var url = Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks',
{'fields': 'items(track(id),added_at)'});
var token = await _token.getAccessToken(); var token = await _token.getAccessToken();
setResponse(await http.get(url, headers: <String, String>{ setResponse(await http.get(url, headers: <String, String>{
'Authorization': '$_tokenType $token', 'Authorization': '$_tokenType $token',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
})); }));
var decodedResponse = jsonDecode(utf8.decode(response.bodyBytes)) as Map; var decodedResponse = jsonDecode(utf8.decode(response.bodyBytes)) as Map;
return decodedResponse['id']; Map<String, DateTime> mapRes = {};
decodedResponse['items'].toList().forEach((elem) =>
{mapRes[elem['track']['id']] = DateTime.parse(elem['added_at'])});
return mapRes;
} }
} }

@ -1,7 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:dafl_project_flutter/main.dart'; import 'package:dafl_project_flutter/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../presentation/custom_icons_icons.dart'; import '../../presentation/custom_icons_icons.dart';
import './w_settings.dart'; import './w_settings.dart';
import './w_spot.dart'; import './w_spot.dart';
import './w_discovery.dart'; import './w_discovery.dart';
@ -9,8 +9,6 @@ import './w_profile.dart';
import './w_messages.dart'; import './w_messages.dart';
import 'w_top.dart'; import 'w_top.dart';
class MainPage extends StatefulWidget { class MainPage extends StatefulWidget {
const MainPage({Key? key}) : super(key: key); const MainPage({Key? key}) : super(key: key);
@ -110,10 +108,12 @@ class _MainPageState extends State<MainPage> {
), ),
); );
} }
@override @override
void initState() { void initState() {
super.initState(); super.initState();
Timer timer = Timer.periodic(const Duration(seconds: 10), (Timer t) => MyApp.controller.currentUser.listSpots()); Timer timer = Timer.periodic(
const Duration(seconds: 10), (Timer t) => MyApp.controller.getSpots());
} }
} }

@ -30,7 +30,7 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( const Text(
'Playlist découverte', 'Playlist découverte',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
@ -118,13 +118,13 @@ class _DiscoveryListState extends State<DiscoveryList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Music> listDiscovery = MyApp.controller.currentUser.discovery; var listDiscoveries = MyApp.controller.getDiscoveries();
if (MyApp.controller.currentUser.sortChoise) { if (MyApp.controller.currentUser.sortChoise) {
listDiscovery.sort((a, b) { listDiscoveries.sort((a, b) {
return a.date.compareTo(b.date); return a.date.compareTo(b.date);
}); });
} else { } else {
listDiscovery.sort((a, b) { listDiscoveries.sort((a, b) {
return a.name.compareTo(b.name); return a.name.compareTo(b.name);
}); });
} }
@ -135,25 +135,27 @@ class _DiscoveryListState extends State<DiscoveryList> {
}, },
key: refreshKey, key: refreshKey,
child: ListView.builder( child: ListView.builder(
itemCount: listDiscovery.length, itemCount: listDiscoveries.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
int itemCount = listDiscovery.length; int itemCount = listDiscoveries.length;
int reversedIndex = itemCount - 1 - index; int reversedIndex = itemCount - 1 - index;
return Dismissible( return Dismissible(
movementDuration: Duration(milliseconds: 400), movementDuration: const Duration(milliseconds: 400),
key: Key(listDiscovery[index].name), key: Key(listDiscoveries[index].name),
confirmDismiss: (direction) async { confirmDismiss: (direction) async {
if (direction == DismissDirection.endToStart) { if (direction == DismissDirection.endToStart) {
print(listDiscovery[reversedIndex].id); print(listDiscoveries[reversedIndex].id);
print(listDiscovery[reversedIndex].name); print(listDiscoveries[reversedIndex].name);
MyApp.controller.currentUser.discovery MyApp.controller.removeFromPlaylist(
.remove(listDiscovery[reversedIndex]); listDiscoveries[reversedIndex].id);
listDiscoveries = MyApp.controller.getDiscoveries();
return true; return true;
} }
if (direction == DismissDirection.startToEnd) { if (direction == DismissDirection.startToEnd) {
print(listDiscovery[reversedIndex].name); print(listDiscoveries[reversedIndex].name);
print('play'); print('play');
MyApp.api.playTrack(listDiscovery[reversedIndex].id); MyApp.controller
.playTrack(listDiscoveries[reversedIndex].id);
setState(() {}); setState(() {});
} }
return false; return false;
@ -191,8 +193,9 @@ class _DiscoveryListState extends State<DiscoveryList> {
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: placeholder:
"assets/images/loadingPlaceholder.gif", "assets/images/loadingPlaceholder.gif",
image: MyApp.controller.currentUser image: MyApp.controller
.discovery[reversedIndex].linkCover), .getDiscoveries()[reversedIndex]
.linkCover),
), ),
Container( Container(
margin: margin:
@ -204,8 +207,9 @@ class _DiscoveryListState extends State<DiscoveryList> {
MainAxisAlignment.center, MainAxisAlignment.center,
children: [ children: [
Text( Text(
MyApp.controller.currentUser MyApp.controller
.discovery[reversedIndex].name, .getDiscoveries()[reversedIndex]
.name,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
color: color:
@ -214,10 +218,8 @@ class _DiscoveryListState extends State<DiscoveryList> {
fontWeight: FontWeight.w800), fontWeight: FontWeight.w800),
), ),
Text( Text(
MyApp MyApp.controller
.controller .getDiscoveries()[reversedIndex]
.currentUser
.discovery[reversedIndex]
.artist, .artist,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',

@ -27,15 +27,15 @@ class MainPageProfil extends StatefulWidget {
} }
class _MainPageProfilState extends State<MainPageProfil> { class _MainPageProfilState extends State<MainPageProfil> {
String? username = MyApp.controller.currentUser.usernameDafl; late String username;
late Music currentmusic; late Music currentmusic;
@override @override
initState() { initState() async {
super.initState(); super.initState();
username = MyApp.controller.currentUser.usernameDafl; username = MyApp.controller.getIdDafl().toString();
MyApp.controller.currentUser.actualiseCurrentMusic(); currentmusic = await MyApp.controller
currentmusic = MyApp.controller.currentUser.currentMusic; .getCompleteMusic(MyApp.controller.getCurrentMusic());
} }
@override @override
@ -77,14 +77,14 @@ class _MainPageProfilState extends State<MainPageProfil> {
], ],
), ),
child: Center( child: Center(
child: Text(username![0], child: Text(username[0],
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 60, fontSize: 60,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
textAlign: TextAlign.center))), textAlign: TextAlign.center))),
Text( Text(
username!, username,
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 17, fontSize: 17,
@ -303,7 +303,7 @@ class _MainPageProfilState extends State<MainPageProfil> {
builder: (context) => const SettingsWidget())) builder: (context) => const SettingsWidget()))
.then((value) => setState(() { .then((value) => setState(() {
username = username =
MyApp.controller.currentUser.usernameDafl; MyApp.controller.getIdDafl().toString();
})); }));
}, },
child: Row( child: Row(

@ -11,9 +11,9 @@ class SettingsWidget extends StatefulWidget {
class _SettingsWidgetState extends State<SettingsWidget> { class _SettingsWidgetState extends State<SettingsWidget> {
final userNameTextField = final userNameTextField =
TextEditingController(text: MyApp.controller.currentUser.usernameDafl); TextEditingController(text: MyApp.controller.getIdDafl().toString());
final passwordTextField = final passwordTextField =
TextEditingController(text: MyApp.controller.currentUser.passwDafl); TextEditingController(text: MyApp.controller.getIdDafl().toString());
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -83,8 +83,8 @@ class _SettingsWidgetState extends State<SettingsWidget> {
const Spacer(), const Spacer(),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
MyApp.controller /*MyApp.controller
.changeCurrentUsername(userNameTextField.text); .changeCurrentUsername(userNameTextField.text);*/
notify(0, context, isError: false); notify(0, context, isError: false);
}, },
child: const Padding( child: const Padding(
@ -143,8 +143,8 @@ class _SettingsWidgetState extends State<SettingsWidget> {
const Spacer(), const Spacer(),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
MyApp.controller /*MyApp.controller
.changeCurrentPassword(passwordTextField.text); .changeCurrentPassword(passwordTextField.text);*/
notify(1, context, isError: false); notify(1, context, isError: false);
}, },
child: const Padding( child: const Padding(

@ -31,11 +31,9 @@ class _SpotsWidgetState extends State<SpotsWidget> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: NetworkImage( image: NetworkImage(MyApp.controller.getSpots().isEmpty
MyApp.controller.currentUser.spots.isEmpty ? "https://i.imgur.com/Uovh293.png"
? "https://i.imgur.com/Uovh293.png" : MyApp.controller.getSpots().last.music.linkCover),
: MyApp.controller.currentUser.spots.last.music
.linkCover),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -49,21 +47,19 @@ class _SpotsWidgetState extends State<SpotsWidget> {
), ),
), ),
Align( Align(
alignment: FractionalOffset.bottomCenter, alignment: FractionalOffset.bottomCenter,
child: MyApp.controller.currentUser.spots.isEmpty child: MyApp.controller.getSpots().isEmpty
? Container() ? Container()
: OpenContainer( : OpenContainer(
closedColor: Colors.transparent, closedColor: Colors.transparent,
closedElevation: 0, closedElevation: 0,
transitionDuration: const Duration(milliseconds: 400), transitionDuration: const Duration(milliseconds: 400),
closedBuilder: (context, openWidget) { closedBuilder: (context, openWidget) {
return const PreviewInfoWidget(); return const PreviewInfoWidget();
}, },
openBuilder: (context, closeWidget) { openBuilder: (context, closeWidget) {
return const DisplayInfoWidget(); return const DisplayInfoWidget();
}, })),
),
),
const Center( const Center(
child: SizedBox( child: SizedBox(
width: 300, width: 300,
@ -75,7 +71,7 @@ class _SpotsWidgetState extends State<SpotsWidget> {
Positioned( Positioned(
top: height * 0.68, top: height * 0.68,
width: width, width: width,
child: MyApp.controller.currentUser.spots.isEmpty child: MyApp.controller.getSpots().isEmpty
? Container() ? Container()
: Row( : Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
@ -172,9 +168,9 @@ class _SpotsWidgetState extends State<SpotsWidget> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
MyApp.controller.currentUser.spots.isEmpty MyApp.controller.getSpots().isEmpty
? '' ? ''
: MyApp.controller.currentUser.spots.last.music.name, : MyApp.controller.getSpots().last.music.name,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
color: Colors.white.withOpacity(1), color: Colors.white.withOpacity(1),
@ -182,10 +178,9 @@ class _SpotsWidgetState extends State<SpotsWidget> {
fontWeight: FontWeight.w800), fontWeight: FontWeight.w800),
), ),
Text( Text(
MyApp.controller.currentUser.spots.isEmpty MyApp.controller.getSpots().isEmpty
? '' ? ''
: MyApp : MyApp.controller.getSpots().last.music.artist,
.controller.currentUser.spots.last.music.artist,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
color: Colors.white.withOpacity(1), color: Colors.white.withOpacity(1),
@ -200,12 +195,12 @@ class _SpotsWidgetState extends State<SpotsWidget> {
right: 0, right: 0,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
MyApp.api.playTrack( MyApp.controller
MyApp.controller.currentUser.spots.last.music.id); .playTrack(MyApp.controller.getSpots().last.music.id);
}, },
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: !MyApp.controller.currentUser.spots.isEmpty child: MyApp.controller.getSpots().isEmpty
? Image.asset("assets/images/play_spotify_button.png") ? Image.asset("assets/images/play_spotify_button.png")
: Container(), : Container(),
), ),

@ -258,10 +258,10 @@ class _SignInPageState extends State<SignInPage> {
} else if (password == "") { } else if (password == "") {
notify(4, context); notify(4, context);
} else { } else {
await MyApp.controller /*await MyApp.controller
.load(userNameTextField.text, passwordTextField.text); .load(userNameTextField.text, passwordTextField.text);*/
if (MyApp.controller.currentUser.usernameDafl != "") { if (MyApp.controller.getIdDafl().toString() != "") {
Navigator.of(context).push( Navigator.of(context).push(
PageTransition( PageTransition(
type: PageTransitionType.fade, type: PageTransitionType.fade,

@ -1,8 +1,8 @@
import 'package:dafl_project_flutter/main.dart'; import 'package:dafl_project_flutter/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart'; import 'package:page_transition/page_transition.dart';
import '../../../api/in_app_browser.dart';
import '../../../model/user.dart'; import '../../../model/user.dart';
import '../../../services/api/in_app_browser.dart';
import '../home/p_home.dart'; import '../home/p_home.dart';
import '../sign_in/p_sign_in.dart'; import '../sign_in/p_sign_in.dart';
@ -334,9 +334,10 @@ class _SignUpPageState extends State<SignUpPage> {
String username, String password, String confirmPassword) async { String username, String password, String confirmPassword) async {
if (username == "") { if (username == "") {
notify(2, context); notify(2, context);
} else if (!await MyApp.controller.searchByUsername(username)) {
notify(0, context);
} }
/* else if (!await MyApp.controller.searchByUsername(username)) {
notify(0, context);
}*/
if (password == "" || confirmPassword == "") { if (password == "" || confirmPassword == "") {
notify(4, context); notify(4, context);
} else if (password.length < 8) { } else if (password.length < 8) {
@ -344,7 +345,7 @@ class _SignUpPageState extends State<SignUpPage> {
} else if (password != confirmPassword) { } else if (password != confirmPassword) {
notify(1, context); notify(1, context);
} else { } else {
MyApp.controller.save(User(username, password)); //MyApp.controller.save(User(username, password));
Navigator.of(context).push( Navigator.of(context).push(
PageTransition( PageTransition(

Loading…
Cancel
Save