Résolution de toutes les erreurs pour le build, toutes les fonctionnalités ne sont quand même pas mise à jour

remotes/origin/database-api-implementation
Félix MIELCAREK 2 years ago committed by felixmielcarek
parent 2b1ad41178
commit 2ca2d71067

@ -1,3 +1,4 @@
import 'dart:collection';
import 'dart:convert'; import 'dart:convert';
import 'package:dafl_project_flutter/controller/live_datas.dart'; import 'package:dafl_project_flutter/controller/live_datas.dart';
import 'package:dafl_project_flutter/model/music.dart'; import 'package:dafl_project_flutter/model/music.dart';
@ -10,47 +11,48 @@ import 'package:http/http.dart' as http;
import '../model/user.dart'; import '../model/user.dart';
class Controller { class Controller {
ApiSpotify _api = ApiSpotify(); final ApiSpotify _api = ApiSpotify();
late User _currentUser; late User _currentUser;
final DataBaseService _dataBaseService = DataBaseService(); final DataBaseService _dataBaseService = DataBaseService();
final LiveDatas _datas = LiveDatas(); final LiveData _data = LiveData();
late BuildContext navigatorKey; late BuildContext navigatorKey;
// //
// Methods to manage datas // Methods to manage data
// //
// Datas that can change // Data that can change
bool getChoice() => _datas.discoveriesSortChoice; bool getChoice() => _data.discoveriesSortChoice;
setChoice(bool c) { setChoice(bool c) {
_datas.discoveriesSortChoice = c; _data.discoveriesSortChoice = c;
} }
Music getCurrentMusic() => _datas.userCurrentMusic; Music getCurrentMusic() => _data.userCurrentMusic;
setCurrentMusic() async { setCurrentMusic() async {
_datas.userCurrentMusic = _data.userCurrentMusic =
await getCompleteMusic(await _api.requests.getCurrentlyPlayingTrack()); await getCompleteMusic(await _api.requests.getCurrentlyPlayingTrack());
} }
List<Spot> getSpots() => _datas.spots; List<Spot> getSpots() => _data.spots;
setSpots() async { setSpots() async {
_datas.spots = await Location.sendCurrentLocation(); _data.spots = await Location.sendCurrentLocation();
} }
Map<Music, DateTime> getDiscoveries() => _datas.discoveries; LinkedHashMap<Music, DateTime> getDiscoveries() => _data.discoveries;
setDiscoveries() async { setDiscoveries() async {
Map<String, DateTime> tmpData = await _api.requests.getPlaylistTracks(); LinkedHashMap<String, DateTime> tmpData =
Map<Music, DateTime> tmpCast = {}; await _api.requests.getPlaylistTracks();
LinkedHashMap<Music, DateTime> tmpCast = LinkedHashMap();
tmpData.forEach((key, value) async { tmpData.forEach((key, value) async {
tmpCast[(await getCompleteMusic(key))] = value; tmpCast[(await getCompleteMusic(key))] = value;
}); });
_datas.discoveries = tmpCast; _data.discoveries = tmpCast;
} }
//Data that can not change //Data that can not change
@ -72,8 +74,8 @@ class Controller {
} }
Future<Music> getCompleteMusic(String id) async { Future<Music> getCompleteMusic(String id) async {
Map infos = await _api.requests.getTrackInfo(id); Map info = await _api.requests.getTrackInfo(id);
return Music(id, infos['name'], infos['artist'], infos['cover']); return Music(id, info['name'], info['artist'], info['cover']);
} }
removeFromPlaylist(String id) { removeFromPlaylist(String id) {

@ -1,14 +1,11 @@
import 'package:dafl_project_flutter/main.dart'; import 'dart:collection';
import '../model/music.dart'; import '../model/music.dart';
import '../model/spot.dart'; import '../model/spot.dart';
class LiveDatas { class LiveData {
bool discoveriesSortChoice = bool discoveriesSortChoice = true;
false; //false = sort by name ; true = sort by date late LinkedHashMap<Music, DateTime> discoveries;
Map<Music, DateTime> discoveries; late List<Spot> spots;
List<Spot> spots; late Music userCurrentMusic;
Music userCurrentMusic;
LiveDatas() {}
} }

@ -176,7 +176,7 @@ class CardProvider extends ChangeNotifier {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
MyApp.controller.getDiscoveries().containsKey( MyApp.controller.getDiscoveries().containsKey(
MyApp.controller.currentUser.spots.last.music) MyApp.controller.getSpots().last.music)
? const Icon( ? const Icon(
Icons.info_rounded, Icons.info_rounded,
size: 40, size: 40,
@ -190,7 +190,7 @@ class CardProvider extends ChangeNotifier {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
MyApp.controller.getDiscoveries().contains( MyApp.controller.getDiscoveries().containsKey(
MyApp.controller.getSpots().last.music) MyApp.controller.getSpots().last.music)
? const Text( ? const Text(
"Déjà dans vos discovery", "Déjà dans vos discovery",
@ -216,7 +216,7 @@ class CardProvider extends ChangeNotifier {
); );
if (!MyApp.controller if (!MyApp.controller
.getDiscoveries() .getDiscoveries()
.contains(MyApp.controller.getSpots().last.music)) { .containsKey(MyApp.controller.getSpots().last.music)) {
MyApp.controller.addToPlaylist(MyApp.controller.getSpots().last.music.id); MyApp.controller.addToPlaylist(MyApp.controller.getSpots().last.music.id);
notifyListeners(); notifyListeners();
} }
@ -327,7 +327,7 @@ class CardProvider extends ChangeNotifier {
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
sendMessage(messageTextField.text, sendMessage(messageTextField.text,
MyApp.controller.getSpots().last.key); MyApp.controller.getSpots().last.userId);
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF3F1DC3), backgroundColor: const Color(0xFF3F1DC3),

@ -1,3 +1,4 @@
import 'dart:collection';
import 'dart:convert'; import 'dart:convert';
import 'package:dafl_project_flutter/services/api/token_spotify.dart'; import 'package:dafl_project_flutter/services/api/token_spotify.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -86,11 +87,11 @@ class ApiSpotifyRequests extends HttpResponseVerification {
'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 daflplaylist = decodedResponse['items'] var daflPlaylist = decodedResponse['items']
.where((element) => element['name'] == _playlistName) .where((element) => element['name'] == _playlistName)
.toList(); .toList();
if (daflplaylist.length == 1) { if (daflPlaylist.length == 1) {
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 await _createPlaylist(); return await _createPlaylist();
@ -148,27 +149,24 @@ class ApiSpotifyRequests extends HttpResponseVerification {
removeFromPlaylist(String idTrack) async { removeFromPlaylist(String idTrack) async {
var idPlaylist = await _getPlaylistId(); var idPlaylist = await _getPlaylistId();
if (idPlaylist != null) { if (await _isInPlaylist(idTrack, idPlaylist)) {
if (await _isInPlaylist(idTrack, idPlaylist)) { var token = await _token.getAccessToken();
var token = await _token.getAccessToken(); var url = Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks');
var url = var jsonVar = jsonEncode(<String, List>{
Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks'); 'tracks': [
var jsonVar = jsonEncode(<String, List>{ {'uri': 'spotify:track:$idTrack'}
'tracks': [ ]
{'uri': 'spotify:track:$idTrack'} });
] setResponse(await http.delete(url,
}); headers: <String, String>{
setResponse(await http.delete(url, 'Authorization': '$_tokenType $token',
headers: <String, String>{ 'Content-Type': 'application/json'
'Authorization': '$_tokenType $token', },
'Content-Type': 'application/json' body: jsonVar));
},
body: jsonVar));
}
} }
} }
Future<Map<String, DateTime>> getPlaylistTracks() async { Future<LinkedHashMap<String, DateTime>> getPlaylistTracks() async {
var idPlaylist = _getPlaylistId(); var idPlaylist = _getPlaylistId();
var url = Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks', var url = Uri.https('api.spotify.com', 'v1/playlists/$idPlaylist/tracks',
{'fields': 'items(track(id),added_at)'}); {'fields': 'items(track(id),added_at)'});
@ -178,7 +176,7 @@ class ApiSpotifyRequests extends HttpResponseVerification {
'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;
Map<String, DateTime> mapRes = {}; LinkedHashMap<String, DateTime> mapRes = LinkedHashMap();
decodedResponse['items'].toList().forEach((elem) => decodedResponse['items'].toList().forEach((elem) =>
{mapRes[elem['track']['id']] = DateTime.parse(elem['added_at'])}); {mapRes[elem['track']['id']] = DateTime.parse(elem['added_at'])});
return mapRes; return mapRes;

@ -1,5 +1,6 @@
import 'dart:collection';
import 'package:dafl_project_flutter/main.dart'; import 'package:dafl_project_flutter/main.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:developer' as dev; import 'dart:developer' as dev;
@ -118,15 +119,20 @@ class _DiscoveryListState extends State<DiscoveryList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var listDiscoveries = MyApp.controller.getDiscoveries(); late LinkedHashMap<Music, DateTime> listDiscoveries;
if (MyApp.controller.getChoice()) { if (MyApp.controller.getChoice()) {
listDiscoveries.sort((a, b) { //TODO : implement sort by date
return a.date.compareTo(b.date); listDiscoveries = LinkedHashMap();
});
} else { } else {
listDiscoveries.sort((a, b) { //TODO : implement sort by name
return a.name.compareTo(b.name); /* var sortedKeys = MyApp.controller
}); .getDiscoveries()
.values
.toList(growable: false)
..sort((v1, v2) => v1.compareTo(v2));
listDiscoveries = LinkedHashMap.fromIterable(sortedKeys,
key: (k) => k, value: (k) => sortedKeys[k]); */
listDiscoveries = LinkedHashMap();
} }
return RefreshIndicator( return RefreshIndicator(
onRefresh: () async { onRefresh: () async {
@ -141,21 +147,23 @@ class _DiscoveryListState extends State<DiscoveryList> {
int reversedIndex = itemCount - 1 - index; int reversedIndex = itemCount - 1 - index;
return Dismissible( return Dismissible(
movementDuration: const Duration(milliseconds: 400), movementDuration: const Duration(milliseconds: 400),
key: Key(listDiscoveries[index].name), key: Key(listDiscoveries.keys.toList()[index].name),
confirmDismiss: (direction) async { confirmDismiss: (direction) async {
if (direction == DismissDirection.endToStart) { if (direction == DismissDirection.endToStart) {
print(listDiscoveries[reversedIndex].id); dev.log(listDiscoveries.keys.toList()[reversedIndex].id);
print(listDiscoveries[reversedIndex].name); dev.log(
listDiscoveries.keys.toList()[reversedIndex].name);
MyApp.controller.removeFromPlaylist( MyApp.controller.removeFromPlaylist(
listDiscoveries[reversedIndex].id); listDiscoveries.keys.toList()[reversedIndex].id);
listDiscoveries = MyApp.controller.getDiscoveries(); listDiscoveries = MyApp.controller.getDiscoveries();
return true; return true;
} }
if (direction == DismissDirection.startToEnd) { if (direction == DismissDirection.startToEnd) {
print(listDiscoveries[reversedIndex].name); dev.log(
print('play'); listDiscoveries.keys.toList()[reversedIndex].name);
MyApp.controller dev.log('play');
.playTrack(listDiscoveries[reversedIndex].id); MyApp.controller.playTrack(
listDiscoveries.keys.toList()[reversedIndex].id);
setState(() {}); setState(() {});
} }
return false; return false;
@ -194,7 +202,9 @@ class _DiscoveryListState extends State<DiscoveryList> {
placeholder: placeholder:
"assets/images/loadingPlaceholder.gif", "assets/images/loadingPlaceholder.gif",
image: MyApp.controller image: MyApp.controller
.getDiscoveries()[reversedIndex] .getDiscoveries()
.keys
.toList()[reversedIndex]
.linkCover), .linkCover),
), ),
Container( Container(
@ -208,7 +218,9 @@ class _DiscoveryListState extends State<DiscoveryList> {
children: [ children: [
Text( Text(
MyApp.controller MyApp.controller
.getDiscoveries()[reversedIndex] .getDiscoveries()
.keys
.toList()[reversedIndex]
.name, .name,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
@ -219,7 +231,9 @@ class _DiscoveryListState extends State<DiscoveryList> {
), ),
Text( Text(
MyApp.controller MyApp.controller
.getDiscoveries()[reversedIndex] .getDiscoveries()
.keys
.toList()[reversedIndex]
.artist, .artist,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',

@ -1,7 +1,4 @@
import 'package:text_scroll/text_scroll.dart';
import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../../model/music.dart';
import './w_settings.dart'; import './w_settings.dart';
import './w_spot.dart'; import './w_spot.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -41,195 +38,187 @@ class _MainPageProfilState extends State<MainPageProfil> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
return Container( return Container(
color: const Color(0xFF141414), color: const Color(0xFF141414),
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
width: double.infinity, width: double.infinity,
margin: const EdgeInsets.fromLTRB(30, 50, 0, 0), margin: const EdgeInsets.fromLTRB(30, 50, 0, 0),
child: const Text("Profil", child: const Text("Profil",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w600,
color: Colors.white,
fontFamily: "DMSans")),
),
Container(
margin: const EdgeInsets.fromLTRB(0, 10, 0, 10),
height: height * 0.14,
width: height * 0.14,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100.0),
color: Colors.blue,
border: Border.all(width: 6.0, color: Colors.white),
boxShadow: const [
BoxShadow(
offset: Offset(0, 0),
spreadRadius: 5,
blurRadius: 10,
color: Color.fromRGBO(0, 0, 0, 1),
),
],
),
child: Center(
child: Text(username[0],
style: const TextStyle(
color: Colors.white,
fontSize: 60,
fontWeight: FontWeight.w500),
textAlign: TextAlign.center))),
Text(
username,
style: const TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
),
Container(
height: 55,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent,
),
margin: const EdgeInsets.fromLTRB(30, 40, 30, 0),
child: SizedBox(
height: 55,
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
const Color(0xFFD9D9D9).withOpacity(0.08),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
), // background// foreground
),
onPressed: () {},
child: Row(
children: [
Image.asset(
'assets/images/fav_logo.png',
height: 25,
),
const SizedBox(
width: 12,
),
const Text(
"Préférences musicales",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
),
const Spacer(),
Icon(
Icons.arrow_forward_ios,
color: Colors.white.withOpacity(0.3),
),
],
)),
),
),
Container(
height: 55,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent,
),
margin: const EdgeInsets.fromLTRB(30, 10, 30, 0),
child: SizedBox(
height: 55,
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
const Color(0xFFD9D9D9).withOpacity(0.08),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
), // background// foreground
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const DisplayInfoWidget()));
},
child: Row(
children: [
const Icon(
Icons.remove_red_eye,
color: Colors.white,
size: 30,
),
const SizedBox(
width: 12,
),
const Text(
"Aperçu de mon profil",
style: TextStyle( style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w600,
color: Colors.white, color: Colors.white,
fontSize: 17, fontFamily: "DMSans"))),
fontWeight: FontWeight.w400), Container(
textAlign: TextAlign.center, margin: const EdgeInsets.fromLTRB(0, 10, 0, 10),
), height: height * 0.14,
const Spacer(), width: height * 0.14,
Icon( decoration: BoxDecoration(
Icons.arrow_forward_ios, borderRadius: BorderRadius.circular(100.0),
color: Colors.white.withOpacity(0.3), color: Colors.blue,
), border: Border.all(width: 6.0, color: Colors.white),
], boxShadow: const [
)), BoxShadow(
), offset: Offset(0, 0),
), spreadRadius: 5,
Container( blurRadius: 10,
height: height * 0.27, color: Color.fromRGBO(0, 0, 0, 1),
width: double.infinity, ),
margin: const EdgeInsets.fromLTRB(30, 15, 30, 0), ],
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [
Icon(
Icons.wifi_tethering,
color: Colors.white,
size: 35,
),
SizedBox(
width: 10,
), ),
Text( child: Center(
"En cours d'écoute", child: Text(username[0],
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 17, fontSize: 60,
fontWeight: FontWeight.w400), fontWeight: FontWeight.w500),
textAlign: TextAlign.center, textAlign: TextAlign.center))),
), Text(
Padding( username,
padding: EdgeInsets.fromLTRB(1, 9, 0, 0), style: const TextStyle(
child: SizedBox( color: Colors.white,
width: 25, fontSize: 17,
height: 25, fontWeight: FontWeight.w400),
child: riv.RiveAnimation.asset( textAlign: TextAlign.center,
'assets/images/playing_animation.riv'),
),
),
],
), ),
FutureBuilder( Container(
future: getData(), height: 55,
builder: (context, snapshot) { width: double.infinity,
if (snapshot.connectionState == ConnectionState.done) { decoration: BoxDecoration(
return Container( borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent,
),
margin: const EdgeInsets.fromLTRB(30, 40, 30, 0),
child: SizedBox(
height: 55,
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
const Color(0xFFD9D9D9).withOpacity(0.08),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
), // background// foreground
),
onPressed: () {},
child: Row(
children: [
Image.asset(
'assets/images/fav_logo.png',
height: 25,
),
const SizedBox(
width: 12,
),
const Text(
"Préférences musicales",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
),
const Spacer(),
Icon(
Icons.arrow_forward_ios,
color: Colors.white.withOpacity(0.3),
),
],
)),
),
),
Container(
height: 55,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent,
),
margin: const EdgeInsets.fromLTRB(30, 10, 30, 0),
child: SizedBox(
height: 55,
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
const Color(0xFFD9D9D9).withOpacity(0.08),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
), // background// foreground
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const DisplayInfoWidget()));
},
child: Row(
children: [
const Icon(
Icons.remove_red_eye,
color: Colors.white,
size: 30,
),
const SizedBox(
width: 12,
),
const Text(
"Aperçu de mon profil",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
),
const Spacer(),
Icon(
Icons.arrow_forward_ios,
color: Colors.white.withOpacity(0.3),
),
],
)),
),
),
Container(
height: height * 0.27,
width: double.infinity,
margin: const EdgeInsets.fromLTRB(30, 15, 30, 0),
child: Column(children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [
Icon(
Icons.wifi_tethering,
color: Colors.white,
size: 35,
),
SizedBox(
width: 10,
),
Text(
"En cours d'écoute",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsets.fromLTRB(1, 9, 0, 0),
child: SizedBox(
width: 25,
height: 25,
child: riv.RiveAnimation.asset(
'assets/images/playing_animation.riv')))
]),
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,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -237,191 +226,117 @@ class _MainPageProfilState extends State<MainPageProfil> {
color: const Color(0xFFD9D9D9).withOpacity(0.08), color: const Color(0xFFD9D9D9).withOpacity(0.08),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
margin: margin: const EdgeInsets.fromLTRB(
const EdgeInsets.fromLTRB(15, 0, 0, 0), 15, 0, 0, 0),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(10), borderRadius:
child: Image.network( BorderRadius.circular(15),
snapshot.data!.linkCover, child: FadeInImage.assetNetwork(
height: 90, height: 90,
width: 90, width: 90,
))), placeholder:
Container( "assets/images/loadingPlaceholder.gif",
margin: image: MyApp.controller
const EdgeInsets.fromLTRB(12, 20, 0, 0), .getCurrentMusic()
child: Column( .linkCover))),
mainAxisAlignment: MainAxisAlignment.start, Container(
crossAxisAlignment: margin: const EdgeInsets.fromLTRB(
CrossAxisAlignment.start, 12, 20, 0, 0),
children: [ child: Column(
snapshot.data!.name.length > 22 mainAxisAlignment:
? SizedBox( MainAxisAlignment.start,
width: 220, crossAxisAlignment:
child: ScrollLoopAutoScroll( CrossAxisAlignment.start,
delayAfterScrollInput: children: [
const Duration(seconds: 1), Text(
delay: MyApp.controller
const Duration(seconds: 1), .getCurrentMusic()
duration: const Duration( .name,
seconds: 100),
scrollDirection:
Axis.horizontal,
child: Text(
snapshot.data!.name,
style: const TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight:
FontWeight.bold),
),
),
)
: Text(
snapshot.data!.name,
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 18,
color: Colors.white, fontWeight: FontWeight.w500,
fontWeight: FontWeight.bold), color: Colors.white),
), ),
Text( Text(
snapshot.data!.artist, MyApp.controller
style: const TextStyle( .getCurrentMusic()
fontSize: 16, .artist,
fontWeight: FontWeight.w400, style: const TextStyle(
color: Colors.grey), fontSize: 16,
fontWeight: FontWeight.w400,
color: Colors.grey))
])),
const Spacer(),
Container(
height: 55,
width: double.infinity,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(10.0),
color: Colors.transparent,
), ),
], margin: const EdgeInsets.fromLTRB(
), 30, 0, 30, 0),
) child: SizedBox(
], height: 55,
), width: double.infinity,
); child: ElevatedButton(
} else { style: ElevatedButton.styleFrom(
return Container( backgroundColor:
margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), const Color(0xFFD9D9D9)
height: height * 0.14, .withOpacity(0.08),
decoration: BoxDecoration( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0), borderRadius:
color: const Color(0xFFD9D9D9).withOpacity(0.08), BorderRadius.circular(
), 10.0),
child: Row( ), // background// foreground
mainAxisAlignment: MainAxisAlignment.start, ),
crossAxisAlignment: CrossAxisAlignment.center, onPressed: () {
children: [ Navigator.push(
Container( context,
margin: MaterialPageRoute(
const EdgeInsets.fromLTRB(15, 0, 0, 0), builder: (context) =>
child: ClipRRect( const SettingsWidget()))
borderRadius: BorderRadius.circular(10), .then(
child: Image.asset( (value) => setState(() {
"assets/images/loadingPlaceholder.gif", username = MyApp
height: 90, .controller
width: 90))), .getIdDafl()
Container( .toString();
margin: }));
const EdgeInsets.fromLTRB(12, 20, 0, 0), },
child: Column( child: Row(children: [
mainAxisAlignment: MainAxisAlignment.start, const Icon(
crossAxisAlignment: Icons.settings,
CrossAxisAlignment.start, color: Colors.white,
children: [ size: 30,
Container( ),
width: 150, const SizedBox(
height: 20, width: 12,
decoration: BoxDecoration( ),
borderRadius: const Text(
BorderRadius.circular(5.0), "Paramètres",
color: Colors.grey.withOpacity(0.7), style: TextStyle(
), color: Colors.white,
), fontSize: 17,
const SizedBox( fontWeight:
height: 10, FontWeight.w400),
), textAlign: TextAlign.center,
Container( ),
width: 100, const Spacer(),
height: 20, Icon(
decoration: BoxDecoration( Icons.arrow_forward_ios,
borderRadius: color: Colors.white
BorderRadius.circular(5.0), .withOpacity(0.3),
color: Colors.grey.withOpacity(0.4), )
), ])))),
), const Spacer()
], ]))
), ]))
) ])));
],
),
);
}
}),
],
),
),
const Spacer(),
Container(
height: 55,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent,
),
margin: const EdgeInsets.fromLTRB(30, 0, 30, 0),
child: SizedBox(
height: 55,
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
const Color(0xFFD9D9D9).withOpacity(0.08),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
), // background// foreground
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsWidget()))
.then((value) => setState(() {
username =
MyApp.controller.getIdDafl().toString();
}));
},
child: Row(
children: [
const Icon(
Icons.settings,
color: Colors.white,
size: 30,
),
const SizedBox(
width: 12,
),
const Text(
"Paramètres",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
),
const Spacer(),
Icon(
Icons.arrow_forward_ios,
color: Colors.white.withOpacity(0.3),
),
],
)),
),
),
const Spacer(),
],
),
),
);
} }
} }

Loading…
Cancel
Save