add tags in item
This commit is contained in:
parent
045209575e
commit
f2cd070898
@ -16,8 +16,6 @@ import '../classes/events.dart';
|
||||
|
||||
import 'ListItemMenu.dart';
|
||||
|
||||
import 'package:textfield_tags/textfield_tags.dart';
|
||||
|
||||
void main() {
|
||||
initializeDateFormatting("fr_FR", null).then((_) => (const MyApp()));
|
||||
}
|
||||
@ -73,6 +71,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
String organizers = "";
|
||||
String place = "";
|
||||
String imgUrl = "";
|
||||
List<String> tags = [];
|
||||
|
||||
Events? events;
|
||||
@override
|
||||
@ -91,6 +90,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
String formerMap = "";
|
||||
String formerImage = "";
|
||||
String formerDesc = "";
|
||||
List<String> formerTags = [];
|
||||
|
||||
if (accessToken.isNotEmpty) {
|
||||
var urlGet = Uri.parse("${globals.api}/events/${widget.title}");
|
||||
@ -105,6 +105,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
formerMap =
|
||||
"${events["place"]} - ${events["zip_code"]} ${events["city"]} - ${events["country"]}";
|
||||
formerDesc = events["description"];
|
||||
formerTags = List<String>.from(events['tags'] as List);
|
||||
final startDate = DateTime.parse(events["start_date"]);
|
||||
final date = DateFormat.yMd().format(startDate);
|
||||
final time = DateFormat.Hm().format(startDate);
|
||||
@ -118,13 +119,13 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
}
|
||||
|
||||
formerDate = "${date} ${time} à ${dateE} ${timeE}";
|
||||
if (events["organizers"].length > 1) {
|
||||
if (events["organizers"].length > 0) {
|
||||
formerOrga = "${events['organizers'][0]}";
|
||||
for (var i = 1; i < events["organizers"].length; i++) {
|
||||
formerOrga = "${formerOrga}, ${events['organizers'][i]}";
|
||||
}
|
||||
} else {
|
||||
formerOrga = "${events['organizers'][0]}";
|
||||
formerOrga = "";
|
||||
}
|
||||
} else {
|
||||
var text = "";
|
||||
@ -183,6 +184,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
place = formerMap;
|
||||
imgUrl = formerImage;
|
||||
eventDescription = formerDesc;
|
||||
tags = formerTags;
|
||||
});
|
||||
}
|
||||
|
||||
@ -274,7 +276,54 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
style: TextStyle(fontSize: 15.0),
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis))
|
||||
])
|
||||
]),
|
||||
Row(children: [
|
||||
Icon(Icons.category),
|
||||
Text("Tags : ",
|
||||
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold))
|
||||
]),
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
left: 8,
|
||||
),
|
||||
child: Wrap(
|
||||
runSpacing: 4.0,
|
||||
spacing: 4.0,
|
||||
children: tags.map((String tag) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(20.0),
|
||||
),
|
||||
color: Colors.blue,
|
||||
),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 5.0),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10.0, vertical: 5.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
child: Text(
|
||||
'$tag',
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
onTap: () {
|
||||
//print("$tag selected");
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
)));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user