Merge branch 'PROFIL_PAGE_LDE'
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
9c3f3024cc
@ -0,0 +1,52 @@
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import '../values/constants.dart';
|
||||
|
||||
class LittleCapsule extends StatelessWidget {
|
||||
final bool isEmpty;
|
||||
final DateTime date;
|
||||
const LittleCapsule({super.key, required this.isEmpty, required this.date});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (isEmpty) {
|
||||
return Flexible(
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxWidth: 45, maxHeight: 45),
|
||||
decoration: BoxDecoration(
|
||||
color: searchBarColor,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: Color(0xFF282828), width: 1),
|
||||
),
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
Icons.rocket_launch,
|
||||
color: Color(0xFF464646),
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Flexible(
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxWidth: 45, maxHeight: 45),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [bgModal, bgModal.withOpacity(0)],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
stops: [0, 1]),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
date.day.toString(),
|
||||
style: GoogleFonts.plusJakartaSans(color: Color(0xFF464646), fontWeight: FontWeight.w800, fontSize: 17),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:justmusic/screens/user_screen.dart';
|
||||
|
||||
import '../config/routes.dart';
|
||||
import '../model/User.dart';
|
||||
|
||||
class ProfilPictureComponent extends StatelessWidget {
|
||||
final User user;
|
||||
const ProfilPictureComponent({super.key, required this.user});
|
||||
|
||||
void _openDetail(BuildContext context) {
|
||||
print("cc");
|
||||
Navigator.of(context).push(routeUser(user));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
_openDetail(context);
|
||||
},
|
||||
child: ClipOval(
|
||||
child: SizedBox.fromSize(
|
||||
// Image radius
|
||||
child: Image(
|
||||
image: NetworkImage(user.pp),
|
||||
width: 40,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../main.dart';
|
||||
import '../model/User.dart' as justMusic;
|
||||
import '../values/constants.dart';
|
||||
import 'little_post_recap_component.dart';
|
||||
|
||||
class RecapComponent extends StatelessWidget {
|
||||
final justMusic.User user;
|
||||
const RecapComponent({super.key, required this.user});
|
||||
|
||||
Future<List<bool>>? _fetchdata() async {
|
||||
return await MyApp.postViewModel.recapSevenDays(user.id);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> weekDays = ['L', 'M', 'M', 'J', 'V', 'S', 'D'];
|
||||
DateTime currentDate = DateTime.now();
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: profileBttnColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: grayColor, width: 1)),
|
||||
height: 120,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: postbutton,
|
||||
borderRadius: BorderRadius.only(topRight: Radius.circular(10), topLeft: Radius.circular(10)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Text(
|
||||
weekDays[currentDate.subtract(Duration(days: 6)).weekday - 1].substring(0, 1),
|
||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
|
||||
),
|
||||
)),
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Text(
|
||||
weekDays[currentDate.subtract(Duration(days: 5)).weekday - 1].substring(0, 1),
|
||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
|
||||
),
|
||||
)),
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Text(
|
||||
weekDays[currentDate.subtract(Duration(days: 4)).weekday - 1].substring(0, 1),
|
||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
|
||||
),
|
||||
)),
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Text(
|
||||
weekDays[currentDate.subtract(Duration(days: 3)).weekday - 1].substring(0, 1),
|
||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
|
||||
),
|
||||
)),
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Text(
|
||||
weekDays[currentDate.subtract(Duration(days: 2)).weekday - 1].substring(0, 1),
|
||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
|
||||
),
|
||||
)),
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Text(
|
||||
weekDays[currentDate.subtract(Duration(days: 1)).weekday - 1].substring(0, 1),
|
||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
|
||||
),
|
||||
)),
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Text(
|
||||
weekDays[currentDate.subtract(Duration(days: 0)).weekday - 1].substring(0, 1),
|
||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 17),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
)),
|
||||
FutureBuilder<List<bool>>(
|
||||
future: _fetchdata(), // a previously-obtained Future<String> or null
|
||||
builder: (BuildContext context, AsyncSnapshot<List<bool>> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
LittleCapsule(
|
||||
isEmpty: snapshot.data![0],
|
||||
date: currentDate.subtract(const Duration(days: 6)),
|
||||
),
|
||||
LittleCapsule(isEmpty: snapshot.data![1], date: currentDate.subtract(const Duration(days: 5))),
|
||||
LittleCapsule(isEmpty: snapshot.data![2], date: currentDate.subtract(const Duration(days: 4))),
|
||||
LittleCapsule(isEmpty: snapshot.data![3], date: currentDate.subtract(const Duration(days: 3))),
|
||||
LittleCapsule(isEmpty: snapshot.data![4], date: currentDate.subtract(const Duration(days: 2))),
|
||||
LittleCapsule(isEmpty: snapshot.data![5], date: currentDate.subtract(const Duration(days: 1))),
|
||||
LittleCapsule(isEmpty: snapshot.data![6], date: currentDate.subtract(const Duration(days: 0))),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,157 @@
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import '../components/profile_component.dart';
|
||||
import '../components/recap_component.dart';
|
||||
import '../main.dart';
|
||||
import '../model/User.dart';
|
||||
import '../values/constants.dart';
|
||||
|
||||
class UserScreen extends StatefulWidget {
|
||||
final User user;
|
||||
const UserScreen({super.key, required this.user});
|
||||
|
||||
@override
|
||||
State<UserScreen> createState() => _UserScreenState();
|
||||
}
|
||||
|
||||
class _UserScreenState extends State<UserScreen> {
|
||||
late bool isClicked;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
isClicked = MyApp.userViewModel.isFriend(widget.user.id);
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: Size(double.infinity, 58),
|
||||
child: Container(
|
||||
height: double.infinity,
|
||||
color: bgAppBar,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
|
||||
child: Stack(
|
||||
alignment: Alignment.centerLeft,
|
||||
children: [
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
height: 30,
|
||||
width: 30,
|
||||
child: Image(
|
||||
image: AssetImage("assets/images/return_icon.png"),
|
||||
height: 8,
|
||||
),
|
||||
)),
|
||||
Align(
|
||||
child: Text(
|
||||
widget.user.pseudo,
|
||||
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: bgColor,
|
||||
child: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(decelerationRate: ScrollDecelerationRate.fast),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: settingPadding),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 68.h, bottom: 40),
|
||||
child: ProfileComponent(user: widget.user),
|
||||
),
|
||||
MyApp.userViewModel.userCurrent.id != widget.user.id
|
||||
? Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: isClicked
|
||||
? SizedBox(
|
||||
// Définir une largeur minimale pour le bouton "Ajouter"
|
||||
width: 120, // Réglez cette valeur en fonction de vos besoins
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
color: selectedButton,
|
||||
child: InkWell(
|
||||
splashColor: Colors.white.withOpacity(0.3),
|
||||
onTap: () async {
|
||||
await MyApp.userViewModel.addOrDeleteFriend(widget.user.id);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
"Vous ne suivez plus ${widget.user.pseudo}",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontWeight: FontWeight.w400, fontSize: 20.h),
|
||||
),
|
||||
backgroundColor: Colors.red,
|
||||
closeIconColor: Colors.white,
|
||||
),
|
||||
);
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(28, 7, 28, 7),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(7))),
|
||||
child: Center(
|
||||
child: Text("Ajouté",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontWeight: FontWeight.w600, fontSize: 13)),
|
||||
),
|
||||
))),
|
||||
)
|
||||
: SizedBox(
|
||||
// Définir une largeur minimale pour le bouton "Ajouter"
|
||||
width: 120, // Réglez cette valeur en fonction de vos besoins
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
color: primaryColor,
|
||||
child: InkWell(
|
||||
splashColor: Colors.white.withOpacity(0.3),
|
||||
onTap: () async {
|
||||
await MyApp.userViewModel.addOrDeleteFriend(widget.user.id);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
backgroundColor: primaryColor,
|
||||
content: Text(
|
||||
"Vous suivez à present ${widget.user.pseudo}",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontWeight: FontWeight.w400, fontSize: 20.h),
|
||||
),
|
||||
),
|
||||
);
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(25, 7, 25, 7),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(7))),
|
||||
child: Center(
|
||||
child: Text("Ajouter",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontWeight: FontWeight.w600, fontSize: 13)),
|
||||
),
|
||||
)))),
|
||||
)
|
||||
: Container(),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
),
|
||||
RecapComponent(user: widget.user)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue