horario_modal.dart 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import 'package:flutter/material.dart';
  2. void verificarHorarioModal(BuildContext context) {
  3. DateTime now = DateTime.now();
  4. int hora = now.hour;
  5. int minuto = now.minute;
  6. int weekday = now.weekday;
  7. print(now);
  8. // 1 = Lunes, 7 = Domingo
  9. bool isOpen = false;
  10. if (weekday >= 1 && weekday <= 6) {
  11. // Lunes a Sábado: 8:00 a.m. - 10:00 p.m.
  12. isOpen = (hora >= 8 && hora < 22) || (hora == 22 && minuto == 0);
  13. } else if (weekday == 7) {
  14. // Domingo: 4:00 p.m. - 10:00 p.m.
  15. isOpen = (hora >= 16 && hora < 22) || (hora == 22 && minuto == 0);
  16. }
  17. if (!isOpen) {}
  18. }
  19. class _DetallesD extends StatelessWidget {
  20. const _DetallesD({super.key});
  21. @override
  22. Widget build(BuildContext context) {
  23. return Container();
  24. }
  25. }
  26. Widget _buildScheduleRow(String day, String hours, bool isHighlighted) {
  27. return Container(
  28. padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
  29. decoration: BoxDecoration(
  30. color: isHighlighted ? Colors.blue[50] : Colors.transparent,
  31. borderRadius: BorderRadius.circular(8),
  32. ),
  33. child: Row(
  34. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  35. children: [
  36. Text(
  37. day,
  38. style: TextStyle(
  39. fontSize: 16,
  40. fontWeight: isHighlighted ? FontWeight.bold : FontWeight.normal,
  41. ),
  42. ),
  43. Row(
  44. children: [
  45. const Icon(Icons.access_time, size: 18),
  46. const SizedBox(width: 8),
  47. Text(
  48. hours,
  49. style: TextStyle(
  50. fontSize: 16,
  51. fontWeight: isHighlighted ? FontWeight.bold : FontWeight.normal,
  52. ),
  53. ),
  54. ],
  55. ),
  56. ],
  57. ),
  58. );
  59. }