|
|
@ -15,18 +15,9 @@ class ProfileListComponent extends StatefulWidget {
|
|
|
|
class _ProfileListComponentState extends State<ProfileListComponent> {
|
|
|
|
class _ProfileListComponentState extends State<ProfileListComponent> {
|
|
|
|
late bool clicked;
|
|
|
|
late bool clicked;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
|
|
|
|
if (MyApp.userViewModel.isFriend(widget.user.id)) {
|
|
|
|
|
|
|
|
clicked = true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
clicked = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
clicked = MyApp.userViewModel.isFriend(widget.user.id);
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
padding: const EdgeInsets.only(bottom: 5),
|
|
|
|
padding: const EdgeInsets.only(bottom: 5),
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
@ -47,22 +38,38 @@ class _ProfileListComponentState extends State<ProfileListComponent> {
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
ScrollConfiguration(
|
|
|
|
Text(
|
|
|
|
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
|
|
|
widget.user.pseudo,
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
widget.user.uniquePseudo,
|
|
|
|
|
|
|
|
style: GoogleFonts.plusJakartaSans(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w700),
|
|
|
|
style: GoogleFonts.plusJakartaSans(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w700),
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
maxLines: 1,
|
|
|
|
maxLines: 1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
widget.user.uniquePseudo,
|
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
|
|
|
style: GoogleFonts.plusJakartaSans(color: Colors.grey, fontWeight: FontWeight.w400),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
widget.user.followed.contains(MyApp.userViewModel.userCurrent.id)
|
|
|
|
|
|
|
|
? Container(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(2),
|
|
|
|
|
|
|
|
margin: const EdgeInsets.only(left: 10),
|
|
|
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
|
|
|
color: grayColor,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(3)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ScrollConfiguration(
|
|
|
|
|
|
|
|
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
widget.user.pseudo,
|
|
|
|
"Vous suit",
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: GoogleFonts.plusJakartaSans(color: Colors.grey, fontWeight: FontWeight.w400),
|
|
|
|
style: GoogleFonts.plusJakartaSans(
|
|
|
|
))
|
|
|
|
color: Colors.grey.withOpacity(0.4), fontWeight: FontWeight.w700, fontSize: 12),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: Container(),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -73,11 +80,9 @@ class _ProfileListComponentState extends State<ProfileListComponent> {
|
|
|
|
color: selectedButton,
|
|
|
|
color: selectedButton,
|
|
|
|
child: InkWell(
|
|
|
|
child: InkWell(
|
|
|
|
splashColor: Colors.white.withOpacity(0.3),
|
|
|
|
splashColor: Colors.white.withOpacity(0.3),
|
|
|
|
onTap: () {
|
|
|
|
onTap: () async {
|
|
|
|
MyApp.userViewModel.addOrDeleteFriend(widget.user.id);
|
|
|
|
await MyApp.userViewModel.addOrDeleteFriend(widget.user.id);
|
|
|
|
setState(() {
|
|
|
|
setState(() {});
|
|
|
|
clicked = !clicked;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.fromLTRB(28, 7, 28, 7),
|
|
|
|
padding: EdgeInsets.fromLTRB(28, 7, 28, 7),
|
|
|
@ -93,11 +98,9 @@ class _ProfileListComponentState extends State<ProfileListComponent> {
|
|
|
|
color: primaryColor,
|
|
|
|
color: primaryColor,
|
|
|
|
child: InkWell(
|
|
|
|
child: InkWell(
|
|
|
|
splashColor: Colors.white.withOpacity(0.3),
|
|
|
|
splashColor: Colors.white.withOpacity(0.3),
|
|
|
|
onTap: () {
|
|
|
|
onTap: () async {
|
|
|
|
MyApp.userViewModel.addOrDeleteFriend(widget.user.id);
|
|
|
|
await MyApp.userViewModel.addOrDeleteFriend(widget.user.id);
|
|
|
|
setState(() {
|
|
|
|
setState(() {});
|
|
|
|
clicked = !clicked;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.fromLTRB(25, 7, 25, 7),
|
|
|
|
padding: EdgeInsets.fromLTRB(25, 7, 25, 7),
|
|
|
|