feature/category #10
@ -132,7 +132,7 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen>
|
|||||||
gemini
|
gemini
|
||||||
.textAndImage(
|
.textAndImage(
|
||||||
text:
|
text:
|
||||||
"Peux-tu donner le nom, la date avec l'année actuelle ou d'une année future proche et le lieu de l'évènement sous format JSON avec les valeurs suivantes : name, address, city, zip_code, country, description, start_date et end_date sous le format en YYYY-MM-DD HH:mm:ssZ, et sans la présence du mot json dans la chaîne de caractère",
|
"Peux-tu donner le nom, la date avec l'année actuelle ou d'une année future proche et le lieu de l'évènement sous format JSON avec les valeurs suivantes : name, address, city, zip_code, country, description, tags (tableau sans espace), organizers (tableau), start_date et end_date sous le format en YYYY-MM-DD HH:mm:ssZ, et sans la présence du mot json dans la chaîne de caractère",
|
||||||
images: [file.readAsBytesSync()],
|
images: [file.readAsBytesSync()],
|
||||||
modelName: "models/gemini-1.5-pro-latest")
|
modelName: "models/gemini-1.5-pro-latest")
|
||||||
.then((value) => searchEvents(
|
.then((value) => searchEvents(
|
||||||
|
@ -4,6 +4,7 @@ import 'dart:io';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:covas_mobile/classes/alert.dart';
|
import 'package:covas_mobile/classes/alert.dart';
|
||||||
|
import 'package:covas_mobile/pages/ListItemByTags.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
@ -15,6 +16,8 @@ import '../variable/globals.dart' as globals;
|
|||||||
import '../classes/events.dart';
|
import '../classes/events.dart';
|
||||||
|
|
||||||
import 'ListItemMenu.dart';
|
import 'ListItemMenu.dart';
|
||||||
|
import 'ListItemByTags.dart';
|
||||||
|
import 'ListItemByOrganizers.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
initializeDateFormatting("fr_FR", null).then((_) => (const MyApp()));
|
initializeDateFormatting("fr_FR", null).then((_) => (const MyApp()));
|
||||||
@ -68,9 +71,10 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
|||||||
String eventName = "";
|
String eventName = "";
|
||||||
String eventStartDate = "";
|
String eventStartDate = "";
|
||||||
String eventDescription = "";
|
String eventDescription = "";
|
||||||
String organizers = "";
|
|
||||||
String place = "";
|
String place = "";
|
||||||
String imgUrl = "";
|
String imgUrl = "";
|
||||||
|
List<String> tags = [];
|
||||||
|
List<String> organizers = [];
|
||||||
|
|
||||||
Events? events;
|
Events? events;
|
||||||
@override
|
@override
|
||||||
@ -85,10 +89,11 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
|||||||
var accessToken = prefs.getString("access_token") ?? "";
|
var accessToken = prefs.getString("access_token") ?? "";
|
||||||
String formerName = "";
|
String formerName = "";
|
||||||
String formerDate = "";
|
String formerDate = "";
|
||||||
String formerOrga = "";
|
|
||||||
String formerMap = "";
|
String formerMap = "";
|
||||||
String formerImage = "";
|
String formerImage = "";
|
||||||
String formerDesc = "";
|
String formerDesc = "";
|
||||||
|
List<String> formerTags = [];
|
||||||
|
List<String> formerOrga = [];
|
||||||
|
|
||||||
if (accessToken.isNotEmpty) {
|
if (accessToken.isNotEmpty) {
|
||||||
var urlGet = Uri.parse("${globals.api}/events/${widget.title}");
|
var urlGet = Uri.parse("${globals.api}/events/${widget.title}");
|
||||||
@ -103,6 +108,8 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
|||||||
formerMap =
|
formerMap =
|
||||||
"${events["place"]} - ${events["zip_code"]} ${events["city"]} - ${events["country"]}";
|
"${events["place"]} - ${events["zip_code"]} ${events["city"]} - ${events["country"]}";
|
||||||
formerDesc = events["description"];
|
formerDesc = events["description"];
|
||||||
|
formerTags = List<String>.from(events['tags'] as List);
|
||||||
|
formerOrga = List<String>.from(events['organizers'] as List);
|
||||||
final startDate = DateTime.parse(events["start_date"]);
|
final startDate = DateTime.parse(events["start_date"]);
|
||||||
final date = DateFormat.yMd().format(startDate);
|
final date = DateFormat.yMd().format(startDate);
|
||||||
final time = DateFormat.Hm().format(startDate);
|
final time = DateFormat.Hm().format(startDate);
|
||||||
@ -116,14 +123,6 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
formerDate = "${date} ${time} à ${dateE} ${timeE}";
|
formerDate = "${date} ${time} à ${dateE} ${timeE}";
|
||||||
if (events["organizers"].length > 1) {
|
|
||||||
formerOrga = "${events['organizers'][0]}";
|
|
||||||
for (var i = 1; i < events["organizers"].length; i++) {
|
|
||||||
formerOrga = "${formerOrga}, ${events['organizers'][i]}";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
formerOrga = "${events['organizers'][0]}";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
var text = "";
|
var text = "";
|
||||||
switch (responseGet.statusCode) {
|
switch (responseGet.statusCode) {
|
||||||
@ -181,6 +180,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
|||||||
place = formerMap;
|
place = formerMap;
|
||||||
imgUrl = formerImage;
|
imgUrl = formerImage;
|
||||||
eventDescription = formerDesc;
|
eventDescription = formerDesc;
|
||||||
|
tags = formerTags;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
// Here we take the value from the MyHomePage object that was created by
|
// Here we take the value from the MyHomePage object that was created by
|
||||||
// the App.build method, and use it to set our appbar title.
|
// the App.build method, and use it to set our appbar title.
|
||||||
title: Text("${eventName}"),
|
title: Text("${eventName}", overflow: TextOverflow.ellipsis),
|
||||||
backgroundColor: Colors.blue,
|
backgroundColor: Colors.blue,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
@ -254,12 +254,50 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
|||||||
]),
|
]),
|
||||||
Row(children: [
|
Row(children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
|
flex: 3,
|
||||||
|
fit: FlexFit.tight,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 8,
|
||||||
|
bottom: 8,
|
||||||
|
left: 8,
|
||||||
|
),
|
||||||
|
child: Wrap(
|
||||||
|
runSpacing: 2.0,
|
||||||
|
spacing: 2.0,
|
||||||
|
children: organizers.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(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => ListItemOrganizers(
|
||||||
|
organizer: '$tag')));
|
||||||
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
"${organizers}",
|
'$tag',
|
||||||
style: TextStyle(fontSize: 15.0),
|
style: const TextStyle(color: Colors.white),
|
||||||
maxLines: 3,
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
),
|
||||||
))
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList()),
|
||||||
|
)),
|
||||||
]),
|
]),
|
||||||
Row(children: [
|
Row(children: [
|
||||||
Icon(Icons.description),
|
Icon(Icons.description),
|
||||||
@ -272,7 +310,63 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
|||||||
style: TextStyle(fontSize: 15.0),
|
style: TextStyle(fontSize: 15.0),
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
overflow: TextOverflow.ellipsis))
|
overflow: TextOverflow.ellipsis))
|
||||||
])
|
]),
|
||||||
|
Row(children: [
|
||||||
|
Icon(Icons.category),
|
||||||
|
Text("Tags : ",
|
||||||
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold))
|
||||||
|
]),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 3,
|
||||||
|
fit: FlexFit.tight,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 8,
|
||||||
|
bottom: 8,
|
||||||
|
left: 8,
|
||||||
|
),
|
||||||
|
child: Wrap(
|
||||||
|
runSpacing: 2.0,
|
||||||
|
spacing: 2.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(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) =>
|
||||||
|
ListItemTags(tags: '$tag')));
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'$tag',
|
||||||
|
style:
|
||||||
|
const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList()),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
124
covas_mobile/lib/pages/ListItemByOrganizers.dart
Normal file
124
covas_mobile/lib/pages/ListItemByOrganizers.dart
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
import "ItemMenu.dart";
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../classes/events.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:intl/date_symbol_data_local.dart';
|
||||||
|
|
||||||
|
import '../variable/globals.dart' as globals;
|
||||||
|
|
||||||
|
// app starting point
|
||||||
|
void main() {
|
||||||
|
initializeDateFormatting("fr_FR", null).then((_) => (const MyApp()));
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
home: const ListItemOrganizers(organizer: "default"),
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// homepage class
|
||||||
|
class ListItemOrganizers extends StatefulWidget {
|
||||||
|
const ListItemOrganizers({Key? key, required this.organizer})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
final String organizer;
|
||||||
|
@override
|
||||||
|
State<ListItemOrganizers> createState() => _MyHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
// homepage state
|
||||||
|
class _MyHomePageState extends State<ListItemOrganizers> {
|
||||||
|
// variable to call and store future list of posts
|
||||||
|
|
||||||
|
// function to fetch data from api and return future list of posts
|
||||||
|
static Future<List<Events>> getPosts(organizer) async {
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
var accessToken = prefs.getString("access_token") ?? "";
|
||||||
|
final List<Events> body = [];
|
||||||
|
if (accessToken.isNotEmpty) {
|
||||||
|
var url = Uri.parse("${globals.api}/events?organizers=${organizer}");
|
||||||
|
final response = await http.get(url, headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
HttpHeaders.cookieHeader: "access_token=${accessToken}"
|
||||||
|
});
|
||||||
|
final List body = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
return body.map((e) => Events.fromJson(e)).toList();
|
||||||
|
}
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
// build function
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Center(
|
||||||
|
// FutureBuilder
|
||||||
|
child: FutureBuilder<List<Events>>(
|
||||||
|
future: getPosts(widget.organizer),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
// until data is fetched, show loader
|
||||||
|
return const CircularProgressIndicator();
|
||||||
|
} else if (snapshot.hasData) {
|
||||||
|
// once data is fetched, display it on screen (call buildPosts())
|
||||||
|
final posts = snapshot.data!;
|
||||||
|
return buildPosts(posts);
|
||||||
|
} else {
|
||||||
|
// if no data, show simple Text
|
||||||
|
return const Text("No data available");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// function to display fetched data on screen
|
||||||
|
Widget buildPosts(List<Events> posts) {
|
||||||
|
// ListView Builder to show data in a list
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
// Here we take the value from the MyHomePage object that was created by
|
||||||
|
// the App.build method, and use it to set our appbar title.
|
||||||
|
title: Text("Organisateur : ${widget.organizer}",
|
||||||
|
overflow: TextOverflow.ellipsis),
|
||||||
|
backgroundColor: Colors.blue,
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
),
|
||||||
|
body: ListView.separated(
|
||||||
|
itemCount: posts.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final post = posts[index];
|
||||||
|
final startDate = DateTime.parse(post.startDate!);
|
||||||
|
final date = DateFormat.yMd().format(startDate);
|
||||||
|
final time = DateFormat.Hm().format(startDate);
|
||||||
|
|
||||||
|
return ListTile(
|
||||||
|
title: Text('${post.name!}'),
|
||||||
|
subtitle: Text('${post.place!}\n${date} ${time}'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => ItemMenu(title: post.id!)));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return Divider();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
122
covas_mobile/lib/pages/ListItemByTags.dart
Normal file
122
covas_mobile/lib/pages/ListItemByTags.dart
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
import "ItemMenu.dart";
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../classes/events.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:intl/date_symbol_data_local.dart';
|
||||||
|
|
||||||
|
import '../variable/globals.dart' as globals;
|
||||||
|
|
||||||
|
// app starting point
|
||||||
|
void main() {
|
||||||
|
initializeDateFormatting("fr_FR", null).then((_) => (const MyApp()));
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
home: const ListItemTags(tags: "default"),
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// homepage class
|
||||||
|
class ListItemTags extends StatefulWidget {
|
||||||
|
const ListItemTags({Key? key, required this.tags}) : super(key: key);
|
||||||
|
|
||||||
|
final String tags;
|
||||||
|
@override
|
||||||
|
State<ListItemTags> createState() => _MyHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
// homepage state
|
||||||
|
class _MyHomePageState extends State<ListItemTags> {
|
||||||
|
// variable to call and store future list of posts
|
||||||
|
|
||||||
|
// function to fetch data from api and return future list of posts
|
||||||
|
static Future<List<Events>> getPosts(tags) async {
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
var accessToken = prefs.getString("access_token") ?? "";
|
||||||
|
final List<Events> body = [];
|
||||||
|
if (accessToken.isNotEmpty) {
|
||||||
|
var url = Uri.parse("${globals.api}/events?tags=${tags}");
|
||||||
|
final response = await http.get(url, headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
HttpHeaders.cookieHeader: "access_token=${accessToken}"
|
||||||
|
});
|
||||||
|
final List body = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
return body.map((e) => Events.fromJson(e)).toList();
|
||||||
|
}
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
// build function
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Center(
|
||||||
|
// FutureBuilder
|
||||||
|
child: FutureBuilder<List<Events>>(
|
||||||
|
future: getPosts(widget.tags),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
// until data is fetched, show loader
|
||||||
|
return const CircularProgressIndicator();
|
||||||
|
} else if (snapshot.hasData) {
|
||||||
|
// once data is fetched, display it on screen (call buildPosts())
|
||||||
|
final posts = snapshot.data!;
|
||||||
|
return buildPosts(posts);
|
||||||
|
} else {
|
||||||
|
// if no data, show simple Text
|
||||||
|
return const Text("No data available");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// function to display fetched data on screen
|
||||||
|
Widget buildPosts(List<Events> posts) {
|
||||||
|
// ListView Builder to show data in a list
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
// Here we take the value from the MyHomePage object that was created by
|
||||||
|
// the App.build method, and use it to set our appbar title.
|
||||||
|
title: Text("Tags : ${widget.tags}", overflow: TextOverflow.ellipsis),
|
||||||
|
backgroundColor: Colors.blue,
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
),
|
||||||
|
body: ListView.separated(
|
||||||
|
itemCount: posts.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final post = posts[index];
|
||||||
|
final startDate = DateTime.parse(post.startDate!);
|
||||||
|
final date = DateFormat.yMd().format(startDate);
|
||||||
|
final time = DateFormat.Hm().format(startDate);
|
||||||
|
|
||||||
|
return ListTile(
|
||||||
|
title: Text('${post.name!}'),
|
||||||
|
subtitle: Text('${post.place!}\n${date} ${time}'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => ItemMenu(title: post.id!)));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return Divider();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import 'package:textfield_tags/textfield_tags.dart';
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
@ -56,13 +57,22 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
TextEditingController startTimepicker = TextEditingController();
|
TextEditingController startTimepicker = TextEditingController();
|
||||||
TextEditingController endDatepicker = TextEditingController();
|
TextEditingController endDatepicker = TextEditingController();
|
||||||
TextEditingController endTimepicker = TextEditingController();
|
TextEditingController endTimepicker = TextEditingController();
|
||||||
|
final _stringTagController = StringTagController();
|
||||||
|
List<String> initialTags = [];
|
||||||
|
|
||||||
|
final _stringOrgaController = StringTagController();
|
||||||
|
List<String> initialOrga = [];
|
||||||
|
|
||||||
onTapFunctionDatePicker(
|
onTapFunctionDatePicker(
|
||||||
{required BuildContext context, required String position}) async {
|
{required BuildContext context, required String position}) async {
|
||||||
|
String date = "start_date";
|
||||||
|
if (position == "end") {
|
||||||
|
date = "end_date";
|
||||||
|
}
|
||||||
DateTime? pickedDate = await showDatePicker(
|
DateTime? pickedDate = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
firstDate: DateTime.parse(widget.events["date"]),
|
firstDate: DateTime.parse(widget.events[date]),
|
||||||
initialDate: DateTime.parse(widget.events["date"]),
|
initialDate: DateTime.parse(widget.events[date]),
|
||||||
lastDate: DateTime(2104));
|
lastDate: DateTime(2104));
|
||||||
if (pickedDate == null) return;
|
if (pickedDate == null) return;
|
||||||
if (position == "start") {
|
if (position == "start") {
|
||||||
@ -75,10 +85,14 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
|
|
||||||
onTapFunctionTimePicker(
|
onTapFunctionTimePicker(
|
||||||
{required BuildContext context, required String position}) async {
|
{required BuildContext context, required String position}) async {
|
||||||
|
String date = "start_date";
|
||||||
|
if (position == "end") {
|
||||||
|
date = "end_date";
|
||||||
|
}
|
||||||
TimeOfDay? pickedDate = await showTimePicker(
|
TimeOfDay? pickedDate = await showTimePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialTime:
|
initialTime:
|
||||||
TimeOfDay.fromDateTime(DateTime.parse(widget.events["date"])));
|
TimeOfDay.fromDateTime(DateTime.parse(widget.events[date])));
|
||||||
if (pickedDate == null) return;
|
if (pickedDate == null) return;
|
||||||
if (position == "start") {
|
if (position == "start") {
|
||||||
startTimepicker.text = pickedDate.format(context);
|
startTimepicker.text = pickedDate.format(context);
|
||||||
@ -95,6 +109,13 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
convertNulltoArray(List<String> check) {
|
||||||
|
if (check == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return check;
|
||||||
|
}
|
||||||
|
|
||||||
String formatDate(String date) {
|
String formatDate(String date) {
|
||||||
var splitedDate = date.split("-");
|
var splitedDate = date.split("-");
|
||||||
var day = splitedDate[0];
|
var day = splitedDate[0];
|
||||||
@ -112,6 +133,9 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
var country = inputCountry.text;
|
var country = inputCountry.text;
|
||||||
var zipCode = inputZipCode.text;
|
var zipCode = inputZipCode.text;
|
||||||
var description = inputDesc.text;
|
var description = inputDesc.text;
|
||||||
|
List<String> tags = List<String>.from(_stringTagController.getTags as List);
|
||||||
|
List<String> organizers =
|
||||||
|
List<String>.from(_stringOrgaController.getTags as List);
|
||||||
|
|
||||||
var startDateFormat = formatDate(startDatepicker.text);
|
var startDateFormat = formatDate(startDatepicker.text);
|
||||||
var endDateFormat = formatDate(endDatepicker.text);
|
var endDateFormat = formatDate(endDatepicker.text);
|
||||||
@ -122,7 +146,7 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
print("end date : ${endDate}");
|
print("end date : ${endDate}");
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
var accessToken = prefs.getString("access_token") ?? "";
|
var accessToken = prefs.getString("access_token") ?? "";
|
||||||
List<String> send = ["toto"];
|
|
||||||
if (accessToken.isNotEmpty) {
|
if (accessToken.isNotEmpty) {
|
||||||
try {
|
try {
|
||||||
await dotenv.load();
|
await dotenv.load();
|
||||||
@ -167,11 +191,12 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
'zip_code': zipCode,
|
'zip_code': zipCode,
|
||||||
'country': country,
|
'country': country,
|
||||||
'city': city,
|
'city': city,
|
||||||
'organizers': send,
|
'organizers': organizers,
|
||||||
'latitude': '0.0',
|
'latitude': '0.0',
|
||||||
'longitude': '0.0',
|
'longitude': '0.0',
|
||||||
'description': description,
|
'description': description,
|
||||||
"imgUrl": imgUrl
|
"imgUrl": imgUrl,
|
||||||
|
"tags": tags
|
||||||
}));
|
}));
|
||||||
print(responsePut.statusCode);
|
print(responsePut.statusCode);
|
||||||
if ((responsePut.statusCode == 200) ||
|
if ((responsePut.statusCode == 200) ||
|
||||||
@ -246,6 +271,8 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
endDatepicker.text = DateFormat("dd-MM-yyyy").format(pickedEndDate);
|
endDatepicker.text = DateFormat("dd-MM-yyyy").format(pickedEndDate);
|
||||||
startTimepicker.text = DateFormat("HH-mm").format(pickedStartDate);
|
startTimepicker.text = DateFormat("HH-mm").format(pickedStartDate);
|
||||||
endTimepicker.text = DateFormat("HH-mm").format(pickedEndDate);
|
endTimepicker.text = DateFormat("HH-mm").format(pickedEndDate);
|
||||||
|
initialTags = List<String>.from(widget.events['tags'] as List);
|
||||||
|
initialOrga = List<String>.from(widget.events['organizers'] as List);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -254,6 +281,11 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
String? _validateField(String? value) {
|
||||||
|
return value!.isEmpty ? 'Champ requis' : null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -263,7 +295,9 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
backgroundColor: Colors.blue,
|
backgroundColor: Colors.blue,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
@ -280,8 +314,9 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
Padding(
|
Padding(
|
||||||
//padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0),
|
//padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0),
|
||||||
padding: EdgeInsets.symmetric(horizontal: 15),
|
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
controller: inputName,
|
controller: inputName,
|
||||||
|
validator: (value) => _validateField(value),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Nom',
|
labelText: 'Nom',
|
||||||
@ -292,8 +327,9 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
controller: inputAddress,
|
controller: inputAddress,
|
||||||
|
validator: (value) => _validateField(value),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Adresse',
|
labelText: 'Adresse',
|
||||||
@ -304,8 +340,9 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
controller: inputZipCode,
|
controller: inputZipCode,
|
||||||
|
validator: (value) => _validateField(value),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Code postal',
|
labelText: 'Code postal',
|
||||||
@ -316,8 +353,9 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
controller: inputCity,
|
controller: inputCity,
|
||||||
|
validator: (value) => _validateField(value),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Ville',
|
labelText: 'Ville',
|
||||||
@ -328,8 +366,9 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
controller: inputCountry,
|
controller: inputCountry,
|
||||||
|
validator: (value) => _validateField(value),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Pays',
|
labelText: 'Pays',
|
||||||
@ -340,12 +379,13 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
controller: startDatepicker,
|
controller: startDatepicker,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
|
validator: (value) => _validateField(value),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Date de debut de l\'évènement',
|
labelText: 'Date de debut',
|
||||||
hintText: 'Cliquez ici pour selectionner une date'),
|
hintText: 'Cliquez ici pour selectionner une date'),
|
||||||
onTap: () => onTapFunctionDatePicker(
|
onTap: () => onTapFunctionDatePicker(
|
||||||
context: context, position: "start")),
|
context: context, position: "start")),
|
||||||
@ -354,12 +394,13 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
controller: startTimepicker,
|
controller: startTimepicker,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
|
validator: (value) => _validateField(value),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Heure de debut de l\'évènement',
|
labelText: 'Heure de debut',
|
||||||
hintText: 'Cliquez ici pour selectionner une heure'),
|
hintText: 'Cliquez ici pour selectionner une heure'),
|
||||||
onTap: () => onTapFunctionTimePicker(
|
onTap: () => onTapFunctionTimePicker(
|
||||||
context: context, position: "start")),
|
context: context, position: "start")),
|
||||||
@ -368,12 +409,13 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
controller: endDatepicker,
|
controller: endDatepicker,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
|
validator: (value) => _validateField(value),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Date de fin de l\'évènement',
|
labelText: 'Date de fin',
|
||||||
hintText: 'Cliquez ici pour selectionner une date'),
|
hintText: 'Cliquez ici pour selectionner une date'),
|
||||||
onTap: () => onTapFunctionDatePicker(
|
onTap: () => onTapFunctionDatePicker(
|
||||||
context: context, position: "end")),
|
context: context, position: "end")),
|
||||||
@ -382,16 +424,207 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
//padding: EdgeInsets.symmetric(horizontal: 15),
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: TextField(
|
child: TextFormField(
|
||||||
controller: endTimepicker,
|
controller: endTimepicker,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
|
validator: (value) => _validateField(value),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Heure de fin de l\'évènement',
|
labelText: 'Heure de fin',
|
||||||
hintText: 'Cliquez ici pour selectionner une heure'),
|
hintText: 'Cliquez ici pour selectionner une heure'),
|
||||||
onTap: () => onTapFunctionTimePicker(
|
onTap: () => onTapFunctionTimePicker(
|
||||||
context: context, position: "end")),
|
context: context, position: "end")),
|
||||||
),
|
),
|
||||||
|
TextFieldTags<String>(
|
||||||
|
textfieldTagsController: _stringTagController,
|
||||||
|
initialTags: initialTags,
|
||||||
|
textSeparators: const [' ', ','],
|
||||||
|
validator: (String tag) {
|
||||||
|
if (_stringTagController.getTags!.contains(tag)) {
|
||||||
|
return 'Tu as deja rentre ce tag';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
inputFieldBuilder: (context, inputFieldValues) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
|
child: TextField(
|
||||||
|
controller: inputFieldValues.textEditingController,
|
||||||
|
focusNode: inputFieldValues.focusNode,
|
||||||
|
onChanged: inputFieldValues.onTagChanged,
|
||||||
|
onSubmitted: inputFieldValues.onTagSubmitted,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Tags',
|
||||||
|
hintText: inputFieldValues.tags.isNotEmpty
|
||||||
|
? ''
|
||||||
|
: "Enter tag...",
|
||||||
|
errorText: inputFieldValues.error,
|
||||||
|
prefixIcon: inputFieldValues.tags.isNotEmpty
|
||||||
|
? SingleChildScrollView(
|
||||||
|
controller:
|
||||||
|
inputFieldValues.tagScrollController,
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 8,
|
||||||
|
bottom: 8,
|
||||||
|
left: 8,
|
||||||
|
),
|
||||||
|
child: Wrap(
|
||||||
|
runSpacing: 4.0,
|
||||||
|
spacing: 4.0,
|
||||||
|
children: inputFieldValues.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");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4.0),
|
||||||
|
InkWell(
|
||||||
|
child: const Icon(
|
||||||
|
Icons.cancel,
|
||||||
|
size: 14.0,
|
||||||
|
color: Color.fromARGB(
|
||||||
|
255, 233, 233, 233),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
inputFieldValues
|
||||||
|
.onTagRemoved(tag);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList()),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
TextFieldTags<String>(
|
||||||
|
textfieldTagsController: _stringOrgaController,
|
||||||
|
initialTags: initialOrga,
|
||||||
|
textSeparators: const [','],
|
||||||
|
validator: (String tag) {
|
||||||
|
if (_stringOrgaController.getTags!.contains(tag)) {
|
||||||
|
return 'Cet organisateur est déjà rentré';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
inputFieldBuilder: (context, inputFieldValues) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
|
child: TextField(
|
||||||
|
controller: inputFieldValues.textEditingController,
|
||||||
|
focusNode: inputFieldValues.focusNode,
|
||||||
|
onChanged: inputFieldValues.onTagChanged,
|
||||||
|
onSubmitted: inputFieldValues.onTagSubmitted,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Organisateurs',
|
||||||
|
hintText: inputFieldValues.tags.isNotEmpty
|
||||||
|
? ''
|
||||||
|
: "Enter un organisateur...",
|
||||||
|
errorText: inputFieldValues.error,
|
||||||
|
prefixIcon: inputFieldValues.tags.isNotEmpty
|
||||||
|
? SingleChildScrollView(
|
||||||
|
controller:
|
||||||
|
inputFieldValues.tagScrollController,
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 8,
|
||||||
|
bottom: 8,
|
||||||
|
left: 8,
|
||||||
|
),
|
||||||
|
child: Wrap(
|
||||||
|
runSpacing: 4.0,
|
||||||
|
spacing: 4.0,
|
||||||
|
children: inputFieldValues.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");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4.0),
|
||||||
|
InkWell(
|
||||||
|
child: const Icon(
|
||||||
|
Icons.cancel,
|
||||||
|
size: 14.0,
|
||||||
|
color: Color.fromARGB(
|
||||||
|
255, 233, 233, 233),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
inputFieldValues
|
||||||
|
.onTagRemoved(tag);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList()),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
@ -413,10 +646,13 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
height: 50,
|
height: 50,
|
||||||
width: 250,
|
width: 250,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue, borderRadius: BorderRadius.circular(20)),
|
color: Colors.blue,
|
||||||
|
borderRadius: BorderRadius.circular(20)),
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
_updateEvent(context);
|
_updateEvent(context);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Ajouter',
|
'Ajouter',
|
||||||
@ -427,6 +663,6 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -581,6 +581,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.2"
|
version: "0.7.2"
|
||||||
|
textfield_tags:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: textfield_tags
|
||||||
|
sha256: d1f2204114157a1296bb97c20d7f8c8c7fd036212812afb2e19de7bb34acc55b
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.1"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -45,6 +45,7 @@ dependencies:
|
|||||||
flutter_dotenv: ^5.1.0
|
flutter_dotenv: ^5.1.0
|
||||||
image_picker: ^1.1.2
|
image_picker: ^1.1.2
|
||||||
date_format_field: ^0.1.0
|
date_format_field: ^0.1.0
|
||||||
|
textfield_tags: ^3.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user