add icon
continuous-integration/drone/push Build is passing Details

PROFIL_PAGE_LDE
Lucas Delanier 2 years ago
parent eb551aefa9
commit cff55c26ee

@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.justmusic"> package="com.example.justmusic">
<application <application
android:label="justmusic" android:label="JustMUSIC"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">

@ -44,7 +44,7 @@ class _ButtonPlayComponentState extends State<ButtonPlayComponent> {
child: Icon( child: Icon(
isPlaying ? Icons.pause_circle : Icons.play_circle, isPlaying ? Icons.pause_circle : Icons.play_circle,
color: Colors.white, color: Colors.white,
size: 53, size: 45,
), ),
)); ));
} }

@ -41,189 +41,7 @@ class _PostComponentState extends State<PostComponent> with TickerProviderStateM
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: switchChoice, onTap: switchChoice,
child: LayoutBuilder( child: SizedBox(
builder: (BuildContext context, BoxConstraints constraints) {
if (widget.callback == null) {
return SizedBox(
width: double.infinity,
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
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),
)
],
),
),
),
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),
),
],
),
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,
),
// 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,
),
),
),
))
: Container(),
],
),
),
),
)),
SizedBox(height: 15),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
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(
padding: EdgeInsets.only(bottom: 2),
child: TextScroll(
widget.post.music.title!,
style: GoogleFonts.plusJakartaSans(
height: 1, color: Colors.white, fontWeight: FontWeight.w300, fontSize: 16.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.withOpacity(0.5), fontWeight: FontWeight.w300, fontSize: 16.h),
textAlign: TextAlign.end,
maxFontSize: 20,
),
],
),
],
));
}
return SizedBox(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
children: [ children: [
@ -366,9 +184,7 @@ class _PostComponentState extends State<PostComponent> with TickerProviderStateM
), ),
)), )),
SizedBox(height: 15), SizedBox(height: 15),
SizedBox( Column(
height: 40,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
@ -398,26 +214,17 @@ class _PostComponentState extends State<PostComponent> with TickerProviderStateM
), ),
], ],
), ),
Expanded( TextScroll(
flex: 8,
child: TextScroll(
widget.post.music.artists.first.name!, widget.post.music.artists.first.name!,
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
height: 1, height: 1, color: Colors.white.withOpacity(0.5), fontWeight: FontWeight.w300, fontSize: 16.h),
color: Colors.white.withOpacity(0.5),
fontWeight: FontWeight.w300,
fontSize: 16.h),
mode: TextScrollMode.endless, mode: TextScrollMode.endless,
pauseBetween: Duration(milliseconds: 500), pauseBetween: Duration(milliseconds: 500),
velocity: Velocity(pixelsPerSecond: Offset(20, 0)), velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
)),
],
), ),
)
], ],
));
},
), ),
); ],
)));
} }
} }

