diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index d6d2375..b90047a 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -135,6 +135,13 @@ + + + + + + @@ -303,6 +310,13 @@ + + + + + + @@ -351,6 +365,7 @@ + @@ -374,6 +389,7 @@ + diff --git a/justMUSIC/lib/components/post_component.dart b/justMUSIC/lib/components/post_component.dart index 811434e..1fcdc6a 100644 --- a/justMUSIC/lib/components/post_component.dart +++ b/justMUSIC/lib/components/post_component.dart @@ -3,6 +3,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:gradient_borders/box_borders/gradient_box_border.dart'; +import 'package:text_scroll/text_scroll.dart'; class PostComponent extends StatelessWidget { const PostComponent({Key? key}) : super(key: key); @@ -57,44 +59,53 @@ class PostComponent extends StatelessWidget { ), ], ), - Container( - margin: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - boxShadow: const [ - BoxShadow( - color: Color(0xFF3A3A3A), - spreadRadius: 0.5, - blurRadius: 0, - offset: Offset(0, 0), // changes position of shadow + SizedBox(height: 10), + AspectRatio( + aspectRatio: 1 / 1, + child: Container( + width: 300, + height: 300, + decoration: BoxDecoration( + // add border + border: const GradientBoxBorder( + gradient: LinearGradient(colors: [ + Colors.transparent, + Color(0xFF323232), + ], begin: Alignment.topCenter, end: Alignment.bottomCenter), + width: 2.5, ), - ], - ), - child: AspectRatio( - aspectRatio: 1 / 1, - child: Padding( - padding: EdgeInsets.all(1.5), - child: ClipRRect( - borderRadius: BorderRadius.circular(20), - child: Container( - height: 20, - width: double.infinity, - child: Stack( - alignment: Alignment.bottomCenter, - children: const [ - Image( - image: AssetImage("assets/images/exemple_cover.png"), - fit: BoxFit.cover, - width: double.infinity, - ), - Image( - image: AssetImage("assets/images/shadow_post.png"), - fit: BoxFit.cover, - width: double.infinity, - ), - ], + // set border radius + borderRadius: BorderRadius.circular(20), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(18), + // implement image + child: Stack( + alignment: Alignment.bottomCenter, + children: [ + Image( + image: AssetImage("assets/images/exemple_cover.png"), + fit: BoxFit.cover, + width: double.infinity, ), - ), + Image( + image: AssetImage("assets/images/shadow_post.png"), + fit: BoxFit.fitHeight, + width: double.infinity, + ), + Padding( + padding: EdgeInsets.all(15), + child: AutoSizeText( + '“J’écoute en boucle ce son. B2O<3”', + style: GoogleFonts.plusJakartaSans( + color: Colors.white, + fontWeight: FontWeight.w400, + fontSize: 15.sp), + maxFontSize: 20, + maxLines: 1, + ), + ) + ], ), ), ), @@ -102,37 +113,57 @@ class PostComponent extends StatelessWidget { SizedBox(height: 10), Row( crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - AutoSizeText( - "BOOBA", - style: GoogleFonts.plusJakartaSans( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 26.sp), - maxFontSize: 30, - ), + Flexible( + flex: 6, + child: TextScroll( + "BOOBA", + style: GoogleFonts.plusJakartaSans( + height: 1, + color: Colors.white, + fontWeight: FontWeight.w600, + fontSize: 26.sp), + mode: TextScrollMode.endless, + pauseBetween: Duration(milliseconds: 500), + velocity: Velocity(pixelsPerSecond: Offset(20, 0)), + )), Padding( - padding: const EdgeInsets.only(left: 15.0), - child: AutoSizeText( - "A.C. Milan", - style: GoogleFonts.plusJakartaSans( - color: Colors.white, - fontWeight: FontWeight.w300, - fontSize: 16.sp), - maxFontSize: 20, + padding: EdgeInsets.only(bottom: 10, right: 7, left: 7), + child: ClipOval( + child: Container( + width: 5.sp, + height: 5.sp, + color: Colors.white, + ), ), ), Expanded( - child: AutoSizeText( - "2013", - style: GoogleFonts.plusJakartaSans( - color: Colors.white.withOpacity(0.5), - fontWeight: FontWeight.w300, - fontSize: 16.sp), - textAlign: TextAlign.end, - maxFontSize: 20, - ), - ) + flex: 8, + child: Padding( + padding: EdgeInsets.only(bottom: 2), + child: TextScroll( + "A.C. Milan", + style: GoogleFonts.plusJakartaSans( + height: 1, + color: Colors.white, + fontWeight: FontWeight.w300, + fontSize: 16.sp), + mode: TextScrollMode.endless, + velocity: Velocity(pixelsPerSecond: Offset(50, 20)), + pauseBetween: Duration(milliseconds: 500), + ), + )), + Container(width: 10), + AutoSizeText( + "2013", + style: GoogleFonts.plusJakartaSans( + color: Colors.white.withOpacity(0.5), + fontWeight: FontWeight.w300, + fontSize: 16.sp), + textAlign: TextAlign.end, + maxFontSize: 20, + ), ], ), SizedBox(height: 60), diff --git a/justMUSIC/lib/components/top_nav_bar_component.dart b/justMUSIC/lib/components/top_nav_bar_component.dart index a3c13da..8616a16 100644 --- a/justMUSIC/lib/components/top_nav_bar_component.dart +++ b/justMUSIC/lib/components/top_nav_bar_component.dart @@ -6,13 +6,21 @@ import 'package:google_fonts/google_fonts.dart'; import '../values/constants.dart'; class TopNavBarComponent extends StatefulWidget { - const TopNavBarComponent({Key? key}) : super(key: key); + final Function(bool) callback; + const TopNavBarComponent({Key? key, required this.callback}) + : super(key: key); @override State createState() => _TopNavBarComponentState(); } class _TopNavBarComponentState extends State { + bool choice = true; + + void actionSurBouton() { + widget.callback(choice); + } + @override Widget build(BuildContext context) { return Padding( @@ -45,20 +53,66 @@ class _TopNavBarComponentState extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - AutoSizeText( - "Mes amis", - style: GoogleFonts.plusJakartaSans( - fontWeight: FontWeight.w300, - fontSize: 16, - color: unactiveFeed), + GestureDetector( + onTap: () { + setState(() { + choice = !choice; + actionSurBouton(); + }); + }, + child: LayoutBuilder( + builder: (BuildContext context, + BoxConstraints constraints) { + if (choice) { + return AutoSizeText( + "Mes amis", + style: GoogleFonts.plusJakartaSans( + fontWeight: FontWeight.w500, + fontSize: 16, + color: Colors.white), + ); + } else { + return AutoSizeText( + "Mes amis", + style: GoogleFonts.plusJakartaSans( + fontWeight: FontWeight.w300, + fontSize: 16, + color: unactiveFeed), + ); + } + }, + ), + ), + GestureDetector( + onTap: () { + setState(() { + choice = !choice; + actionSurBouton(); + }); + }, + child: LayoutBuilder( + builder: (BuildContext context, + BoxConstraints constraints) { + if (choice) { + return AutoSizeText( + "Discovery", + style: GoogleFonts.plusJakartaSans( + fontWeight: FontWeight.w300, + fontSize: 16, + color: unactiveFeed), + ); + } else { + return AutoSizeText( + "Discovery", + style: GoogleFonts.plusJakartaSans( + fontWeight: FontWeight.w500, + fontSize: 16, + color: Colors.white), + ); + } + }, + ), ), - AutoSizeText( - "Discovery", - style: GoogleFonts.plusJakartaSans( - fontWeight: FontWeight.bold, - fontSize: 16, - color: Colors.white), - ) ], ), ], diff --git a/justMUSIC/lib/screens/feed_screen.dart b/justMUSIC/lib/screens/feed_screen.dart index 9d76663..e98d77a 100644 --- a/justMUSIC/lib/screens/feed_screen.dart +++ b/justMUSIC/lib/screens/feed_screen.dart @@ -14,6 +14,35 @@ class FeedScreen extends StatefulWidget { } class _FeedScreenState extends State { + List friendFeed = [ + PostComponent(), + PostComponent(), + PostComponent(), + ]; + List discoveryFeed = [ + PostComponent(), + ]; + late List displayFeed; + + @override + void initState() { + displayFeed = friendFeed; + super.initState(); + } + + void changeFeed(bool choice) { + // Mettez ici le code pour l'action que vous souhaitez effectuer avec le paramètre + if (choice) { + setState(() { + displayFeed = friendFeed; + }); + } else { + setState(() { + displayFeed = discoveryFeed; + }); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -36,12 +65,7 @@ class _FeedScreenState extends State { child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - PostComponent(), - PostComponent(), - PostComponent(), - PostComponent(), - ], + children: displayFeed, ), )), ), @@ -66,7 +90,7 @@ class _FeedScreenState extends State { alignment: Alignment.topCenter, child: ConstrainedBox( constraints: BoxConstraints(maxWidth: 800), - child: const TopNavBarComponent(), + child: TopNavBarComponent(callback: changeFeed), ), ), ], diff --git a/justMUSIC/pubspec.lock b/justMUSIC/pubspec.lock index 7f422d0..bbae3a5 100644 --- a/justMUSIC/pubspec.lock +++ b/justMUSIC/pubspec.lock @@ -130,6 +130,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.1" + gradient_borders: + dependency: "direct main" + description: + name: gradient_borders + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" http: dependency: transitive description: @@ -296,6 +303,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.12" + text_scroll: + dependency: "direct main" + description: + name: text_scroll + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" typed_data: dependency: transitive description: diff --git a/justMUSIC/pubspec.yaml b/justMUSIC/pubspec.yaml index e781d02..6666edd 100644 --- a/justMUSIC/pubspec.yaml +++ b/justMUSIC/pubspec.yaml @@ -42,6 +42,8 @@ dependencies: flutter_signin_button: ^2.0.0 flutter_screenutil: ^5.7.0 auto_size_text: ^3.0.0 + gradient_borders: ^1.0.0 + text_scroll: ^0.2.0 dev_dependencies: flutter_test: