update
This commit is contained in:
@@ -5,24 +5,11 @@ import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/components/primary_btn.dart';
|
||||
import '../components/schedule_picker.dart';
|
||||
|
||||
class HorarioScreen extends StatefulWidget {
|
||||
class HorarioScreen extends StatelessWidget {
|
||||
Map<String, Schedule> horarios;
|
||||
HorarioScreen({super.key, required this.horarios});
|
||||
|
||||
@override
|
||||
State<HorarioScreen> createState() => _HorarioScreenState();
|
||||
}
|
||||
|
||||
class _HorarioScreenState extends State<HorarioScreen> {
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
print('horario a ${widget.horarios}');
|
||||
}
|
||||
|
||||
bool lunesValue = false;
|
||||
bool martesValue = false;
|
||||
bool miercolesValue = false;
|
||||
@@ -32,10 +19,10 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
||||
bool domingoValue = false;
|
||||
bool jornadaContinuaLunes = false;
|
||||
|
||||
Future<void> updateHorario() async {
|
||||
Future<void> updateHorario(BuildContext context) async {
|
||||
try {
|
||||
Map<String, dynamic> horariosMap = {};
|
||||
widget.horarios.forEach((key, value) {
|
||||
horarios.forEach((key, value) {
|
||||
horariosMap[key] = {
|
||||
'habilitado': value.habilitado,
|
||||
'jornadaContinua': value.jornadaContinua,
|
||||
@@ -87,7 +74,7 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final sortedHorarios = Map.fromEntries(
|
||||
widget.horarios.entries.toList()
|
||||
horarios.entries.toList()
|
||||
..sort(
|
||||
(a, b) => _dayOfWeekToInt(a.key).compareTo(_dayOfWeekToInt(b.key))),
|
||||
);
|
||||
@@ -118,7 +105,7 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
||||
padding: const EdgeInsets.only(top: 30, bottom: 30),
|
||||
child: PrimaryButtom(
|
||||
onPressed: () async {
|
||||
await updateHorario();
|
||||
await updateHorario(context);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
label: 'Guardar',
|
||||
|
||||
Reference in New Issue
Block a user