Files
Lizandro GuarnizoandClaude Sonnet 4.6 15175c1b91 replace: swap prosappweb content for prosapp_web_app (more complete version)
prosapp_web_app has chat, dashboard, calendar, support, 13 providers and
Fluro URL routing. Keep Dockerfile + nginx.conf from previous prosappweb.
Upgrade google_fonts 6.2.1 → 8.1.0 (Dart 3.12 compat fix).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 15:26:32 -05:00

117 lines
3.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:prosapp_web_app/models/schedules_entity.dart';
class ScheduleDayTile extends StatelessWidget {
final String day;
final ScheduleEntity schedule;
final Function(bool) onEnableChanged;
final Function(bool) onContinuousDayChanged;
final Function(TimeOfDay) onRange1Hour1Pick;
final Function(TimeOfDay) onRange1Hour2Pick;
final Function(TimeOfDay) onRange2Hour1Pick;
final Function(TimeOfDay) onRange2Hour2Pick;
const ScheduleDayTile({
super.key,
required this.day,
required this.schedule,
required this.onEnableChanged,
required this.onContinuousDayChanged,
required this.onRange1Hour1Pick,
required this.onRange1Hour2Pick,
required this.onRange2Hour1Pick,
required this.onRange2Hour2Pick,
});
@override
Widget build(BuildContext context) {
return Column(
children: [
SwitchListTile(
title: Text(day),
value: schedule.enabled,
onChanged: onEnableChanged,
),
if (schedule.enabled) ...[
SwitchListTile(
title: const Text('Jornada continua'),
value: schedule.continuousDay,
onChanged: onContinuousDayChanged,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
timePickerField(
context: context,
text: ScheduleEntity.getFormatTime(schedule.range1Hour1),
onPick: onRange1Hour1Pick,
),
Center(
child: Container(
width: 10,
height: 1,
color: Colors.black,
),
),
if (!schedule.continuousDay) ...[
timePickerField(
context: context,
text: ScheduleEntity.getFormatTime(schedule.range1Hour2),
onPick: onRange1Hour2Pick,
),
const SizedBox(width: 10),
timePickerField(
context: context,
text: ScheduleEntity.getFormatTime(schedule.range2Hour1),
onPick: onRange2Hour1Pick,
),
Center(
child: Container(
width: 10,
height: 1,
color: Colors.black,
),
),
],
timePickerField(
context: context,
text: ScheduleEntity.getFormatTime(schedule.range2Hour2),
onPick: onRange2Hour2Pick,
),
],
),
],
],
);
}
Widget timePickerField({
required BuildContext context,
required String? text,
required Function(TimeOfDay) onPick,
}) {
return Expanded(
child: TextField(
readOnly: true,
controller: TextEditingController(
text: text,
),
textAlign: TextAlign.center,
onTap: () async {
final TimeOfDay? pickedTime = await showTimePicker(
context: context,
initialTime: TimeOfDay.now(),
);
if (pickedTime != null) {
onPick.call(pickedTime);
}
},
decoration: const InputDecoration(
hintText: 'Hora',
border: UnderlineInputBorder(),
),
),
);
}
}