add button star
This commit is contained in:
@@ -12,6 +12,8 @@ class Events {
|
|||||||
List<String>? tags;
|
List<String>? tags;
|
||||||
List<String>? organizers;
|
List<String>? organizers;
|
||||||
String? imgUrl;
|
String? imgUrl;
|
||||||
|
int? interestedCount;
|
||||||
|
bool? interested;
|
||||||
Events(
|
Events(
|
||||||
{this.place,
|
{this.place,
|
||||||
this.id,
|
this.id,
|
||||||
@@ -25,7 +27,9 @@ class Events {
|
|||||||
this.organizers,
|
this.organizers,
|
||||||
this.link,
|
this.link,
|
||||||
this.ticket,
|
this.ticket,
|
||||||
this.imgUrl});
|
this.imgUrl,
|
||||||
|
this.interestedCount,
|
||||||
|
this.interested});
|
||||||
|
|
||||||
Events.fromJson(Map<String, dynamic> json) {
|
Events.fromJson(Map<String, dynamic> json) {
|
||||||
id = json['id'] as String?;
|
id = json['id'] as String?;
|
||||||
@@ -44,5 +48,7 @@ class Events {
|
|||||||
imgUrl = json['imgUrl'] as String?;
|
imgUrl = json['imgUrl'] as String?;
|
||||||
link = json['link'] as String?;
|
link = json['link'] as String?;
|
||||||
ticket = json['ticket'] as String?;
|
ticket = json['ticket'] as String?;
|
||||||
|
interested = json['interested'] as bool?;
|
||||||
|
interestedCount = json['interested_count'] as int?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -874,6 +874,17 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text('${post.name!}'),
|
title: Text('${post.name!}'),
|
||||||
subtitle: Text('${post.place!}\n${dateLongue}'),
|
subtitle: Text('${post.place!}\n${dateLongue}'),
|
||||||
|
trailing: IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
setState(() {
|
||||||
|
bool checkInterested = post?.interested ?? false;
|
||||||
|
post?.interested = !checkInterested;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
post?.interested ?? false ? Icons.star : Icons.star_border,
|
||||||
|
color:
|
||||||
|
post?.interested ?? false ? Colors.blue : Colors.grey)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
Reference in New Issue
Block a user