update
This commit is contained in:
@@ -1,452 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.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/scores_model.dart';
|
||||
import 'package:prosappco/src/models/user_model.dart';
|
||||
import 'package:prosappco/src/providers/user_provider.dart';
|
||||
import 'package:prosappco/src/screens/configuracion.dart';
|
||||
import 'package:prosappco/src/screens/messages_user.dart';
|
||||
import 'package:prosappco/src/screens/professional_profile_web.dart';
|
||||
import 'package:prosappco/src/screens/profile.dart';
|
||||
import 'package:prosappco/src/screens/profile_web.dart';
|
||||
import 'package:prosappco/src/screens/reputation.dart';
|
||||
import 'package:prosappco/src/screens/support.dart';
|
||||
import 'package:prosappco/src/screens/web_view.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class DrawerMenu extends StatelessWidget {
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
|
||||
Future<void> _irSugerencias() async {
|
||||
const url = 'https://admin.prosapp.co/sugerencias';
|
||||
|
||||
final Uri _url = Uri.parse(url);
|
||||
|
||||
if (await canLaunchUrl(_url)) {
|
||||
await launchUrl(_url);
|
||||
} else {
|
||||
throw 'No se pudo abrir la URL $url';
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userProvider = Provider.of<UserProvider>(context);
|
||||
UserModel? user = userProvider.user;
|
||||
ScoresModel? score = userProvider.score;
|
||||
|
||||
return Drawer(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
infoUser(context, user),
|
||||
], //
|
||||
),
|
||||
),
|
||||
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: () {
|
||||
if (ModalRoute.of(context)?.settings.name !=
|
||||
'/misservicios') {
|
||||
Navigator.pushNamed(context, '/misservicios');
|
||||
} else {
|
||||
Scaffold.of(context).openEndDrawer();
|
||||
}
|
||||
},
|
||||
leading: const Icon(
|
||||
Icons.history,
|
||||
color: Colors.black,
|
||||
),
|
||||
title: const Text(
|
||||
'Mis servicios',
|
||||
style: TextStyle(fontSize: 15),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
if (kIsWeb) {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const ProfileWebScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const ProfileScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
leading: const Icon(
|
||||
Icons.person_outline,
|
||||
color: Colors.black,
|
||||
),
|
||||
title: const Text(
|
||||
'Mi perfil',
|
||||
style: TextStyle(fontSize: 15),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const ConfiguracionScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
leading: const Icon(
|
||||
Icons.construction_outlined,
|
||||
color: Colors.black,
|
||||
),
|
||||
title: const Text(
|
||||
'Configuración',
|
||||
style: TextStyle(fontSize: 15),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const SupportScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
leading: const Icon(
|
||||
Icons.question_mark_rounded,
|
||||
color: Colors.black,
|
||||
),
|
||||
title: const Text(
|
||||
'Soporte',
|
||||
style: TextStyle(fontSize: 15),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
if (kIsWeb) {
|
||||
_irSugerencias();
|
||||
} else {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return WebViewScreen(
|
||||
label: 'Sugerencias',
|
||||
link: 'https://admin.prosapp.co/sugerencias');
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
leading: const Icon(
|
||||
Icons.campaign_outlined,
|
||||
color: Colors.black,
|
||||
),
|
||||
title: const Text(
|
||||
'Sugerencias',
|
||||
style: TextStyle(fontSize: 15),
|
||||
),
|
||||
),
|
||||
// ListTile(
|
||||
// onTap: () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// CupertinoPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return const MessagesUserScreen();
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// 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 !=
|
||||
'/servicio') {
|
||||
Navigator.pushNamed(context, '/servicio');
|
||||
} 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),
|
||||
);
|
||||
}),
|
||||
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: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const ReputationScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
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: 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(
|
||||
'(${score?.total.toString()}) ${score?.average.toStringAsFixed(1)}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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]),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
UserModel? user = userProvider.user;
|
||||
if (user?.name == '' ||
|
||||
user?.city == '' ||
|
||||
user?.phoneNumber == '' ||
|
||||
user?.phoneNumber == null) {
|
||||
Get.snackbar(
|
||||
'Completa tu perfil',
|
||||
'Para ser un profesional registrado, asegúrate de llenar todos los campos necesarios y no olvides guardar tus cambios para que surtan efecto.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
if (user?.phoneNumber != user?.phoneNumber) {
|
||||
Get.snackbar(
|
||||
'Tu número de teléfono sigue sin cambios.',
|
||||
'Para guardar esta información, dirígete a tu perfil y selecciona la opción Guardar',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
if (user?.state == 'pendiente' || user?.state == null) {
|
||||
Navigator.pop(context);
|
||||
if (kIsWeb) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
const ProfessionalProfileWebScreen(),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Navigator.pushNamed(context, '/profesionalProfile');
|
||||
}
|
||||
} else if (user?.state == 'revision') {
|
||||
Navigator.pushNamed(context, '/profesionalRevision');
|
||||
} else if (user?.state == 'activo') {
|
||||
Navigator.pushNamed(context, '/solicitud');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2BA4EC),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
elevation: 0,
|
||||
minimumSize: const Size(230, 45),
|
||||
),
|
||||
child: const Text(
|
||||
'Modo profesional',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
await AuthenticationRepository.instance.logout(uid!);
|
||||
|
||||
userProvider.setNullUser();
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
),
|
||||
minimumSize: const Size(230, 40),
|
||||
),
|
||||
child: const Text(
|
||||
'Cerrar Sesión',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ListTile infoUser(BuildContext context, UserModel? user) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
if (kIsWeb) {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const ProfileWebScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const ProfileScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
title: Text(user?.name ?? '',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
user?.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),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,18 +6,18 @@ 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';
|
||||
import 'package:prosappco/src/screens/calendar.dart';
|
||||
import 'package:prosappco/src/screens/messages.dart';
|
||||
import 'package:prosappco/src/screens/my_services_pro.dart';
|
||||
import 'package:prosappco/src/screens/professional.dart';
|
||||
import 'package:prosappco/src/screens/profile.dart';
|
||||
import 'package:prosappco/src/screens/profile_pro.dart';
|
||||
import 'package:prosappco/src/screens/profile_pro_web.dart';
|
||||
import 'package:prosappco/src/screens/reputacion_pro.dart';
|
||||
import 'package:prosappco/src/screens/web_view.dart';
|
||||
import 'package:prosappco/src/presentation/screens/calendar.dart';
|
||||
import 'package:prosappco/src/presentation/screens/messages.dart';
|
||||
import 'package:prosappco/src/presentation/screens/my_services_pro.dart';
|
||||
import 'package:prosappco/src/presentation/screens/professional.dart';
|
||||
import 'package:prosappco/src/presentation/screens/profile/profile.dart';
|
||||
import 'package:prosappco/src/presentation/screens/profile/profile_pro.dart';
|
||||
import 'package:prosappco/src/presentation/screens/profile/profile_pro_web.dart';
|
||||
import 'package:prosappco/src/presentation/screens/reputacion_pro.dart';
|
||||
import 'package:prosappco/src/presentation/screens/web_view.dart';
|
||||
import '../models/scores_model.dart';
|
||||
import '../screens/configuracion.dart';
|
||||
import '../screens/support.dart';
|
||||
import '../presentation/screens/configuracion.dart';
|
||||
import '../presentation/screens/support.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class DrawerProfessional extends StatefulWidget {
|
||||
|
||||
Reference in New Issue
Block a user