Résolution d'erreurs

remotes/origin/database-api-implementation
Félix MIELCAREK 2 years ago committed by felixmielcarek
parent 7b3b514770
commit e049a265cd

@ -2,7 +2,7 @@ import 'dart:convert';
import 'package:dafl_project_flutter/model/music.dart'; import 'package:dafl_project_flutter/model/music.dart';
import 'package:dafl_project_flutter/services/api/api_spotify.dart'; import 'package:dafl_project_flutter/services/api/api_spotify.dart';
import 'package:dafl_project_flutter/services/database/database_service.dart'; import 'package:dafl_project_flutter/services/database/database_service.dart';
import 'package:dafl_project_flutter/services/position/area.dart'; import 'package:dafl_project_flutter/services/position/location.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import '../model/spot.dart'; import '../model/spot.dart';
@ -11,8 +11,9 @@ import '../model/user.dart';
class Controller { class Controller {
ApiSpotify _api = ApiSpotify(); ApiSpotify _api = ApiSpotify();
late User _currentUser; late User _currentUser;
Area _area = Area(); final Location _location = Location();
DataBaseService _dataBaseService = DataBaseService(); final DataBaseService _dataBaseService = DataBaseService();
bool sortChoice = false; //false = sort by name ; true = sort by date
late BuildContext navigatorKey; late BuildContext navigatorKey;
@ -50,13 +51,11 @@ class Controller {
} }
List<Spot> getSpots() { List<Spot> getSpots() {
return _area.spots; return _location.spots;
} }
Future<List<Spot>> getArea() async { getLocation() async {
await _area.sendCurrentLocation(); await _location.sendCurrentLocation();
await _area.getData();
return _area.spots;
} }
playTrack(String id) { playTrack(String id) {
@ -76,7 +75,6 @@ class Controller {
_api.requests.addToPlaylist(id); _api.requests.addToPlaylist(id);
} }
// DATABASE // DATABASE
void save(User userToSave) { void save(User userToSave) {
_dataBaseService.save(userToSave); _dataBaseService.save(userToSave);
@ -98,12 +96,8 @@ class Controller {
return await _dataBaseService.searchUser(username); return await _dataBaseService.searchUser(username);
} }
Future sendEmail(String reporterId, String reportedId, String reason,
String message) async {
Future sendEmail(
User reporter, User reported, String reason, String message) async {
const serviceId = 'service_dzyndyb'; const serviceId = 'service_dzyndyb';
const templateId = 'template_idgriw2'; const templateId = 'template_idgriw2';
const userId = 'hy7HxL5QGV6gpdqry'; const userId = 'hy7HxL5QGV6gpdqry';
@ -119,13 +113,12 @@ class Controller {
'template_id': templateId, 'template_id': templateId,
'user_id': userId, 'user_id': userId,
'template_params': { 'template_params': {
'from_name': reporter.usernameDafl, 'from_name': reporterId,
'to_name': reported.usernameDafl, 'to_name': reportedId,
'reason': reason, 'reason': reason,
'message': message, 'message': message,
}, },
}), }),
); );
} }
*/
} }

