fecha en mensajes y lista profesional
This commit is contained in:
@@ -367,9 +367,9 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Text(
|
||||
DateFormat('h:mm a').format(e.createdAt),
|
||||
_getFechaHoraFormateada(e.createdAt),
|
||||
style:
|
||||
const TextStyle(color: Colors.grey, fontSize: 12),
|
||||
const TextStyle(color: Colors.grey, fontSize: 11),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -403,10 +403,10 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Text(
|
||||
DateFormat('h:mm a').format(e.createdAt),
|
||||
_getFechaHoraFormateada(e.createdAt),
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 12,
|
||||
fontSize: 11,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -417,7 +417,26 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<List<dynamic>> _getUserAndProfessionalInfo(ServiceEntity service) async {
|
||||
String _getFechaHoraFormateada(DateTime fecha) {
|
||||
final now = DateTime.now();
|
||||
final yesterday = now.subtract(const Duration(days: 1));
|
||||
final formatter = DateFormat('h:mm a');
|
||||
|
||||
if (fecha.day == now.day &&
|
||||
fecha.month == now.month &&
|
||||
fecha.year == now.year) {
|
||||
return 'Hoy - ${formatter.format(fecha)}';
|
||||
} else if (fecha.day == yesterday.day &&
|
||||
fecha.month == yesterday.month &&
|
||||
fecha.year == yesterday.year) {
|
||||
return 'Ayer - ${formatter.format(fecha)}';
|
||||
} else {
|
||||
return '${DateFormat('dd/MM/yyyy').format(fecha)} - ${formatter.format(fecha)}';
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<dynamic>> _getUserAndProfessionalInfo(
|
||||
ServiceEntity service) async {
|
||||
final userRepo = FirebaseUserRepository(FirebaseAuth.instance);
|
||||
|
||||
final MyUser? userInfo;
|
||||
|
||||
@@ -81,55 +81,64 @@ class _ProfessionalListScreenState extends State<ProfessionalListScreen> {
|
||||
children: [
|
||||
_isLoading
|
||||
? _buildShimmerEffect()
|
||||
: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Colors.grey[400]!,
|
||||
: _selectedProfession == null
|
||||
? Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Colors.grey[400]!,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
isExpanded: true,
|
||||
value: _selectedProfession,
|
||||
hint: const Text('Seleccione una profesión'),
|
||||
items: _filteredProfessions
|
||||
?.map((String profession) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: profession,
|
||||
child: Text(profession),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
_selectedProfession = newValue;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
_selectedProfession != null
|
||||
? TextField(
|
||||
controller: _searchController,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_searchController.text = value;
|
||||
});
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Busca un profesional',
|
||||
prefixIcon: Icon(Icons.search),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey),
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
isExpanded: true,
|
||||
value: _selectedProfession,
|
||||
hint: const Text('Seleccione una profesión'),
|
||||
items:
|
||||
_filteredProfessions?.map((String profession) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: profession,
|
||||
child: Text(profession),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
_selectedProfession = newValue;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
controller: _searchController,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_searchController.text = value;
|
||||
});
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Busca un profesional',
|
||||
prefixIcon: Icon(Icons.search),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey),
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
Expanded(
|
||||
child: _body(state),
|
||||
child: _selectedProfession != null
|
||||
? _body(state)
|
||||
: const Center(
|
||||
child: Text(
|
||||
'Agrega los filtros para ver los profesionales'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -151,6 +160,8 @@ class _ProfessionalListScreenState extends State<ProfessionalListScreen> {
|
||||
.contains(removeDiacritics(_searchController.text.toLowerCase())))
|
||||
.where((user) =>
|
||||
user.myUser.id != FirebaseAuth.instance.currentUser!.uid)
|
||||
.where(
|
||||
(user) => user.professionalInfo.profession == _selectedProfession)
|
||||
.toList();
|
||||
// } else {
|
||||
// filteredUsers = state.users
|
||||
@@ -160,7 +171,7 @@ class _ProfessionalListScreenState extends State<ProfessionalListScreen> {
|
||||
|
||||
if (filteredUsers.isEmpty) {
|
||||
return const Center(
|
||||
child: Text('No hay profesionales'),
|
||||
child: Text('Ningun profesional coincide con la busqueda'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user