update
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.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/primary_btn.dart';
|
||||
import 'package:prosappco/src/screens/horario.dart';
|
||||
import 'package:prosappco/src/screens/professional.dart';
|
||||
import 'package:prosappco/src/services/select_image_profile.dart';
|
||||
|
||||
class ProfilePro extends StatefulWidget {
|
||||
const ProfilePro({super.key});
|
||||
@@ -9,14 +21,80 @@ class ProfilePro extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProfileProState extends State<ProfilePro> {
|
||||
File? image_portada;
|
||||
File? imagen_to_upload;
|
||||
|
||||
bool domicilioValue = false;
|
||||
bool sitioValue = false;
|
||||
|
||||
var _photo = '...';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
late final FirebaseAuth _auth;
|
||||
_auth = FirebaseAuth.instance;
|
||||
|
||||
if (_photo == '...') {
|
||||
AuthenticationRepository.instance.getPhoto(uid.toString()).then(
|
||||
(String s) => setState(
|
||||
() {
|
||||
_photo = s;
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showChoiceDialog(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
content: SingleChildScrollView(
|
||||
child: ListBody(
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: const Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Tomar foto",
|
||||
style: TextStyle(color: Color(0xFF2BA4EC)),
|
||||
),
|
||||
onTap: () async {
|
||||
final imagen = await getImage(1);
|
||||
setState(() {
|
||||
imagen_to_upload = File(imagen[0]!.path);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
const Divider(color: Colors.black54),
|
||||
GestureDetector(
|
||||
child: const Text(
|
||||
textAlign: TextAlign.center,
|
||||
"Abrir Galería",
|
||||
style: TextStyle(color: Color(0xFF2BA4EC)),
|
||||
),
|
||||
onTap: () async {
|
||||
final imagen = await getImage(2);
|
||||
setState(() {
|
||||
imagen_to_upload = File(imagen[0]!.path);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool switchValue = false;
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -32,17 +110,207 @@ class _ProfileProState extends State<ProfilePro> {
|
||||
),
|
||||
),
|
||||
drawer: DrawerProfessional(),
|
||||
body: Center(
|
||||
child: Switch(
|
||||
value: switchValue,
|
||||
onChanged: (bool newValue) {
|
||||
setState(() {
|
||||
switchValue = newValue;
|
||||
});
|
||||
},
|
||||
body: SingleChildScrollView(
|
||||
reverse: true,
|
||||
child: Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
_showChoiceDialog(context);
|
||||
},
|
||||
child: Container(
|
||||
child: (imagen_to_upload != null)
|
||||
? LocalPhoto(
|
||||
file: imagen_to_upload!,
|
||||
)
|
||||
: ReferenceBannerPhoto(
|
||||
ref: storage.ref().child('_photo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
color: Colors.white,
|
||||
height: 12,
|
||||
),
|
||||
customSwitch(
|
||||
'Servicio a domicilio',
|
||||
domicilioValue,
|
||||
(value) {
|
||||
domicilioValue = value;
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
customSwitch(
|
||||
'Servicio en sitio',
|
||||
sitioValue,
|
||||
(value) {
|
||||
sitioValue = value;
|
||||
},
|
||||
),
|
||||
sitioValue
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 40, right: 40, bottom: 15),
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
// controller: _emailController,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.near_me),
|
||||
hintText: 'Dirección'),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TextFormField(
|
||||
// controller: _emailController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Oficina / Piso / Conjunto'),
|
||||
),
|
||||
],
|
||||
)
|
||||
.animate()
|
||||
.moveY(duration: const Duration(milliseconds: 100)),
|
||||
)
|
||||
: const SizedBox(),
|
||||
const Divider(),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 30),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Text(
|
||||
'Horario estandar',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const HorarioScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Row(
|
||||
children: const [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 30),
|
||||
child: Text(
|
||||
'Dia',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 170),
|
||||
child: Text(
|
||||
'Hora',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 35),
|
||||
child: Icon(Icons.edit_outlined),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: sitioValue
|
||||
? const EdgeInsets.only(bottom: 30)
|
||||
: const EdgeInsets.only(bottom: 70),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 30),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
Text('Lunes'),
|
||||
Text('Martes'),
|
||||
Text('Miércoles'),
|
||||
Text('Jueves'),
|
||||
Text('Viernes'),
|
||||
Text('Sábado'),
|
||||
Text('Domingo'),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 35),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
Text('N/A'),
|
||||
Text('N/A'),
|
||||
Text('N/A'),
|
||||
Text('N/A'),
|
||||
Text('N/A'),
|
||||
Text('N/A'),
|
||||
Text('N/A'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PrimaryButtom(onPressed: () {}, label: 'Guardar'),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
customSwitch(String text, bool switchValue, ValueChanged<bool> onChanged) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
),
|
||||
)),
|
||||
Transform.scale(
|
||||
scale: 1.2,
|
||||
child: Switch(
|
||||
value: switchValue,
|
||||
onChanged: (bool newValue) {
|
||||
setState(() {
|
||||
onChanged(newValue);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user