text on spot page when no spot available

remotes/origin/database-api-implementation
Lucas DELANIER 2 years ago committed by felixmielcarek
parent 6543623795
commit 23faec1eb7

@ -31,9 +31,11 @@ class _SpotsWidgetState extends State<SpotsWidget> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: NetworkImage(MyApp.controller.getSpots().isEmpty image: NetworkImage(
? "https://i.imgur.com/Uovh293.png" MyApp.controller.currentUser.spots.isEmpty
: MyApp.controller.getSpots().last.music.linkCover), ? "https://i.imgur.com/Uovh293.png"
: MyApp.controller.currentUser.spots.last.music
.linkCover),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -47,31 +49,32 @@ class _SpotsWidgetState extends State<SpotsWidget> {
), ),
), ),
Align( Align(
alignment: FractionalOffset.bottomCenter, alignment: FractionalOffset.bottomCenter,
child: MyApp.controller.getSpots().isEmpty child: MyApp.controller.currentUser.spots.isEmpty
? Container() ? const Center(
: OpenContainer( child: SizedBox(
closedColor: Colors.transparent, width: 300,
closedElevation: 0, height: 300,
transitionDuration: const Duration(milliseconds: 400), child: riv.RiveAnimation.asset(
closedBuilder: (context, openWidget) { 'assets/images/search_spot_animation.riv'),
return const PreviewInfoWidget(); ),
}, )
openBuilder: (context, closeWidget) { : OpenContainer(
return const DisplayInfoWidget(); closedColor: Colors.transparent,
})), closedElevation: 0,
const Center( transitionDuration: const Duration(milliseconds: 400),
child: SizedBox( closedBuilder: (context, openWidget) {
width: 300, return const PreviewInfoWidget();
height: 300, },
child: riv.RiveAnimation.asset( openBuilder: (context, closeWidget) {
'assets/images/search_spot_animation.riv'), return const DisplayInfoWidget();
), },
),
), ),
Positioned( Positioned(
top: height * 0.68, top: height * 0.68,
width: width, width: width,
child: MyApp.controller.getSpots().isEmpty child: MyApp.controller.currentUser.spots.isEmpty
? Container() ? Container()
: Row( : Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
@ -162,25 +165,48 @@ class _SpotsWidgetState extends State<SpotsWidget> {
)), )),
), ),
), ),
MyApp.controller.currentUser.spots.isEmpty?
SafeArea(child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
MyApp.controller.currentUser.spots.isEmpty?
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Quelques instants...',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w500,
fontSize: 25),
),
const Padding(padding: EdgeInsets.fromLTRB(0, 5, 0, 0)),
Text(
'Nous cherchons des profils a vous proposer.',
style: TextStyle(
color: Colors.grey.withOpacity(0.4), fontSize: 15),
),
],
) :
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( Text(MyApp.controller.currentUser.spots.last.music.name,
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( Text(MyApp.controller.currentUser.spots.last.music.artist,
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),
@ -195,12 +221,12 @@ class _SpotsWidgetState extends State<SpotsWidget> {
right: 0, right: 0,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
MyApp.controller MyApp.api.playTrack(
.playTrack(MyApp.controller.getSpots().last.music.id); MyApp.controller.currentUser.spots.last.music.id);
}, },
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: MyApp.controller.getSpots().isEmpty child: !MyApp.controller.currentUser.spots.isEmpty
? Image.asset("assets/images/play_spotify_button.png") ? Image.asset("assets/images/play_spotify_button.png")
: Container(), : Container(),
), ),

Loading…
Cancel
Save