@ -46,14 +46,11 @@ class MyApp extends StatelessWidget {
enum CardStatus { like, disLike, discovery, message } enum CardStatus { like, disLike, discovery, message }
class CardProvider extends ChangeNotifier { class CardProvider extends ChangeNotifier {
final List<Spot> _spotsList = MyApp.controller.getSpots();
bool _isDragging = false; bool _isDragging = false;
double _angle = 0; double _angle = 0;
Offset _position = Offset.zero; Offset _position = Offset.zero;
Size _screenSize = Size.zero; Size _screenSize = Size.zero;
List<Spot> get spotsList => _spotsList;
bool get isDragging => _isDragging; bool get isDragging => _isDragging;
Offset get position => _position; Offset get position => _position;
@ -373,14 +370,15 @@ class CardProvider extends ChangeNotifier {
} }
Future _nextCard() async { Future _nextCard() async {
dev.log(_spotsList.length.toString()); List<Spot> spots = MyApp.controller.getSpots();
if (_spotsList.isEmpty) { dev.log(spots.length.toString());
if (spots.isEmpty) {
dev.log('dernier'); dev.log('dernier');
return; return;
} else { } else {
await Future.delayed(const Duration(milliseconds: 200)); await Future.delayed(const Duration(milliseconds: 200));
dev.log(_spotsList.last.music.name); dev.log(spots.last.music.name);
_spotsList.removeLast(); spots.removeLast();
resetPosition(); resetPosition();
} }
} }

@ -1,8 +1,8 @@
import 'user.dart'; import 'user.dart';
class Message { class Message {
User sender; String senderId;
String content; String content;
Message(this.sender, this.content); Message(this.senderId, this.content);
} }

@ -1,8 +1,15 @@
import 'package:dafl_project_flutter/services/database/user_modifier.dart'; import 'package:dafl_project_flutter/services/database/user_modifier.dart';
class DatabaseUserModifier implements UserModifier { class DatabaseUserModifier implements UserModifier {
@override
changeCurrentPassword(String userToModify, String newPass) {
// TODO: implement changeCurrentPassword
throw UnimplementedError();
}
@override
changeUsername(String userToModify, String newName) {
// TODO: implement changeUsername
throw UnimplementedError();
}
} }

@ -1,57 +0,0 @@
import 'package:geolocator/geolocator.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'dart:async';
import '../main.dart';
class Location {
static Future<Map<String, dynamic>> sendCurrentLocation() async {
Uri uri = Uri.parse("https://codefirst.iut.uca.fr/containers/php_script-dorianhodin/insertAndMakeListUser.php");
Map<String, dynamic> spot = {};
LocationPermission permission;
permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.deniedForever) {
return Future.error('Location Not Available');
}
}
String actualUser = MyApp.controller.currentUser.usernameDafl;
String actualSong = await MyApp.api.getCurrentlyPlayingTrack();
Position current = await Geolocator.getCurrentPosition();
http.Response response = await http.post(uri, body: {
"id": actualUser.toString(),
"latitude": current.latitude.toString(),
"longitude": current.longitude.toString(),
"idMusic": actualSong.toString(),
});
var data = jsonDecode(response.body);
if (data == 2){
return Future.error("Failed to connect, connection timeout");
}else if (data == 3) {
return Future.error("POST method failed");
}else{
data.forEach((s) => spot.putIfAbsent(s['user'], () => s['music']));
return spot;
}
}
}

@ -1 +1,55 @@
class Location {} import 'package:dafl_project_flutter/model/spot.dart';
import 'package:geolocator/geolocator.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'dart:async';
import '../../main.dart';
class Location {
final Map _spots = {};
List<Spot> get spots {
List<Spot> spots = [];
_spots.forEach((key, value) {
spots.add(Spot(key, value));
});
return spots;
}
sendCurrentLocation() async {
Uri uri = Uri.parse(
"https://codefirst.iut.uca.fr/containers/php_script-dorianhodin/insertAndMakeListUser.php");
LocationPermission permission;
permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.deniedForever) {
//TODO : handle this case
}
}
String actualUser = MyApp.controller.getIdDafl().toString();
String actualSong = MyApp.controller.getCurrentMusic();
Position current = await Geolocator.getCurrentPosition();
http.Response response = await http.post(uri, body: {
"id": actualUser,
"latitude": current.latitude.toString(),
"longitude": current.longitude.toString(),
"idMusic": actualSong,
});
var data = jsonDecode(response.body);
if (data == 2) {
return Future.error("Failed to connect, connection timeout");
} else if (data == 3) {
return Future.error("POST method failed");
} else {
data.forEach((s) => _spots.putIfAbsent(s['user'], () => s['music']));
}
}
}

