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,7 +61,15 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
resetFullScreen();
}
},
child: Container(
height: 760.h, height: 760.h,
child: Column( child: Column(
children: [ children: [
@ -153,7 +161,8 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
Padding( Padding(
padding: const EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
child: choice child: choice
? DateTime(today.year, today.month, today.day).isAtSameMomentAs( ? DateTime(today.year, today.month, today.day)
.isAtSameMomentAs(
DateTime( DateTime(
widget.post.date.year, widget.post.date.year,
widget.post.date.month, widget.post.date.month,
@ -274,10 +283,11 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
onTap: () { onTap: () {
myFocusNode.requestFocus(); myFocusNode.requestFocus();
}, },
child: child: SvgPicture.asset("assets/images/chat.svg",
SvgPicture.asset("assets/images/chat.svg", semanticsLabel: 'Chat Logo'), semanticsLabel: 'Chat Logo'),
), ),
SvgPicture.asset("assets/images/add.svg", semanticsLabel: 'Add playlist Logo'), SvgPicture.asset("assets/images/add.svg",
semanticsLabel: 'Add playlist Logo'),
SvgPicture.asset("assets/images/save.svg", semanticsLabel: 'Save Logo'), SvgPicture.asset("assets/images/save.svg", semanticsLabel: 'Save Logo'),
SvgPicture.asset("assets/images/report.svg", semanticsLabel: 'Report Logo'), SvgPicture.asset("assets/images/report.svg", semanticsLabel: 'Report Logo'),
], ],
@ -287,7 +297,6 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
future: MyApp.commentViewModel.getCommentsByPostId(widget.post.id), future: MyApp.commentViewModel.getCommentsByPostId(widget.post.id),
builder: (BuildContext context, AsyncSnapshot<List<Comment>> snapshot) { builder: (BuildContext context, AsyncSnapshot<List<Comment>> snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
print("test:");
return Column( return Column(
children: [ children: [
snapshot.data!.length > 0 snapshot.data!.length > 0
@ -373,7 +382,8 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
// implementer l'image // implementer l'image
child: Image( child: Image(
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,
), ),
), ),
@ -445,15 +455,32 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
_textController.clear(); _textController.clear();
}); });
}, },
onChanged: (value) {
setState(() {});
},
cursorColor: primaryColor, cursorColor: primaryColor,
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
style: GoogleFonts.plusJakartaSans(color: Colors.white), style: GoogleFonts.plusJakartaSans(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: IconButton( suffixIcon: _textController.text.isEmpty
onPressed: () {}, ? 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( icon: Icon(
Icons.send, Icons.send,
color: grayText, color: primaryColor,
size: 20, size: 20,
)), )),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
@ -481,7 +508,7 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
), ),
], ],
), ),
); ));
} }
} }

Loading…
Cancel
Save