foto portada
This commit is contained in:
@@ -1,23 +1,28 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/components/primary_btn.dart';
|
||||
import 'package:prosappco/src/screens/profile_pro.dart';
|
||||
|
||||
import '../components/schedule_picker.dart';
|
||||
|
||||
class HorarioScreen extends StatefulWidget {
|
||||
const HorarioScreen({super.key});
|
||||
Map<String, Schedule> horarios;
|
||||
HorarioScreen({super.key, required this.horarios});
|
||||
|
||||
@override
|
||||
State<HorarioScreen> createState() => _HorarioScreenState();
|
||||
}
|
||||
|
||||
class _HorarioScreenState extends State<HorarioScreen> {
|
||||
late final FirebaseAuth _auth;
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
bool lunesValue = false;
|
||||
bool martesValue = false;
|
||||
bool miercolesValue = false;
|
||||
@@ -27,20 +32,10 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
||||
bool domingoValue = false;
|
||||
bool jornadaContinuaLunes = false;
|
||||
|
||||
Map<String, Schedule> horarios = {
|
||||
"Lunes": Schedule(false, false, null, null, null, null),
|
||||
"Martes": Schedule(false, false, null, null, null, null),
|
||||
"Miercoles": Schedule(false, false, null, null, null, null),
|
||||
"Jueves": Schedule(false, false, null, null, null, null),
|
||||
"Viernes": Schedule(false, false, null, null, null, null),
|
||||
"Sabado": Schedule(false, false, null, null, null, null),
|
||||
"Domingo": Schedule(false, false, null, null, null, null),
|
||||
};
|
||||
|
||||
Future<void> updateHorario() async {
|
||||
try {
|
||||
Map<String, dynamic> horariosMap = {};
|
||||
horarios.forEach((key, value) {
|
||||
widget.horarios.forEach((key, value) {
|
||||
horariosMap[key] = {
|
||||
'habilitado': value.habilitado,
|
||||
'jornadaContinua': value.jornadaContinua,
|
||||
@@ -74,7 +69,10 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
||||
child: Scaffold(
|
||||
appBar: PopAppbar(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const ProfilePro()),
|
||||
);
|
||||
},
|
||||
label: 'Horario'),
|
||||
body: SingleChildScrollView(
|
||||
@@ -84,7 +82,7 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
||||
height: 5,
|
||||
),
|
||||
Column(
|
||||
children: horarios.entries.map<Widget>(
|
||||
children: widget.horarios.entries.map<Widget>(
|
||||
(entry) {
|
||||
return SchedulePicker(
|
||||
name: entry.key,
|
||||
@@ -97,7 +95,11 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
||||
padding: const EdgeInsets.only(top: 100, bottom: 30),
|
||||
child: PrimaryButtom(
|
||||
onPressed: () async {
|
||||
updateHorario();
|
||||
updateHorario().then((value) => Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ProfilePro()),
|
||||
));
|
||||
},
|
||||
label: 'Guardar'),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user