PROFIL_PAGE_LDE
Lucas Delanier 2 years ago
parent cff55c26ee
commit 95c90cc25a

@ -106,36 +106,7 @@ class _MyAppState extends State<MyApp> {
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),
home: StreamBuilder<User?>( home: WellcomeScreen());
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return LoadingScreen();
} else if (snapshot.hasData) {
return FutureBuilder<userJustMusic.User?>(
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();
}
},
));
}, },
designSize: Size(390, 844), designSize: Size(390, 844),
); );

@ -61,427 +61,454 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return GestureDetector(
height: 760.h, onTap: () {
child: Column( FocusScopeNode currentFocus = FocusScope.of(context);
children: [ if (!currentFocus.hasPrimaryFocus) {
Expanded( currentFocus.unfocus();
child: Stack( resetFullScreen();
children: [ }
ScrollConfiguration( },
behavior: MyBehavior(), child: Container(
child: SingleChildScrollView( height: 760.h,
controller: _scrollController, child: Column(
physics: AlwaysScrollableScrollPhysics(), children: [
child: Stack( Expanded(
clipBehavior: Clip.hardEdge, child: Stack(
children: [ children: [
Align( ScrollConfiguration(
alignment: Alignment.topCenter, behavior: MyBehavior(),
child: Container( child: SingleChildScrollView(
height: 400, controller: _scrollController,
width: double.infinity, physics: AlwaysScrollableScrollPhysics(),
child: FadeInImage.assetNetwork( child: Stack(
placeholder: "assets/images/loadingPlaceholder.gif", clipBehavior: Clip.hardEdge,
image: choice ? widget.post.selfie! : widget.post.music.cover!,
width: double.infinity,
fit: BoxFit.cover,
),
),
),
Column(
children: [ children: [
Container( Align(
height: 200, alignment: Alignment.topCenter,
margin: EdgeInsets.only(top: 230), child: Container(
width: double.infinity, height: 400,
decoration: const BoxDecoration( width: double.infinity,
gradient: LinearGradient( child: FadeInImage.assetNetwork(
begin: Alignment.topCenter, placeholder: "assets/images/loadingPlaceholder.gif",
end: Alignment.bottomCenter, image: choice ? widget.post.selfie! : widget.post.music.cover!,
colors: [Colors.transparent, bgModal], width: double.infinity,
stops: [0, 0.8], fit: BoxFit.cover,
), ),
), ),
child: Padding( ),
padding: const EdgeInsets.fromLTRB(20, 0, 20, 10), Column(
child: Row( children: [
crossAxisAlignment: CrossAxisAlignment.end, Container(
children: [ height: 200,
Padding( margin: EdgeInsets.only(top: 230),
padding: const EdgeInsets.only(right: 10), width: double.infinity,
child: choice decoration: const BoxDecoration(
? Padding( gradient: LinearGradient(
padding: const EdgeInsets.all(4), begin: Alignment.topCenter,
child: ClipOval( end: Alignment.bottomCenter,
child: SizedBox.fromSize( colors: [Colors.transparent, bgModal],
// Image radius stops: [0, 0.8],
child: ProfilPictureComponent(user: widget.post.user),
),
),
)
: widget.post.music.previewUrl != null
? ButtonPlayComponent(music: widget.post.music)
: Container(),
), ),
Flexible( ),
child: Column( child: Padding(
mainAxisAlignment: MainAxisAlignment.end, padding: const EdgeInsets.fromLTRB(20, 0, 20, 10),
crossAxisAlignment: CrossAxisAlignment.start, child: Row(
children: [ crossAxisAlignment: CrossAxisAlignment.end,
Flexible( children: [
child: Row( Padding(
crossAxisAlignment: CrossAxisAlignment.end, padding: const EdgeInsets.only(right: 10),
children: [ child: choice
Expanded( ? Padding(
child: ScrollConfiguration( padding: const EdgeInsets.all(4),
behavior: ScrollBehavior().copyWith(scrollbars: false), child: ClipOval(
child: TextScroll( child: SizedBox.fromSize(
choice ? widget.post.user.pseudo : widget.post.music.title!, // Image radius
style: GoogleFonts.plusJakartaSans( child: ProfilPictureComponent(user: widget.post.user),
height: 1,
color: Colors.white,
fontWeight: FontWeight.w800,
fontSize: 22,
),
mode: TextScrollMode.endless,
pauseBetween: Duration(milliseconds: 500),
velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
), ),
), ),
), )
Padding( : widget.post.music.previewUrl != null
padding: const EdgeInsets.only(left: 20.0), ? ButtonPlayComponent(music: widget.post.music)
child: choice : Container(),
? DateTime(today.year, today.month, today.day).isAtSameMomentAs( ),
DateTime( Flexible(
widget.post.date.year, child: Column(
widget.post.date.month, mainAxisAlignment: MainAxisAlignment.end,
widget.post.date.day, 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,
? Text( pauseBetween: Duration(milliseconds: 500),
"Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}", velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
style: GoogleFonts.plusJakartaSans( ),
height: 1, ),
color: Colors.white, ),
fontWeight: FontWeight.w900, Padding(
fontSize: 18, 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( : Text(
"hier, ${widget.post.date.hour}:${widget.post.date.minute}", widget.post.music.date.toString(),
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
height: 1, height: 1,
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
fontSize: 18, 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( : Text(
widget.post.music.date.toString(), "",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
height: 1, color: Colors.white.withOpacity(0.4),
color: Colors.white, fontWeight: FontWeight.w300,
fontWeight: FontWeight.w900, fontSize: 13,
fontSize: 18,
), ),
)
: 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)),
),
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,
), ),
)
: 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,
), ),
), ),
), widget.post.description != null
child: Column( ? Align(
children: [ alignment: Alignment.bottomLeft,
Padding( child: Padding(
padding: EdgeInsets.symmetric(vertical: 20), padding: const EdgeInsets.fromLTRB(50, 35, 50, 35),
child: Row( child: Text(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, widget.post.description!,
children: [ textAlign: TextAlign.left,
SvgPicture.asset("assets/images/heart.svg", semanticsLabel: 'Like Logo'), style: GoogleFonts.plusJakartaSans(
GestureDetector( height: 1,
onTap: () { color: Colors.white,
myFocusNode.requestFocus(); fontWeight: FontWeight.w400,
}, fontSize: 14,
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'), : Container(
SvgPicture.asset("assets/images/report.svg", semanticsLabel: 'Report Logo'), height: 30,
], ),
Container(
width: double.infinity,
decoration: const BoxDecoration(
color: bgAppBar,
border: Border(
top: BorderSide(
color: Color(0xFF262626),
width: 1.0,
),
), ),
), ),
FutureBuilder<List<Comment>>( child: Column(
future: MyApp.commentViewModel.getCommentsByPostId(widget.post.id), children: [
builder: (BuildContext context, AsyncSnapshot<List<Comment>> snapshot) { Padding(
if (snapshot.hasData) { padding: EdgeInsets.symmetric(vertical: 20),
print("test:"); child: Row(
return Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
snapshot.data!.length > 0 SvgPicture.asset("assets/images/heart.svg", semanticsLabel: 'Like Logo'),
? Padding( GestureDetector(
padding: const EdgeInsets.all(15.0), onTap: () {
child: RichText( myFocusNode.requestFocus();
text: TextSpan( },
text: snapshot.data!.length.toString(), child: SvgPicture.asset("assets/images/chat.svg",
style: GoogleFonts.plusJakartaSans( semanticsLabel: 'Chat Logo'),
color: Colors.white, ),
fontWeight: FontWeight.w800, SvgPicture.asset("assets/images/add.svg",
), semanticsLabel: 'Add playlist Logo'),
children: [ SvgPicture.asset("assets/images/save.svg", semanticsLabel: 'Save Logo'),
TextSpan( SvgPicture.asset("assets/images/report.svg", semanticsLabel: 'Report Logo'),
text: snapshot.data!.length > 1 ],
? " commentaires" ),
: " commentaire", ),
FutureBuilder<List<Comment>>(
future: MyApp.commentViewModel.getCommentsByPostId(widget.post.id),
builder: (BuildContext context, AsyncSnapshot<List<Comment>> 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( style: GoogleFonts.plusJakartaSans(
color: Colors.white, 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
: Container(), ? Padding(
snapshot.data!.length > 0 padding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
? Padding( child: ListView.builder(
padding: const EdgeInsets.fromLTRB(20, 0, 20, 20), shrinkWrap: true,
child: ListView.builder( physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, itemCount: snapshot.data?.length,
physics: NeverScrollableScrollPhysics(), itemBuilder: (BuildContext context, int index) {
itemCount: snapshot.data?.length, return CommentComponent(comment: snapshot.data![index]);
itemBuilder: (BuildContext context, int index) { },
return CommentComponent(comment: snapshot.data![index]); ),
}, )
), : Container(),
) ],
: Container(), );
], } else {
); return Container(
} else { child: Center(
return Container( child: CupertinoActivityIndicator(),
child: Center( ),
child: CupertinoActivityIndicator(), );
), }
); },
} ),
}, ],
), ),
], ),
), ],
), ),
], widget.post.selfie != null
), ? Align(
widget.post.selfie != null alignment: Alignment.topRight,
? Align( child: ZoomTapAnimation(
alignment: Alignment.topRight, onTap: () {
child: ZoomTapAnimation( if (widget.post.selfie != null) {
onTap: () { switchChoice();
if (widget.post.selfie != null) { }
switchChoice(); },
} enableLongTapRepeatEvent: false,
}, longTapRepeatDuration: const Duration(milliseconds: 100),
enableLongTapRepeatEvent: false, begin: 1.0,
longTapRepeatDuration: const Duration(milliseconds: 100), end: 0.96,
begin: 1.0, beginDuration: const Duration(milliseconds: 70),
end: 0.96, endDuration: const Duration(milliseconds: 100),
beginDuration: const Duration(milliseconds: 70), beginCurve: Curves.decelerate,
endDuration: const Duration(milliseconds: 100), endCurve: Curves.easeInOutSine,
beginCurve: Curves.decelerate, child: Container(
endCurve: Curves.easeInOutSine, margin: EdgeInsets.all(20),
child: Container( width: 120,
margin: EdgeInsets.all(20), height: 120,
width: 120, decoration: BoxDecoration(
height: 120, borderRadius: BorderRadius.circular(20),
decoration: BoxDecoration( border: Border.all(width: 4, color: Colors.white),
borderRadius: BorderRadius.circular(20), ),
border: Border.all(width: 4, color: Colors.white), child: ClipRRect(
), borderRadius: BorderRadius.circular(15),
child: ClipRRect( // implementer l'image
borderRadius: BorderRadius.circular(15), child: Image(
// implementer l'image image:
child: Image( NetworkImage(choice ? widget.post.music.cover! : widget.post.selfie!),
image: NetworkImage(choice ? widget.post.music.cover! : widget.post.selfie!), fit: BoxFit.cover,
fit: BoxFit.cover, ),
),
), ),
), ),
), )
), : Container(),
) ],
: Container(), ),
], ),
), ),
), Align(
),
Align(
alignment: Alignment.topCenter,
child: Container(
height: 50,
width: double.infinity,
color: Colors.transparent,
child: Align(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: Container( child: Container(
margin: EdgeInsets.only(top: 10), height: 50,
width: 60, width: double.infinity,
height: 5, color: Colors.transparent,
decoration: BoxDecoration( child: Align(
color: Colors.white.withOpacity(0.6), alignment: Alignment.topCenter,
borderRadius: BorderRadius.circular(20), 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( Padding(
child: Padding( padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
padding: const EdgeInsets.symmetric(horizontal: 20), child: Container(
child: Row( height: 70,
children: [ width: double.infinity,
ClipOval( decoration: BoxDecoration(
child: SizedBox.fromSize( border: Border(top: BorderSide(color: grayColor, width: 2)),
// Rayon de l'image color: textFieldMessage,
child: Image.network( ),
MyApp.userViewModel.userCurrent.pp, child: Center(
width: 45, child: Padding(
), padding: const EdgeInsets.symmetric(horizontal: 20),
), child: Row(
), children: [
SizedBox(width: 10), ClipOval(
Expanded( child: SizedBox.fromSize(
child: TextField( // Rayon de l'image
keyboardAppearance: Brightness.dark, child: Image.network(
controller: _textController, MyApp.userViewModel.userCurrent.pp,
focusNode: myFocusNode, width: 45,
onSubmitted: (value) async { ),
if (value.isNotEmpty) {
await MyApp.commentViewModel.addComment(value, widget.post.id, widget.post.user);
}
setState(() {
_textController.clear();
});
},
cursorColor: primaryColor,
keyboardType: TextInputType.emailAddress,
style: GoogleFonts.plusJakartaSans(color: Colors.white),
decoration: InputDecoration(
suffixIcon: IconButton(
onPressed: () {},
icon: Icon(
Icons.send,
color: grayText,
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, SizedBox(width: 10),
filled: true, Expanded(
focusColor: Color.fromRGBO(255, 255, 255, 0.30), child: TextField(
enabledBorder: OutlineInputBorder( keyboardAppearance: Brightness.dark,
borderSide: BorderSide(width: 1, color: grayText), controller: _textController,
borderRadius: BorderRadius.all(Radius.circular(100)), 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),
), ),
), ],
), ),
], ),
), ),
), ),
), ),
), ],
), ),
], ));
),
);
} }
} }

Loading…
Cancel
Save