Compare commits
2 Commits
main
...
feature/ch
Author | SHA1 | Date | |
---|---|---|---|
5354575430 | |||
6c2324cb91 |
@@ -48,17 +48,18 @@ class _EditProfileState extends State<EditSettings>
|
|||||||
final AuthService _authService = AuthService();
|
final AuthService _authService = AuthService();
|
||||||
|
|
||||||
TextEditingController inputUserName = TextEditingController();
|
TextEditingController inputUserName = TextEditingController();
|
||||||
int? kilometer;
|
int? kilometer = 50;
|
||||||
|
|
||||||
Future<void> getParameter() async {
|
Future<void> getParameter() async {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
setState(() {
|
setState(() {
|
||||||
var kilometer = prefs.getDouble("kilometer")?.toInt() ?? null;
|
kilometer = prefs.getDouble("kilometer")?.toInt() ?? 50;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setParameter() async {
|
Future<void> setParameter() async {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
print("kilometer : ${kilometer}");
|
||||||
if (kilometer != null) {
|
if (kilometer != null) {
|
||||||
prefs.setDouble("kilometer", kilometer?.toDouble() ?? 50);
|
prefs.setDouble("kilometer", kilometer?.toDouble() ?? 50);
|
||||||
showAlertDialog(
|
showAlertDialog(
|
||||||
@@ -115,8 +116,7 @@ class _EditProfileState extends State<EditSettings>
|
|||||||
AppLocalizations.of(context)?.define_kilometer ??
|
AppLocalizations.of(context)?.define_kilometer ??
|
||||||
'Define kilometer',
|
'Define kilometer',
|
||||||
),
|
),
|
||||||
value:
|
value: kilometer,
|
||||||
kilometer, // Set the initial selected value here, or leave as `null` if unselected.
|
|
||||||
items: [
|
items: [
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
value: 5,
|
value: 5,
|
||||||
@@ -155,7 +155,7 @@ class _EditProfileState extends State<EditSettings>
|
|||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
borderRadius: BorderRadius.circular(20)),
|
borderRadius: BorderRadius.circular(20)),
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () {},
|
onPressed: setParameter,
|
||||||
child: Text(
|
child: Text(
|
||||||
AppLocalizations.of(context)?.update ?? "Update",
|
AppLocalizations.of(context)?.update ?? "Update",
|
||||||
style: TextStyle(color: Colors.white, fontSize: 25),
|
style: TextStyle(color: Colors.white, fontSize: 25),
|
||||||
|
@@ -853,12 +853,55 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||||
|
const SizedBox(height: 12), // espace entre les deux boutons
|
||||||
|
FloatingActionButton(
|
||||||
|
heroTag: "btn2",
|
||||||
|
onPressed: () {
|
||||||
|
// Action du deuxième bouton : ouvrir ton modal
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
final controller = TextEditingController();
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text("Nouveau message"),
|
||||||
|
content: TextField(
|
||||||
|
controller: controller,
|
||||||
|
decoration:
|
||||||
|
InputDecoration(hintText: "Écris ton message..."),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
child: Text("Annuler"),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
final msg = controller.text.trim();
|
||||||
|
if (msg.isNotEmpty) {
|
||||||
|
print("Message saisi: $msg");
|
||||||
|
// ➝ ici tu peux envoyer à ton chatbot
|
||||||
|
}
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Text("Envoyer"),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
backgroundColor: Colors.green,
|
||||||
|
tooltip: 'Chatbot',
|
||||||
|
child: const Icon(Icons.chat, color: Colors.white),
|
||||||
|
),
|
||||||
|
FloatingActionButton(
|
||||||
onPressed: popCamera,
|
onPressed: popCamera,
|
||||||
backgroundColor: Colors.blue,
|
backgroundColor: Colors.blue,
|
||||||
tooltip: loc?.search ?? 'Recherche',
|
tooltip: loc?.search ?? 'Recherche',
|
||||||
child: const Icon(Icons.photo_camera, color: Colors.white),
|
child: const Icon(Icons.photo_camera, color: Colors.white),
|
||||||
),
|
)
|
||||||
|
]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user