Merge with master
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
1a723656fe
commit
2c9b8c1336
@ -1,438 +1,438 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
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:gradient_borders/box_borders/gradient_box_border.dart';
|
import 'package:gradient_borders/box_borders/gradient_box_border.dart';
|
||||||
import 'package:text_scroll/text_scroll.dart';
|
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 '../model/Post.dart';
|
import '../model/Post.dart';
|
||||||
|
|
||||||
class PostComponent extends StatefulWidget {
|
class PostComponent extends StatefulWidget {
|
||||||
final Function(int)? callback;
|
final Function(int)? callback;
|
||||||
final Post post;
|
final Post post;
|
||||||
final int index;
|
final int index;
|
||||||
|
|
||||||
PostComponent({Key? key, required this.callback, required this.post, required this.index}) : super(key: key);
|
PostComponent({Key? key, required this.callback, required this.post, required this.index}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PostComponent> createState() => _PostComponentState();
|
State<PostComponent> createState() => _PostComponentState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PostComponentState extends State<PostComponent> with TickerProviderStateMixin {
|
class _PostComponentState extends State<PostComponent> with TickerProviderStateMixin {
|
||||||
bool choice = false;
|
bool choice = false;
|
||||||
DateTime today = DateTime.now();
|
DateTime today = DateTime.now();
|
||||||
|
|
||||||
void switchChoice() {
|
void switchChoice() {
|
||||||
setState(() {
|
setState(() {
|
||||||
choice = !choice;
|
choice = !choice;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
print("post: ${widget.post.date.toString()}");
|
print("post: ${widget.post.date.toString()}");
|
||||||
print("ajrd: ${DateTime.now().toString()}");
|
print("ajrd: ${DateTime.now().toString()}");
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: switchChoice,
|
onTap: switchChoice,
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
if (widget.callback == null) {
|
if (widget.callback == null) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
ClipOval(
|
ClipOval(
|
||||||
child: SizedBox.fromSize(
|
child: SizedBox.fromSize(
|
||||||
// Image radius
|
// Image radius
|
||||||
child: Image(
|
child: Image(
|
||||||
image: NetworkImage(widget.post.user.pp),
|
image: NetworkImage(widget.post.user.pp),
|
||||||
width: 40,
|
width: 40,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 8,
|
flex: 8,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 10),
|
padding: const EdgeInsets.only(left: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
widget.post.user.pseudo,
|
widget.post.user.pseudo,
|
||||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w600),
|
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
widget.post.location.item2 != null
|
widget.post.location.item2 != null
|
||||||
? Text(
|
? Text(
|
||||||
"${widget.post.location.item1}, ${widget.post.location.item2}",
|
"${widget.post.location.item1}, ${widget.post.location.item2}",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.4),
|
color: Colors.white.withOpacity(0.4),
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
fontSize: 13),
|
fontSize: 13),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
"",
|
"",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.4),
|
color: Colors.white.withOpacity(0.4),
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
fontSize: 13),
|
fontSize: 13),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DateTime(today.year, today.month, today.day).isAtSameMomentAs(
|
DateTime(today.year, today.month, today.day).isAtSameMomentAs(
|
||||||
DateTime(widget.post.date.year, widget.post.date.month, widget.post.date.day))
|
DateTime(widget.post.date.year, widget.post.date.month, widget.post.date.day))
|
||||||
? Text(
|
? Text(
|
||||||
"Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
|
"Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
|
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
"${widget.post.date.day}/${widget.post.date.month}/${widget.post.date.year}-${widget.post.date.hour}:${widget.post.date.minute}",
|
"${widget.post.date.day}/${widget.post.date.month}/${widget.post.date.year}-${widget.post.date.hour}:${widget.post.date.minute}",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
|
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
ZoomTapAnimation(
|
ZoomTapAnimation(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (widget.post.selfie != null) {
|
if (widget.post.selfie != null) {
|
||||||
switchChoice();
|
switchChoice();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enableLongTapRepeatEvent: false,
|
enableLongTapRepeatEvent: false,
|
||||||
longTapRepeatDuration: const Duration(milliseconds: 100),
|
longTapRepeatDuration: const Duration(milliseconds: 100),
|
||||||
begin: 1.0,
|
begin: 1.0,
|
||||||
end: 0.99,
|
end: 0.99,
|
||||||
beginDuration: const Duration(milliseconds: 70),
|
beginDuration: const Duration(milliseconds: 70),
|
||||||
endDuration: const Duration(milliseconds: 100),
|
endDuration: const Duration(milliseconds: 100),
|
||||||
beginCurve: Curves.decelerate,
|
beginCurve: Curves.decelerate,
|
||||||
endCurve: Curves.easeInOutSine,
|
endCurve: Curves.easeInOutSine,
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 1 / 1,
|
aspectRatio: 1 / 1,
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
// add border
|
// add border
|
||||||
border: const GradientBoxBorder(
|
border: const GradientBoxBorder(
|
||||||
gradient: LinearGradient(colors: [
|
gradient: LinearGradient(colors: [
|
||||||
Colors.transparent,
|
Colors.transparent,
|
||||||
Color(0xFF323232),
|
Color(0xFF323232),
|
||||||
], begin: Alignment.topCenter, end: Alignment.bottomCenter),
|
], begin: Alignment.topCenter, end: Alignment.bottomCenter),
|
||||||
width: 2.5,
|
width: 2.5,
|
||||||
),
|
),
|
||||||
// set border radius
|
// set border radius
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(18),
|
borderRadius: BorderRadius.circular(18),
|
||||||
// implement image
|
// implement image
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
children: [
|
children: [
|
||||||
Image(
|
Image(
|
||||||
image: NetworkImage(choice ? widget.post.selfie! : widget.post.music.cover!),
|
image: NetworkImage(choice ? widget.post.selfie! : widget.post.music.cover!),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
),
|
),
|
||||||
widget.post.selfie != null
|
widget.post.selfie != null
|
||||||
? Positioned(
|
? Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(12),
|
padding: EdgeInsets.all(12),
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: BoxConstraints(maxWidth: 140, maxHeight: 140),
|
constraints: BoxConstraints(maxWidth: 140, maxHeight: 140),
|
||||||
width: 90.sp,
|
width: 90.sp,
|
||||||
height: 90.sp,
|
height: 90.sp,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
// add border
|
// add border
|
||||||
border: Border.all(width: 3, color: Colors.white),
|
border: Border.all(width: 3, color: Colors.white),
|
||||||
// set border radius
|
// set border radius
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(13),
|
borderRadius: BorderRadius.circular(13),
|
||||||
// implement image
|
// implement image
|
||||||
child: Image(
|
child: Image(
|
||||||
image: NetworkImage(
|
image: NetworkImage(
|
||||||
choice ? widget.post.music.cover! : widget.post.selfie!),
|
choice ? widget.post.music.cover! : widget.post.selfie!),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
: Container(),
|
: Container(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 8,
|
flex: 8,
|
||||||
child: TextScroll(
|
child: TextScroll(
|
||||||
widget.post.music.artists.first.name!,
|
widget.post.music.artists.first.name!,
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
height: 1, color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
|
height: 1, color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.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)),
|
||||||
)),
|
)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(bottom: 10.h, right: 5.w, left: 5.w),
|
padding: EdgeInsets.only(bottom: 10.h, right: 5.w, left: 5.w),
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 5.h,
|
width: 5.h,
|
||||||
height: 5.h,
|
height: 5.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 8,
|
flex: 8,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(bottom: 2),
|
padding: EdgeInsets.only(bottom: 2),
|
||||||
child: TextScroll(
|
child: TextScroll(
|
||||||
widget.post.music.title!,
|
widget.post.music.title!,
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
height: 1, color: Colors.white, fontWeight: FontWeight.w300, fontSize: 16.h),
|
height: 1, color: Colors.white, fontWeight: FontWeight.w300, fontSize: 16.h),
|
||||||
mode: TextScrollMode.endless,
|
mode: TextScrollMode.endless,
|
||||||
velocity: Velocity(pixelsPerSecond: Offset(50, 20)),
|
velocity: Velocity(pixelsPerSecond: Offset(50, 20)),
|
||||||
pauseBetween: Duration(milliseconds: 500),
|
pauseBetween: Duration(milliseconds: 500),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
Container(width: 10),
|
Container(width: 10),
|
||||||
AutoSizeText(
|
AutoSizeText(
|
||||||
widget.post.music.date.toString(),
|
widget.post.music.date.toString(),
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.5), fontWeight: FontWeight.w300, fontSize: 16.h),
|
color: Colors.white.withOpacity(0.5), fontWeight: FontWeight.w300, fontSize: 16.h),
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
maxFontSize: 20,
|
maxFontSize: 20,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
ClipOval(
|
ClipOval(
|
||||||
child: SizedBox.fromSize(
|
child: SizedBox.fromSize(
|
||||||
// Image radius
|
// Image radius
|
||||||
child: Image(
|
child: Image(
|
||||||
image: NetworkImage(widget.post.user.pp),
|
image: NetworkImage(widget.post.user.pp),
|
||||||
width: 40,
|
width: 40,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 8,
|
flex: 8,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 10),
|
padding: const EdgeInsets.only(left: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
widget.post.user.pseudo,
|
widget.post.user.pseudo,
|
||||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w600),
|
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
widget.post.location.item2 != null
|
widget.post.location.item2 != null
|
||||||
? Text(
|
? Text(
|
||||||
"${widget.post.location.item1}, ${widget.post.location.item2}",
|
"${widget.post.location.item1}, ${widget.post.location.item2}",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.4),
|
color: Colors.white.withOpacity(0.4),
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
fontSize: 13),
|
fontSize: 13),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
"",
|
"",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.4),
|
color: Colors.white.withOpacity(0.4),
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
fontSize: 13),
|
fontSize: 13),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DateTime(today.year, today.month, today.day).isAtSameMomentAs(
|
DateTime(today.year, today.month, today.day).isAtSameMomentAs(
|
||||||
DateTime(widget.post.date.year, widget.post.date.month, widget.post.date.day))
|
DateTime(widget.post.date.year, widget.post.date.month, widget.post.date.day))
|
||||||
? Text(
|
? Text(
|
||||||
"Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
|
"Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
|
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
"hier, ${widget.post.date.hour}:${widget.post.date.minute}",
|
"hier, ${widget.post.date.hour}:${widget.post.date.minute}",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
|
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
ZoomTapAnimation(
|
ZoomTapAnimation(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
widget.callback!(widget.index);
|
widget.callback!(widget.index);
|
||||||
},
|
},
|
||||||
enableLongTapRepeatEvent: false,
|
enableLongTapRepeatEvent: false,
|
||||||
longTapRepeatDuration: const Duration(milliseconds: 100),
|
longTapRepeatDuration: const Duration(milliseconds: 100),
|
||||||
begin: 1.0,
|
begin: 1.0,
|
||||||
end: 0.99,
|
end: 0.99,
|
||||||
beginDuration: const Duration(milliseconds: 70),
|
beginDuration: const Duration(milliseconds: 70),
|
||||||
endDuration: const Duration(milliseconds: 100),
|
endDuration: const Duration(milliseconds: 100),
|
||||||
beginCurve: Curves.decelerate,
|
beginCurve: Curves.decelerate,
|
||||||
endCurve: Curves.easeInOutSine,
|
endCurve: Curves.easeInOutSine,
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 1 / 1,
|
aspectRatio: 1 / 1,
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
// add border
|
// add border
|
||||||
border: const GradientBoxBorder(
|
border: const GradientBoxBorder(
|
||||||
gradient: LinearGradient(colors: [
|
gradient: LinearGradient(colors: [
|
||||||
Colors.transparent,
|
Colors.transparent,
|
||||||
Color(0xFF323232),
|
Color(0xFF323232),
|
||||||
], begin: Alignment.topCenter, end: Alignment.bottomCenter),
|
], begin: Alignment.topCenter, end: Alignment.bottomCenter),
|
||||||
width: 2.5,
|
width: 2.5,
|
||||||
),
|
),
|
||||||
// set border radius
|
// set border radius
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(18),
|
borderRadius: BorderRadius.circular(18),
|
||||||
// implement image
|
// implement image
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
children: [
|
children: [
|
||||||
Image(
|
Image(
|
||||||
image: NetworkImage(widget.post.music.cover!),
|
image: NetworkImage(widget.post.music.cover!),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
),
|
),
|
||||||
Image(
|
Image(
|
||||||
image: AssetImage("assets/images/shadow_post.png"),
|
image: AssetImage("assets/images/shadow_post.png"),
|
||||||
opacity: AnimationController(vsync: this, value: 0.7),
|
opacity: AnimationController(vsync: this, value: 0.7),
|
||||||
fit: BoxFit.fitHeight,
|
fit: BoxFit.fitHeight,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
),
|
),
|
||||||
widget.post.description == null
|
widget.post.description == null
|
||||||
? Container()
|
? Container()
|
||||||
: Padding(
|
: Padding(
|
||||||
padding: EdgeInsets.all(15),
|
padding: EdgeInsets.all(15),
|
||||||
child: AutoSizeText(
|
child: AutoSizeText(
|
||||||
'“${widget.post.description}”',
|
'“${widget.post.description}”',
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white, fontWeight: FontWeight.w400, fontSize: 15.sp),
|
color: Colors.white, fontWeight: FontWeight.w400, fontSize: 15.sp),
|
||||||
maxFontSize: 20,
|
maxFontSize: 20,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
widget.post.selfie != null
|
widget.post.selfie != null
|
||||||
? Positioned(
|
? Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(12),
|
padding: EdgeInsets.all(12),
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: BoxConstraints(maxWidth: 140, maxHeight: 140),
|
constraints: BoxConstraints(maxWidth: 140, maxHeight: 140),
|
||||||
width: 90.sp,
|
width: 90.sp,
|
||||||
height: 90.sp,
|
height: 90.sp,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
// add border
|
// add border
|
||||||
border: Border.all(width: 3, color: Colors.white),
|
border: Border.all(width: 3, color: Colors.white),
|
||||||
// set border radius
|
// set border radius
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(13),
|
borderRadius: BorderRadius.circular(13),
|
||||||
// implement image
|
// implement image
|
||||||
child: Image(
|
child: Image(
|
||||||
image: NetworkImage(widget.post.selfie!),
|
image: NetworkImage(widget.post.selfie!),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
: Container(),
|
: Container(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 60,
|
height: 60,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 8,
|
flex: 8,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(bottom: 2),
|
padding: EdgeInsets.only(bottom: 2),
|
||||||
child: TextScroll(
|
child: TextScroll(
|
||||||
widget.post.music.title!,
|
widget.post.music.title!,
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
height: 1, color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
|
height: 1, color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
|
||||||
mode: TextScrollMode.endless,
|
mode: TextScrollMode.endless,
|
||||||
velocity: Velocity(pixelsPerSecond: Offset(50, 20)),
|
velocity: Velocity(pixelsPerSecond: Offset(50, 20)),
|
||||||
pauseBetween: Duration(milliseconds: 500),
|
pauseBetween: Duration(milliseconds: 500),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
Container(width: 10),
|
Container(width: 10),
|
||||||
AutoSizeText(
|
AutoSizeText(
|
||||||
widget.post.music.date.toString(),
|
widget.post.music.date.toString(),
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
|
color: Colors.white, fontWeight: FontWeight.w600, fontSize: 26.h),
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
maxFontSize: 20,
|
maxFontSize: 20,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 8,
|
flex: 8,
|
||||||
child: TextScroll(
|
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),
|
color: Colors.white.withOpacity(0.5),
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
fontSize: 16.h),
|
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,269 +1,269 @@
|
|||||||
import 'package:another_flushbar/flushbar.dart';
|
import 'package:another_flushbar/flushbar.dart';
|
||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
|
import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:ionicons/ionicons.dart';
|
import 'package:ionicons/ionicons.dart';
|
||||||
import 'package:lottie/lottie.dart';
|
import 'package:lottie/lottie.dart';
|
||||||
import 'package:zoom_tap_animation/zoom_tap_animation.dart';
|
import 'package:zoom_tap_animation/zoom_tap_animation.dart';
|
||||||
|
|
||||||
import '../config/routes.dart';
|
import '../config/routes.dart';
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
import '../values/constants.dart';
|
import '../values/constants.dart';
|
||||||
|
|
||||||
class TopNavBarComponent extends StatefulWidget {
|
class TopNavBarComponent extends StatefulWidget {
|
||||||
final Function(bool) callback;
|
final Function(bool) callback;
|
||||||
const TopNavBarComponent({Key? key, required this.callback}) : super(key: key);
|
const TopNavBarComponent({Key? key, required this.callback}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TopNavBarComponent> createState() => _TopNavBarComponentState();
|
State<TopNavBarComponent> createState() => _TopNavBarComponentState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TopNavBarComponentState extends State<TopNavBarComponent> with TickerProviderStateMixin {
|
class _TopNavBarComponentState extends State<TopNavBarComponent> with TickerProviderStateMixin {
|
||||||
bool choice = true;
|
bool choice = true;
|
||||||
late AnimationController _controller;
|
late AnimationController _controller;
|
||||||
bool isDismissed = true;
|
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() async {
|
void actionSurBouton() async {
|
||||||
widget.callback(choice);
|
widget.callback(choice);
|
||||||
await MyApp.postViewModel.getBestPosts();
|
await MyApp.postViewModel.getBestPosts();
|
||||||
await MyApp.postViewModel.getPostsFriends();
|
await MyApp.postViewModel.getPostsFriends();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_controller = AnimationController(
|
_controller = AnimationController(
|
||||||
vsync: this,
|
vsync: this,
|
||||||
duration: Duration(seconds: 3),
|
duration: Duration(seconds: 3),
|
||||||
);
|
);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCapsuleDot(bool isAvailable) {
|
void showCapsuleDot(bool isAvailable) {
|
||||||
isAvailable
|
isAvailable
|
||||||
? Flushbar(
|
? Flushbar(
|
||||||
maxWidth: 210,
|
maxWidth: 210,
|
||||||
animationDuration: Duration(seconds: 1),
|
animationDuration: Duration(seconds: 1),
|
||||||
forwardAnimationCurve: Curves.easeOutCirc,
|
forwardAnimationCurve: Curves.easeOutCirc,
|
||||||
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Ionicons.sparkles,
|
Ionicons.sparkles,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
size: 18,
|
size: 18,
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
||||||
messageText: Align(
|
messageText: Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Capsule disponible",
|
"Capsule disponible",
|
||||||
style: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
|
style: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
flushbarStyle: FlushbarStyle.FLOATING,
|
flushbarStyle: FlushbarStyle.FLOATING,
|
||||||
flushbarPosition: FlushbarPosition.BOTTOM,
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
||||||
textDirection: Directionality.of(context),
|
textDirection: Directionality.of(context),
|
||||||
borderRadius: BorderRadius.circular(1000),
|
borderRadius: BorderRadius.circular(1000),
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: Colors.white.withOpacity(0.04),
|
borderColor: Colors.white.withOpacity(0.04),
|
||||||
duration: const Duration(minutes: 100),
|
duration: const Duration(minutes: 100),
|
||||||
leftBarIndicatorColor: Colors.transparent,
|
leftBarIndicatorColor: Colors.transparent,
|
||||||
positionOffset: 20,
|
positionOffset: 20,
|
||||||
onTap: (_) {
|
onTap: (_) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
Navigator.pushNamed(context, '/post');
|
Navigator.pushNamed(context, '/post');
|
||||||
},
|
},
|
||||||
).show(context)
|
).show(context)
|
||||||
: Flushbar(
|
: Flushbar(
|
||||||
maxWidth: 155,
|
maxWidth: 155,
|
||||||
animationDuration: Duration(seconds: 1),
|
animationDuration: Duration(seconds: 1),
|
||||||
forwardAnimationCurve: Curves.easeOutCirc,
|
forwardAnimationCurve: Curves.easeOutCirc,
|
||||||
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||||
icon: Lottie.asset(
|
icon: Lottie.asset(
|
||||||
'assets/animations/LottieHourGlass.json',
|
'assets/animations/LottieHourGlass.json',
|
||||||
width: 26,
|
width: 26,
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
||||||
messageText: Align(
|
messageText: Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: CountdownTimer(
|
child: CountdownTimer(
|
||||||
endTime: midnight.millisecondsSinceEpoch - 2 * 60 * 60 * 1000,
|
endTime: midnight.millisecondsSinceEpoch - 2 * 60 * 60 * 1000,
|
||||||
textStyle: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
|
textStyle: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
flushbarStyle: FlushbarStyle.FLOATING,
|
flushbarStyle: FlushbarStyle.FLOATING,
|
||||||
flushbarPosition: FlushbarPosition.BOTTOM,
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
||||||
textDirection: Directionality.of(context),
|
textDirection: Directionality.of(context),
|
||||||
borderRadius: BorderRadius.circular(1000),
|
borderRadius: BorderRadius.circular(1000),
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: Colors.white.withOpacity(0.04),
|
borderColor: Colors.white.withOpacity(0.04),
|
||||||
duration: const Duration(minutes: 100),
|
duration: const Duration(minutes: 100),
|
||||||
leftBarIndicatorColor: Colors.transparent,
|
leftBarIndicatorColor: Colors.transparent,
|
||||||
positionOffset: 20,
|
positionOffset: 20,
|
||||||
onTap: (_) {
|
onTap: (_) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
).show(context);
|
).show(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkAvailable() async {
|
void checkAvailable() async {
|
||||||
print("test");
|
print("test");
|
||||||
var res = await MyApp.postViewModel.getAvailable();
|
var res = await MyApp.postViewModel.getAvailable();
|
||||||
print(res);
|
print(res);
|
||||||
ModalRoute<dynamic>? route = ModalRoute.of(context);
|
ModalRoute<dynamic>? route = ModalRoute.of(context);
|
||||||
if (route != null) {
|
if (route != null) {
|
||||||
if (route.settings.name != '/flushbarRoute') {
|
if (route.settings.name != '/flushbarRoute') {
|
||||||
print("yes");
|
print("yes");
|
||||||
showCapsuleDot(res);
|
showCapsuleDot(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(top: defaultPadding),
|
padding: const EdgeInsets.only(top: defaultPadding),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(horizontal: defaultPadding),
|
padding: EdgeInsets.symmetric(horizontal: defaultPadding),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 100,
|
height: 100,
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Navigator.of(context).push(routeAddFriend());
|
Navigator.of(context).push(routeAddFriend());
|
||||||
},
|
},
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.person_add_alt_1_rounded,
|
Icons.person_add_alt_1_rounded,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
size: 30,
|
size: 30,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: 200),
|
constraints: BoxConstraints(maxWidth: 200),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
ZoomTapAnimation(
|
ZoomTapAnimation(
|
||||||
enableLongTapRepeatEvent: false,
|
enableLongTapRepeatEvent: false,
|
||||||
longTapRepeatDuration: const Duration(milliseconds: 100),
|
longTapRepeatDuration: const Duration(milliseconds: 100),
|
||||||
begin: 1.0,
|
begin: 1.0,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
checkAvailable();
|
checkAvailable();
|
||||||
},
|
},
|
||||||
end: 0.97,
|
end: 0.97,
|
||||||
beginDuration: const Duration(milliseconds: 70),
|
beginDuration: const Duration(milliseconds: 70),
|
||||||
endDuration: const Duration(milliseconds: 100),
|
endDuration: const Duration(milliseconds: 100),
|
||||||
beginCurve: Curves.decelerate,
|
beginCurve: Curves.decelerate,
|
||||||
endCurve: Curves.easeInOutSine,
|
endCurve: Curves.easeInOutSine,
|
||||||
child: Image(
|
child: Image(
|
||||||
image: AssetImage("assets/images/logo.png"),
|
image: AssetImage("assets/images/logo.png"),
|
||||||
height: 30,
|
height: 30,
|
||||||
)),
|
)),
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (!choice) {
|
if (!choice) {
|
||||||
setState(() {
|
setState(() {
|
||||||
choice = !choice;
|
choice = !choice;
|
||||||
actionSurBouton();
|
actionSurBouton();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
if (choice) {
|
if (choice) {
|
||||||
return Padding(
|
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(
|
child: AutoSizeText(
|
||||||
"Mes amis",
|
"Mes amis",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
fontWeight: FontWeight.w500, fontSize: 16, color: Colors.white),
|
fontWeight: FontWeight.w500, fontSize: 16, color: Colors.white),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Padding(
|
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(
|
child: AutoSizeText(
|
||||||
"Mes amis",
|
"Mes amis",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
fontWeight: FontWeight.w300, fontSize: 16, color: unactiveFeed),
|
fontWeight: FontWeight.w300, fontSize: 16, color: unactiveFeed),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (choice) {
|
if (choice) {
|
||||||
setState(() {
|
setState(() {
|
||||||
choice = !choice;
|
choice = !choice;
|
||||||
actionSurBouton();
|
actionSurBouton();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
if (choice) {
|
if (choice) {
|
||||||
return Padding(
|
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(
|
child: AutoSizeText(
|
||||||
"Discovery",
|
"Discovery",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
fontWeight: FontWeight.w300, fontSize: 16, color: unactiveFeed),
|
fontWeight: FontWeight.w300, fontSize: 16, color: unactiveFeed),
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
return Padding(
|
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(
|
child: AutoSizeText(
|
||||||
"Discovery",
|
"Discovery",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
fontWeight: FontWeight.w500, fontSize: 16, color: Colors.white),
|
fontWeight: FontWeight.w500, fontSize: 16, color: Colors.white),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await MyApp.userViewModel.updateUserCurrent();
|
await MyApp.userViewModel.updateUserCurrent();
|
||||||
Navigator.of(context).push(routeProfile());
|
Navigator.of(context).push(routeProfile());
|
||||||
},
|
},
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: SizedBox.fromSize(
|
child: SizedBox.fromSize(
|
||||||
// Image radius
|
// Image radius
|
||||||
child: FadeInImage.assetNetwork(
|
child: FadeInImage.assetNetwork(
|
||||||
placeholder: 'assets/images/loadingPlaceholder.gif',
|
placeholder: 'assets/images/loadingPlaceholder.gif',
|
||||||
image: MyApp.userViewModel.userCurrent.pp,
|
image: MyApp.userViewModel.userCurrent.pp,
|
||||||
width: 30,
|
width: 30,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
|
||||||
import '../../main.dart';
|
import '../../main.dart';
|
||||||
import '../Comment.dart';
|
import '../Comment.dart';
|
||||||
import '../User.dart';
|
import '../User.dart';
|
||||||
|
|
||||||
class CommentMapper {
|
class CommentMapper {
|
||||||
static Future<Comment> toModel(DocumentSnapshot<Map<String, dynamic>> snapshot) async {
|
static Future<Comment> toModel(DocumentSnapshot<Map<String, dynamic>> snapshot) async {
|
||||||
final data = snapshot.data();
|
final data = snapshot.data();
|
||||||
User? user = await MyApp.userViewModel.getUser(data?['user_id']);
|
User? user = await MyApp.userViewModel.getUser(data?['user_id']);
|
||||||
return Comment(
|
return Comment(
|
||||||
snapshot.id,
|
snapshot.id,
|
||||||
user!,
|
user!,
|
||||||
data?["text"],
|
data?["text"],
|
||||||
data?["date"]);
|
data?["date"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,451 +1,451 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/Material.dart';
|
import 'package:flutter/Material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
|
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
import 'package:text_scroll/text_scroll.dart';
|
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 '../main.dart';
|
import '../main.dart';
|
||||||
import '../model/Post.dart';
|
import '../model/Post.dart';
|
||||||
import '../values/constants.dart';
|
import '../values/constants.dart';
|
||||||
|
|
||||||
class DetailPostScreen extends StatefulWidget {
|
class DetailPostScreen extends StatefulWidget {
|
||||||
final Post post;
|
final Post post;
|
||||||
const DetailPostScreen({super.key, required this.post});
|
const DetailPostScreen({super.key, required this.post});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<DetailPostScreen> createState() => _DetailPostScreenState();
|
State<DetailPostScreen> createState() => _DetailPostScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DetailPostScreenState extends State<DetailPostScreen> {
|
class _DetailPostScreenState extends State<DetailPostScreen> {
|
||||||
TextEditingController _textController = TextEditingController();
|
TextEditingController _textController = TextEditingController();
|
||||||
late FocusNode myFocusNode;
|
late FocusNode myFocusNode;
|
||||||
late StreamSubscription<bool> keyboardSubscription;
|
late StreamSubscription<bool> keyboardSubscription;
|
||||||
Future<void> resetFullScreen() async {
|
Future<void> resetFullScreen() async {
|
||||||
await SystemChannels.platform.invokeMethod<void>(
|
await SystemChannels.platform.invokeMethod<void>(
|
||||||
'SystemChrome.restoreSystemUIOverlays',
|
'SystemChrome.restoreSystemUIOverlays',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool choice = false;
|
bool choice = false;
|
||||||
DateTime today = DateTime.now();
|
DateTime today = DateTime.now();
|
||||||
|
|
||||||
void switchChoice() {
|
void switchChoice() {
|
||||||
setState(() {
|
setState(() {
|
||||||
choice = !choice;
|
choice = !choice;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
MyApp.audioPlayer.release();
|
MyApp.audioPlayer.release();
|
||||||
myFocusNode.dispose();
|
myFocusNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
print("post: ${widget.post.date.toString()}");
|
print("post: ${widget.post.date.toString()}");
|
||||||
print("ajrd: ${DateTime.now().toString()}");
|
print("ajrd: ${DateTime.now().toString()}");
|
||||||
myFocusNode = FocusNode();
|
myFocusNode = FocusNode();
|
||||||
var keyboardVisibilityController = KeyboardVisibilityController();
|
var keyboardVisibilityController = KeyboardVisibilityController();
|
||||||
print('Keyboard visibility direct query: ${keyboardVisibilityController.isVisible}');
|
print('Keyboard visibility direct query: ${keyboardVisibilityController.isVisible}');
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
keyboardSubscription = keyboardVisibilityController.onChange.listen((bool visible) {
|
keyboardSubscription = keyboardVisibilityController.onChange.listen((bool visible) {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
myFocusNode.unfocus();
|
myFocusNode.unfocus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
final ScrollController _scrollController = ScrollController();
|
final ScrollController _scrollController = ScrollController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
FocusScopeNode currentFocus = FocusScope.of(context);
|
FocusScopeNode currentFocus = FocusScope.of(context);
|
||||||
if (!currentFocus.hasPrimaryFocus) {
|
if (!currentFocus.hasPrimaryFocus) {
|
||||||
currentFocus.unfocus();
|
currentFocus.unfocus();
|
||||||
resetFullScreen();
|
resetFullScreen();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 760.h,
|
height: 760.h,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
ScrollConfiguration(
|
ScrollConfiguration(
|
||||||
behavior: MyBehavior(),
|
behavior: MyBehavior(),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
physics: AlwaysScrollableScrollPhysics(),
|
physics: AlwaysScrollableScrollPhysics(),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
children: [
|
children: [
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 400,
|
height: 400,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: FadeInImage.assetNetwork(
|
child: FadeInImage.assetNetwork(
|
||||||
placeholder: "assets/images/loadingPlaceholder.gif",
|
placeholder: "assets/images/loadingPlaceholder.gif",
|
||||||
image: choice ? widget.post.selfie! : widget.post.music.cover!,
|
image: choice ? widget.post.selfie! : widget.post.music.cover!,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: 200,
|
height: 200,
|
||||||
margin: EdgeInsets.only(top: 230),
|
margin: EdgeInsets.only(top: 230),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [Colors.transparent, bgModal],
|
colors: [Colors.transparent, bgModal],
|
||||||
stops: [0, 0.8]),
|
stops: [0, 0.8]),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 10),
|
padding: const EdgeInsets.fromLTRB(20, 0, 20, 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: 10),
|
padding: const EdgeInsets.only(right: 10),
|
||||||
child: choice
|
child: choice
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: SizedBox.fromSize(
|
child: SizedBox.fromSize(
|
||||||
// Image radius
|
// Image radius
|
||||||
child: Image(
|
child: Image(
|
||||||
image: NetworkImage(widget.post.user.pp),
|
image: NetworkImage(widget.post.user.pp),
|
||||||
width: 45,
|
width: 45,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: widget.post.music.previewUrl != null
|
: widget.post.music.previewUrl != null
|
||||||
? ButtonPlayComponent(music: widget.post.music)
|
? ButtonPlayComponent(music: widget.post.music)
|
||||||
: Container(),
|
: Container(),
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ScrollConfiguration(
|
child: ScrollConfiguration(
|
||||||
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
||||||
child: TextScroll(
|
child: TextScroll(
|
||||||
choice
|
choice
|
||||||
? widget.post.user.pseudo
|
? widget.post.user.pseudo
|
||||||
: widget.post.music.title!,
|
: widget.post.music.title!,
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
height: 1,
|
height: 1,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.w800,
|
fontWeight: FontWeight.w800,
|
||||||
fontSize: 22),
|
fontSize: 22),
|
||||||
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)),
|
||||||
))),
|
))),
|
||||||
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)
|
? DateTime(today.year, today.month, today.day)
|
||||||
.isAtSameMomentAs(DateTime(widget.post.date.year,
|
.isAtSameMomentAs(DateTime(widget.post.date.year,
|
||||||
widget.post.date.month, widget.post.date.day))
|
widget.post.date.month, widget.post.date.day))
|
||||||
? Text(
|
? Text(
|
||||||
"Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
|
"Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
|
||||||
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),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
"hier, ${widget.post.date.hour}:${widget.post.date.minute}",
|
"hier, ${widget.post.date.hour}:${widget.post.date.minute}",
|
||||||
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),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
widget.post.music.date.toString(),
|
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
|
choice
|
||||||
? widget.post.location.item2 != null
|
? widget.post.location.item2 != null
|
||||||
? Text(
|
? Text(
|
||||||
"${widget.post.location.item1}, ${widget.post.location.item2}",
|
"${widget.post.location.item1}, ${widget.post.location.item2}",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.5),
|
color: Colors.white.withOpacity(0.5),
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 15),
|
fontSize: 15),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
"",
|
"",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white.withOpacity(0.4),
|
color: Colors.white.withOpacity(0.4),
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
fontSize: 13),
|
fontSize: 13),
|
||||||
)
|
)
|
||||||
: ScrollConfiguration(
|
: ScrollConfiguration(
|
||||||
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
||||||
child: TextScroll(widget.post.music.artists.first.name!,
|
child: TextScroll(widget.post.music.artists.first.name!,
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
height: 1,
|
height: 1,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
fontSize: 17),
|
fontSize: 17),
|
||||||
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))),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
widget.post.description != null
|
widget.post.description != null
|
||||||
? Align(
|
? Align(
|
||||||
alignment: Alignment.bottomLeft,
|
alignment: Alignment.bottomLeft,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(50, 35, 50, 35),
|
padding: const EdgeInsets.fromLTRB(50, 35, 50, 35),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.post.description!,
|
widget.post.description!,
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
height: 1,
|
height: 1,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 14),
|
fontSize: 14),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Container(
|
: Container(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: bgAppBar,
|
color: bgAppBar,
|
||||||
border: Border(
|
border: Border(
|
||||||
top: BorderSide(
|
top: BorderSide(
|
||||||
color: Color(0xFF262626), // Couleur de la bordure
|
color: Color(0xFF262626), // Couleur de la bordure
|
||||||
width: 1.0, // Épaisseur de la bordure
|
width: 1.0, // Épaisseur de la bordure
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 20),
|
padding: EdgeInsets.symmetric(vertical: 20),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.asset("assets/images/heart.svg", semanticsLabel: 'Like Logo'),
|
SvgPicture.asset("assets/images/heart.svg", semanticsLabel: 'Like Logo'),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
myFocusNode.requestFocus();
|
myFocusNode.requestFocus();
|
||||||
},
|
},
|
||||||
child: SvgPicture.asset("assets/images/chat.svg",
|
child: SvgPicture.asset("assets/images/chat.svg",
|
||||||
semanticsLabel: 'Chat Logo')),
|
semanticsLabel: 'Chat Logo')),
|
||||||
SvgPicture.asset("assets/images/add.svg",
|
SvgPicture.asset("assets/images/add.svg",
|
||||||
semanticsLabel: 'Add playlist Logo'),
|
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",
|
SvgPicture.asset("assets/images/report.svg",
|
||||||
semanticsLabel: 'Report Logo'),
|
semanticsLabel: 'Report Logo'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(15.0),
|
padding: const EdgeInsets.all(15.0),
|
||||||
child: RichText(
|
child: RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: "3",
|
text: "3",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white, fontWeight: FontWeight.w800),
|
color: Colors.white, fontWeight: FontWeight.w800),
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: " commentaires",
|
text: " commentaires",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white, fontWeight: FontWeight.w400),
|
color: Colors.white, fontWeight: FontWeight.w400),
|
||||||
)
|
)
|
||||||
])),
|
])),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.fromLTRB(20, 0, 20, 20),
|
padding: EdgeInsets.fromLTRB(20, 0, 20, 20),
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
runSpacing: 13,
|
runSpacing: 13,
|
||||||
children: [
|
children: [
|
||||||
CommentComponent(),
|
CommentComponent(),
|
||||||
CommentComponent(),
|
CommentComponent(),
|
||||||
CommentComponent(),
|
CommentComponent(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
widget.post.selfie != null
|
widget.post.selfie != null
|
||||||
? Align(
|
? Align(
|
||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
child: ZoomTapAnimation(
|
child: ZoomTapAnimation(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (widget.post.selfie != null) {
|
if (widget.post.selfie != null) {
|
||||||
switchChoice();
|
switchChoice();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enableLongTapRepeatEvent: false,
|
enableLongTapRepeatEvent: false,
|
||||||
longTapRepeatDuration: const Duration(milliseconds: 100),
|
longTapRepeatDuration: const Duration(milliseconds: 100),
|
||||||
begin: 1.0,
|
begin: 1.0,
|
||||||
end: 0.96,
|
end: 0.96,
|
||||||
beginDuration: const Duration(milliseconds: 70),
|
beginDuration: const Duration(milliseconds: 70),
|
||||||
endDuration: const Duration(milliseconds: 100),
|
endDuration: const Duration(milliseconds: 100),
|
||||||
beginCurve: Curves.decelerate,
|
beginCurve: Curves.decelerate,
|
||||||
endCurve: Curves.easeInOutSine,
|
endCurve: Curves.easeInOutSine,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.all(20),
|
margin: EdgeInsets.all(20),
|
||||||
width: 120,
|
width: 120,
|
||||||
height: 120,
|
height: 120,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
border: Border.all(width: 4, color: Colors.white)),
|
border: Border.all(width: 4, color: Colors.white)),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
// implement image
|
// implement image
|
||||||
child: Image(
|
child: Image(
|
||||||
image: NetworkImage(
|
image: NetworkImage(
|
||||||
choice ? widget.post.music.cover! : widget.post.selfie!),
|
choice ? widget.post.music.cover! : widget.post.selfie!),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Container()
|
: Container()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 50,
|
height: 50,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(top: 10),
|
margin: EdgeInsets.only(top: 10),
|
||||||
width: 60,
|
width: 60,
|
||||||
height: 5,
|
height: 5,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white.withOpacity(0.6), borderRadius: BorderRadius.circular(20))),
|
color: Colors.white.withOpacity(0.6), borderRadius: BorderRadius.circular(20))),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 70,
|
height: 70,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(top: BorderSide(color: grayColor, width: 2)), color: textFieldMessage),
|
border: Border(top: BorderSide(color: grayColor, width: 2)), color: textFieldMessage),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
ClipOval(
|
ClipOval(
|
||||||
child: SizedBox.fromSize(
|
child: SizedBox.fromSize(
|
||||||
// Image radius
|
// Image radius
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
MyApp.userViewModel.userCurrent.pp,
|
MyApp.userViewModel.userCurrent.pp,
|
||||||
width: 45,
|
width: 45,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
keyboardAppearance: Brightness.dark,
|
keyboardAppearance: Brightness.dark,
|
||||||
controller: _textController,
|
controller: _textController,
|
||||||
focusNode: myFocusNode,
|
focusNode: myFocusNode,
|
||||||
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: Icon(
|
suffixIcon: 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))),
|
||||||
contentPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20),
|
contentPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20),
|
||||||
fillColor: bgModal,
|
fillColor: bgModal,
|
||||||
filled: true,
|
filled: true,
|
||||||
focusColor: Color.fromRGBO(255, 255, 255, 0.30),
|
focusColor: Color.fromRGBO(255, 255, 255, 0.30),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: 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))),
|
||||||
hintText: 'Ajoutez une réponse...',
|
hintText: 'Ajoutez une réponse...',
|
||||||
hintStyle: GoogleFonts.plusJakartaSans(color: grayText)),
|
hintStyle: GoogleFonts.plusJakartaSans(color: grayText)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyBehavior extends ScrollBehavior {
|
class MyBehavior extends ScrollBehavior {
|
||||||
@override
|
@override
|
||||||
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
|
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,300 +1,300 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:another_flushbar/flushbar.dart';
|
import 'package:another_flushbar/flushbar.dart';
|
||||||
import 'package:circular_reveal_animation/circular_reveal_animation.dart';
|
import 'package:circular_reveal_animation/circular_reveal_animation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
|
import 'package:flutter_countdown_timer/flutter_countdown_timer.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:ionicons/ionicons.dart';
|
import 'package:ionicons/ionicons.dart';
|
||||||
import 'package:justmusic/main.dart';
|
import 'package:justmusic/main.dart';
|
||||||
import 'package:lottie/lottie.dart';
|
import 'package:lottie/lottie.dart';
|
||||||
|
|
||||||
import '../components/post_component.dart';
|
import '../components/post_component.dart';
|
||||||
import '../components/top_nav_bar_component.dart';
|
import '../components/top_nav_bar_component.dart';
|
||||||
import '../model/Post.dart';
|
import '../model/Post.dart';
|
||||||
import '../values/constants.dart';
|
import '../values/constants.dart';
|
||||||
import 'detail_post_screen.dart';
|
import 'detail_post_screen.dart';
|
||||||
|
|
||||||
class FeedScreen extends StatefulWidget {
|
class FeedScreen extends StatefulWidget {
|
||||||
const FeedScreen({Key? key}) : super(key: key);
|
const FeedScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<FeedScreen> createState() => _FeedScreenState();
|
State<FeedScreen> createState() => _FeedScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FeedScreenState extends State<FeedScreen> with SingleTickerProviderStateMixin {
|
class _FeedScreenState extends State<FeedScreen> with SingleTickerProviderStateMixin {
|
||||||
late AnimationController animationController;
|
late AnimationController animationController;
|
||||||
late Animation<double> animation;
|
late Animation<double> animation;
|
||||||
late List<Post> friendFeed;
|
late List<Post> friendFeed;
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
|
|
||||||
late List<Post> discoveryFeed;
|
late List<Post> discoveryFeed;
|
||||||
late List<Post> displayFeed;
|
late List<Post> displayFeed;
|
||||||
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);
|
||||||
bool isDismissed = true;
|
bool isDismissed = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
MyApp.postViewModel.getPostsFriends();
|
MyApp.postViewModel.getPostsFriends();
|
||||||
friendFeed = MyApp.postViewModel.postsFriends;
|
friendFeed = MyApp.postViewModel.postsFriends;
|
||||||
MyApp.postViewModel.getBestPosts();
|
MyApp.postViewModel.getBestPosts();
|
||||||
discoveryFeed = MyApp.postViewModel.bestPosts;
|
discoveryFeed = MyApp.postViewModel.bestPosts;
|
||||||
displayFeed = [];
|
displayFeed = [];
|
||||||
animationController = AnimationController(
|
animationController = AnimationController(
|
||||||
vsync: this,
|
vsync: this,
|
||||||
duration: Duration(milliseconds: 400),
|
duration: Duration(milliseconds: 400),
|
||||||
);
|
);
|
||||||
animation = CurvedAnimation(
|
animation = CurvedAnimation(
|
||||||
parent: animationController,
|
parent: animationController,
|
||||||
curve: Curves.easeInOutSine,
|
curve: Curves.easeInOutSine,
|
||||||
);
|
);
|
||||||
animationController.forward();
|
animationController.forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showCapsuleDot() async {
|
Future<void> showCapsuleDot() async {
|
||||||
bool res = await MyApp.postViewModel.getAvailable();
|
bool res = await MyApp.postViewModel.getAvailable();
|
||||||
if (isDismissed) {
|
if (isDismissed) {
|
||||||
if (res) {
|
if (res) {
|
||||||
setState(() {
|
setState(() {
|
||||||
isDismissed = !isDismissed;
|
isDismissed = !isDismissed;
|
||||||
});
|
});
|
||||||
Flushbar(
|
Flushbar(
|
||||||
maxWidth: 210,
|
maxWidth: 210,
|
||||||
animationDuration: Duration(seconds: 1),
|
animationDuration: Duration(seconds: 1),
|
||||||
forwardAnimationCurve: Curves.easeOutCirc,
|
forwardAnimationCurve: Curves.easeOutCirc,
|
||||||
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Ionicons.sparkles,
|
Ionicons.sparkles,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
size: 18,
|
size: 18,
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
||||||
messageText: Align(
|
messageText: Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Capsule disponible",
|
"Capsule disponible",
|
||||||
style: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
|
style: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
flushbarStyle: FlushbarStyle.FLOATING,
|
flushbarStyle: FlushbarStyle.FLOATING,
|
||||||
flushbarPosition: FlushbarPosition.BOTTOM,
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
||||||
textDirection: Directionality.of(context),
|
textDirection: Directionality.of(context),
|
||||||
borderRadius: BorderRadius.circular(1000),
|
borderRadius: BorderRadius.circular(1000),
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
isDismissible: false,
|
isDismissible: false,
|
||||||
borderColor: Colors.white.withOpacity(0.04),
|
borderColor: Colors.white.withOpacity(0.04),
|
||||||
duration: const Duration(minutes: 100),
|
duration: const Duration(minutes: 100),
|
||||||
leftBarIndicatorColor: Colors.transparent,
|
leftBarIndicatorColor: Colors.transparent,
|
||||||
positionOffset: 20,
|
positionOffset: 20,
|
||||||
onTap: (_) {
|
onTap: (_) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
Navigator.pushNamed(context, '/post');
|
Navigator.pushNamed(context, '/post');
|
||||||
},
|
},
|
||||||
).show(context).then((value) {
|
).show(context).then((value) {
|
||||||
isDismissed = !isDismissed;
|
isDismissed = !isDismissed;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
isDismissed = !isDismissed;
|
isDismissed = !isDismissed;
|
||||||
});
|
});
|
||||||
Flushbar(
|
Flushbar(
|
||||||
maxWidth: 155,
|
maxWidth: 155,
|
||||||
animationDuration: Duration(seconds: 1),
|
animationDuration: Duration(seconds: 1),
|
||||||
isDismissible: false,
|
isDismissible: false,
|
||||||
forwardAnimationCurve: Curves.easeOutCirc,
|
forwardAnimationCurve: Curves.easeOutCirc,
|
||||||
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||||
icon: Lottie.asset(
|
icon: Lottie.asset(
|
||||||
'assets/animations/LottieHourGlass.json',
|
'assets/animations/LottieHourGlass.json',
|
||||||
width: 26,
|
width: 26,
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
|
||||||
messageText: Align(
|
messageText: Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: CountdownTimer(
|
child: CountdownTimer(
|
||||||
endTime: midnight.millisecondsSinceEpoch - 2 * 60 * 60 * 1000,
|
endTime: midnight.millisecondsSinceEpoch - 2 * 60 * 60 * 1000,
|
||||||
textStyle: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
|
textStyle: GoogleFonts.plusJakartaSans(color: Colors.grey, fontSize: 15),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
flushbarStyle: FlushbarStyle.FLOATING,
|
flushbarStyle: FlushbarStyle.FLOATING,
|
||||||
flushbarPosition: FlushbarPosition.BOTTOM,
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
||||||
textDirection: Directionality.of(context),
|
textDirection: Directionality.of(context),
|
||||||
borderRadius: BorderRadius.circular(1000),
|
borderRadius: BorderRadius.circular(1000),
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: Colors.white.withOpacity(0.04),
|
borderColor: Colors.white.withOpacity(0.04),
|
||||||
duration: const Duration(minutes: 100),
|
duration: const Duration(minutes: 100),
|
||||||
leftBarIndicatorColor: Colors.transparent,
|
leftBarIndicatorColor: Colors.transparent,
|
||||||
positionOffset: 20,
|
positionOffset: 20,
|
||||||
onTap: (_) {},
|
onTap: (_) {},
|
||||||
).show(context).then((value) {
|
).show(context).then((value) {
|
||||||
{
|
{
|
||||||
setState(() {
|
setState(() {
|
||||||
isDismissed = !isDismissed;
|
isDismissed = !isDismissed;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _refresh() async {
|
Future _refresh() async {
|
||||||
print("refresh");
|
print("refresh");
|
||||||
discoveryFeed = await MyApp.postViewModel.getBestPosts();
|
discoveryFeed = await MyApp.postViewModel.getBestPosts();
|
||||||
setState(() {
|
setState(() {
|
||||||
displayFeed = discoveryFeed.reversed.toList();
|
displayFeed = discoveryFeed.reversed.toList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeFeed(bool choice) {
|
void changeFeed(bool choice) {
|
||||||
// Mettez ici le code pour l'action que vous souhaitez effectuer avec le paramètre
|
// Mettez ici le code pour l'action que vous souhaitez effectuer avec le paramètre
|
||||||
if (choice) {
|
if (choice) {
|
||||||
setState(() {
|
setState(() {
|
||||||
animationController.reset();
|
animationController.reset();
|
||||||
displayFeed = MyApp.postViewModel.postsFriends.reversed.toList();
|
displayFeed = MyApp.postViewModel.postsFriends.reversed.toList();
|
||||||
animationController.forward();
|
animationController.forward();
|
||||||
print(displayFeed.length);
|
print(displayFeed.length);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
animationController.reset();
|
animationController.reset();
|
||||||
displayFeed = MyApp.postViewModel.bestPosts.reversed.toList();
|
displayFeed = MyApp.postViewModel.bestPosts.reversed.toList();
|
||||||
print(displayFeed.length);
|
print(displayFeed.length);
|
||||||
animationController.forward();
|
animationController.forward();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void openDetailPost(int index) {
|
void openDetailPost(int index) {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
backgroundColor: bgModal,
|
backgroundColor: bgModal,
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: 600,
|
maxWidth: 600,
|
||||||
),
|
),
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
context: context,
|
context: context,
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
||||||
builder: ((BuildContext context) {
|
builder: ((BuildContext context) {
|
||||||
return ClipRRect(
|
return ClipRRect(
|
||||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
||||||
child: DetailPostScreen(post: displayFeed[index]));
|
child: DetailPostScreen(post: displayFeed[index]));
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
showCapsuleDot();
|
showCapsuleDot();
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: true,
|
resizeToAvoidBottomInset: true,
|
||||||
backgroundColor: bgColor,
|
backgroundColor: bgColor,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
body: displayFeed.isEmpty
|
body: displayFeed.isEmpty
|
||||||
? Container(
|
? Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage("assets/images/empty_bg.png"), fit: BoxFit.cover, opacity: 0.3),
|
image: AssetImage("assets/images/empty_bg.png"), fit: BoxFit.cover, opacity: 0.3),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(top: 140.h, left: defaultPadding),
|
padding: EdgeInsets.only(top: 140.h, left: defaultPadding),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("Suis tes amis pour voir leurs capsules",
|
Text("Suis tes amis pour voir leurs capsules",
|
||||||
style: GoogleFonts.plusJakartaSans(
|
style: GoogleFonts.plusJakartaSans(
|
||||||
color: Colors.white, fontSize: 23, fontWeight: FontWeight.w800))
|
color: Colors.white, fontSize: 23, fontWeight: FontWeight.w800))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: IgnorePointer(
|
child: IgnorePointer(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 240.h,
|
height: 240.h,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topRight,
|
begin: Alignment.topRight,
|
||||||
stops: [0.3, 1],
|
stops: [0.3, 1],
|
||||||
colors: [bgColor.withOpacity(0.9), bgColor.withOpacity(0)])),
|
colors: [bgColor.withOpacity(0.9), bgColor.withOpacity(0)])),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: 800),
|
constraints: BoxConstraints(maxWidth: 800),
|
||||||
child: TopNavBarComponent(callback: changeFeed),
|
child: TopNavBarComponent(callback: changeFeed),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Container(
|
: Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
children: [
|
children: [
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: CircularRevealAnimation(
|
child: CircularRevealAnimation(
|
||||||
animation: animation,
|
animation: animation,
|
||||||
centerOffset: Offset(30.w, -100),
|
centerOffset: Offset(30.w, -100),
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints: BoxConstraints(maxWidth: 600),
|
constraints: BoxConstraints(maxWidth: 600),
|
||||||
padding: EdgeInsets.fromLTRB(defaultPadding, 100.h, defaultPadding, 0),
|
padding: EdgeInsets.fromLTRB(defaultPadding, 100.h, defaultPadding, 0),
|
||||||
child: RefreshIndicator(
|
child: RefreshIndicator(
|
||||||
displacement: 20,
|
displacement: 20,
|
||||||
triggerMode: RefreshIndicatorTriggerMode.onEdge,
|
triggerMode: RefreshIndicatorTriggerMode.onEdge,
|
||||||
onRefresh: _refresh,
|
onRefresh: _refresh,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
physics: const BouncingScrollPhysics(decelerationRate: ScrollDecelerationRate.fast),
|
physics: const BouncingScrollPhysics(decelerationRate: ScrollDecelerationRate.fast),
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: displayFeed.length,
|
itemCount: displayFeed.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 40),
|
padding: const EdgeInsets.only(bottom: 40),
|
||||||
child:
|
child:
|
||||||
PostComponent(callback: openDetailPost, post: displayFeed[index], index: index),
|
PostComponent(callback: openDetailPost, post: displayFeed[index], index: index),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: IgnorePointer(
|
child: IgnorePointer(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 240.h,
|
height: 240.h,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topRight,
|
begin: Alignment.topRight,
|
||||||
stops: [0.3, 1],
|
stops: [0.3, 1],
|
||||||
colors: [bgColor.withOpacity(0.9), bgColor.withOpacity(0)])),
|
colors: [bgColor.withOpacity(0.9), bgColor.withOpacity(0)])),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: 800),
|
constraints: BoxConstraints(maxWidth: 800),
|
||||||
child: TopNavBarComponent(callback: changeFeed),
|
child: TopNavBarComponent(callback: changeFeed),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
|
|
||||||
class CommentService {
|
class CommentService {
|
||||||
createComment(String text, String idPost) async {
|
createComment(String text, String idPost) async {
|
||||||
var id = MyApp.userViewModel.userCurrent.id;
|
var id = MyApp.userViewModel.userCurrent.id;
|
||||||
final comment = <String, dynamic>{
|
final comment = <String, dynamic>{
|
||||||
"user_id": id,
|
"user_id": id,
|
||||||
"text": text,
|
"text": text,
|
||||||
"date": DateTime.now(),
|
"date": DateTime.now(),
|
||||||
"post_id": idPost
|
"post_id": idPost
|
||||||
};
|
};
|
||||||
|
|
||||||
await MyApp.db.collection("comments").add(comment);
|
await MyApp.db.collection("comments").add(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<QueryDocumentSnapshot<Map<String, dynamic>>>> getCommentsByPostId(
|
Future<List<QueryDocumentSnapshot<Map<String, dynamic>>>> getCommentsByPostId(
|
||||||
String id) async {
|
String id) async {
|
||||||
var response = await FirebaseFirestore.instance
|
var response = await FirebaseFirestore.instance
|
||||||
.collection("comments")
|
.collection("comments")
|
||||||
.where("post_id", isEqualTo: id)
|
.where("post_id", isEqualTo: id)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
return response.docs;
|
return response.docs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
class NotificationService {
|
class NotificationService {
|
||||||
sendPushMessage(String token, String title, String body) async {
|
sendPushMessage(String token, String title, String body) async {
|
||||||
try {
|
try {
|
||||||
await http.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
await http.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization':
|
'Authorization':
|
||||||
'key=AAAA56TmIPg:APA91bFeKMr_i6CbUuuUdFI1XkdaNE2A7OVHzxrPIsOSlDfhR6qzZwof7JNGxthWUKj1dRHQMheWNYaLbf3AtXUp9o4DX_gB2073yR4urqUEh9CjvnxVws_9g1cWMgmFS3EpaQEA3icC'
|
'key=AAAA56TmIPg:APA91bFeKMr_i6CbUuuUdFI1XkdaNE2A7OVHzxrPIsOSlDfhR6qzZwof7JNGxthWUKj1dRHQMheWNYaLbf3AtXUp9o4DX_gB2073yR4urqUEh9CjvnxVws_9g1cWMgmFS3EpaQEA3icC'
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, dynamic>{
|
body: jsonEncode(<String, dynamic>{
|
||||||
'priority': 'high',
|
'priority': 'high',
|
||||||
'data': <String, dynamic>{
|
'data': <String, dynamic>{
|
||||||
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||||
'status': 'done',
|
'status': 'done',
|
||||||
'body': body,
|
'body': body,
|
||||||
'title': title
|
'title': title
|
||||||
},
|
},
|
||||||
"notification": <String, dynamic>{
|
"notification": <String, dynamic>{
|
||||||
"title": title,
|
"title": title,
|
||||||
"body": body,
|
"body": body,
|
||||||
},
|
},
|
||||||
"to": token,
|
"to": token,
|
||||||
}));
|
}));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("error push notification");
|
print("error push notification");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
import 'package:justmusic/model/mapper/CommentMapper.dart';
|
import 'package:justmusic/model/mapper/CommentMapper.dart';
|
||||||
|
|
||||||
import '../model/Comment.dart';
|
import '../model/Comment.dart';
|
||||||
import '../services/CommentService.dart';
|
import '../services/CommentService.dart';
|
||||||
|
|
||||||
class CommentViewModel {
|
class CommentViewModel {
|
||||||
List<Comment> _comments = [];
|
List<Comment> _comments = [];
|
||||||
final CommentService _commentService = CommentService();
|
final CommentService _commentService = CommentService();
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
CommentViewModel();
|
CommentViewModel();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
addComment(String text, String idPost) async {
|
addComment(String text, String idPost) async {
|
||||||
try {
|
try {
|
||||||
await _commentService.createComment(text,idPost);
|
await _commentService.createComment(text,idPost);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
print(e);
|
print(e);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Comment>> getCommentsByPostId(String id) async {
|
Future<List<Comment>> getCommentsByPostId(String id) async {
|
||||||
try {
|
try {
|
||||||
var responseData = await _commentService.getCommentsByPostId(id);
|
var responseData = await _commentService.getCommentsByPostId(id);
|
||||||
var commentsFutures = responseData.map((value) async {
|
var commentsFutures = responseData.map((value) async {
|
||||||
return await CommentMapper.toModel(value);
|
return await CommentMapper.toModel(value);
|
||||||
}).toList();
|
}).toList();
|
||||||
_comments = await Future.wait(commentsFutures);
|
_comments = await Future.wait(commentsFutures);
|
||||||
return _comments;
|
return _comments;
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
print(e);
|
print(e);
|
||||||
_comments = [];
|
_comments = [];
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,129 +1,129 @@
|
|||||||
name: justmusic
|
name: justmusic
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
|
|
||||||
# The following line prevents the package from being accidentally published to
|
# The following line prevents the package from being accidentally published to
|
||||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
# The following defines the version and build number for your application.
|
# The following defines the version and build number for your application.
|
||||||
# A version number is three numbers separated by dots, like 1.2.43
|
# A version number is three numbers separated by dots, like 1.2.43
|
||||||
# followed by an optional build number separated by a +.
|
# followed by an optional build number separated by a +.
|
||||||
# Both the version and the builder number may be overridden in flutter
|
# Both the version and the builder number may be overridden in flutter
|
||||||
# build by specifying --build-name and --build-number, respectively.
|
# build by specifying --build-name and --build-number, respectively.
|
||||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.0+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.18.2 <3.0.0'
|
sdk: '>=2.18.2 <3.0.0'
|
||||||
|
|
||||||
# Dependencies specify other packages that your package needs in order to work.
|
# Dependencies specify other packages that your package needs in order to work.
|
||||||
# To automatically upgrade your package dependencies to the latest versions
|
# To automatically upgrade your package dependencies to the latest versions
|
||||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
||||||
# dependencies can be manually updated by changing the version numbers below to
|
# dependencies can be manually updated by changing the version numbers below to
|
||||||
# the latest version available on pub.dev. To see which dependencies have newer
|
# the latest version available on pub.dev. To see which dependencies have newer
|
||||||
# versions available, run `flutter pub outdated`.
|
# versions available, run `flutter pub outdated`.
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
http: ^0.13.5
|
http: ^0.13.5
|
||||||
|
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
google_fonts: ^4.0.4
|
google_fonts: ^4.0.4
|
||||||
gradiantbutton: ^0.0.1
|
gradiantbutton: ^0.0.1
|
||||||
smooth_corner: ^1.1.0
|
smooth_corner: ^1.1.0
|
||||||
flutter_signin_button: ^2.0.0
|
flutter_signin_button: ^2.0.0
|
||||||
flutter_screenutil: ^5.7.0
|
flutter_screenutil: ^5.7.0
|
||||||
auto_size_text: ^3.0.0
|
auto_size_text: ^3.0.0
|
||||||
gradient_borders: ^1.0.0
|
gradient_borders: ^1.0.0
|
||||||
text_scroll: ^0.2.0
|
text_scroll: ^0.2.0
|
||||||
circular_reveal_animation: ^2.0.1
|
circular_reveal_animation: ^2.0.1
|
||||||
zoom_tap_animation: ^1.1.0
|
zoom_tap_animation: ^1.1.0
|
||||||
custom_draggable_widget: ^0.0.2
|
custom_draggable_widget: ^0.0.2
|
||||||
modal_bottom_sheet: ^2.1.2
|
modal_bottom_sheet: ^2.1.2
|
||||||
flutter_animated_play_button: ^0.3.0
|
flutter_animated_play_button: ^0.3.0
|
||||||
audioplayers: ^4.1.0
|
audioplayers: ^4.1.0
|
||||||
ionicons: ^0.2.2
|
ionicons: ^0.2.2
|
||||||
top_snackbar_flutter: ^3.1.0
|
top_snackbar_flutter: ^3.1.0
|
||||||
firebase_core: ^2.15.0
|
firebase_core: ^2.15.0
|
||||||
firebase_auth: ^4.7.2
|
firebase_auth: ^4.7.2
|
||||||
cloud_firestore: ^4.8.4
|
cloud_firestore: ^4.8.4
|
||||||
image_picker: ^1.0.1
|
image_picker: ^1.0.1
|
||||||
insta_image_viewer: ^1.0.2
|
insta_image_viewer: ^1.0.2
|
||||||
pinch_zoom: ^1.0.0
|
pinch_zoom: ^1.0.0
|
||||||
smooth_list_view: ^1.0.4
|
smooth_list_view: ^1.0.4
|
||||||
animated_appear: ^0.0.4
|
animated_appear: ^0.0.4
|
||||||
geolocator: ^9.0.2
|
geolocator: ^9.0.2
|
||||||
tuple: ^2.0.2
|
tuple: ^2.0.2
|
||||||
firebase_storage: ^11.2.5
|
firebase_storage: ^11.2.5
|
||||||
another_flushbar: ^1.12.30
|
another_flushbar: ^1.12.30
|
||||||
flutter_countdown_timer: ^4.1.0
|
flutter_countdown_timer: ^4.1.0
|
||||||
intl: ^0.18.1
|
intl: ^0.18.1
|
||||||
lottie: ^2.5.0
|
lottie: ^2.5.0
|
||||||
custom_refresh_indicator: ^2.2.1
|
custom_refresh_indicator: ^2.2.1
|
||||||
animations: ^2.0.7
|
animations: ^2.0.7
|
||||||
flutter_svg: ^2.0.7
|
flutter_svg: ^2.0.7
|
||||||
flutter_keyboard_visibility: ^5.4.1
|
flutter_keyboard_visibility: ^5.4.1
|
||||||
firebase_messaging: ^14.6.5
|
firebase_messaging: ^14.6.5
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
# The "flutter_lints" package below contains a set of recommended lints to
|
# The "flutter_lints" package below contains a set of recommended lints to
|
||||||
# encourage good coding practices. The lint set provided by the package is
|
# encourage good coding practices. The lint set provided by the package is
|
||||||
# activated in the `analysis_options.yaml` file located at the root of your
|
# activated in the `analysis_options.yaml` file located at the root of your
|
||||||
# package. See that file for information about deactivating specific lint
|
# package. See that file for information about deactivating specific lint
|
||||||
# rules and activating additional ones.
|
# rules and activating additional ones.
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^2.0.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
||||||
# The following section is specific to Flutter packages.
|
# The following section is specific to Flutter packages.
|
||||||
flutter:
|
flutter:
|
||||||
|
|
||||||
# The following line ensures that the Material Icons font is
|
# The following line ensures that the Material Icons font is
|
||||||
# included with your application, so that you can use the icons in
|
# included with your application, so that you can use the icons in
|
||||||
# the material Icons class.
|
# the material Icons class.
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
# To add assets to your application, add an assets section, like this:
|
||||||
assets:
|
assets:
|
||||||
- assets/images/
|
- assets/images/
|
||||||
- assets/animations/
|
- assets/animations/
|
||||||
- assets/
|
- assets/
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||||
|
|
||||||
# For details regarding adding assets from package dependencies, see
|
# For details regarding adding assets from package dependencies, see
|
||||||
# https://flutter.dev/assets-and-images/#from-packages
|
# https://flutter.dev/assets-and-images/#from-packages
|
||||||
|
|
||||||
# To add custom fonts to your application, add a fonts section here,
|
# To add custom fonts to your application, add a fonts section here,
|
||||||
# in this "flutter" section. Each entry in this list should have a
|
# in this "flutter" section. Each entry in this list should have a
|
||||||
# "family" key with the font family name, and a "fonts" key with a
|
# "family" key with the font family name, and a "fonts" key with a
|
||||||
# list giving the asset and other descriptors for the font. For
|
# list giving the asset and other descriptors for the font. For
|
||||||
# example:
|
# example:
|
||||||
# fonts:
|
# fonts:
|
||||||
# - family: Schyler
|
# - family: Schyler
|
||||||
# fonts:
|
# fonts:
|
||||||
# - asset: fonts/Schyler-Regular.ttf
|
# - asset: fonts/Schyler-Regular.ttf
|
||||||
# - asset: fonts/Schyler-Italic.ttf
|
# - asset: fonts/Schyler-Italic.ttf
|
||||||
# style: italic
|
# style: italic
|
||||||
# - family: Trajan Pro
|
# - family: Trajan Pro
|
||||||
# fonts:
|
# fonts:
|
||||||
# - asset: fonts/TrajanPro.ttf
|
# - asset: fonts/TrajanPro.ttf
|
||||||
# - asset: fonts/TrajanPro_Bold.ttf
|
# - asset: fonts/TrajanPro_Bold.ttf
|
||||||
# weight: 700
|
# weight: 700
|
||||||
#
|
#
|
||||||
# For details regarding fonts from package dependencies,
|
# For details regarding fonts from package dependencies,
|
||||||
# see https://flutter.dev/custom-fonts/#from-packages
|
# see https://flutter.dev/custom-fonts/#from-packages
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:justmusic/services/NotificationService.dart';
|
import 'package:justmusic/services/NotificationService.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
var notif = NotificationService();
|
var notif = NotificationService();
|
||||||
await notif.sendPushMessage("cAJAJw_aR7yPQbFTMS-r6H:APA91bEZs34Ab3-xSYeIGykHrxD5pRj-OyODaEcNBPtds1eLzEH0uzFkzCSQY7BvZQHEFPfeHSN7nri4webskXbu1zzgwe9NIdPagsc6IHaouuewWqWd9V7ucTeDeYt1Sbby4-pb6jtA", "Just Music", "Vien voir les nouveautés");
|
await notif.sendPushMessage("cAJAJw_aR7yPQbFTMS-r6H:APA91bEZs34Ab3-xSYeIGykHrxD5pRj-OyODaEcNBPtds1eLzEH0uzFkzCSQY7BvZQHEFPfeHSN7nri4webskXbu1zzgwe9NIdPagsc6IHaouuewWqWd9V7ucTeDeYt1Sbby4-pb6jtA", "Just Music", "Vien voir les nouveautés");
|
||||||
}
|
}
|
Loading…
Reference in new issue