se añadio un modelo y el menu de modo profesional
This commit is contained in:
+9
-2
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||||
import 'package:prosappco/src/screens/city.dart';
|
import 'package:prosappco/src/screens/city.dart';
|
||||||
@@ -9,10 +10,10 @@ import 'package:prosappco/src/screens/new_number.dart';
|
|||||||
import 'package:prosappco/src/screens/new_password.dart';
|
import 'package:prosappco/src/screens/new_password.dart';
|
||||||
import 'package:prosappco/src/screens/profession.dart';
|
import 'package:prosappco/src/screens/profession.dart';
|
||||||
import 'package:prosappco/src/screens/professional.dart';
|
import 'package:prosappco/src/screens/professional.dart';
|
||||||
import 'package:prosappco/src/screens/professional_info.dart';
|
|
||||||
import 'package:prosappco/src/screens/professional_profile.dart';
|
import 'package:prosappco/src/screens/professional_profile.dart';
|
||||||
import 'package:prosappco/src/screens/professional_revision.dart';
|
import 'package:prosappco/src/screens/professional_revision.dart';
|
||||||
import 'package:prosappco/src/screens/profile.dart';
|
import 'package:prosappco/src/screens/profile.dart';
|
||||||
|
import 'package:prosappco/src/screens/prueba.dart';
|
||||||
import 'package:prosappco/src/screens/register.dart';
|
import 'package:prosappco/src/screens/register.dart';
|
||||||
import 'package:prosappco/src/screens/request_sent.dart';
|
import 'package:prosappco/src/screens/request_sent.dart';
|
||||||
import 'package:prosappco/src/screens/service.dart';
|
import 'package:prosappco/src/screens/service.dart';
|
||||||
@@ -21,6 +22,11 @@ import 'firebase_options.dart';
|
|||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
SystemChrome.setPreferredOrientations([
|
||||||
|
DeviceOrientation.portraitUp,
|
||||||
|
DeviceOrientation.portraitDown,
|
||||||
|
]);
|
||||||
await Firebase.initializeApp(
|
await Firebase.initializeApp(
|
||||||
options: DefaultFirebaseOptions.currentPlatform,
|
options: DefaultFirebaseOptions.currentPlatform,
|
||||||
).then((value) => Get.put(AuthenticationRepository()));
|
).then((value) => Get.put(AuthenticationRepository()));
|
||||||
@@ -41,7 +47,7 @@ class MyApp extends StatelessWidget {
|
|||||||
'/': (context) => const LoginScreen(),
|
'/': (context) => const LoginScreen(),
|
||||||
'/login': (context) => const LoginEmailScreen(),
|
'/login': (context) => const LoginEmailScreen(),
|
||||||
'/welcome': (context) => const WelcomeScreen(),
|
'/welcome': (context) => const WelcomeScreen(),
|
||||||
'/profile': (context) => ProfileScreen(),
|
'/profile': (context) => const ProfileScreen(),
|
||||||
'/register': (context) => const RegisterScreen(),
|
'/register': (context) => const RegisterScreen(),
|
||||||
'/city': (context) => const CityScreen(),
|
'/city': (context) => const CityScreen(),
|
||||||
'/profession': (context) => const ProfessionScreen(),
|
'/profession': (context) => const ProfessionScreen(),
|
||||||
@@ -52,6 +58,7 @@ class MyApp extends StatelessWidget {
|
|||||||
'/nuevaPassword': (context) => NewPasswordScreen(),
|
'/nuevaPassword': (context) => NewPasswordScreen(),
|
||||||
'/servicio': (context) => const ServiceScreen(),
|
'/servicio': (context) => const ServiceScreen(),
|
||||||
'/profesional': (context) => const ProfessionalScreen(),
|
'/profesional': (context) => const ProfessionalScreen(),
|
||||||
|
'/prueba': (context) => const PruebaScreen(),
|
||||||
},
|
},
|
||||||
onGenerateRoute: (settings) {
|
onGenerateRoute: (settings) {
|
||||||
throw Exception('Ruta desconocida: ${settings.name}');
|
throw Exception('Ruta desconocida: ${settings.name}');
|
||||||
|
|||||||
+290
-204
@@ -1,233 +1,319 @@
|
|||||||
import 'package:firebase_auth/firebase_auth.dart';
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
import 'package:firebase_storage/firebase_storage.dart';
|
import 'package:firebase_storage/firebase_storage.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||||
import 'package:prosappco/src/components/photo_view.dart';
|
import 'package:prosappco/src/components/photo_view.dart';
|
||||||
|
import 'package:prosappco/src/models/user_model.dart';
|
||||||
|
import 'package:prosappco/src/screens/profile.dart';
|
||||||
|
|
||||||
class DrawerMenu extends StatelessWidget {
|
class DrawerMenu extends StatefulWidget {
|
||||||
Reference? ref;
|
@override
|
||||||
String userName;
|
State<DrawerMenu> createState() => _DrawerMenuState();
|
||||||
String userPhoneNumber;
|
}
|
||||||
String userCity;
|
|
||||||
String userState;
|
|
||||||
|
|
||||||
DrawerMenu({
|
class _DrawerMenuState extends State<DrawerMenu> {
|
||||||
super.key,
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
required this.ref,
|
UserModel? user;
|
||||||
required this.userName,
|
|
||||||
required this.userPhoneNumber,
|
@override
|
||||||
required this.userCity,
|
void initState() {
|
||||||
required this.userState,
|
super.initState();
|
||||||
});
|
|
||||||
|
if (user == null) {
|
||||||
|
UserModel.getUser(uid.toString()).then(
|
||||||
|
(UserModel s) => setState(() => user = s),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final User? currentUser = FirebaseAuth.instance.currentUser;
|
||||||
|
|
||||||
return Drawer(
|
return Drawer(
|
||||||
child: ListView(
|
child: Column(
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Container(
|
||||||
children: [
|
color: Colors.white,
|
||||||
Column(
|
child: Column(
|
||||||
children: [
|
|
||||||
ListTile(
|
|
||||||
onTap: () {
|
|
||||||
if (ModalRoute.of(context)?.settings.name != '/profile') {
|
|
||||||
Navigator.pushNamed(context, '/profile');
|
|
||||||
} else {
|
|
||||||
Scaffold.of(context).openEndDrawer();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
title: Text(userName,
|
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold)),
|
|
||||||
subtitle: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
userPhoneNumber,
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
userCity,
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
leading: ReferencePhoto(
|
|
||||||
ref: ref,
|
|
||||||
size: 55,
|
|
||||||
sizeCircle: 60,
|
|
||||||
),
|
|
||||||
trailing: const Icon(Icons.keyboard_arrow_right,
|
|
||||||
color: Colors.black),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 20, horizontal: 16),
|
|
||||||
),
|
|
||||||
], //
|
|
||||||
),
|
|
||||||
const Divider(height: 0, color: Colors.grey),
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
ListTile(
|
|
||||||
onTap: () {},
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.history,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
title: const Text(
|
|
||||||
'Mis servicios',
|
|
||||||
style: TextStyle(fontSize: 15),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () {
|
|
||||||
if (ModalRoute.of(context)?.settings.name != '/profile') {
|
|
||||||
Navigator.pushNamed(context, '/profile');
|
|
||||||
} else {
|
|
||||||
Scaffold.of(context).openEndDrawer();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.person_outline,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
title: const Text(
|
|
||||||
'Mi perfil',
|
|
||||||
style: TextStyle(fontSize: 15),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () {},
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.construction_outlined,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
title: const Text(
|
|
||||||
'Configuración',
|
|
||||||
style: TextStyle(fontSize: 15),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () {},
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.question_mark_rounded,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
title: const Text(
|
|
||||||
'Soporte',
|
|
||||||
style: TextStyle(fontSize: 15),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () {},
|
|
||||||
leading: const Icon(
|
|
||||||
Icons.messenger_outline,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
title: const Text(
|
|
||||||
'Mensajes',
|
|
||||||
style: TextStyle(fontSize: 15),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Builder(builder: (BuildContext context) {
|
|
||||||
return ListTile(
|
|
||||||
onTap: () {
|
|
||||||
if (ModalRoute.of(context)?.settings.name !=
|
|
||||||
'/welcome') {
|
|
||||||
Navigator.pushNamed(context, '/welcome');
|
|
||||||
} else {
|
|
||||||
Scaffold.of(context).openEndDrawer();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
trailing: const Icon(
|
|
||||||
Icons.keyboard_arrow_right,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
title: const Text(
|
|
||||||
'Solicitar servicio',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 17,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
tileColor: const Color(0xFF2BA4EC),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 5, horizontal: 16),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'Prosapp',
|
|
||||||
style: TextStyle(fontSize: 10, color: Colors.grey[700]),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(top: 7, left: 3, right: 3),
|
|
||||||
child: Text(
|
|
||||||
'®',
|
|
||||||
style: TextStyle(fontSize: 25, color: Colors.grey[700]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'todos los derechos reservados',
|
|
||||||
style: TextStyle(fontSize: 10, color: Colors.grey[700]),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(top: 200),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: 10),
|
ListTile(
|
||||||
ElevatedButton(
|
onTap: () {
|
||||||
onPressed: () {
|
Navigator.push(
|
||||||
AuthenticationRepository.instance.logout();
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return const ProfileScreen();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
// if (ModalRoute.of(context)?.settings.name != '/profile') {
|
||||||
|
// Navigator.pushNamed(context, '/profile');
|
||||||
|
// } else {
|
||||||
|
// Scaffold.of(context).openEndDrawer();
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
title: Text(user?.name ?? '',
|
||||||
backgroundColor: Colors.white,
|
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||||
shape: const CircleBorder(),
|
subtitle: Column(
|
||||||
elevation: 3,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
minimumSize: const Size(45, 45),
|
children: [
|
||||||
|
Text(
|
||||||
|
currentUser?.phoneNumber ?? '',
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
user?.city ?? '',
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: const Icon(
|
leading: ReferencePhoto(
|
||||||
Icons.logout_outlined,
|
ref: user?.photo,
|
||||||
color: Colors.red,
|
size: 55,
|
||||||
size: 35,
|
sizeCircle: 60,
|
||||||
|
),
|
||||||
|
trailing: const Icon(Icons.keyboard_arrow_right,
|
||||||
|
color: Colors.black),
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 20, horizontal: 16),
|
||||||
|
),
|
||||||
|
], //
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.3),
|
||||||
|
spreadRadius: 1,
|
||||||
|
blurRadius: 3,
|
||||||
|
offset: const Offset(0, 0), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Divider(
|
||||||
|
height: 0,
|
||||||
|
color: Colors.grey[300],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.history,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Mis servicios',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 5),
|
ListTile(
|
||||||
ElevatedButton(
|
onTap: () {
|
||||||
onPressed: () {
|
Navigator.push(
|
||||||
if (userState == 'pendiente' || userState.isEmpty) {
|
context,
|
||||||
Navigator.pushNamed(context, '/profesionalProfile');
|
CupertinoPageRoute(
|
||||||
} else if (userState == 'revision') {
|
builder: (BuildContext context) {
|
||||||
Navigator.pushNamed(context, '/profesionalRevision');
|
return const ProfileScreen();
|
||||||
}
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
leading: const Icon(
|
||||||
backgroundColor: const Color(0xFF2BA4EC),
|
Icons.person_outline,
|
||||||
shape: RoundedRectangleBorder(
|
color: Colors.black,
|
||||||
borderRadius: BorderRadius.circular(50),
|
|
||||||
),
|
|
||||||
elevation: 0,
|
|
||||||
minimumSize: const Size(200, 45),
|
|
||||||
),
|
),
|
||||||
child: const Text(
|
title: const Text(
|
||||||
'Modo profesional',
|
'Mi perfil',
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.construction_outlined,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Configuración',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.question_mark_rounded,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Soporte',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.messenger_outline,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Mensajes',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Builder(builder: (BuildContext context) {
|
||||||
|
return ListTile(
|
||||||
|
onTap: () {
|
||||||
|
if (ModalRoute.of(context)?.settings.name != '/welcome') {
|
||||||
|
Navigator.pushNamed(context, '/welcome');
|
||||||
|
} else {
|
||||||
|
Scaffold.of(context).openEndDrawer();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trailing: const Icon(
|
||||||
|
Icons.keyboard_arrow_right,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 15,
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Solicitar servicio',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
tileColor: const Color(0xFF2BA4EC),
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.5),
|
||||||
|
spreadRadius: 2,
|
||||||
|
blurRadius: 3,
|
||||||
|
offset:
|
||||||
|
const Offset(0, 2), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
color: const Color(0xFFD6F4FF),
|
||||||
|
child: ListTile(
|
||||||
|
tileColor: const Color(0xFFD6F4FF),
|
||||||
|
onTap: () {},
|
||||||
|
trailing: const Icon(Icons.keyboard_arrow_right,
|
||||||
|
color: Colors.black),
|
||||||
|
title: const Text(
|
||||||
|
'Reputación',
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
subtitle: Row(
|
||||||
|
children: [
|
||||||
|
RatingBar.builder(
|
||||||
|
initialRating: user?.score?.average ?? 0,
|
||||||
|
minRating: 1,
|
||||||
|
direction: Axis.horizontal,
|
||||||
|
allowHalfRating: true,
|
||||||
|
itemCount: 5,
|
||||||
|
itemSize: 25,
|
||||||
|
maxRating: 5,
|
||||||
|
itemPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 0),
|
||||||
|
itemBuilder: (context, _) => const Icon(
|
||||||
|
Icons.star,
|
||||||
|
color: Color(0xFF2BA4EC),
|
||||||
|
),
|
||||||
|
onRatingUpdate: (rating) {},
|
||||||
|
ignoreGestures: true,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
Text(
|
||||||
|
'(${user?.score?.total.toString()}) ${user?.score?.average.toString()}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Prosapp',
|
||||||
|
style: TextStyle(fontSize: 10, color: Colors.grey[700]),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 7, left: 3, right: 3),
|
||||||
|
child: Text(
|
||||||
|
'®',
|
||||||
|
style: TextStyle(fontSize: 25, color: Colors.grey[700]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'todos los derechos reservados',
|
||||||
|
style: TextStyle(fontSize: 10, color: Colors.grey[700]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
AuthenticationRepository.instance.logout();
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
shape: const CircleBorder(),
|
||||||
|
elevation: 3,
|
||||||
|
minimumSize: const Size(45, 45),
|
||||||
|
),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.logout_outlined,
|
||||||
|
color: Colors.red,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
if (user?.state == 'pendiente' ||
|
||||||
|
user?.state?.isEmpty == true) {
|
||||||
|
Navigator.pushNamed(context, '/profesionalProfile');
|
||||||
|
} else if (user?.state == 'revision') {
|
||||||
|
Navigator.pushNamed(context, '/profesionalRevision');
|
||||||
|
} else if (user?.state == 'activo') {
|
||||||
|
Navigator.pushNamed(context, '/prueba');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFF2BA4EC),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
minimumSize: const Size(200, 45),
|
||||||
|
),
|
||||||
|
child: const Text(
|
||||||
|
'Modo profesional',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,315 @@
|
|||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:firebase_storage/firebase_storage.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||||
|
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||||
|
import 'package:prosappco/src/components/photo_view.dart';
|
||||||
|
import 'package:prosappco/src/models/user_model.dart';
|
||||||
|
|
||||||
|
class DrawerProfessional extends StatefulWidget {
|
||||||
|
Reference? ref;
|
||||||
|
String userName;
|
||||||
|
String userPhoneNumber;
|
||||||
|
String userCity;
|
||||||
|
String userState;
|
||||||
|
|
||||||
|
DrawerProfessional({
|
||||||
|
super.key,
|
||||||
|
required this.ref,
|
||||||
|
required this.userName,
|
||||||
|
required this.userPhoneNumber,
|
||||||
|
required this.userCity,
|
||||||
|
required this.userState,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DrawerProfessional> createState() => _DrawerProfessionalState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DrawerProfessionalState extends State<DrawerProfessional> {
|
||||||
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
|
UserModel? user;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
UserModel.getUser(uid.toString()).then(
|
||||||
|
(UserModel s) => setState(() => user = s),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final User? currentUser = FirebaseAuth.instance.currentUser;
|
||||||
|
|
||||||
|
return Drawer(
|
||||||
|
child: Container(
|
||||||
|
color: const Color(0xFFE9F9FF),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
title: Text(user?.name ?? '',
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||||
|
subtitle: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
currentUser?.phoneNumber ?? '',
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
user?.city ?? '',
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
leading: ReferencePhoto(
|
||||||
|
ref: user?.photo,
|
||||||
|
size: 55,
|
||||||
|
sizeCircle: 60,
|
||||||
|
),
|
||||||
|
trailing: const Icon(Icons.keyboard_arrow_right,
|
||||||
|
color: Colors.black),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 20, horizontal: 16),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.3),
|
||||||
|
spreadRadius: 1,
|
||||||
|
blurRadius: 3,
|
||||||
|
offset: const Offset(0, 0), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Divider(
|
||||||
|
height: 0,
|
||||||
|
color: Colors.grey[300],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.history,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Mis servicios',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.person_outline,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Perfil profesional',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.construction_outlined,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Configuración',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.question_mark_rounded,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Soporte',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.messenger_outline,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Mensajes',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: const Icon(
|
||||||
|
Icons.calendar_month,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Calendario',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Builder(builder: (BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
color: const Color(0xFF2BA4EC),
|
||||||
|
child: ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
trailing: const Icon(
|
||||||
|
Icons.keyboard_arrow_right,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Solicitudes',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 5, horizontal: 16),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.5),
|
||||||
|
spreadRadius: 2,
|
||||||
|
blurRadius: 3,
|
||||||
|
offset:
|
||||||
|
const Offset(0, 2), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
trailing: const Icon(Icons.keyboard_arrow_right,
|
||||||
|
color: Colors.black),
|
||||||
|
title: const Text(
|
||||||
|
'Reputación',
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
subtitle: Row(
|
||||||
|
children: [
|
||||||
|
RatingBar.builder(
|
||||||
|
initialRating: user?.score?.average ?? 0,
|
||||||
|
minRating: 1,
|
||||||
|
direction: Axis.horizontal,
|
||||||
|
allowHalfRating: true,
|
||||||
|
itemCount: 5,
|
||||||
|
itemSize: 25,
|
||||||
|
maxRating: 5,
|
||||||
|
itemPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 0),
|
||||||
|
itemBuilder: (context, _) => const Icon(
|
||||||
|
Icons.star,
|
||||||
|
color: Color(0xFF2BA4EC),
|
||||||
|
),
|
||||||
|
onRatingUpdate: (rating) {},
|
||||||
|
ignoreGestures: true,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
Text(
|
||||||
|
'(${user?.score?.total.toString()}) ${user?.score?.average.toString()}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Prosapp',
|
||||||
|
style: TextStyle(fontSize: 10, color: Colors.grey[700]),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(top: 7, left: 3, right: 3),
|
||||||
|
child: Text(
|
||||||
|
'®',
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 25, color: Colors.grey[700]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'todos los derechos reservados',
|
||||||
|
style: TextStyle(fontSize: 10, color: Colors.grey[700]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
AuthenticationRepository.instance.logout();
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
shape: const CircleBorder(),
|
||||||
|
elevation: 3,
|
||||||
|
minimumSize: const Size(45, 45),
|
||||||
|
),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.logout_outlined,
|
||||||
|
color: Colors.red,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pushReplacementNamed(context, '/welcome');
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFF2BA4EC),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
minimumSize: const Size(200, 45),
|
||||||
|
),
|
||||||
|
child: const Text(
|
||||||
|
'Modo usuario',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,13 +8,16 @@ class ScoreModel {
|
|||||||
|
|
||||||
ScoreModel(this.total, this.average, this.details);
|
ScoreModel(this.total, this.average, this.details);
|
||||||
|
|
||||||
static Future<ScoreModel> fromJson(Map<String, dynamic>? json) async {
|
static Future<ScoreModel> fromJson(
|
||||||
|
Map<String, dynamic>? json, bool requiredDetails) async {
|
||||||
try {
|
try {
|
||||||
if (json == null) return ScoreModel(0, 0, []);
|
if (json == null) return ScoreModel(0, 0, []);
|
||||||
|
|
||||||
List<ScoreDetailsModel> list = [];
|
List<ScoreDetailsModel> list = [];
|
||||||
for (var e in (json['detalles'] as List<dynamic>)) {
|
if (requiredDetails) {
|
||||||
list.add(await ScoreDetailsModel.fromJson(e));
|
for (var e in (json['detalles'] as List<dynamic>)) {
|
||||||
|
list.add(await ScoreDetailsModel.fromJson(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ScoreModel(
|
return ScoreModel(
|
||||||
@@ -37,7 +40,7 @@ class ScoreDetailsModel {
|
|||||||
|
|
||||||
ScoreDetailsModel(this.name, this.avatar, this.score, this.comment);
|
ScoreDetailsModel(this.name, this.avatar, this.score, this.comment);
|
||||||
|
|
||||||
static Future<ScoreDetailsModel> fromJson(Map<String, dynamic?>? json) async {
|
static Future<ScoreDetailsModel> fromJson(Map<String, dynamic>? json) async {
|
||||||
final FirebaseStorage storage = FirebaseStorage.instance;
|
final FirebaseStorage storage = FirebaseStorage.instance;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:firebase_storage/firebase_storage.dart';
|
||||||
|
import 'package:prosappco/src/models/score_model.dart';
|
||||||
|
import 'package:prosappco/src/screens/professional.dart';
|
||||||
|
|
||||||
|
class UserModel {
|
||||||
|
final String name;
|
||||||
|
final String city;
|
||||||
|
final String? state;
|
||||||
|
final Reference? photo;
|
||||||
|
final ScoreModel? score;
|
||||||
|
|
||||||
|
UserModel(this.name, this.city, this.state, this.photo, this.score);
|
||||||
|
|
||||||
|
static Future<UserModel> fromJson(Map<String, dynamic>? json) async {
|
||||||
|
try {
|
||||||
|
if (json == null) return UserModel('', '', null, null, null);
|
||||||
|
|
||||||
|
String? avatar = json['photo'];
|
||||||
|
return UserModel(
|
||||||
|
json['name'],
|
||||||
|
json['city'],
|
||||||
|
json['estado'],
|
||||||
|
avatar != null ? storage.ref().child(avatar) : null,
|
||||||
|
await ScoreModel.fromJson(json['puntuacion'], false),
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
print('XD user $e');
|
||||||
|
return UserModel('', '', null, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<UserModel> getUser(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 UserModel('', '', null, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -84,7 +84,7 @@ Future<List<Professional>> getProfessionals() async {
|
|||||||
professionalRef: storage.ref().child(_photo),
|
professionalRef: storage.ref().child(_photo),
|
||||||
professionalEspecializado: especializaciones,
|
professionalEspecializado: especializaciones,
|
||||||
ubicacion: data['ubicacion'],
|
ubicacion: data['ubicacion'],
|
||||||
puntuacion: await ScoreModel.fromJson(data['puntuacion']),
|
puntuacion: await ScoreModel.fromJson(data['puntuacion'], true),
|
||||||
);
|
);
|
||||||
professionals.add(professional);
|
professionals.add(professional);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import 'package:firebase_auth/firebase_auth.dart';
|
|||||||
import 'package:firebase_storage/firebase_storage.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: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/drawer_menu.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';
|
||||||
import 'package:prosappco/src/screens/new_number.dart';
|
import 'package:prosappco/src/screens/new_number.dart';
|
||||||
@@ -17,7 +17,7 @@ import 'package:prosappco/src/services/select_image_profile.dart';
|
|||||||
import '../components/photo_view.dart';
|
import '../components/photo_view.dart';
|
||||||
|
|
||||||
class ProfileScreen extends StatefulWidget {
|
class ProfileScreen extends StatefulWidget {
|
||||||
ProfileScreen({Key? key}) : super(key: key);
|
const ProfileScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ProfileScreen> createState() => _ProfileScreenState();
|
State<ProfileScreen> createState() => _ProfileScreenState();
|
||||||
@@ -39,7 +39,6 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
var photoTemp = '';
|
var photoTemp = '';
|
||||||
var _ciudad = '...';
|
var _ciudad = '...';
|
||||||
var _photo = '...';
|
var _photo = '...';
|
||||||
var _estado = '...';
|
|
||||||
String? _email = '';
|
String? _email = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -79,13 +78,6 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
_photo = s;
|
_photo = s;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (_estado == '...') {
|
|
||||||
AuthenticationRepository.instance
|
|
||||||
.getState(uid.toString())
|
|
||||||
.then((String s) => setState(() {
|
|
||||||
_estado = s;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateImage(image) async {
|
Future<void> updateImage(image) async {
|
||||||
@@ -349,30 +341,16 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final User? user = FirebaseAuth.instance.currentUser;
|
|
||||||
String city = _ciudad.toString();
|
String city = _ciudad.toString();
|
||||||
String state = _estado.toString();
|
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: PopAppbar(
|
||||||
backgroundColor: Colors.white,
|
onPressed: () {
|
||||||
iconTheme: const IconThemeData(
|
Navigator.pop(context);
|
||||||
color: Colors.black,
|
},
|
||||||
),
|
label: 'Perfil'),
|
||||||
title: const Text(
|
drawer: DrawerMenu(),
|
||||||
'Perfil',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
drawer: DrawerMenu(
|
|
||||||
ref: storage.ref().child(_photo),
|
|
||||||
userName: user?.displayName ?? '',
|
|
||||||
userPhoneNumber: user?.phoneNumber ?? '',
|
|
||||||
userCity: city,
|
|
||||||
userState: state),
|
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
reverse: true,
|
reverse: true,
|
||||||
child: Center(
|
child: Center(
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:firebase_storage/firebase_storage.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||||
|
import 'package:prosappco/src/components/drawer_professional.dart';
|
||||||
|
|
||||||
|
class PruebaScreen extends StatefulWidget {
|
||||||
|
const PruebaScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PruebaScreen> createState() => _PruebaScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PruebaScreenState extends State<PruebaScreen> {
|
||||||
|
File? imagen_to_upload;
|
||||||
|
|
||||||
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
|
|
||||||
|
late final FirebaseAuth _auth;
|
||||||
|
final FirebaseStorage storage = FirebaseStorage.instance;
|
||||||
|
var photoTemp = '';
|
||||||
|
var _ciudad = '...';
|
||||||
|
var _photo = '...';
|
||||||
|
var _estado = '...';
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
|
_auth = FirebaseAuth.instance;
|
||||||
|
|
||||||
|
final currentUser = _auth.currentUser;
|
||||||
|
|
||||||
|
if (_ciudad == '...') {
|
||||||
|
AuthenticationRepository.instance
|
||||||
|
.getCity(uid.toString())
|
||||||
|
.then((String s) => setState(() {
|
||||||
|
_ciudad = s;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_photo == '...') {
|
||||||
|
AuthenticationRepository.instance
|
||||||
|
.getPhoto(uid.toString())
|
||||||
|
.then((String s) => setState(() {
|
||||||
|
_photo = s;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (_estado == '...') {
|
||||||
|
AuthenticationRepository.instance
|
||||||
|
.getState(uid.toString())
|
||||||
|
.then((String s) => setState(() {
|
||||||
|
_estado = s;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final User? user = FirebaseAuth.instance.currentUser;
|
||||||
|
String city = _ciudad.toString();
|
||||||
|
String state = _estado.toString();
|
||||||
|
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
iconTheme: const IconThemeData(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
title: const Text(
|
||||||
|
'Perfil',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
drawer: DrawerProfessional(
|
||||||
|
ref: storage.ref().child(_photo),
|
||||||
|
userName: user?.displayName ?? '',
|
||||||
|
userPhoneNumber: user?.phoneNumber ?? '',
|
||||||
|
userCity: city,
|
||||||
|
userState: state),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import 'package:flutter/cupertino.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/drawer_menu.dart';
|
import 'package:prosappco/src/components/drawer_menu.dart';
|
||||||
|
import 'package:prosappco/src/models/score_model.dart';
|
||||||
import 'package:prosappco/src/screens/professional.dart';
|
import 'package:prosappco/src/screens/professional.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ class ServiceScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _ServiceScreenState extends State<ServiceScreen> {
|
class _ServiceScreenState extends State<ServiceScreen> {
|
||||||
final DateFormat formatter = DateFormat('dd/MM/yyyy');
|
final DateFormat formatter = DateFormat('dd/MM/yyyy');
|
||||||
|
final DateTime now = DateTime.now();
|
||||||
|
|
||||||
DateTime? _selectedDate;
|
DateTime? _selectedDate;
|
||||||
TimeOfDay? _selectedTime;
|
TimeOfDay? _selectedTime;
|
||||||
@@ -23,9 +25,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
Future<void> _selectDate(BuildContext context) async {
|
Future<void> _selectDate(BuildContext context) async {
|
||||||
final DateTime? picked = await showDatePicker(
|
final DateTime? picked = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialDate: DateTime.now(),
|
initialDate: now,
|
||||||
firstDate: DateTime(2022),
|
firstDate: DateTime(now.year),
|
||||||
lastDate: DateTime(2025),
|
lastDate: DateTime(now.year + 1),
|
||||||
// builder: (context, child) {
|
// builder: (context, child) {
|
||||||
// return Theme(data: ThemeData.dark(), child: child!);
|
// return Theme(data: ThemeData.dark(), child: child!);
|
||||||
// },
|
// },
|
||||||
@@ -95,18 +97,10 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
List<String> opc = ["Servicio", "Opción 1", "Opción 2", "Opción 3"];
|
List<String> opc = ["Servicio", "Opción 1", "Opción 2", "Opción 3"];
|
||||||
String defaultValue = opc[0];
|
String defaultValue = opc[0];
|
||||||
|
|
||||||
String city = _ciudad.toString();
|
|
||||||
String state = _estado.toString();
|
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Color(0xFFD6F4FF),
|
backgroundColor: Color(0xFFD6F4FF),
|
||||||
drawer: DrawerMenu(
|
drawer: DrawerMenu(),
|
||||||
ref: storage.ref().child(_photo),
|
|
||||||
userName: user?.displayName ?? '',
|
|
||||||
userPhoneNumber: user?.phoneNumber ?? '',
|
|
||||||
userCity: city,
|
|
||||||
userState: state),
|
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
reverse: true,
|
reverse: true,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
@@ -243,8 +237,11 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
_selectDate(context);
|
_selectDate(context);
|
||||||
},
|
},
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
prefixIcon: Icon(Icons.calendar_month),
|
prefixIcon: const Icon(Icons.calendar_month),
|
||||||
|
suffixIcon: _selectedDate == null
|
||||||
|
? const Icon(Icons.arrow_drop_down)
|
||||||
|
: null,
|
||||||
hintText: 'Fecha',
|
hintText: 'Fecha',
|
||||||
),
|
),
|
||||||
controller: TextEditingController(
|
controller: TextEditingController(
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import 'package:prosappco/src/authentication/authentication_repository.dart';
|
|||||||
import 'package:prosappco/src/components/drawer_menu.dart';
|
import 'package:prosappco/src/components/drawer_menu.dart';
|
||||||
import 'package:prosappco/src/components/primary_btn.dart';
|
import 'package:prosappco/src/components/primary_btn.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/models/score_model.dart';
|
||||||
|
import 'package:prosappco/src/models/user_model.dart';
|
||||||
|
|
||||||
import '../components/photo_view.dart';
|
import '../components/photo_view.dart';
|
||||||
|
|
||||||
@@ -21,55 +23,17 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
|||||||
final FirebaseStorage storage = FirebaseStorage.instance;
|
final FirebaseStorage storage = FirebaseStorage.instance;
|
||||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
final controller = Get.put(NameEmailCityController());
|
final controller = Get.put(NameEmailCityController());
|
||||||
var _ciudad = '';
|
|
||||||
var _photo = '...';
|
|
||||||
var _estado = '...';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
if (_estado == '...') {
|
|
||||||
AuthenticationRepository.instance
|
|
||||||
.getState(uid.toString())
|
|
||||||
.then((String s) => setState(() {
|
|
||||||
_estado = s;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_ciudad == '') {
|
|
||||||
AuthenticationRepository.instance
|
|
||||||
.getCity(uid.toString())
|
|
||||||
.then((String s) => setState(() {
|
|
||||||
_ciudad = s;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_photo == '...') {
|
|
||||||
AuthenticationRepository.instance
|
|
||||||
.getPhoto(uid.toString())
|
|
||||||
.then((String s) => setState(() {
|
|
||||||
_photo = s;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final User? user = FirebaseAuth.instance.currentUser;
|
|
||||||
|
|
||||||
// String name = _nombre.toString();
|
|
||||||
String city = _ciudad.toString();
|
|
||||||
String state = _estado.toString();
|
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
drawer: DrawerMenu(
|
drawer: DrawerMenu(),
|
||||||
ref: storage.ref().child(_photo),
|
|
||||||
userName: user?.displayName ?? '',
|
|
||||||
userPhoneNumber: user?.phoneNumber ?? '',
|
|
||||||
userCity: city,
|
|
||||||
userState: state),
|
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: const Color(0xFFD6F4FF),
|
backgroundColor: const Color(0xFFD6F4FF),
|
||||||
body: Stack(
|
body: Stack(
|
||||||
|
|||||||
Reference in New Issue
Block a user