2 Commits

Author SHA1 Message Date
5354575430 add showmodal 2025-09-13 01:02:42 +02:00
6c2324cb91 fix set settings 2025-09-07 20:51:27 +02:00
2 changed files with 54 additions and 11 deletions

View File

@@ -48,17 +48,18 @@ class _EditProfileState extends State<EditSettings>
final AuthService _authService = AuthService();
TextEditingController inputUserName = TextEditingController();
int? kilometer;
int? kilometer = 50;
Future<void> getParameter() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
setState(() {
var kilometer = prefs.getDouble("kilometer")?.toInt() ?? null;
kilometer = prefs.getDouble("kilometer")?.toInt() ?? 50;
});
}
Future<void> setParameter() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
print("kilometer : ${kilometer}");
if (kilometer != null) {
prefs.setDouble("kilometer", kilometer?.toDouble() ?? 50);
showAlertDialog(
@@ -115,8 +116,7 @@ class _EditProfileState extends State<EditSettings>
AppLocalizations.of(context)?.define_kilometer ??
'Define kilometer',
),
value:
kilometer, // Set the initial selected value here, or leave as `null` if unselected.
value: kilometer,
items: [
DropdownMenuItem(
value: 5,
@@ -155,7 +155,7 @@ class _EditProfileState extends State<EditSettings>
color: Colors.blue,
borderRadius: BorderRadius.circular(20)),
child: TextButton(
onPressed: () {},
onPressed: setParameter,
child: Text(
AppLocalizations.of(context)?.update ?? "Update",
style: TextStyle(color: Colors.white, fontSize: 25),

View File

@@ -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,
backgroundColor: Colors.blue,
tooltip: loc?.search ?? 'Recherche',
child: const Icon(Icons.photo_camera, color: Colors.white),
),
)
]),
);
}