@ -12,7 +12,7 @@ class ConversationPage extends StatefulWidget {
} }
class _ConversationPageState extends State<ConversationPage> { class _ConversationPageState extends State<ConversationPage> {
User destinataire = User("test1", '1234'); String destinataire = 'test';
List<Widget> messages = []; List<Widget> messages = [];
bool isNull = true; bool isNull = true;
@ -20,13 +20,13 @@ class _ConversationPageState extends State<ConversationPage> {
void sendMessage(String content) { void sendMessage(String content) {
setState(() { setState(() {
messages messages.add(messageWidget(
.add(messageWidget(Message(MyApp.controller.currentUser, content))); Message(MyApp.controller.getIdDafl().toString(), content)));
}); });
} }
Widget messageWidget(Message message) { Widget messageWidget(Message message) {
if (message.sender != MyApp.controller.currentUser) { if (message.senderId != MyApp.controller.getIdDafl().toString()) {
return Align( return Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Container( child: Container(
@ -374,8 +374,11 @@ class _ConversationPageState extends State<ConversationPage> {
height: 70, height: 70,
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
MyApp.controller.sendEmail(MyApp.controller.currentUser, MyApp.controller.sendEmail(
destinataire, currentValue, messageTextField.text); MyApp.controller.getIdDafl().toString(),
destinataire,
currentValue,
messageTextField.text);
Navigator.pop(context); Navigator.pop(context);
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(

@ -39,17 +39,17 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
), ),
OutlinedButton( OutlinedButton(
onPressed: () { onPressed: () {
MyApp.controller.currentUser.sortChoise = MyApp.controller.sortChoice =
!MyApp.controller.currentUser.sortChoise; !MyApp.controller.sortChoice;
rebuildAllChildren(context); rebuildAllChildren(context);
setState(() {}); setState(() {});
}, },
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
foregroundColor: Colors.grey,
shadowColor: Colors.black, shadowColor: Colors.black,
shape: CircleBorder(), shape: const CircleBorder(),
padding: EdgeInsets.all(24), padding: const EdgeInsets.all(24)),
primary: Colors.grey), child: MyApp.controller.sortChoice
child: MyApp.controller.currentUser.sortChoise
? Image.asset( ? Image.asset(
'assets/images/date_sort_icon.png', 'assets/images/date_sort_icon.png',
height: 25, height: 25,
@ -70,7 +70,7 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
), ),
), ),
Expanded( Expanded(
child: MyApp.controller.currentUser.discovery.isEmpty child: MyApp.controller.getDiscoveries().isEmpty
? Center( ? Center(
child: Image.asset( child: Image.asset(
'assets/images/EmptyDiscovery-Hint.png', 'assets/images/EmptyDiscovery-Hint.png',
@ -119,7 +119,7 @@ class _DiscoveryListState extends State<DiscoveryList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var listDiscoveries = MyApp.controller.getDiscoveries(); var listDiscoveries = MyApp.controller.getDiscoveries();
if (MyApp.controller.currentUser.sortChoise) { if (MyApp.controller.sortChoice) {
listDiscoveries.sort((a, b) { listDiscoveries.sort((a, b) {
return a.date.compareTo(b.date); return a.date.compareTo(b.date);
}); });

@ -1,8 +1,5 @@
import 'package:text_scroll/text_scroll.dart'; import 'package:text_scroll/text_scroll.dart';
import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart'; import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../../model/music.dart'; import '../../../model/music.dart';
import './w_settings.dart'; import './w_settings.dart';
@ -32,19 +29,18 @@ class MainPageProfil extends StatefulWidget {
} }
class _MainPageProfilState extends State<MainPageProfil> { class _MainPageProfilState extends State<MainPageProfil> {
String? username = MyApp.controller.currentUser.usernameDafl; String username = MyApp.controller.getIdDafl().toString();
late Future<Map> data; late Future<Music> data;
Future<Map> getdata() async {
return MyApp.api.getTrackInfo( await MyApp.api.getCurrentlyPlayingTrack());
Future<Music> getData() async {
return await MyApp.controller
.getCompleteMusic(MyApp.controller.getCurrentMusic());
} }
@override @override
initState() { initState() async {
super.initState(); super.initState();
username = MyApp.controller.currentUser.usernameDafl; username = MyApp.controller.getIdDafl().toString();
MyApp.controller.currentUser.actualiseCurrentMusic();
} }
@override @override
@ -86,14 +82,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,
@ -236,7 +232,7 @@ class _MainPageProfilState extends State<MainPageProfil> {
], ],
), ),
FutureBuilder( FutureBuilder(
future: getdata(), future: getData(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) { if (snapshot.connectionState == ConnectionState.done) {
return Container( return Container(
@ -251,43 +247,54 @@ class _MainPageProfilState extends State<MainPageProfil> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), margin:
const EdgeInsets.fromLTRB(15, 0, 0, 0),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
child: Image.network(snapshot.data!['cover'], child: Image.network(
snapshot.data!.linkCover,
height: 90, height: 90,
width: 90, width: 90,
))), ))),
Container( Container(
margin: const EdgeInsets.fromLTRB(12, 20, 0, 0), margin:
const EdgeInsets.fromLTRB(12, 20, 0, 0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
snapshot.data!['name'].length > 22? snapshot.data!.name.length > 22
SizedBox(width: 220, ? SizedBox(
width: 220,
child: ScrollLoopAutoScroll( child: ScrollLoopAutoScroll(
delayAfterScrollInput: Duration(seconds: 1), delayAfterScrollInput:
delay: Duration(seconds: 1), const Duration(seconds: 1),
delay:
const Duration(seconds: 1),
duration: const Duration(
seconds: 100),
scrollDirection:
Axis.horizontal,
child: Text( child: Text(
snapshot.data!['name'], snapshot.data!.name,
style: TextStyle(fontSize: 20, style: const TextStyle(
fontSize: 20,
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold), fontWeight:
FontWeight.bold),
), ),
duration: Duration(seconds: 100), ),
scrollDirection: Axis.horizontal, )
),)
: Text( : Text(
snapshot.data!['name'], snapshot.data!.name,
style: TextStyle(fontSize: 20, style: const TextStyle(
fontSize: 20,
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
Text( Text(
snapshot.data!['artist'], snapshot.data!.artist,
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -299,8 +306,7 @@ class _MainPageProfilState extends State<MainPageProfil> {
], ],
), ),
); );
} } else {
else{
return Container( return Container(
margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), margin: const EdgeInsets.fromLTRB(0, 10, 0, 0),
height: height * 0.14, height: height * 0.14,
@ -313,32 +319,40 @@ class _MainPageProfilState extends State<MainPageProfil> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), margin:
const EdgeInsets.fromLTRB(15, 0, 0, 0),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
child: Image.asset("assets/images/loadingPlaceholder.gif", child: Image.asset(
"assets/images/loadingPlaceholder.gif",
height: 90, height: 90,
width: 90))), width: 90))),
Container( Container(
margin: const EdgeInsets.fromLTRB(12, 20, 0, 0), margin:
const EdgeInsets.fromLTRB(12, 20, 0, 0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: 150, width: 150,
height: 20, height: 20,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0), borderRadius:
BorderRadius.circular(5.0),
color: Colors.grey.withOpacity(0.7), color: Colors.grey.withOpacity(0.7),
), ),
), ),
SizedBox(height: 10,), const SizedBox(
height: 10,
),
Container( Container(
width: 100, width: 100,
height: 20, height: 20,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0), borderRadius:
BorderRadius.circular(5.0),
color: Colors.grey.withOpacity(0.4), color: Colors.grey.withOpacity(0.4),
), ),
), ),
@ -349,9 +363,7 @@ class _MainPageProfilState extends State<MainPageProfil> {
), ),
); );
} }
}),
})
,
], ],
), ),
), ),
@ -382,7 +394,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(
@ -418,5 +430,4 @@ class _MainPageProfilState extends State<MainPageProfil> {
), ),
); );
} }
} }