@ -1,6 +1,7 @@
import 'package:flutter/Material.dart'; import 'package:flutter/Material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:justmusic/components/profil_picture_component.dart';
import '../main.dart'; import '../main.dart';
import '../model/User.dart'; import '../model/User.dart';
import '../values/constants.dart'; import '../values/constants.dart';
@ -23,13 +24,7 @@ class _ProfileListComponentState extends State<ProfileListComponent> {
padding: const EdgeInsets.only(bottom: 5), padding: const EdgeInsets.only(bottom: 5),
child: Row( child: Row(
children: [ children: [
ClipOval( ProfilPictureComponent(user: widget.user),
child: FadeInImage.assetNetwork(
height: 50,
width: 50,
fit: BoxFit.cover,
placeholder: "assets/images/loadingPlaceholder.gif",
image: widget.user.pp)),
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),

@ -9,6 +9,7 @@ import 'package:text_scroll/text_scroll.dart';
import 'package:zoom_tap_animation/zoom_tap_animation.dart'; import 'package:zoom_tap_animation/zoom_tap_animation.dart';
import '../components/button_play_component.dart'; import '../components/button_play_component.dart';
import '../components/comment_component.dart'; import '../components/comment_component.dart';
import '../components/profil_picture_component.dart';
import '../main.dart'; import '../main.dart';
import '../model/Post.dart'; import '../model/Post.dart';
import '../model/Comment.dart'; import '../model/Comment.dart';
@ -115,10 +116,7 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
child: ClipOval( child: ClipOval(
child: SizedBox.fromSize( child: SizedBox.fromSize(
// Image radius // Image radius
child: Image( child: ProfilPictureComponent(user: widget.post.user),
image: NetworkImage(widget.post.user.pp),
width: 45,
),
), ),
), ),
) )
@ -146,13 +144,9 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontSize: 22, fontSize: 22,
), ),
mode: TextScrollMode mode: TextScrollMode.endless,
.endless, pauseBetween: Duration(milliseconds: 500),
pauseBetween: Duration( velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
milliseconds: 500),
velocity: Velocity(
pixelsPerSecond:
Offset(20, 0)),
), ),
), ),
), ),
@ -445,7 +439,7 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
focusNode: myFocusNode, focusNode: myFocusNode,
onSubmitted: (value) async { onSubmitted: (value) async {
if (value.isNotEmpty) { if (value.isNotEmpty) {
await MyApp.commentViewModel.addComment(value, widget.post.id); await MyApp.commentViewModel.addComment(value, widget.post.id, widget.post.user);
} }
setState(() { setState(() {
_textController.clear(); _textController.clear();
@ -455,11 +449,13 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
style: GoogleFonts.plusJakartaSans(color: Colors.white), style: GoogleFonts.plusJakartaSans(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: Icon( suffixIcon: IconButton(
onPressed: () {},
icon: Icon(
Icons.send, Icons.send,
color: grayText, color: grayText,
size: 20, size: 20,
), )),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1, color: grayText), borderSide: BorderSide(width: 1, color: grayText),
borderRadius: BorderRadius.all(Radius.circular(100)), borderRadius: BorderRadius.all(Radius.circular(100)),
@ -491,8 +487,7 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
class MyBehavior extends ScrollBehavior { class MyBehavior extends ScrollBehavior {
@override @override
Widget buildOverscrollIndicator( Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
BuildContext context, Widget child, ScrollableDetails details) {
return child; return child;
} }
} }

@ -56,6 +56,7 @@ class _FeedScreenState extends State<FeedScreen> with SingleTickerProviderStateM
@override @override
void dispose() { void dispose() {
controller.dispose();
animationController.dispose(); animationController.dispose();
super.dispose(); super.dispose();
} }
@ -120,7 +121,7 @@ class _FeedScreenState extends State<FeedScreen> with SingleTickerProviderStateM
bool empty = bool empty =
(choiceFeed == true && displayFeed.item1.isEmpty) || (choiceFeed == false && displayFeed.item2.isEmpty); (choiceFeed == true && displayFeed.item1.isEmpty) || (choiceFeed == false && displayFeed.item2.isEmpty);
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: false,
backgroundColor: bgColor, backgroundColor: bgColor,
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: Container( body: Container(

@ -1,19 +1,24 @@
import 'package:justmusic/model/mapper/CommentMapper.dart'; import 'package:justmusic/model/mapper/CommentMapper.dart';
import '../model/Comment.dart'; import '../model/Comment.dart';
import '../model/User.dart';
import '../services/CommentService.dart'; import '../services/CommentService.dart';
import '../services/NotificationService.dart';
class CommentViewModel { class CommentViewModel {
List<Comment> _comments = []; List<Comment> _comments = [];
final CommentService _commentService = CommentService(); final CommentService _commentService = CommentService();
final NotificationService _notificationService = NotificationService();
// Constructor // Constructor
CommentViewModel(); CommentViewModel();
// Methods // Methods
addComment(String text, String idPost) async { addComment(String text, String idPost, User receiver) async {
try { try {
print(receiver.token);
await _commentService.createComment(text, idPost); await _commentService.createComment(text, idPost);
_notificationService.sendNotifyComment(receiver.token, text);
} catch (e) { } catch (e) {
print(e); print(e);
rethrow; rethrow;

Loading…
Cancel
Save