fix likes
continuous-integration/drone/push Build is passing Details

FIX_LIKES_LDE
Lucas Delanier 2 years ago
parent 2b6182f5d0
commit 1ac6d85f59

@ -695,6 +695,48 @@
</list>
</value>
</entry>
<entry key="google_identity_services_web">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/google_identity_services_web-0.2.1/lib" />
</list>
</value>
</entry>
<entry key="google_sign_in">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/google_sign_in-6.1.4/lib" />
</list>
</value>
</entry>
<entry key="google_sign_in_android">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/google_sign_in_android-6.1.18/lib" />
</list>
</value>
</entry>
<entry key="google_sign_in_ios">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/google_sign_in_ios-5.6.2/lib" />
</list>
</value>
</entry>
<entry key="google_sign_in_platform_interface">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/google_sign_in_platform_interface-2.4.1/lib" />
</list>
</value>
</entry>
<entry key="google_sign_in_web">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/google_sign_in_web-0.12.0+2/lib" />
</list>
</value>
</entry>
<entry key="gradiantbutton">
<value>
<list>
@ -975,6 +1017,13 @@
</list>
</value>
</entry>
<entry key="quiver">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dev/quiver-3.2.1/lib" />
</list>
</value>
</entry>
<entry key="rxdart">
<value>
<list>

@ -302,33 +302,32 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
onTap: () async {
var bool = await MyApp.postViewModel
.addOrDeleteFavoritePost(widget.post.id);
print("testttt");
if (!bool) {
widget.post.likes.add(MyApp.userViewModel.userCurrent.id);
setState(() {});
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("Vous avez liké cette capsule",
style: TextStyle(fontWeight: FontWeight.bold)),
backgroundColor: primaryColor,
closeIconColor: Colors.white,
),
);
} else {
widget.post.likes.remove(MyApp.userViewModel.userCurrent.id);
setState(() {});
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("Vous avez supprimé votre like",
style: TextStyle(fontWeight: FontWeight.bold)),
backgroundColor: Colors.red,
closeIconColor: Colors.white,
),
);
}
!bool
? ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("Vous avez liké cette capsule",
style: TextStyle(fontWeight: FontWeight.bold)),
backgroundColor: primaryColor,
closeIconColor: Colors.white,
),
)
: ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: SnackBar(
content: Text("Vous avez supprimé votre like",
style: TextStyle(fontWeight: FontWeight.bold)),
backgroundColor: primaryColor,
closeIconColor: Colors.white,
),
backgroundColor: Colors.red,
closeIconColor: Colors.white,
),
);
setState(() {});
},
child: SvgPicture.asset(
"assets/images/heart.svg",

@ -108,9 +108,11 @@ class PostViewModel {
Future<bool> addOrDeleteFavoritePost(String id) async {
try {
return await _postService.addOrDeleteFavoritePost(id);
var bool = await _postService.addOrDeleteFavoritePost(id);
print(bool);
return bool;
} catch (e) {
print(e);
print("haaaaaaaaa");
rethrow;
}
}

Loading…
Cancel
Save