foto portada
This commit is contained in:
@@ -176,6 +176,19 @@ class AuthenticationRepository extends GetxController {
|
|||||||
return photo;
|
return photo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String> getBanner(String uid) async {
|
||||||
|
String photo = '';
|
||||||
|
try {
|
||||||
|
final snapshot =
|
||||||
|
await FirebaseFirestore.instance.collection('users').doc(uid).get();
|
||||||
|
final Map<String, dynamic>? data = snapshot.data();
|
||||||
|
photo = data?['banner'] ?? '';
|
||||||
|
} catch (e) {
|
||||||
|
print('Error getting banner: $e');
|
||||||
|
}
|
||||||
|
return photo;
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> getProfession(String uid) async {
|
Future<String> getProfession(String uid) async {
|
||||||
String profession = '';
|
String profession = '';
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class ReferenceBannerPhoto extends StatelessWidget {
|
|||||||
if (imageData != null) {
|
if (imageData != null) {
|
||||||
return Image.memory(
|
return Image.memory(
|
||||||
imageData,
|
imageData,
|
||||||
|
width: double.infinity,
|
||||||
height: size,
|
height: size,
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:prosappco/src/components/primary_btn.dart';
|
import 'package:prosappco/src/components/primary_btn.dart';
|
||||||
|
|
||||||
typedef TimeCallback = void Function(TimeOfDay? pickedTime);
|
typedef TimeCallback = void Function(TimeOfDay? pickedTime);
|
||||||
@@ -60,8 +62,8 @@ class _SchedulePickerState extends State<SchedulePicker> {
|
|||||||
const Text('-'),
|
const Text('-'),
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
datePicker(widget.schedule.range1Hour2,
|
datePicker(widget.schedule.range2Hour2,
|
||||||
(pickedTime) => widget.schedule.range1Hour2 = pickedTime),
|
(pickedTime) => widget.schedule.range2Hour2 = pickedTime),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@@ -137,4 +139,74 @@ class Schedule {
|
|||||||
|
|
||||||
Schedule(this.habilitado, this.jornadaContinua, this.range1Hour1,
|
Schedule(this.habilitado, this.jornadaContinua, this.range1Hour1,
|
||||||
this.range1Hour2, this.range2Hour1, this.range2Hour2);
|
this.range1Hour2, this.range2Hour1, this.range2Hour2);
|
||||||
|
|
||||||
|
static Future<Map<String, Schedule>> fromJson(
|
||||||
|
Map<String, dynamic>? json) async {
|
||||||
|
try {
|
||||||
|
if (json == null) {
|
||||||
|
return {
|
||||||
|
"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),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
Map<String, dynamic> horarios = json['horario'];
|
||||||
|
horarios.entries;
|
||||||
|
print('Entrada ${horarios.entries}');
|
||||||
|
var hora = horarios.map((key, value) => MapEntry(
|
||||||
|
key,
|
||||||
|
Schedule(
|
||||||
|
value['habilitado'],
|
||||||
|
value['jornadaContinua'],
|
||||||
|
stringToTimeOfDay(value['range1Hour1']),
|
||||||
|
stringToTimeOfDay(value['range1Hour2']),
|
||||||
|
stringToTimeOfDay(value['range2Hour1']),
|
||||||
|
stringToTimeOfDay(value['range2Hour2']))));
|
||||||
|
|
||||||
|
print('Entradas ${hora}');
|
||||||
|
return hora;
|
||||||
|
} catch (e) {
|
||||||
|
return {
|
||||||
|
"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),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static TimeOfDay stringToTimeOfDay(String? tod) {
|
||||||
|
if (tod == null) {
|
||||||
|
return TimeOfDay.now();
|
||||||
|
}
|
||||||
|
final format = DateFormat.jm();
|
||||||
|
return TimeOfDay.fromDateTime(format.parse(tod));
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Map<String, Schedule>> getHorarios(String uid) async {
|
||||||
|
try {
|
||||||
|
final snapshot =
|
||||||
|
await FirebaseFirestore.instance.collection('users').doc(uid).get();
|
||||||
|
final Map<String, dynamic>? data = snapshot.data();
|
||||||
|
return fromJson(data);
|
||||||
|
} catch (e) {
|
||||||
|
print('Error getting user: $e');
|
||||||
|
return {
|
||||||
|
"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),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,28 @@
|
|||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||||
import 'package:prosappco/src/components/primary_btn.dart';
|
import 'package:prosappco/src/components/primary_btn.dart';
|
||||||
|
import 'package:prosappco/src/screens/profile_pro.dart';
|
||||||
|
|
||||||
import '../components/schedule_picker.dart';
|
import '../components/schedule_picker.dart';
|
||||||
|
|
||||||
class HorarioScreen extends StatefulWidget {
|
class HorarioScreen extends StatefulWidget {
|
||||||
const HorarioScreen({super.key});
|
Map<String, Schedule> horarios;
|
||||||
|
HorarioScreen({super.key, required this.horarios});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HorarioScreen> createState() => _HorarioScreenState();
|
State<HorarioScreen> createState() => _HorarioScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HorarioScreenState extends State<HorarioScreen> {
|
class _HorarioScreenState extends State<HorarioScreen> {
|
||||||
late final FirebaseAuth _auth;
|
|
||||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
bool lunesValue = false;
|
bool lunesValue = false;
|
||||||
bool martesValue = false;
|
bool martesValue = false;
|
||||||
bool miercolesValue = false;
|
bool miercolesValue = false;
|
||||||
@@ -27,20 +32,10 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
|||||||
bool domingoValue = false;
|
bool domingoValue = false;
|
||||||
bool jornadaContinuaLunes = 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 {
|
Future<void> updateHorario() async {
|
||||||
try {
|
try {
|
||||||
Map<String, dynamic> horariosMap = {};
|
Map<String, dynamic> horariosMap = {};
|
||||||
horarios.forEach((key, value) {
|
widget.horarios.forEach((key, value) {
|
||||||
horariosMap[key] = {
|
horariosMap[key] = {
|
||||||
'habilitado': value.habilitado,
|
'habilitado': value.habilitado,
|
||||||
'jornadaContinua': value.jornadaContinua,
|
'jornadaContinua': value.jornadaContinua,
|
||||||
@@ -74,7 +69,10 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
|||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: PopAppbar(
|
appBar: PopAppbar(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => const ProfilePro()),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
label: 'Horario'),
|
label: 'Horario'),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
@@ -84,7 +82,7 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
|||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
children: horarios.entries.map<Widget>(
|
children: widget.horarios.entries.map<Widget>(
|
||||||
(entry) {
|
(entry) {
|
||||||
return SchedulePicker(
|
return SchedulePicker(
|
||||||
name: entry.key,
|
name: entry.key,
|
||||||
@@ -97,7 +95,11 @@ class _HorarioScreenState extends State<HorarioScreen> {
|
|||||||
padding: const EdgeInsets.only(top: 100, bottom: 30),
|
padding: const EdgeInsets.only(top: 100, bottom: 30),
|
||||||
child: PrimaryButtom(
|
child: PrimaryButtom(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
updateHorario();
|
updateHorario().then((value) => Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const ProfilePro()),
|
||||||
|
));
|
||||||
},
|
},
|
||||||
label: 'Guardar'),
|
label: 'Guardar'),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||||
import 'package:prosappco/src/components/drawer_menu.dart';
|
|
||||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||||
import 'package:prosappco/src/controllers/add_name_email_city.dart';
|
import 'package:prosappco/src/controllers/add_name_email_city.dart';
|
||||||
import 'package:prosappco/src/screens/city.dart';
|
import 'package:prosappco/src/screens/city.dart';
|
||||||
@@ -155,7 +154,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
_showChoiceDialog(context);
|
_showChoiceDialog(context);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.symmetric(vertical: 50),
|
margin: const EdgeInsets.symmetric(vertical: 50),
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Image.memory(
|
child: Image.memory(
|
||||||
imageData,
|
imageData,
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:firebase_storage/firebase_storage.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_animate/flutter_animate.dart';
|
import 'package:flutter_animate/flutter_animate.dart';
|
||||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||||
import 'package:prosappco/src/components/banner_photo.dart';
|
import 'package:prosappco/src/components/banner_photo.dart';
|
||||||
import 'package:prosappco/src/components/column_padding.dart';
|
|
||||||
import 'package:prosappco/src/components/drawer_professional.dart';
|
import 'package:prosappco/src/components/drawer_professional.dart';
|
||||||
import 'package:prosappco/src/components/primary_btn.dart';
|
import 'package:prosappco/src/components/primary_btn.dart';
|
||||||
|
import 'package:prosappco/src/components/schedule_picker.dart';
|
||||||
import 'package:prosappco/src/screens/horario.dart';
|
import 'package:prosappco/src/screens/horario.dart';
|
||||||
import 'package:prosappco/src/screens/professional.dart';
|
import 'package:prosappco/src/screens/professional.dart';
|
||||||
import 'package:prosappco/src/services/select_image_profile.dart';
|
import 'package:prosappco/src/services/select_image_profile.dart';
|
||||||
@@ -21,31 +23,191 @@ class ProfilePro extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ProfileProState extends State<ProfilePro> {
|
class _ProfileProState extends State<ProfilePro> {
|
||||||
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
|
|
||||||
File? image_portada;
|
File? image_portada;
|
||||||
File? imagen_to_upload;
|
File? imagen_to_upload;
|
||||||
|
|
||||||
bool domicilioValue = false;
|
bool domicilioValue = false;
|
||||||
bool sitioValue = false;
|
bool sitioValue = false;
|
||||||
|
var photoTemp = '';
|
||||||
|
|
||||||
var _photo = '...';
|
var _photo = '...';
|
||||||
|
Map<String, Schedule>? _horarios;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
late final FirebaseAuth _auth;
|
|
||||||
_auth = FirebaseAuth.instance;
|
|
||||||
|
|
||||||
if (_photo == '...') {
|
if (_photo == '...') {
|
||||||
AuthenticationRepository.instance.getPhoto(uid.toString()).then(
|
AuthenticationRepository.instance.getBanner(uid.toString()).then(
|
||||||
(String s) => setState(
|
(String s) => setState(
|
||||||
() {
|
() {
|
||||||
_photo = s;
|
_photo = s;
|
||||||
|
print('HOLA $s');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_horarios == null) {
|
||||||
|
Schedule.getHorarios(uid.toString()).then(
|
||||||
|
(Map<String, Schedule> s) => setState(
|
||||||
|
() {
|
||||||
|
_horarios = s;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateInfo() async {
|
||||||
|
try {
|
||||||
|
if (imagen_to_upload == null) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
final uploaded = await uploadImage(imagen_to_upload!);
|
||||||
|
updateImage(photoTemp);
|
||||||
|
//image
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Error al actualizar la imagen de perfil $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Future<Widget> downloadImage(Reference ref) async {
|
||||||
|
// try {
|
||||||
|
// if (_photo == '...' || _photo.isEmpty) {
|
||||||
|
// return GestureDetector(
|
||||||
|
// onTap: () {
|
||||||
|
// _showChoiceDialog(context);
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// margin: EdgeInsets.symmetric(vertical: 50),
|
||||||
|
// width: 100,
|
||||||
|
// height: 100,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: Color(0xFF2BA4EC),
|
||||||
|
// borderRadius: BorderRadius.circular(50),
|
||||||
|
// ),
|
||||||
|
// child: Icon(
|
||||||
|
// Icons.person,
|
||||||
|
// color: Colors.white,
|
||||||
|
// size: 90,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// final imageData = await ref.getData();
|
||||||
|
// if (imageData != null) {
|
||||||
|
// final widgetImage = GestureDetector(
|
||||||
|
// onTap: () {
|
||||||
|
// _showChoiceDialog(context);
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// margin: const EdgeInsets.symmetric(vertical: 50),
|
||||||
|
// child: ClipOval(
|
||||||
|
// child: Image.memory(
|
||||||
|
// imageData,
|
||||||
|
// width: 60,
|
||||||
|
// height: 60,
|
||||||
|
// fit: BoxFit.cover,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// return widgetImage;
|
||||||
|
// } else {
|
||||||
|
// return GestureDetector(
|
||||||
|
// onTap: () {
|
||||||
|
// _showChoiceDialog(context);
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// margin: const EdgeInsets.symmetric(vertical: 50),
|
||||||
|
// width: 100,
|
||||||
|
// height: 100,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: const Color(0xFF2BA4EC),
|
||||||
|
// borderRadius: BorderRadius.circular(50),
|
||||||
|
// ),
|
||||||
|
// child: const Icon(
|
||||||
|
// Icons.person,
|
||||||
|
// color: Colors.white,
|
||||||
|
// size: 90,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (e) {
|
||||||
|
// print('XD $e');
|
||||||
|
// return GestureDetector(
|
||||||
|
// onTap: () {
|
||||||
|
// _showChoiceDialog(context);
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// margin: const EdgeInsets.symmetric(vertical: 50),
|
||||||
|
// width: 100,
|
||||||
|
// height: 100,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: const Color(0xFF2BA4EC),
|
||||||
|
// borderRadius: BorderRadius.circular(50),
|
||||||
|
// ),
|
||||||
|
// child: const Icon(
|
||||||
|
// Icons.person,
|
||||||
|
// color: Colors.white,
|
||||||
|
// size: 90,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
Future<void> updateImage(image) async {
|
||||||
|
try {
|
||||||
|
await FirebaseFirestore.instance
|
||||||
|
.collection('users')
|
||||||
|
.doc(uid)
|
||||||
|
.update({'banner': image});
|
||||||
|
|
||||||
|
print('imagen actualizada correctamente');
|
||||||
|
} catch (e) {
|
||||||
|
try {
|
||||||
|
await FirebaseFirestore.instance
|
||||||
|
.collection('users')
|
||||||
|
.doc(uid)
|
||||||
|
.set({'banner': image});
|
||||||
|
} catch (e) {
|
||||||
|
print('Error al agregar la imagen de perfil: $e');
|
||||||
|
}
|
||||||
|
|
||||||
|
print('Error al actualizar la imagen de perfil: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> uploadImage(File image) async {
|
||||||
|
final String namefile = image.path.split('/').last;
|
||||||
|
|
||||||
|
Reference ref = storage
|
||||||
|
.ref()
|
||||||
|
.child('users')
|
||||||
|
.child(uid!)
|
||||||
|
.child('profile')
|
||||||
|
.child(namefile);
|
||||||
|
|
||||||
|
final UploadTask uploadTask = ref.putFile(image);
|
||||||
|
|
||||||
|
final TaskSnapshot snapshot = await uploadTask.whenComplete(() => true);
|
||||||
|
|
||||||
|
photoTemp = ref.fullPath;
|
||||||
|
|
||||||
|
if (snapshot.state == TaskState.success) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showChoiceDialog(BuildContext context) async {
|
Future<void> _showChoiceDialog(BuildContext context) async {
|
||||||
@@ -124,7 +286,7 @@ class _ProfileProState extends State<ProfilePro> {
|
|||||||
file: imagen_to_upload!,
|
file: imagen_to_upload!,
|
||||||
)
|
)
|
||||||
: ReferenceBannerPhoto(
|
: ReferenceBannerPhoto(
|
||||||
ref: storage.ref().child('_photo'),
|
ref: storage.ref().child(_photo),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -191,7 +353,9 @@ class _ProfileProState extends State<ProfilePro> {
|
|||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return const HorarioScreen();
|
return HorarioScreen(
|
||||||
|
horarios: _horarios!,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -223,7 +387,7 @@ class _ProfileProState extends State<ProfilePro> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(right: 35),
|
padding: EdgeInsets.only(right: 45),
|
||||||
child: Icon(Icons.edit_outlined),
|
child: Icon(Icons.edit_outlined),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -251,17 +415,18 @@ class _ProfileProState extends State<ProfilePro> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 35),
|
padding: const EdgeInsets.only(left: 25),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: const [
|
children: [
|
||||||
Text('N/A'),
|
Text(timeList(_horarios?['Lunes'], context)),
|
||||||
Text('N/A'),
|
Text(timeList(_horarios?['Martes'], context)),
|
||||||
Text('N/A'),
|
Text(
|
||||||
Text('N/A'),
|
timeList(_horarios?['Miercoles'], context)),
|
||||||
Text('N/A'),
|
Text(timeList(_horarios?['Jueves'], context)),
|
||||||
Text('N/A'),
|
Text(timeList(_horarios?['Viernes'], context)),
|
||||||
Text('N/A'),
|
Text(timeList(_horarios?['Sabado'], context)),
|
||||||
|
Text(timeList(_horarios?['Domingo'], context)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -271,7 +436,11 @@ class _ProfileProState extends State<ProfilePro> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PrimaryButtom(onPressed: () {}, label: 'Guardar'),
|
PrimaryButtom(
|
||||||
|
onPressed: () {
|
||||||
|
updateInfo();
|
||||||
|
},
|
||||||
|
label: 'Guardar'),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
)
|
)
|
||||||
@@ -313,4 +482,19 @@ class _ProfileProState extends State<ProfilePro> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String timeList(Schedule? schedule, BuildContext context) {
|
||||||
|
if (schedule == null) {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!schedule.habilitado) {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
if (schedule.jornadaContinua) {
|
||||||
|
return '${schedule.range1Hour1?.format(context).toString()} - ${schedule.range1Hour2?.format(context).toString()}';
|
||||||
|
} else {
|
||||||
|
return '${schedule.range1Hour1?.format(context).toString()} - ${schedule.range1Hour2?.format(context).toString()}; ${schedule.range2Hour1?.format(context).toString()} - ${schedule.range2Hour2?.format(context).toString()}';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -353,7 +353,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "2.6.3"
|
version: "2.6.3"
|
||||||
intl:
|
intl:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: intl
|
name: intl
|
||||||
sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91"
|
sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91"
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ dependencies:
|
|||||||
image_picker: ^0.8.7+1
|
image_picker: ^0.8.7+1
|
||||||
flutter_animate: ^4.1.1+1
|
flutter_animate: ^4.1.1+1
|
||||||
flutter_rating_bar: ^4.0.1
|
flutter_rating_bar: ^4.0.1
|
||||||
|
intl:
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user