ultimos cambios
This commit is contained in:
@@ -17,7 +17,6 @@ import 'package:prosappco/src/screens/profile_pro.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';
|
||||||
import 'package:prosappco/src/screens/welcome.dart';
|
|
||||||
import 'firebase_options.dart';
|
import 'firebase_options.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
@@ -46,7 +45,6 @@ class MyApp extends StatelessWidget {
|
|||||||
routes: {
|
routes: {
|
||||||
'/': (context) => const LoginScreen(),
|
'/': (context) => const LoginScreen(),
|
||||||
'/login': (context) => const LoginEmailScreen(),
|
'/login': (context) => const LoginEmailScreen(),
|
||||||
'/welcome': (context) => const WelcomeScreen(),
|
|
||||||
'/profile': (context) => const ProfileScreen(),
|
'/profile': (context) => const ProfileScreen(),
|
||||||
'/register': (context) => const RegisterScreen(),
|
'/register': (context) => const RegisterScreen(),
|
||||||
'/city': (context) => const CityScreen(),
|
'/city': (context) => const CityScreen(),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:google_sign_in/google_sign_in.dart';
|
import 'package:google_sign_in/google_sign_in.dart';
|
||||||
import 'package:prosappco/src/authentication/exceptions/register_failed.dart';
|
import 'package:prosappco/src/authentication/exceptions/register_failed.dart';
|
||||||
import 'package:prosappco/src/screens/login.dart';
|
import 'package:prosappco/src/screens/login.dart';
|
||||||
import 'package:prosappco/src/screens/welcome.dart';
|
import 'package:prosappco/src/screens/service.dart';
|
||||||
|
|
||||||
class AuthenticationRepository extends GetxController {
|
class AuthenticationRepository extends GetxController {
|
||||||
static AuthenticationRepository get instance => Get.find();
|
static AuthenticationRepository get instance => Get.find();
|
||||||
@@ -29,7 +29,7 @@ class AuthenticationRepository extends GetxController {
|
|||||||
_setInitialScreen(User? user) {
|
_setInitialScreen(User? user) {
|
||||||
user == null
|
user == null
|
||||||
? Get.offAll(const LoginScreen())
|
? Get.offAll(const LoginScreen())
|
||||||
: Get.offAll(const WelcomeScreen());
|
: Get.offAll(const ServiceScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> phoneAuthentication(String phoneNo) async {
|
Future<void> phoneAuthentication(String phoneNo) async {
|
||||||
@@ -79,7 +79,7 @@ class AuthenticationRepository extends GetxController {
|
|||||||
email: email, password: password);
|
email: email, password: password);
|
||||||
|
|
||||||
firebaseUser.value != null
|
firebaseUser.value != null
|
||||||
? Get.offAll(WelcomeScreen())
|
? Get.offAll(ServiceScreen())
|
||||||
: Get.to(LoginScreen());
|
: Get.to(LoginScreen());
|
||||||
} on FirebaseAuthException catch (e) {
|
} on FirebaseAuthException catch (e) {
|
||||||
final ex = SignUpWithEmailAndPasswordFailure.code(e.code);
|
final ex = SignUpWithEmailAndPasswordFailure.code(e.code);
|
||||||
|
|||||||
@@ -169,8 +169,9 @@ class _DrawerMenuState extends State<DrawerMenu> {
|
|||||||
Builder(builder: (BuildContext context) {
|
Builder(builder: (BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (ModalRoute.of(context)?.settings.name != '/welcome') {
|
if (ModalRoute.of(context)?.settings.name !=
|
||||||
Navigator.pushNamed(context, '/welcome');
|
'/servicio') {
|
||||||
|
Navigator.pushNamed(context, '/servicio');
|
||||||
} else {
|
} else {
|
||||||
Scaffold.of(context).openEndDrawer();
|
Scaffold.of(context).openEndDrawer();
|
||||||
}
|
}
|
||||||
@@ -286,8 +287,7 @@ class _DrawerMenuState extends State<DrawerMenu> {
|
|||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (user?.state == 'pendiente' ||
|
if (user?.state == 'pendiente' || user?.state == null) {
|
||||||
user?.state?.isEmpty == true) {
|
|
||||||
Navigator.pushNamed(context, '/profesionalProfile');
|
Navigator.pushNamed(context, '/profesionalProfile');
|
||||||
} else if (user?.state == 'revision') {
|
} else if (user?.state == 'revision') {
|
||||||
Navigator.pushNamed(context, '/profesionalRevision');
|
Navigator.pushNamed(context, '/profesionalRevision');
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ class _DrawerProfessionalState extends State<DrawerProfessional> {
|
|||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushReplacementNamed(context, '/welcome');
|
Navigator.pushReplacementNamed(context, '/servicio');
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: const Color(0xFF2BA4EC),
|
backgroundColor: const Color(0xFF2BA4EC),
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
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/welcome.dart';
|
import 'package:prosappco/src/screens/service.dart';
|
||||||
|
|
||||||
class OTPController extends GetxController {
|
class OTPController extends GetxController {
|
||||||
static OTPController get instance => Get.find();
|
static OTPController get instance => Get.find();
|
||||||
|
|
||||||
Future<void> verifyOTP(String otp) async {
|
Future<void> verifyOTP(String otp) async {
|
||||||
var isVerified = AuthenticationRepository.instance.verifyOTP(otp);
|
var isVerified = AuthenticationRepository.instance.verifyOTP(otp);
|
||||||
await isVerified ? Get.offAll(const WelcomeScreen()) : Get.back();
|
await isVerified ? Get.offAll(const ServiceScreen()) : Get.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import 'package:prosappco/src/authentication/authentication_repository.dart';
|
|||||||
import 'package:prosappco/src/components/primary_btn.dart';
|
import 'package:prosappco/src/components/primary_btn.dart';
|
||||||
import 'package:prosappco/src/controllers/register_controller.dart';
|
import 'package:prosappco/src/controllers/register_controller.dart';
|
||||||
import 'package:prosappco/src/screens/login.dart';
|
import 'package:prosappco/src/screens/login.dart';
|
||||||
import 'package:prosappco/src/screens/welcome.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class RegisterScreen extends StatefulWidget {
|
class RegisterScreen extends StatefulWidget {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class RequestSentScreen extends StatelessWidget {
|
|||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: PopAppbar(
|
appBar: PopAppbar(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushReplacementNamed(context, '/welcome');
|
Navigator.pushReplacementNamed(context, '/servicio');
|
||||||
},
|
},
|
||||||
label: 'Solicitud enviada',
|
label: 'Solicitud enviada',
|
||||||
),
|
),
|
||||||
@@ -34,7 +34,7 @@ class RequestSentScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
PrimaryButtom(
|
PrimaryButtom(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushReplacementNamed(context, '/welcome');
|
Navigator.pushReplacementNamed(context, '/servicio');
|
||||||
},
|
},
|
||||||
label: 'Inicio'),
|
label: 'Inicio'),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,125 +0,0 @@
|
|||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:firebase_storage/firebase_storage.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
|
||||||
import 'package:prosappco/src/components/drawer_menu.dart';
|
|
||||||
import 'package:prosappco/src/components/primary_btn.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';
|
|
||||||
|
|
||||||
class WelcomeScreen extends StatefulWidget {
|
|
||||||
const WelcomeScreen({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<WelcomeScreen> createState() => _WelcomeScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _WelcomeScreenState extends State<WelcomeScreen> {
|
|
||||||
final FirebaseStorage storage = FirebaseStorage.instance;
|
|
||||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
|
||||||
final controller = Get.put(NameEmailCityController());
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SafeArea(
|
|
||||||
child: Scaffold(
|
|
||||||
drawer: DrawerMenu(),
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
backgroundColor: const Color(0xFFD6F4FF),
|
|
||||||
body: Stack(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
margin: const EdgeInsets.only(top: 130),
|
|
||||||
width: double.infinity,
|
|
||||||
height: 800,
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
topRight: Radius.circular(50),
|
|
||||||
topLeft: Radius.circular(50))),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: const EdgeInsets.only(top: 20, left: 30),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.topCenter,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Builder(
|
|
||||||
builder: (context) => ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
shape: const CircleBorder(),
|
|
||||||
elevation: 3,
|
|
||||||
minimumSize: const Size(50, 50),
|
|
||||||
),
|
|
||||||
child: const Icon(
|
|
||||||
Icons.menu,
|
|
||||||
color: Colors.black,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Scaffold.of(context).openDrawer();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 150,
|
|
||||||
),
|
|
||||||
const Padding(
|
|
||||||
padding: EdgeInsets.only(top: 50),
|
|
||||||
child: Image(
|
|
||||||
image: AssetImage('images/logo_prosapp.png'),
|
|
||||||
width: 120,
|
|
||||||
height: 50,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
|
||||||
margin: const EdgeInsets.only(top: 170),
|
|
||||||
child: const Align(
|
|
||||||
alignment: Alignment.topCenter,
|
|
||||||
child: Text(
|
|
||||||
'Bienvenido',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Color(0xFF262626),
|
|
||||||
fontSize: 38.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
|
||||||
margin: const EdgeInsets.only(top: 280, left: 50, right: 50),
|
|
||||||
child: Column(children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 40),
|
|
||||||
child: Center(
|
|
||||||
child: PrimaryButtom(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pushNamed(context, '/servicio');
|
|
||||||
},
|
|
||||||
label: 'Solicitar un servicio'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user