@ -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.currentUser.spots.last.music : MyApp.controller.getSpots().last.music.linkCover),
.linkCover),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -50,15 +48,8 @@ class _SpotsWidgetState extends State<SpotsWidget> {
), ),
Align( Align(
alignment: FractionalOffset.bottomCenter, alignment: FractionalOffset.bottomCenter,
child: MyApp.controller.currentUser.spots.isEmpty child: MyApp.controller.getSpots().isEmpty
? const Center( ? Container()
child: SizedBox(
width: 300,
height: 300,
child: riv.RiveAnimation.asset(
'assets/images/search_spot_animation.riv'),
),
)
: OpenContainer( : OpenContainer(
closedColor: Colors.transparent, closedColor: Colors.transparent,
closedElevation: 0, closedElevation: 0,
@ -68,13 +59,19 @@ class _SpotsWidgetState extends State<SpotsWidget> {
}, },
openBuilder: (context, closeWidget) { openBuilder: (context, closeWidget) {
return const DisplayInfoWidget(); return const DisplayInfoWidget();
}, })),
const Center(
child: SizedBox(
width: 300,
height: 300,
child: riv.RiveAnimation.asset(
'assets/images/search_spot_animation.riv'),
), ),
), ),
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,
@ -165,14 +162,16 @@ class _SpotsWidgetState extends State<SpotsWidget> {
)), )),
), ),
), ),
MyApp.controller.currentUser.spots.isEmpty? MyApp.controller.getSpots().isEmpty
SafeArea(child: Center( ? SafeArea(
child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
MyApp.controller.currentUser.spots.isEmpty? MyApp.controller.getSpots().isEmpty
Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
const Text( const Text(
'Quelques instants...', 'Quelques instants...',
@ -181,32 +180,39 @@ class _SpotsWidgetState extends State<SpotsWidget> {
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 25), fontSize: 25),
), ),
const Padding(padding: EdgeInsets.fromLTRB(0, 5, 0, 0)), const Padding(
padding:
EdgeInsets.fromLTRB(0, 5, 0, 0)),
Text( Text(
'Nous cherchons des profils a vous proposer.', 'Nous cherchons des profils a vous proposer.',
style: TextStyle( style: TextStyle(
color: Colors.grey.withOpacity(0.4), fontSize: 15), color: Colors.grey.withOpacity(0.4),
fontSize: 15),
), ),
], ],
) :
Container(),
]
) )
),): : Container(),
Padding( ])),
)
: Padding(
padding: const EdgeInsets.fromLTRB(20, 60, 0, 0), padding: const EdgeInsets.fromLTRB(20, 60, 0, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(MyApp.controller.currentUser.spots.last.music.name, Text(
MyApp.controller.getSpots().isEmpty
? ''
: MyApp.controller.getSpots().last.music.name,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
color: Colors.white.withOpacity(1), color: Colors.white.withOpacity(1),
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w800), fontWeight: FontWeight.w800),
), ),
Text(MyApp.controller.currentUser.spots.last.music.artist, Text(
MyApp.controller.getSpots().isEmpty
? ''
: MyApp.controller.getSpots().last.music.artist,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
color: Colors.white.withOpacity(1), color: Colors.white.withOpacity(1),
@ -221,12 +227,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(),
), ),
@ -238,7 +244,7 @@ class _SpotsWidgetState extends State<SpotsWidget> {
Widget buildCards() { Widget buildCards() {
final provider = Provider.of<CardProvider>(context); final provider = Provider.of<CardProvider>(context);
final urlImages = provider.spotsList; final urlImages = MyApp.controller.getSpots();
return Stack( return Stack(
children: urlImages children: urlImages

@ -558,6 +558,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.1" version: "0.1.1"
time:
dependency: transitive
description:
name: time
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save