- Ajout système complet de gestion des secteurs avec contours géographiques - Import des contours départementaux depuis GeoJSON - API REST pour la gestion des secteurs (/api/sectors) - Service de géolocalisation pour déterminer les secteurs - Migration base de données avec tables x_departements_contours et sectors_adresses - Interface Flutter pour visualisation et gestion des secteurs - Ajout thème sombre dans l'application - Corrections diverses et optimisations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
99 lines
2.7 KiB
Dart
Executable File
99 lines
2.7 KiB
Dart
Executable File
import 'package:flutter/material.dart';
|
|
|
|
/// Zone de saisie de message
|
|
///
|
|
/// Ce widget permet à l'utilisateur de saisir et envoyer des messages
|
|
|
|
class ChatInput extends StatefulWidget {
|
|
final Function(String) onSendText;
|
|
final Function(dynamic)? onSendFile;
|
|
final Function(dynamic)? onSendImage;
|
|
final bool enableAttachments;
|
|
final bool enabled;
|
|
final String hintText;
|
|
final String? disabledMessage;
|
|
final int? maxLength;
|
|
|
|
const ChatInput({
|
|
super.key,
|
|
required this.onSendText,
|
|
this.onSendFile,
|
|
this.onSendImage,
|
|
this.enableAttachments = true,
|
|
this.enabled = true,
|
|
this.hintText = 'Saisissez votre message...',
|
|
this.disabledMessage = 'Vous ne pouvez pas répondre à cette annonce',
|
|
this.maxLength,
|
|
});
|
|
|
|
@override
|
|
State<ChatInput> createState() => _ChatInputState();
|
|
}
|
|
|
|
class _ChatInputState extends State<ChatInput> {
|
|
final TextEditingController _textController = TextEditingController();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (!widget.enabled) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(8),
|
|
color: Colors.grey.shade200,
|
|
child: Text(
|
|
widget.disabledMessage ?? '',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(color: Colors.grey.shade600),
|
|
),
|
|
);
|
|
}
|
|
|
|
return Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
border: Border(top: BorderSide(color: Colors.grey.shade300)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
if (widget.enableAttachments)
|
|
IconButton(
|
|
icon: const Icon(Icons.attach_file),
|
|
onPressed: () {
|
|
// TODO: Gérer les pièces jointes
|
|
},
|
|
),
|
|
Expanded(
|
|
child: TextField(
|
|
controller: _textController,
|
|
decoration: InputDecoration(
|
|
hintText: widget.hintText,
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
),
|
|
maxLength: widget.maxLength,
|
|
maxLines: null,
|
|
),
|
|
),
|
|
IconButton(
|
|
icon: const Icon(Icons.send),
|
|
onPressed: () {
|
|
if (_textController.text.trim().isNotEmpty) {
|
|
widget.onSendText(_textController.text.trim());
|
|
_textController.clear();
|
|
}
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_textController.dispose();
|
|
super.dispose();
|
|
}
|
|
}
|