update calendar
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/components/primary_btn.dart';
|
||||
import 'package:prosappco/src/models/event_model.dart';
|
||||
import 'package:prosappco/src/presentation/screens/cita.dart';
|
||||
import 'package:prosappco/src/presentation/widgets/shared/loading_item_list.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
@@ -64,6 +65,8 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
today = DateTime.utc(today.year, today.month, today.day);
|
||||
|
||||
if (_events == null) {
|
||||
Event.getEventsAllByIdStatus(uid ?? "", 'aprobado')
|
||||
.then((value) => setState(() {
|
||||
@@ -87,8 +90,10 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_events == null) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -351,16 +356,32 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
return FutureBuilder(
|
||||
future: getByProId(DateFormat("yyyy-MM-dd 00:00:00.000").format(today)),
|
||||
builder: (BuildContext context, AsyncSnapshot<List<Event>> snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return const Text('No tienes citas');
|
||||
}
|
||||
|
||||
List<Event> eventos = [];
|
||||
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Column(
|
||||
children: [
|
||||
LoadingItemList(useCircleAvatar: false),
|
||||
LoadingItemList(useCircleAvatar: false),
|
||||
LoadingItemList(useCircleAvatar: false),
|
||||
LoadingItemList(useCircleAvatar: false),
|
||||
],
|
||||
);
|
||||
}
|
||||
try {
|
||||
snapshot.data!.sort((a, b) {
|
||||
String? range1Hour1A = a.range1Hour1;
|
||||
String? range1Hour1B = b.range1Hour1;
|
||||
|
||||
DateTime dateTimeA = DateTime.parse(range1Hour1A);
|
||||
DateTime dateTimeB = DateTime.parse(range1Hour1B);
|
||||
|
||||
return dateTimeB.compareTo(dateTimeA);
|
||||
});
|
||||
|
||||
eventos.addAll(snapshot.data!);
|
||||
} catch (e) {
|
||||
print("Error" + e.toString());
|
||||
print("Error al cargar eventos: inflar $e");
|
||||
}
|
||||
|
||||
if (eventos.isEmpty) {
|
||||
|
||||
@@ -262,7 +262,6 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
final ultimoMensaje = mensajes.last;
|
||||
final ultimoMensajeUser = ultimoMensaje['user'];
|
||||
if (ultimoMensajeUser == uid) {
|
||||
// El último mensaje fue enviado por ti, no se envía la notificación
|
||||
} else {
|
||||
sendPushNotification(user!.token!);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
child: ListView.builder(
|
||||
itemCount: 8,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return const LoadingItemList();
|
||||
return const LoadingItemList(useCircleAvatar: true);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user