fecha en mensajes y lista profesional
This commit is contained in:
@@ -367,9 +367,9 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
child: Text(
|
child: Text(
|
||||||
DateFormat('h:mm a').format(e.createdAt),
|
_getFechaHoraFormateada(e.createdAt),
|
||||||
style:
|
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(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
child: Text(
|
child: Text(
|
||||||
DateFormat('h:mm a').format(e.createdAt),
|
_getFechaHoraFormateada(e.createdAt),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
fontSize: 12,
|
fontSize: 11,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -417,7 +417,26 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
.toList();
|
.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 userRepo = FirebaseUserRepository(FirebaseAuth.instance);
|
||||||
|
|
||||||
final MyUser? userInfo;
|
final MyUser? userInfo;
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ class _ProfessionalListScreenState extends State<ProfessionalListScreen> {
|
|||||||
children: [
|
children: [
|
||||||
_isLoading
|
_isLoading
|
||||||
? _buildShimmerEffect()
|
? _buildShimmerEffect()
|
||||||
: Container(
|
: _selectedProfession == null
|
||||||
|
? Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
@@ -95,8 +96,8 @@ class _ProfessionalListScreenState extends State<ProfessionalListScreen> {
|
|||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
value: _selectedProfession,
|
value: _selectedProfession,
|
||||||
hint: const Text('Seleccione una profesión'),
|
hint: const Text('Seleccione una profesión'),
|
||||||
items:
|
items: _filteredProfessions
|
||||||
_filteredProfessions?.map((String profession) {
|
?.map((String profession) {
|
||||||
return DropdownMenuItem<String>(
|
return DropdownMenuItem<String>(
|
||||||
value: profession,
|
value: profession,
|
||||||
child: Text(profession),
|
child: Text(profession),
|
||||||
@@ -109,8 +110,10 @@ class _ProfessionalListScreenState extends State<ProfessionalListScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
TextField(
|
: Container(),
|
||||||
|
_selectedProfession != null
|
||||||
|
? TextField(
|
||||||
controller: _searchController,
|
controller: _searchController,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -127,9 +130,15 @@ class _ProfessionalListScreenState extends State<ProfessionalListScreen> {
|
|||||||
borderSide: BorderSide(color: Colors.grey),
|
borderSide: BorderSide(color: Colors.grey),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
|
: Container(),
|
||||||
Expanded(
|
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())))
|
.contains(removeDiacritics(_searchController.text.toLowerCase())))
|
||||||
.where((user) =>
|
.where((user) =>
|
||||||
user.myUser.id != FirebaseAuth.instance.currentUser!.uid)
|
user.myUser.id != FirebaseAuth.instance.currentUser!.uid)
|
||||||
|
.where(
|
||||||
|
(user) => user.professionalInfo.profession == _selectedProfession)
|
||||||
.toList();
|
.toList();
|
||||||
// } else {
|
// } else {
|
||||||
// filteredUsers = state.users
|
// filteredUsers = state.users
|
||||||
@@ -160,7 +171,7 @@ class _ProfessionalListScreenState extends State<ProfessionalListScreen> {
|
|||||||
|
|
||||||
if (filteredUsers.isEmpty) {
|
if (filteredUsers.isEmpty) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: Text('No hay profesionales'),
|
child: Text('Ningun profesional coincide con la busqueda'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user