diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
index 2795ffb..7f7c6f9 100644
--- a/.idea/libraries/Dart_Packages.xml
+++ b/.idea/libraries/Dart_Packages.xml
@@ -296,6 +296,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -950,6 +971,9 @@
+
+
+
diff --git a/Sources/justMUSIC/android/app/src/main/AndroidManifest.xml b/Sources/justMUSIC/android/app/src/main/AndroidManifest.xml
index 5fefc0b..5f9a1bc 100644
--- a/Sources/justMUSIC/android/app/src/main/AndroidManifest.xml
+++ b/Sources/justMUSIC/android/app/src/main/AndroidManifest.xml
@@ -1,7 +1,7 @@
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index db77bb4..56c3c48 100644
Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..48f7c41
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..5c9a24f
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 17987b7..6aaf26d 100644
Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..c2d540b
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..157a3e4
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 09d4391..dcc4075 100644
Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..df01833
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..5b00dfd
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index d5f1c8d..594f7f8 100644
Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..042992b
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..fe01fd5
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 4d6372e..bebe455 100644
Binary files a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..0ae7d7d
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png differ
diff --git a/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..3dff0d4
Binary files /dev/null and b/Sources/justMUSIC/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png differ
diff --git a/Sources/justMUSIC/lib/components/button_play_component.dart b/Sources/justMUSIC/lib/components/button_play_component.dart
index 2b252de..09393d3 100644
--- a/Sources/justMUSIC/lib/components/button_play_component.dart
+++ b/Sources/justMUSIC/lib/components/button_play_component.dart
@@ -44,7 +44,7 @@ class _ButtonPlayComponentState extends State {
child: Icon(
isPlaying ? Icons.pause_circle : Icons.play_circle,
color: Colors.white,
- size: 53,
+ size: 45,
),
));
}
diff --git a/Sources/justMUSIC/lib/components/editable_post_component.dart b/Sources/justMUSIC/lib/components/editable_post_component.dart
index fa60606..82e0d30 100644
--- a/Sources/justMUSIC/lib/components/editable_post_component.dart
+++ b/Sources/justMUSIC/lib/components/editable_post_component.dart
@@ -1,8 +1,6 @@
import 'dart:io';
-
import 'package:animated_appear/animated_appear.dart';
import 'package:auto_size_text/auto_size_text.dart';
-import 'package:circular_reveal_animation/circular_reveal_animation.dart';
import 'package:flutter/Material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
@@ -143,8 +141,14 @@ class _EditablePostComponentState extends State with Tick
// implement image
child: widget.music == null
? Container(
- color: grayColor,
width: double.infinity,
+ child: Center(
+ child: Icon(
+ Icons.headphones,
+ color: grayColor.withOpacity(0.4),
+ size: 150,
+ ),
+ ),
)
: Image(
image: NetworkImage(widget.music?.cover ?? ""),
diff --git a/Sources/justMUSIC/lib/components/little_post_recap_component.dart b/Sources/justMUSIC/lib/components/little_post_recap_component.dart
new file mode 100644
index 0000000..2134adc
--- /dev/null
+++ b/Sources/justMUSIC/lib/components/little_post_recap_component.dart
@@ -0,0 +1,52 @@
+import 'package:flutter/Material.dart';
+import 'package:google_fonts/google_fonts.dart';
+
+import '../values/constants.dart';
+
+class LittleCapsule extends StatelessWidget {
+ final bool isEmpty;
+ final DateTime date;
+ const LittleCapsule({super.key, required this.isEmpty, required this.date});
+
+ @override
+ Widget build(BuildContext context) {
+ if (isEmpty) {
+ return Flexible(
+ child: Container(
+ constraints: BoxConstraints(maxWidth: 45, maxHeight: 45),
+ decoration: BoxDecoration(
+ color: searchBarColor,
+ borderRadius: BorderRadius.circular(5),
+ border: Border.all(color: Color(0xFF282828), width: 1),
+ ),
+ child: const Center(
+ child: Icon(
+ Icons.rocket_launch,
+ color: Color(0xFF464646),
+ size: 18,
+ ),
+ ),
+ ),
+ );
+ }
+ return Flexible(
+ child: Container(
+ constraints: BoxConstraints(maxWidth: 45, maxHeight: 45),
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ colors: [bgModal, bgModal.withOpacity(0)],
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ stops: [0, 1]),
+ borderRadius: BorderRadius.circular(5),
+ ),
+ child: Center(
+ child: Text(
+ date.day.toString(),
+ style: GoogleFonts.plusJakartaSans(color: Color(0xFF464646), fontWeight: FontWeight.w800, fontSize: 17),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/Sources/justMUSIC/lib/components/post_component.dart b/Sources/justMUSIC/lib/components/post_component.dart
index 2118eee..2d0535c 100644
--- a/Sources/justMUSIC/lib/components/post_component.dart
+++ b/Sources/justMUSIC/lib/components/post_component.dart
@@ -3,6 +3,7 @@ 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:justmusic/components/profil_picture_component.dart';
import 'package:text_scroll/text_scroll.dart';
import 'package:zoom_tap_animation/zoom_tap_animation.dart';
@@ -39,170 +40,157 @@ class _PostComponentState extends State with TickerProviderStateM
@override
Widget build(BuildContext context) {
return GestureDetector(
- onTap: switchChoice,
- child: LayoutBuilder(
- builder: (BuildContext context, BoxConstraints constraints) {
- if (widget.callback == null) {
- return SizedBox(
- width: double.infinity,
- child: Column(
+ onTap: switchChoice,
+ child: SizedBox(
+ width: double.infinity,
+ child: Column(
+ children: [
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.end,
children: [
- Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- ClipOval(
- child: SizedBox.fromSize(
- // Image radius
- child: Image(
- image: NetworkImage(widget.post.user.pp),
- width: 40,
+ ProfilPictureComponent(user: widget.post.user),
+ Expanded(
+ flex: 8,
+ child: Padding(
+ padding: const EdgeInsets.only(left: 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ widget.post.user.pseudo,
+ style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w600),
),
- ),
+ widget.post.location.item2 != null
+ ? Text(
+ "${widget.post.location.item1}, ${widget.post.location.item2}",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white.withOpacity(0.4),
+ fontWeight: FontWeight.w300,
+ fontSize: 13),
+ )
+ : Text(
+ "",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white.withOpacity(0.4),
+ fontWeight: FontWeight.w300,
+ fontSize: 13),
+ )
+ ],
),
- Expanded(
- flex: 8,
- child: Padding(
- padding: const EdgeInsets.only(left: 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- widget.post.user.pseudo,
- style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w600),
- ),
- widget.post.location.item2 != null
- ? Text(
- "${widget.post.location.item1}, ${widget.post.location.item2}",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.4),
- fontWeight: FontWeight.w300,
- fontSize: 13),
- )
- : Text(
- "",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.4),
- fontWeight: FontWeight.w300,
- fontSize: 13),
- )
- ],
- ),
+ ),
+ ),
+ DateTime(today.year, today.month, today.day).isAtSameMomentAs(
+ DateTime(widget.post.date.year, widget.post.date.month, widget.post.date.day))
+ ? Text(
+ "Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
+ )
+ : Text(
+ "hier, ${widget.post.date.hour}:${widget.post.date.minute}",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
),
+ ],
+ ),
+ SizedBox(height: 10),
+ ZoomTapAnimation(
+ onTap: () {
+ widget.callback!(widget.post);
+ },
+ enableLongTapRepeatEvent: false,
+ longTapRepeatDuration: const Duration(milliseconds: 100),
+ begin: 1.0,
+ end: 0.99,
+ beginDuration: const Duration(milliseconds: 70),
+ endDuration: const Duration(milliseconds: 100),
+ beginCurve: Curves.decelerate,
+ endCurve: Curves.easeInOutSine,
+ child: AspectRatio(
+ aspectRatio: 1 / 1,
+ child: Container(
+ decoration: BoxDecoration(
+ // add border
+ border: const GradientBoxBorder(
+ gradient: LinearGradient(colors: [
+ Colors.transparent,
+ Color(0xFF323232),
+ ], begin: Alignment.topCenter, end: Alignment.bottomCenter),
+ width: 2.5,
+ ),
+ // set border radius
+ borderRadius: BorderRadius.circular(20),
),
- DateTime(today.year, today.month, today.day).isAtSameMomentAs(
- DateTime(widget.post.date.year, widget.post.date.month, widget.post.date.day))
- ? Text(
- "Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
- )
- : Text(
- "${widget.post.date.day}/${widget.post.date.month}/${widget.post.date.year}-${widget.post.date.hour}:${widget.post.date.minute}",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(18),
+ // implement image
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ Image(
+ image: NetworkImage(widget.post.music.cover!),
+ fit: BoxFit.cover,
+ width: double.infinity,
),
- ],
- ),
- SizedBox(height: 10),
- ZoomTapAnimation(
- onTap: () {
- if (widget.post.selfie != null) {
- switchChoice();
- }
- },
- enableLongTapRepeatEvent: false,
- longTapRepeatDuration: const Duration(milliseconds: 100),
- begin: 1.0,
- end: 0.99,
- beginDuration: const Duration(milliseconds: 70),
- endDuration: const Duration(milliseconds: 100),
- beginCurve: Curves.decelerate,
- endCurve: Curves.easeInOutSine,
- child: AspectRatio(
- aspectRatio: 1 / 1,
- child: Container(
- decoration: BoxDecoration(
- // add border
- border: const GradientBoxBorder(
- gradient: LinearGradient(colors: [
- Colors.transparent,
- Color(0xFF323232),
- ], begin: Alignment.topCenter, end: Alignment.bottomCenter),
- width: 2.5,
+ Image(
+ image: AssetImage("assets/images/shadow_post.png"),
+ opacity: AnimationController(vsync: this, value: 0.7),
+ fit: BoxFit.fitHeight,
+ 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: NetworkImage(choice ? widget.post.selfie! : widget.post.music.cover!),
- fit: BoxFit.cover,
- width: double.infinity,
- ),
- widget.post.selfie != null
- ? Positioned(
- top: 0,
- right: 0,
- child: Padding(
- padding: EdgeInsets.all(12),
- child: Container(
- constraints: BoxConstraints(maxWidth: 140, maxHeight: 140),
- width: 90.sp,
- height: 90.sp,
- decoration: BoxDecoration(
- color: Colors.white,
- // add border
- border: Border.all(width: 3, color: Colors.white),
- // set border radius
- borderRadius: BorderRadius.circular(15),
- ),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(13),
- // implement image
- child: Image(
- image: NetworkImage(
- choice ? widget.post.music.cover! : widget.post.selfie!),
- fit: BoxFit.cover,
- ),
- ),
+ widget.post.description == null
+ ? Container()
+ : Padding(
+ padding: EdgeInsets.all(15),
+ child: AutoSizeText(
+ '“${widget.post.description}”',
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white, fontWeight: FontWeight.w400, fontSize: 15.sp),
+ maxFontSize: 20,
+ maxLines: 1,
+ ),
+ ),
+ widget.post.selfie != null
+ ? Positioned(
+ top: 0,
+ right: 0,
+ child: Padding(
+ padding: EdgeInsets.all(12),
+ child: Container(
+ constraints: BoxConstraints(maxWidth: 140, maxHeight: 140),
+ width: 90.sp,
+ height: 90.sp,
+ decoration: BoxDecoration(
+ color: Colors.white,
+ // add border
+ border: Border.all(width: 3, color: Colors.white),
+ // set border radius
+ borderRadius: BorderRadius.circular(15),
+ ),
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(13),
+ // implement image
+ child: Image(
+ image: NetworkImage(widget.post.selfie!),
+ fit: BoxFit.cover,
),
- ))
- : Container(),
- ],
- ),
- ),
+ ),
+ ),
+ ))
+ : Container(),
+ ],
),
- )),
- SizedBox(height: 15),
+ ),
+ ),
+ )),
+ SizedBox(height: 15),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.start,
children: [
- Flexible(
- flex: 8,
- child: TextScroll(
- widget.post.music.artists.first.name!,
- style: GoogleFonts.plusJakartaSans(
- height: 1, color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
- mode: TextScrollMode.endless,
- pauseBetween: Duration(milliseconds: 500),
- velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
- )),
- Padding(
- padding: EdgeInsets.only(bottom: 10.h, right: 5.w, left: 5.w),
- child: ClipOval(
- child: Container(
- width: 5.h,
- height: 5.h,
- color: Colors.white,
- ),
- ),
- ),
Expanded(
flex: 8,
child: Padding(
@@ -210,7 +198,7 @@ class _PostComponentState extends State with TickerProviderStateM
child: TextScroll(
widget.post.music.title!,
style: GoogleFonts.plusJakartaSans(
- height: 1, color: Colors.white, fontWeight: FontWeight.w300, fontSize: 16.h),
+ height: 1, color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
mode: TextScrollMode.endless,
velocity: Velocity(pixelsPerSecond: Offset(50, 20)),
pauseBetween: Duration(milliseconds: 500),
@@ -220,219 +208,23 @@ class _PostComponentState extends State with TickerProviderStateM
AutoSizeText(
widget.post.music.date.toString(),
style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.5), fontWeight: FontWeight.w300, fontSize: 16.h),
+ color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
textAlign: TextAlign.end,
maxFontSize: 20,
),
],
),
- ],
- ));
- }
-
- return SizedBox(
- width: double.infinity,
- child: Column(
- children: [
- Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- ClipOval(
- child: SizedBox.fromSize(
- // Image radius
- child: Image(
- image: NetworkImage(widget.post.user.pp),
- width: 40,
- ),
- ),
- ),
- Expanded(
- flex: 8,
- child: Padding(
- padding: const EdgeInsets.only(left: 10),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- widget.post.user.pseudo,
- style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w600),
- ),
- widget.post.location.item2 != null
- ? Text(
- "${widget.post.location.item1}, ${widget.post.location.item2}",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.4),
- fontWeight: FontWeight.w300,
- fontSize: 13),
- )
- : Text(
- "",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.4),
- fontWeight: FontWeight.w300,
- fontSize: 13),
- )
- ],
- ),
- ),
- ),
- DateTime(today.year, today.month, today.day).isAtSameMomentAs(
- DateTime(widget.post.date.year, widget.post.date.month, widget.post.date.day))
- ? Text(
- "Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
- )
- : Text(
- "hier, ${widget.post.date.hour}:${widget.post.date.minute}",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
- ),
- ],
- ),
- SizedBox(height: 10),
- ZoomTapAnimation(
- onTap: () {
- widget.callback!(widget.post);
- },
- enableLongTapRepeatEvent: false,
- longTapRepeatDuration: const Duration(milliseconds: 100),
- begin: 1.0,
- end: 0.99,
- beginDuration: const Duration(milliseconds: 70),
- endDuration: const Duration(milliseconds: 100),
- beginCurve: Curves.decelerate,
- endCurve: Curves.easeInOutSine,
- child: AspectRatio(
- aspectRatio: 1 / 1,
- child: Container(
- decoration: BoxDecoration(
- // add border
- border: const GradientBoxBorder(
- gradient: LinearGradient(colors: [
- Colors.transparent,
- Color(0xFF323232),
- ], begin: Alignment.topCenter, end: Alignment.bottomCenter),
- width: 2.5,
- ),
- // set border radius
- borderRadius: BorderRadius.circular(20),
- ),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(18),
- // implement image
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- Image(
- image: NetworkImage(widget.post.music.cover!),
- fit: BoxFit.cover,
- width: double.infinity,
- ),
- Image(
- image: AssetImage("assets/images/shadow_post.png"),
- opacity: AnimationController(vsync: this, value: 0.7),
- fit: BoxFit.fitHeight,
- width: double.infinity,
- ),
- widget.post.description == null
- ? Container()
- : Padding(
- padding: EdgeInsets.all(15),
- child: AutoSizeText(
- '“${widget.post.description}”',
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white, fontWeight: FontWeight.w400, fontSize: 15.sp),
- maxFontSize: 20,
- maxLines: 1,
- ),
- ),
- widget.post.selfie != null
- ? Positioned(
- top: 0,
- right: 0,
- child: Padding(
- padding: EdgeInsets.all(12),
- child: Container(
- constraints: BoxConstraints(maxWidth: 140, maxHeight: 140),
- width: 90.sp,
- height: 90.sp,
- decoration: BoxDecoration(
- color: Colors.white,
- // add border
- border: Border.all(width: 3, color: Colors.white),
- // set border radius
- borderRadius: BorderRadius.circular(15),
- ),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(13),
- // implement image
- child: Image(
- image: NetworkImage(widget.post.selfie!),
- fit: BoxFit.cover,
- ),
- ),
- ),
- ))
- : Container(),
- ],
- ),
- ),
- ),
- )),
- SizedBox(height: 15),
- SizedBox(
- height: 40,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Expanded(
- flex: 8,
- child: Padding(
- padding: EdgeInsets.only(bottom: 2),
- child: TextScroll(
- widget.post.music.title!,
- style: GoogleFonts.plusJakartaSans(
- height: 1, color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
- mode: TextScrollMode.endless,
- velocity: Velocity(pixelsPerSecond: Offset(50, 20)),
- pauseBetween: Duration(milliseconds: 500),
- ),
- )),
- Container(width: 10),
- AutoSizeText(
- widget.post.music.date.toString(),
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
- textAlign: TextAlign.end,
- maxFontSize: 20,
- ),
- ],
- ),
- Expanded(
- flex: 8,
- child: TextScroll(
- widget.post.music.artists.first.name!,
- style: GoogleFonts.plusJakartaSans(
- height: 1,
- color: Colors.white.withOpacity(0.5),
- fontWeight: FontWeight.w300,
- fontSize: 16.h),
- mode: TextScrollMode.endless,
- pauseBetween: Duration(milliseconds: 500),
- velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
- )),
- ],
+ TextScroll(
+ widget.post.music.artists.first.name!,
+ style: GoogleFonts.plusJakartaSans(
+ height: 1, color: Colors.white.withOpacity(0.5), fontWeight: FontWeight.w300, fontSize: 16.h),
+ mode: TextScrollMode.endless,
+ pauseBetween: Duration(milliseconds: 500),
+ velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
),
- )
- ],
- ));
- },
- ),
- );
+ ],
+ ),
+ ],
+ )));
}
}
diff --git a/Sources/justMUSIC/lib/components/profil_picture_component.dart b/Sources/justMUSIC/lib/components/profil_picture_component.dart
new file mode 100644
index 0000000..cd0ad72
--- /dev/null
+++ b/Sources/justMUSIC/lib/components/profil_picture_component.dart
@@ -0,0 +1,33 @@
+import 'package:flutter/Material.dart';
+import 'package:justmusic/screens/user_screen.dart';
+
+import '../config/routes.dart';
+import '../model/User.dart';
+
+class ProfilPictureComponent extends StatelessWidget {
+ final User user;
+ const ProfilPictureComponent({super.key, required this.user});
+
+ void _openDetail(BuildContext context) {
+ print("cc");
+ Navigator.of(context).push(routeUser(user));
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: () {
+ _openDetail(context);
+ },
+ child: ClipOval(
+ child: SizedBox.fromSize(
+ // Image radius
+ child: Image(
+ image: NetworkImage(user.pp),
+ width: 40,
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/Sources/justMUSIC/lib/components/profile_list_component.dart b/Sources/justMUSIC/lib/components/profile_list_component.dart
index ebb5363..9201a0c 100644
--- a/Sources/justMUSIC/lib/components/profile_list_component.dart
+++ b/Sources/justMUSIC/lib/components/profile_list_component.dart
@@ -1,6 +1,7 @@
import 'package:flutter/Material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:google_fonts/google_fonts.dart';
+import 'package:justmusic/components/profil_picture_component.dart';
import '../main.dart';
import '../model/User.dart';
import '../values/constants.dart';
@@ -23,13 +24,7 @@ class _ProfileListComponentState extends State {
padding: const EdgeInsets.only(bottom: 5),
child: Row(
children: [
- ClipOval(
- child: FadeInImage.assetNetwork(
- height: 50,
- width: 50,
- fit: BoxFit.cover,
- placeholder: "assets/images/loadingPlaceholder.gif",
- image: widget.user.pp)),
+ ProfilPictureComponent(user: widget.user),
const SizedBox(
width: 10,
),
diff --git a/Sources/justMUSIC/lib/components/recap_component.dart b/Sources/justMUSIC/lib/components/recap_component.dart
new file mode 100644
index 0000000..d7ce67e
--- /dev/null
+++ b/Sources/justMUSIC/lib/components/recap_component.dart
@@ -0,0 +1,125 @@
+import 'package:firebase_auth/firebase_auth.dart';
+import 'package:flutter/Material.dart';
+import 'package:google_fonts/google_fonts.dart';
+import '../main.dart';
+import '../model/User.dart' as justMusic;
+import '../values/constants.dart';
+import 'little_post_recap_component.dart';
+
+class RecapComponent extends StatelessWidget {
+ final justMusic.User user;
+ const RecapComponent({super.key, required this.user});
+
+ Future>? _fetchdata() async {
+ return await MyApp.postViewModel.recapSevenDays(user.id);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ List weekDays = ['L', 'M', 'M', 'J', 'V', 'S', 'D'];
+ DateTime currentDate = DateTime.now();
+
+ return Container(
+ decoration: BoxDecoration(
+ color: profileBttnColor,
+ borderRadius: BorderRadius.circular(10),
+ border: Border.all(color: grayColor, width: 1)),
+ height: 120,
+ clipBehavior: Clip.hardEdge,
+ child: Column(
+ children: [
+ Expanded(
+ child: Container(
+ padding: EdgeInsets.symmetric(horizontal: 10),
+ decoration: BoxDecoration(
+ color: postbutton,
+ borderRadius: BorderRadius.only(topRight: Radius.circular(10), topLeft: Radius.circular(10)),
+ ),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Flexible(
+ child: Center(
+ child: Text(
+ weekDays[currentDate.subtract(Duration(days: 6)).weekday - 1].substring(0, 1),
+ style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
+ ),
+ )),
+ Flexible(
+ child: Center(
+ child: Text(
+ weekDays[currentDate.subtract(Duration(days: 5)).weekday - 1].substring(0, 1),
+ style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
+ ),
+ )),
+ Flexible(
+ child: Center(
+ child: Text(
+ weekDays[currentDate.subtract(Duration(days: 4)).weekday - 1].substring(0, 1),
+ style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
+ ),
+ )),
+ Flexible(
+ child: Center(
+ child: Text(
+ weekDays[currentDate.subtract(Duration(days: 3)).weekday - 1].substring(0, 1),
+ style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
+ ),
+ )),
+ Flexible(
+ child: Center(
+ child: Text(
+ weekDays[currentDate.subtract(Duration(days: 2)).weekday - 1].substring(0, 1),
+ style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
+ ),
+ )),
+ Flexible(
+ child: Center(
+ child: Text(
+ weekDays[currentDate.subtract(Duration(days: 1)).weekday - 1].substring(0, 1),
+ style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
+ ),
+ )),
+ Flexible(
+ child: Center(
+ child: Text(
+ weekDays[currentDate.subtract(Duration(days: 0)).weekday - 1].substring(0, 1),
+ style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
+ ),
+ )),
+ ],
+ ),
+ )),
+ FutureBuilder>(
+ future: _fetchdata(), // a previously-obtained Future or null
+ builder: (BuildContext context, AsyncSnapshot> snapshot) {
+ if (snapshot.hasData) {
+ return Padding(
+ padding: EdgeInsets.all(12),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ LittleCapsule(
+ isEmpty: snapshot.data![0],
+ date: currentDate.subtract(const Duration(days: 6)),
+ ),
+ LittleCapsule(isEmpty: snapshot.data![1], date: currentDate.subtract(const Duration(days: 5))),
+ LittleCapsule(isEmpty: snapshot.data![2], date: currentDate.subtract(const Duration(days: 4))),
+ LittleCapsule(isEmpty: snapshot.data![3], date: currentDate.subtract(const Duration(days: 3))),
+ LittleCapsule(isEmpty: snapshot.data![4], date: currentDate.subtract(const Duration(days: 2))),
+ LittleCapsule(isEmpty: snapshot.data![5], date: currentDate.subtract(const Duration(days: 1))),
+ LittleCapsule(isEmpty: snapshot.data![6], date: currentDate.subtract(const Duration(days: 0))),
+ ],
+ ),
+ );
+ } else {
+ return Container();
+ }
+ }),
+ ],
+ ),
+ );
+ }
+}
diff --git a/Sources/justMUSIC/lib/components/setting_part_component.dart b/Sources/justMUSIC/lib/components/setting_part_component.dart
index 21e47f1..3079d48 100644
--- a/Sources/justMUSIC/lib/components/setting_part_component.dart
+++ b/Sources/justMUSIC/lib/components/setting_part_component.dart
@@ -9,7 +9,9 @@ class SettingPartComponent extends StatelessWidget {
final JustMusicIcon icon;
final String label;
final bool important;
- const SettingPartComponent({Key? key, required this.icon, required this.label, this.important = false})
+ final VoidCallback? action;
+ const SettingPartComponent(
+ {Key? key, required this.icon, required this.label, this.important = false, required this.action})
: super(key: key);
@override
@@ -24,11 +26,7 @@ class SettingPartComponent extends StatelessWidget {
color: important ? warningBttnColor : settingColor,
borderOnForeground: false,
child: InkWell(
- onTap: () {
- if (icon == JustMusicIcon.cross) {
- logout();
- }
- },
+ onTap: action,
splashColor: Colors.transparent,
highlightColor: Colors.white.withOpacity(0.08),
child: Container(
diff --git a/Sources/justMUSIC/lib/components/top_nav_bar_component.dart b/Sources/justMUSIC/lib/components/top_nav_bar_component.dart
index 39deb0d..d258f68 100644
--- a/Sources/justMUSIC/lib/components/top_nav_bar_component.dart
+++ b/Sources/justMUSIC/lib/components/top_nav_bar_component.dart
@@ -27,8 +27,7 @@ class _TopNavBarComponentState extends State with TickerProv
bool isDismissed = true;
- final DateTime midnight = DateTime(
- DateTime.now().year, DateTime.now().month, DateTime.now().day + 1);
+ final DateTime midnight = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1);
void actionSurBouton(bool choice) async {
widget.callback(choice);
@@ -47,8 +46,7 @@ class _TopNavBarComponentState extends State with TickerProv
var now = tz.TZDateTime.now(franceTimeZone);
// Calculate the midnight time for the next day in France timezone
- var midnight =
- tz.TZDateTime(franceTimeZone, now.year, now.month, now.day + 1);
+ var midnight = tz.TZDateTime(franceTimeZone, now.year, now.month, now.day + 1);
bool res = await MyApp.postViewModel.getAvailable();
if (res) {
@@ -67,8 +65,7 @@ class _TopNavBarComponentState extends State with TickerProv
alignment: Alignment.centerLeft,
child: Text(
"Capsule disponible",
- style:
- GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
+ style: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
),
),
flushbarStyle: FlushbarStyle.FLOATING,
@@ -105,8 +102,7 @@ class _TopNavBarComponentState extends State with TickerProv
alignment: Alignment.centerLeft,
child: CountdownTimer(
endTime: midnight.millisecondsSinceEpoch,
- textStyle:
- GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
+ textStyle: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
),
),
flushbarStyle: FlushbarStyle.FLOATING,
@@ -153,7 +149,7 @@ class _TopNavBarComponentState extends State with TickerProv
flex: 1,
child: GestureDetector(
behavior: HitTestBehavior.translucent,
- onTap: () async {
+ onTap: () {
Navigator.of(context).push(routeAddFriend());
},
child: const Icon(
@@ -199,30 +195,23 @@ class _TopNavBarComponentState extends State with TickerProv
}
},
child: LayoutBuilder(
- builder: (BuildContext context,
- BoxConstraints constraints) {
+ builder: (BuildContext context, BoxConstraints constraints) {
if (choice) {
return Padding(
- padding: const EdgeInsets.only(
- left: 8, top: 0, right: 8, bottom: 6),
+ padding: const EdgeInsets.only(left: 8, top: 0, right: 8, bottom: 6),
child: AutoSizeText(
"Mes amis",
style: GoogleFonts.plusJakartaSans(
- fontWeight: FontWeight.w500,
- fontSize: 16,
- color: Colors.white),
+ fontWeight: FontWeight.w500, fontSize: 16, color: Colors.white),
),
);
} else {
return Padding(
- padding: const EdgeInsets.only(
- left: 8, top: 0, right: 8, bottom: 6),
+ padding: const EdgeInsets.only(left: 8, top: 0, right: 8, bottom: 6),
child: AutoSizeText(
"Mes amis",
style: GoogleFonts.plusJakartaSans(
- fontWeight: FontWeight.w300,
- fontSize: 16,
- color: unactiveFeed),
+ fontWeight: FontWeight.w300, fontSize: 16, color: unactiveFeed),
));
}
},
@@ -239,29 +228,22 @@ class _TopNavBarComponentState extends State with TickerProv
}
},
child: LayoutBuilder(
- builder: (BuildContext context,
- BoxConstraints constraints) {
+ builder: (BuildContext context, BoxConstraints constraints) {
if (choice) {
return Padding(
- padding: const EdgeInsets.only(
- left: 8, top: 0, right: 8, bottom: 6),
+ padding: const EdgeInsets.only(left: 8, top: 0, right: 8, bottom: 6),
child: AutoSizeText(
"Discovery",
style: GoogleFonts.plusJakartaSans(
- fontWeight: FontWeight.w300,
- fontSize: 16,
- color: unactiveFeed),
+ fontWeight: FontWeight.w300, fontSize: 16, color: unactiveFeed),
));
} else {
return Padding(
- padding: const EdgeInsets.only(
- left: 8, top: 0, right: 8, bottom: 6),
+ padding: const EdgeInsets.only(left: 8, top: 0, right: 8, bottom: 6),
child: AutoSizeText(
"Discovery",
style: GoogleFonts.plusJakartaSans(
- fontWeight: FontWeight.w500,
- fontSize: 16,
- color: Colors.white),
+ fontWeight: FontWeight.w500, fontSize: 16, color: Colors.white),
));
}
},
diff --git a/Sources/justMUSIC/lib/config/routes.dart b/Sources/justMUSIC/lib/config/routes.dart
index 5c6c7a6..1c4ed4b 100644
--- a/Sources/justMUSIC/lib/config/routes.dart
+++ b/Sources/justMUSIC/lib/config/routes.dart
@@ -2,6 +2,9 @@ import 'package:flutter/Material.dart';
import 'package:justmusic/screens/add_friend_screen.dart';
import 'package:justmusic/screens/feed_screen.dart';
import 'package:justmusic/screens/profile_screen.dart';
+import 'package:justmusic/screens/user_screen.dart';
+
+import '../model/User.dart';
Route routeProfile() {
return PageRouteBuilder(
@@ -50,3 +53,21 @@ Route routeRocket() {
},
);
}
+
+Route routeUser(User user) {
+ return PageRouteBuilder(
+ pageBuilder: (context, animation, secondaryAnimation) => UserScreen(user: user),
+ transitionsBuilder: (context, animation, secondaryAnimation, child) {
+ const begin = Offset(1.0, 0.0);
+ const end = Offset.zero;
+ const curve = Curves.ease;
+
+ var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
+
+ return SlideTransition(
+ position: animation.drive(tween),
+ child: child,
+ );
+ },
+ );
+}
diff --git a/Sources/justMUSIC/lib/main.dart b/Sources/justMUSIC/lib/main.dart
index 83fabcd..391db40 100644
--- a/Sources/justMUSIC/lib/main.dart
+++ b/Sources/justMUSIC/lib/main.dart
@@ -17,6 +17,7 @@ import 'package:justmusic/screens/launching_rocker_screen.dart';
import 'package:justmusic/screens/post_screen.dart';
import 'package:justmusic/screens/profile_screen.dart';
import 'package:justmusic/screens/registration_screen.dart';
+import 'package:justmusic/screens/user_screen.dart';
import 'package:justmusic/screens/welcome_screen.dart';
import 'package:justmusic/view_model/CommentViewModel.dart';
import 'package:justmusic/view_model/MusicViewModel.dart';
@@ -67,8 +68,7 @@ class _MyAppState extends State {
print('User is currently signed out!');
return null;
} else {
- MyApp.userViewModel.userCurrent =
- (await (MyApp.userViewModel.getUser(user.uid)))!;
+ MyApp.userViewModel.userCurrent = (await (MyApp.userViewModel.getUser(user.uid)))!;
userCurrent = Stream.value(MyApp.userViewModel.userCurrent);
print('User is signed in!');
}
@@ -106,38 +106,7 @@ class _MyAppState extends State {
theme: ThemeData(
primarySwatch: Colors.blue,
),
- home: StreamBuilder(
- stream: FirebaseAuth.instance.authStateChanges(),
- builder: (context, snapshot) {
- if (snapshot.connectionState == ConnectionState.waiting) {
- return LoadingScreen();
- } else if (snapshot.hasData) {
- return FutureBuilder(
- future: MyApp.userViewModel.getUser(snapshot.data!.uid),
- builder: (context, userSnapshot) {
- if (userSnapshot.connectionState ==
- ConnectionState.waiting) {
- return LoadingScreen();
- } else if (userSnapshot.hasData) {
- MyApp.userViewModel.userCurrent = userSnapshot.data!;
- return AnimatedSwitcher(
- duration: Duration(milliseconds: 1000),
- transitionBuilder: (child, animation) {
- return FadeTransition(
- opacity: animation, child: child);
- },
- child: FeedScreen(),
- );
- } else {
- return WellcomeScreen();
- }
- },
- );
- } else {
- return WellcomeScreen();
- }
- },
- ));
+ home: WellcomeScreen());
},
designSize: Size(390, 844),
);
diff --git a/Sources/justMUSIC/lib/screens/detail_post_screen.dart b/Sources/justMUSIC/lib/screens/detail_post_screen.dart
index 0f1b875..a99e540 100644
--- a/Sources/justMUSIC/lib/screens/detail_post_screen.dart
+++ b/Sources/justMUSIC/lib/screens/detail_post_screen.dart
@@ -9,6 +9,7 @@ import 'package:text_scroll/text_scroll.dart';
import 'package:zoom_tap_animation/zoom_tap_animation.dart';
import '../components/button_play_component.dart';
import '../components/comment_component.dart';
+import '../components/profil_picture_component.dart';
import '../main.dart';
import '../model/Post.dart';
import '../model/Comment.dart';
@@ -60,439 +61,460 @@ class _DetailPostScreenState extends State {
@override
Widget build(BuildContext context) {
- return Container(
- height: 760.h,
- child: Column(
- children: [
- Expanded(
- child: Stack(
- children: [
- ScrollConfiguration(
- behavior: MyBehavior(),
- child: SingleChildScrollView(
- controller: _scrollController,
- physics: AlwaysScrollableScrollPhysics(),
- child: Stack(
- clipBehavior: Clip.hardEdge,
- children: [
- Align(
- alignment: Alignment.topCenter,
- child: Container(
- height: 400,
- width: double.infinity,
- child: FadeInImage.assetNetwork(
- placeholder: "assets/images/loadingPlaceholder.gif",
- image: choice ? widget.post.selfie! : widget.post.music.cover!,
- width: double.infinity,
- fit: BoxFit.cover,
- ),
- ),
- ),
- Column(
+ return GestureDetector(
+ onTap: () {
+ FocusScopeNode currentFocus = FocusScope.of(context);
+ if (!currentFocus.hasPrimaryFocus) {
+ currentFocus.unfocus();
+ resetFullScreen();
+ }
+ },
+ child: Container(
+ height: 760.h,
+ child: Column(
+ children: [
+ Expanded(
+ child: Stack(
+ children: [
+ ScrollConfiguration(
+ behavior: MyBehavior(),
+ child: SingleChildScrollView(
+ controller: _scrollController,
+ physics: AlwaysScrollableScrollPhysics(),
+ child: Stack(
+ clipBehavior: Clip.hardEdge,
children: [
- Container(
- height: 200,
- margin: EdgeInsets.only(top: 230),
- width: double.infinity,
- decoration: const BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [Colors.transparent, bgModal],
- stops: [0, 0.8],
+ Align(
+ alignment: Alignment.topCenter,
+ child: Container(
+ height: 400,
+ width: double.infinity,
+ child: FadeInImage.assetNetwork(
+ placeholder: "assets/images/loadingPlaceholder.gif",
+ image: choice ? widget.post.selfie! : widget.post.music.cover!,
+ width: double.infinity,
+ fit: BoxFit.cover,
),
),
- child: Padding(
- padding: const EdgeInsets.fromLTRB(20, 0, 20, 10),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Padding(
- padding: const EdgeInsets.only(right: 10),
- child: choice
- ? Padding(
- padding: const EdgeInsets.all(4),
- child: ClipOval(
- child: SizedBox.fromSize(
- // Image radius
- child: Image(
- image: NetworkImage(widget.post.user.pp),
- width: 45,
- ),
- ),
- ),
- )
- : widget.post.music.previewUrl != null
- ? ButtonPlayComponent(music: widget.post.music)
- : Container(),
+ ),
+ Column(
+ children: [
+ Container(
+ height: 200,
+ margin: EdgeInsets.only(top: 230),
+ width: double.infinity,
+ decoration: const BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [Colors.transparent, bgModal],
+ stops: [0, 0.8],
),
- Flexible(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.end,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Flexible(
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Expanded(
- child: ScrollConfiguration(
- behavior: ScrollBehavior().copyWith(scrollbars: false),
- child: TextScroll(
- choice ? widget.post.user.pseudo : widget.post.music.title!,
- style: GoogleFonts.plusJakartaSans(
- height: 1,
- color: Colors.white,
- fontWeight: FontWeight.w800,
- fontSize: 22,
- ),
- mode: TextScrollMode
- .endless,
- pauseBetween: Duration(
- milliseconds: 500),
- velocity: Velocity(
- pixelsPerSecond:
- Offset(20, 0)),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(20, 0, 20, 10),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: choice
+ ? Padding(
+ padding: const EdgeInsets.all(4),
+ child: ClipOval(
+ child: SizedBox.fromSize(
+ // Image radius
+ child: ProfilPictureComponent(user: widget.post.user),
),
),
- ),
- Padding(
- padding: const EdgeInsets.only(left: 20.0),
- child: choice
- ? DateTime(today.year, today.month, today.day).isAtSameMomentAs(
- DateTime(
- widget.post.date.year,
- widget.post.date.month,
- widget.post.date.day,
+ )
+ : widget.post.music.previewUrl != null
+ ? ButtonPlayComponent(music: widget.post.music)
+ : Container(),
+ ),
+ Flexible(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.end,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Flexible(
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Expanded(
+ child: ScrollConfiguration(
+ behavior: ScrollBehavior().copyWith(scrollbars: false),
+ child: TextScroll(
+ choice ? widget.post.user.pseudo : widget.post.music.title!,
+ style: GoogleFonts.plusJakartaSans(
+ height: 1,
+ color: Colors.white,
+ fontWeight: FontWeight.w800,
+ fontSize: 22,
),
- )
- ? Text(
- "Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
- style: GoogleFonts.plusJakartaSans(
- height: 1,
- color: Colors.white,
- fontWeight: FontWeight.w900,
- fontSize: 18,
+ mode: TextScrollMode.endless,
+ pauseBetween: Duration(milliseconds: 500),
+ velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
+ ),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.only(left: 20.0),
+ child: choice
+ ? DateTime(today.year, today.month, today.day)
+ .isAtSameMomentAs(
+ DateTime(
+ widget.post.date.year,
+ widget.post.date.month,
+ widget.post.date.day,
),
)
+ ? Text(
+ "Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
+ style: GoogleFonts.plusJakartaSans(
+ height: 1,
+ color: Colors.white,
+ fontWeight: FontWeight.w900,
+ fontSize: 18,
+ ),
+ )
+ : Text(
+ "hier, ${widget.post.date.hour}:${widget.post.date.minute}",
+ style: GoogleFonts.plusJakartaSans(
+ height: 1,
+ color: Colors.white,
+ fontWeight: FontWeight.w900,
+ fontSize: 18,
+ ),
+ )
: Text(
- "hier, ${widget.post.date.hour}:${widget.post.date.minute}",
+ widget.post.music.date.toString(),
style: GoogleFonts.plusJakartaSans(
height: 1,
color: Colors.white,
fontWeight: FontWeight.w900,
fontSize: 18,
),
- )
+ ),
+ ),
+ ],
+ ),
+ ),
+ choice
+ ? widget.post.location.item2 != null
+ ? Text(
+ "${widget.post.location.item1}, ${widget.post.location.item2}",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white.withOpacity(0.5),
+ fontWeight: FontWeight.w400,
+ fontSize: 15,
+ ),
+ )
: Text(
- widget.post.music.date.toString(),
+ "",
style: GoogleFonts.plusJakartaSans(
- height: 1,
- color: Colors.white,
- fontWeight: FontWeight.w900,
- fontSize: 18,
+ color: Colors.white.withOpacity(0.4),
+ fontWeight: FontWeight.w300,
+ fontSize: 13,
),
+ )
+ : ScrollConfiguration(
+ behavior: ScrollBehavior().copyWith(scrollbars: false),
+ child: TextScroll(
+ widget.post.music.artists.first.name!,
+ style: GoogleFonts.plusJakartaSans(
+ height: 1,
+ color: Colors.white,
+ fontWeight: FontWeight.w500,
+ fontSize: 17,
),
- ),
- ],
- ),
- ),
- choice
- ? widget.post.location.item2 != null
- ? Text(
- "${widget.post.location.item1}, ${widget.post.location.item2}",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.5),
- fontWeight: FontWeight.w400,
- fontSize: 15,
- ),
- )
- : Text(
- "",
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white.withOpacity(0.4),
- fontWeight: FontWeight.w300,
- fontSize: 13,
+ mode: TextScrollMode.endless,
+ pauseBetween: Duration(milliseconds: 500),
+ velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
),
- )
- : ScrollConfiguration(
- behavior: ScrollBehavior().copyWith(scrollbars: false),
- child: TextScroll(
- widget.post.music.artists.first.name!,
- style: GoogleFonts.plusJakartaSans(
- height: 1,
- color: Colors.white,
- fontWeight: FontWeight.w500,
- fontSize: 17,
),
- mode: TextScrollMode.endless,
- pauseBetween: Duration(milliseconds: 500),
- velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- widget.post.description != null
- ? Align(
- alignment: Alignment.bottomLeft,
- child: Padding(
- padding: const EdgeInsets.fromLTRB(50, 35, 50, 35),
- child: Text(
- widget.post.description!,
- textAlign: TextAlign.left,
- style: GoogleFonts.plusJakartaSans(
- height: 1,
- color: Colors.white,
- fontWeight: FontWeight.w400,
- fontSize: 14,
+ ],
+ ),
),
- ),
+ ],
),
- )
- : Container(
- height: 30,
- ),
- Container(
- width: double.infinity,
- decoration: const BoxDecoration(
- color: bgAppBar,
- border: Border(
- top: BorderSide(
- color: Color(0xFF262626),
- width: 1.0,
),
),
- ),
- child: Column(
- children: [
- Padding(
- padding: EdgeInsets.symmetric(vertical: 20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- SvgPicture.asset("assets/images/heart.svg", semanticsLabel: 'Like Logo'),
- GestureDetector(
- onTap: () {
- myFocusNode.requestFocus();
- },
- child:
- SvgPicture.asset("assets/images/chat.svg", semanticsLabel: 'Chat Logo'),
+ widget.post.description != null
+ ? Align(
+ alignment: Alignment.bottomLeft,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(50, 35, 50, 35),
+ child: Text(
+ widget.post.description!,
+ textAlign: TextAlign.left,
+ style: GoogleFonts.plusJakartaSans(
+ height: 1,
+ color: Colors.white,
+ fontWeight: FontWeight.w400,
+ fontSize: 14,
+ ),
+ ),
),
- SvgPicture.asset("assets/images/add.svg", semanticsLabel: 'Add playlist Logo'),
- SvgPicture.asset("assets/images/save.svg", semanticsLabel: 'Save Logo'),
- SvgPicture.asset("assets/images/report.svg", semanticsLabel: 'Report Logo'),
- ],
+ )
+ : Container(
+ height: 30,
+ ),
+ Container(
+ width: double.infinity,
+ decoration: const BoxDecoration(
+ color: bgAppBar,
+ border: Border(
+ top: BorderSide(
+ color: Color(0xFF262626),
+ width: 1.0,
+ ),
),
),
- FutureBuilder>(
- future: MyApp.commentViewModel.getCommentsByPostId(widget.post.id),
- builder: (BuildContext context, AsyncSnapshot> snapshot) {
- if (snapshot.hasData) {
- print("test:");
- return Column(
+ child: Column(
+ children: [
+ Padding(
+ padding: EdgeInsets.symmetric(vertical: 20),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
- snapshot.data!.length > 0
- ? Padding(
- padding: const EdgeInsets.all(15.0),
- child: RichText(
- text: TextSpan(
- text: snapshot.data!.length.toString(),
- style: GoogleFonts.plusJakartaSans(
- color: Colors.white,
- fontWeight: FontWeight.w800,
- ),
- children: [
- TextSpan(
- text: snapshot.data!.length > 1
- ? " commentaires"
- : " commentaire",
+ SvgPicture.asset("assets/images/heart.svg", semanticsLabel: 'Like Logo'),
+ GestureDetector(
+ onTap: () {
+ myFocusNode.requestFocus();
+ },
+ child: SvgPicture.asset("assets/images/chat.svg",
+ semanticsLabel: 'Chat Logo'),
+ ),
+ SvgPicture.asset("assets/images/add.svg",
+ semanticsLabel: 'Add playlist Logo'),
+ SvgPicture.asset("assets/images/save.svg", semanticsLabel: 'Save Logo'),
+ SvgPicture.asset("assets/images/report.svg", semanticsLabel: 'Report Logo'),
+ ],
+ ),
+ ),
+ FutureBuilder>(
+ future: MyApp.commentViewModel.getCommentsByPostId(widget.post.id),
+ builder: (BuildContext context, AsyncSnapshot> snapshot) {
+ if (snapshot.hasData) {
+ return Column(
+ children: [
+ snapshot.data!.length > 0
+ ? Padding(
+ padding: const EdgeInsets.all(15.0),
+ child: RichText(
+ text: TextSpan(
+ text: snapshot.data!.length.toString(),
style: GoogleFonts.plusJakartaSans(
color: Colors.white,
- fontWeight: FontWeight.w400,
+ fontWeight: FontWeight.w800,
),
+ children: [
+ TextSpan(
+ text: snapshot.data!.length > 1
+ ? " commentaires"
+ : " commentaire",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white,
+ fontWeight: FontWeight.w400,
+ ),
+ ),
+ ],
),
- ],
- ),
- ),
- )
- : Container(),
- snapshot.data!.length > 0
- ? Padding(
- padding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
- child: ListView.builder(
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- itemCount: snapshot.data?.length,
- itemBuilder: (BuildContext context, int index) {
- return CommentComponent(comment: snapshot.data![index]);
- },
- ),
- )
- : Container(),
- ],
- );
- } else {
- return Container(
- child: Center(
- child: CupertinoActivityIndicator(),
- ),
- );
- }
- },
+ ),
+ )
+ : Container(),
+ snapshot.data!.length > 0
+ ? Padding(
+ padding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
+ child: ListView.builder(
+ shrinkWrap: true,
+ physics: NeverScrollableScrollPhysics(),
+ itemCount: snapshot.data?.length,
+ itemBuilder: (BuildContext context, int index) {
+ return CommentComponent(comment: snapshot.data![index]);
+ },
+ ),
+ )
+ : Container(),
+ ],
+ );
+ } else {
+ return Container(
+ child: Center(
+ child: CupertinoActivityIndicator(),
+ ),
+ );
+ }
+ },
+ ),
+ ],
),
- ],
- ),
+ ),
+ ],
),
- ],
- ),
- widget.post.selfie != null
- ? Align(
- alignment: Alignment.topRight,
- child: ZoomTapAnimation(
- onTap: () {
- if (widget.post.selfie != null) {
- switchChoice();
- }
- },
- enableLongTapRepeatEvent: false,
- longTapRepeatDuration: const Duration(milliseconds: 100),
- begin: 1.0,
- end: 0.96,
- beginDuration: const Duration(milliseconds: 70),
- endDuration: const Duration(milliseconds: 100),
- beginCurve: Curves.decelerate,
- endCurve: Curves.easeInOutSine,
- child: Container(
- margin: EdgeInsets.all(20),
- width: 120,
- height: 120,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(20),
- border: Border.all(width: 4, color: Colors.white),
- ),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(15),
- // implementer l'image
- child: Image(
- image: NetworkImage(choice ? widget.post.music.cover! : widget.post.selfie!),
- fit: BoxFit.cover,
+ widget.post.selfie != null
+ ? Align(
+ alignment: Alignment.topRight,
+ child: ZoomTapAnimation(
+ onTap: () {
+ if (widget.post.selfie != null) {
+ switchChoice();
+ }
+ },
+ enableLongTapRepeatEvent: false,
+ longTapRepeatDuration: const Duration(milliseconds: 100),
+ begin: 1.0,
+ end: 0.96,
+ beginDuration: const Duration(milliseconds: 70),
+ endDuration: const Duration(milliseconds: 100),
+ beginCurve: Curves.decelerate,
+ endCurve: Curves.easeInOutSine,
+ child: Container(
+ margin: EdgeInsets.all(20),
+ width: 120,
+ height: 120,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(20),
+ border: Border.all(width: 4, color: Colors.white),
+ ),
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(15),
+ // implementer l'image
+ child: Image(
+ image:
+ NetworkImage(choice ? widget.post.music.cover! : widget.post.selfie!),
+ fit: BoxFit.cover,
+ ),
+ ),
),
),
- ),
- ),
- )
- : Container(),
- ],
+ )
+ : Container(),
+ ],
+ ),
+ ),
),
- ),
- ),
- Align(
- alignment: Alignment.topCenter,
- child: Container(
- height: 50,
- width: double.infinity,
- color: Colors.transparent,
- child: Align(
+ Align(
alignment: Alignment.topCenter,
child: Container(
- margin: EdgeInsets.only(top: 10),
- width: 60,
- height: 5,
- decoration: BoxDecoration(
- color: Colors.white.withOpacity(0.6),
- borderRadius: BorderRadius.circular(20),
+ height: 50,
+ width: double.infinity,
+ color: Colors.transparent,
+ child: Align(
+ alignment: Alignment.topCenter,
+ child: Container(
+ margin: EdgeInsets.only(top: 10),
+ width: 60,
+ height: 5,
+ decoration: BoxDecoration(
+ color: Colors.white.withOpacity(0.6),
+ borderRadius: BorderRadius.circular(20),
+ ),
+ ),
),
),
),
- ),
+ ],
),
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
- child: Container(
- height: 70,
- width: double.infinity,
- decoration: BoxDecoration(
- border: Border(top: BorderSide(color: grayColor, width: 2)),
- color: textFieldMessage,
),
- child: Center(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20),
- child: Row(
- children: [
- ClipOval(
- child: SizedBox.fromSize(
- // Rayon de l'image
- child: Image.network(
- MyApp.userViewModel.userCurrent.pp,
- width: 45,
- ),
- ),
- ),
- SizedBox(width: 10),
- Expanded(
- child: TextField(
- keyboardAppearance: Brightness.dark,
- controller: _textController,
- focusNode: myFocusNode,
- onSubmitted: (value) async {
- if (value.isNotEmpty) {
- await MyApp.commentViewModel.addComment(value, widget.post.id);
- }
- setState(() {
- _textController.clear();
- });
- },
- cursorColor: primaryColor,
- keyboardType: TextInputType.emailAddress,
- style: GoogleFonts.plusJakartaSans(color: Colors.white),
- decoration: InputDecoration(
- suffixIcon: Icon(
- Icons.send,
- color: grayText,
- size: 20,
- ),
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(width: 1, color: grayText),
- borderRadius: BorderRadius.all(Radius.circular(100)),
+ Padding(
+ padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
+ child: Container(
+ height: 70,
+ width: double.infinity,
+ decoration: BoxDecoration(
+ border: Border(top: BorderSide(color: grayColor, width: 2)),
+ color: textFieldMessage,
+ ),
+ child: Center(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: Row(
+ children: [
+ ClipOval(
+ child: SizedBox.fromSize(
+ // Rayon de l'image
+ child: Image.network(
+ MyApp.userViewModel.userCurrent.pp,
+ width: 45,
+ ),
),
- contentPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20),
- fillColor: bgModal,
- filled: true,
- focusColor: Color.fromRGBO(255, 255, 255, 0.30),
- enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(width: 1, color: grayText),
- borderRadius: BorderRadius.all(Radius.circular(100)),
+ ),
+ SizedBox(width: 10),
+ Expanded(
+ child: TextField(
+ keyboardAppearance: Brightness.dark,
+ controller: _textController,
+ focusNode: myFocusNode,
+ onSubmitted: (value) async {
+ if (value.isNotEmpty) {
+ await MyApp.commentViewModel.addComment(value, widget.post.id, widget.post.user);
+ }
+ setState(() {
+ _textController.clear();
+ });
+ },
+ onChanged: (value) {
+ setState(() {});
+ },
+ cursorColor: primaryColor,
+ keyboardType: TextInputType.emailAddress,
+ style: GoogleFonts.plusJakartaSans(color: Colors.white),
+ decoration: InputDecoration(
+ suffixIcon: _textController.text.isEmpty
+ ? Container(
+ height: 20,
+ width: 20,
+ )
+ : IconButton(
+ onPressed: () async {
+ if (_textController.text.isNotEmpty) {
+ await MyApp.commentViewModel
+ .addComment(_textController.text, widget.post.id, widget.post.user);
+ }
+ myFocusNode.unfocus();
+ setState(() {
+ _textController.clear();
+ });
+ },
+ icon: Icon(
+ Icons.send,
+ color: primaryColor,
+ size: 20,
+ )),
+ focusedBorder: OutlineInputBorder(
+ borderSide: BorderSide(width: 1, color: grayText),
+ borderRadius: BorderRadius.all(Radius.circular(100)),
+ ),
+ contentPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20),
+ fillColor: bgModal,
+ filled: true,
+ focusColor: Color.fromRGBO(255, 255, 255, 0.30),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(width: 1, color: grayText),
+ borderRadius: BorderRadius.all(Radius.circular(100)),
+ ),
+ hintText: 'Ajoutez une réponse...',
+ hintStyle: GoogleFonts.plusJakartaSans(color: grayText),
+ ),
),
- hintText: 'Ajoutez une réponse...',
- hintStyle: GoogleFonts.plusJakartaSans(color: grayText),
),
- ),
+ ],
),
- ],
+ ),
),
),
),
- ),
+ ],
),
- ],
- ),
- );
+ ));
}
}
class MyBehavior extends ScrollBehavior {
@override
- Widget buildOverscrollIndicator(
- BuildContext context, Widget child, ScrollableDetails details) {
+ Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
return child;
}
}
diff --git a/Sources/justMUSIC/lib/screens/feed_screen.dart b/Sources/justMUSIC/lib/screens/feed_screen.dart
index c7b73dc..4382192 100644
--- a/Sources/justMUSIC/lib/screens/feed_screen.dart
+++ b/Sources/justMUSIC/lib/screens/feed_screen.dart
@@ -56,6 +56,7 @@ class _FeedScreenState extends State with SingleTickerProviderStateM
@override
void dispose() {
+ controller.dispose();
animationController.dispose();
super.dispose();
}
@@ -120,7 +121,7 @@ class _FeedScreenState extends State with SingleTickerProviderStateM
bool empty =
(choiceFeed == true && displayFeed.item1.isEmpty) || (choiceFeed == false && displayFeed.item2.isEmpty);
return Scaffold(
- resizeToAvoidBottomInset: true,
+ resizeToAvoidBottomInset: false,
backgroundColor: bgColor,
extendBodyBehindAppBar: true,
body: Container(
diff --git a/Sources/justMUSIC/lib/screens/profile_screen.dart b/Sources/justMUSIC/lib/screens/profile_screen.dart
index 5d13b0c..a40fd0a 100644
--- a/Sources/justMUSIC/lib/screens/profile_screen.dart
+++ b/Sources/justMUSIC/lib/screens/profile_screen.dart
@@ -1,3 +1,4 @@
+import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -5,6 +6,7 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:justmusic/values/icons.dart';
import '../components/profile_component.dart';
import '../components/setting_part_component.dart';
+import '../config/routes.dart';
import '../main.dart';
import '../values/constants.dart';
@@ -18,6 +20,16 @@ class ProfileScreen extends StatefulWidget {
class _ProfileScreenState extends State {
@override
Widget build(BuildContext context) {
+ Future logout() async {
+ print("cc");
+ await FirebaseAuth.instance.signOut();
+ Navigator.pushNamed(context, '/welcome');
+ }
+
+ void _openDetail() {
+ Navigator.of(context).push(routeUser(MyApp.userViewModel.userCurrent));
+ }
+
return Scaffold(
appBar: PreferredSize(
preferredSize: Size(double.infinity, 58),
@@ -84,23 +96,28 @@ class _ProfileScreenState extends State {
SettingPartComponent(
icon: JustMusicIcon.profile,
label: 'Compte',
+ action: _openDetail,
),
- SettingPartComponent(
+ const SettingPartComponent(
icon: JustMusicIcon.history,
label: 'Historiques des capsules',
+ action: null,
),
- SettingPartComponent(
+ const SettingPartComponent(
icon: JustMusicIcon.spotify,
label: 'Lier un compte Spotify',
+ action: null,
),
- SettingPartComponent(
+ const SettingPartComponent(
icon: JustMusicIcon.trash,
label: 'Supprimer mon compte',
+ action: null,
),
SettingPartComponent(
icon: JustMusicIcon.cross,
label: 'Déconnexion',
important: true,
+ action: logout,
),
],
),
@@ -114,15 +131,17 @@ class _ProfileScreenState extends State {
),
ClipRRect(
borderRadius: BorderRadius.circular(8),
- child: Column(
- children: const [
+ child: const Column(
+ children: [
SettingPartComponent(
icon: JustMusicIcon.theme,
label: 'Thême de l\'application',
+ action: null,
),
SettingPartComponent(
icon: JustMusicIcon.notification,
label: 'Notifications',
+ action: null,
),
],
),
diff --git a/Sources/justMUSIC/lib/screens/search_song_screen.dart b/Sources/justMUSIC/lib/screens/search_song_screen.dart
index 9e20070..8b702de 100644
--- a/Sources/justMUSIC/lib/screens/search_song_screen.dart
+++ b/Sources/justMUSIC/lib/screens/search_song_screen.dart
@@ -21,6 +21,7 @@ class SearchSongScreen extends StatefulWidget {
class _SearchSongScreenState extends State {
final ScrollController _scrollController = ScrollController();
final TextEditingController _textEditingController = TextEditingController();
+
int? playingIndex;
Future resetFullScreen() async {
@@ -32,9 +33,18 @@ class _SearchSongScreenState extends State {
@override
void initState() {
super.initState();
+ fetchTrendingMusic();
_scrollController.addListener(_scrollListener);
}
+ Future fetchTrendingMusic() async {
+ await MyApp.musicViewModel.getMusicsWithPlaylistId('37i9dQZF1DX1X23oiQRTB5').then((value) {
+ setState(() {
+ filteredData = value;
+ });
+ });
+ }
+
Future _scrollListener() async {
if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {
filteredData.addAll(await MyApp.musicViewModel
@@ -120,8 +130,7 @@ class _SearchSongScreenState extends State {
onEditingComplete: resetFullScreen,
onSubmitted: (value) async {
if (_textEditingController.text.isEmpty) {
- } else if (value == " ") {
- print("popular");
+ fetchTrendingMusic();
} else {
filteredData = await MyApp.musicViewModel.getMusicsWithNameOrArtistName(value);
setState(() {
diff --git a/Sources/justMUSIC/lib/screens/user_screen.dart b/Sources/justMUSIC/lib/screens/user_screen.dart
new file mode 100644
index 0000000..c81851d
--- /dev/null
+++ b/Sources/justMUSIC/lib/screens/user_screen.dart
@@ -0,0 +1,157 @@
+import 'package:flutter/Material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:google_fonts/google_fonts.dart';
+
+import '../components/profile_component.dart';
+import '../components/recap_component.dart';
+import '../main.dart';
+import '../model/User.dart';
+import '../values/constants.dart';
+
+class UserScreen extends StatefulWidget {
+ final User user;
+ const UserScreen({super.key, required this.user});
+
+ @override
+ State createState() => _UserScreenState();
+}
+
+class _UserScreenState extends State {
+ late bool isClicked;
+ @override
+ Widget build(BuildContext context) {
+ isClicked = MyApp.userViewModel.isFriend(widget.user.id);
+ return Scaffold(
+ appBar: PreferredSize(
+ preferredSize: Size(double.infinity, 58),
+ child: Container(
+ height: double.infinity,
+ color: bgAppBar,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
+ child: Stack(
+ alignment: Alignment.centerLeft,
+ children: [
+ GestureDetector(
+ behavior: HitTestBehavior.translucent,
+ onTap: () {
+ Navigator.pop(context, true);
+ },
+ child: Container(
+ padding: EdgeInsets.symmetric(horizontal: 10),
+ height: 30,
+ width: 30,
+ child: Image(
+ image: AssetImage("assets/images/return_icon.png"),
+ height: 8,
+ ),
+ )),
+ Align(
+ child: Text(
+ widget.user.pseudo,
+ style: GoogleFonts.plusJakartaSans(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold),
+ ),
+ )
+ ],
+ ),
+ ),
+ ),
+ ),
+ body: Container(
+ width: double.infinity,
+ height: double.infinity,
+ color: bgColor,
+ child: SingleChildScrollView(
+ physics: const BouncingScrollPhysics(decelerationRate: ScrollDecelerationRate.fast),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: settingPadding),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: EdgeInsets.only(top: 68.h, bottom: 40),
+ child: ProfileComponent(user: widget.user),
+ ),
+ MyApp.userViewModel.userCurrent.id != widget.user.id
+ ? Align(
+ alignment: Alignment.topCenter,
+ child: isClicked
+ ? SizedBox(
+ // Définir une largeur minimale pour le bouton "Ajouter"
+ width: 120, // Réglez cette valeur en fonction de vos besoins
+ child: Material(
+ borderRadius: BorderRadius.all(Radius.circular(5)),
+ color: selectedButton,
+ child: InkWell(
+ splashColor: Colors.white.withOpacity(0.3),
+ onTap: () async {
+ await MyApp.userViewModel.addOrDeleteFriend(widget.user.id);
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(
+ content: Text(
+ "Vous ne suivez plus ${widget.user.pseudo}",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white, fontWeight: FontWeight.w400, fontSize: 20.h),
+ ),
+ backgroundColor: Colors.red,
+ closeIconColor: Colors.white,
+ ),
+ );
+ setState(() {});
+ },
+ child: Container(
+ padding: EdgeInsets.fromLTRB(28, 7, 28, 7),
+ decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(7))),
+ child: Center(
+ child: Text("Ajouté",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white, fontWeight: FontWeight.w600, fontSize: 13)),
+ ),
+ ))),
+ )
+ : SizedBox(
+ // Définir une largeur minimale pour le bouton "Ajouter"
+ width: 120, // Réglez cette valeur en fonction de vos besoins
+ child: Material(
+ borderRadius: BorderRadius.all(Radius.circular(5)),
+ color: primaryColor,
+ child: InkWell(
+ splashColor: Colors.white.withOpacity(0.3),
+ onTap: () async {
+ await MyApp.userViewModel.addOrDeleteFriend(widget.user.id);
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(
+ backgroundColor: primaryColor,
+ content: Text(
+ "Vous suivez à present ${widget.user.pseudo}",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white, fontWeight: FontWeight.w400, fontSize: 20.h),
+ ),
+ ),
+ );
+ setState(() {});
+ },
+ child: Container(
+ padding: EdgeInsets.fromLTRB(25, 7, 25, 7),
+ decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(7))),
+ child: Center(
+ child: Text("Ajouter",
+ style: GoogleFonts.plusJakartaSans(
+ color: Colors.white, fontWeight: FontWeight.w600, fontSize: 13)),
+ ),
+ )))),
+ )
+ : Container(),
+ SizedBox(
+ height: 40,
+ ),
+ RecapComponent(user: widget.user)
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/Sources/justMUSIC/lib/services/PostService.dart b/Sources/justMUSIC/lib/services/PostService.dart
index 18719ab..17e2645 100644
--- a/Sources/justMUSIC/lib/services/PostService.dart
+++ b/Sources/justMUSIC/lib/services/PostService.dart
@@ -7,8 +7,7 @@ import 'package:firebase_storage/firebase_storage.dart';
import '../main.dart';
class PostService {
- createPost(String? description, String idMusic, File? image,
- Tuple2? location) async {
+ createPost(String? description, String idMusic, File? image, Tuple2? location) async {
var id = MyApp.userViewModel.userCurrent.id;
final post = {
"user_id": id,
@@ -42,14 +41,11 @@ class PostService {
deletePost() {}
- Future>>> getPopularPosts(
- {int limit = 10, int offset = 0}) async {
+ Future>>> getPopularPosts({int limit = 10, int offset = 0}) async {
DateTime twentyFourHoursAgo = DateTime.now().subtract(Duration(hours: 24));
- Timestamp twentyFourHoursAgoTimestamp =
- Timestamp.fromDate(twentyFourHoursAgo);
+ Timestamp twentyFourHoursAgoTimestamp = Timestamp.fromDate(twentyFourHoursAgo);
- QuerySnapshot