login por celular fixeado
This commit is contained in:
@@ -2,20 +2,18 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_otp_text_field/flutter_otp_text_field.dart';
|
import 'package:flutter_otp_text_field/flutter_otp_text_field.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:prosappco/src/controllers/otp_controller.dart';
|
import 'package:prosappco/src/controllers/otp_controller.dart';
|
||||||
|
import 'package:prosappco/src/controllers/phone_auth_controller.dart';
|
||||||
|
|
||||||
class CodeValidationScreen extends StatefulWidget {
|
class CodeValidationScreen extends StatelessWidget {
|
||||||
const CodeValidationScreen({super.key});
|
CodeValidationScreen({super.key, this.phoneNumber});
|
||||||
|
String? phoneNumber;
|
||||||
|
|
||||||
@override
|
|
||||||
State<CodeValidationScreen> createState() => _CodeValidationScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CodeValidationScreenState extends State<CodeValidationScreen> {
|
|
||||||
final controller = Get.put(OTPController());
|
final controller = Get.put(OTPController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var otp;
|
var otp;
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
@@ -80,18 +78,27 @@ class _CodeValidationScreenState extends State<CodeValidationScreen> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
onChanged: (value) {
|
||||||
|
phoneNumber = value;
|
||||||
|
},
|
||||||
|
controller:
|
||||||
|
TextEditingController(text: phoneNumber ?? ''),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
hintText: '+57',
|
hintText: '',
|
||||||
suffixIcon: Icon(Icons.edit),
|
suffixIcon: Icon(Icons.edit),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
|
||||||
// Acción a realizar cuando se hace clic en el texto
|
|
||||||
},
|
|
||||||
child: Text('Reenviar código'),
|
child: Text('Reenviar código'),
|
||||||
|
onPressed: () {
|
||||||
|
if (phoneNumber!.isNotEmpty) {
|
||||||
|
PhoneAuthController.instance.phoneAuthentication(
|
||||||
|
phoneNumber!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -130,7 +130,9 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
PhoneAuthController.instance.phoneAuthentication(
|
PhoneAuthController.instance.phoneAuthentication(
|
||||||
completePhoneNumber.trim(),
|
completePhoneNumber.trim(),
|
||||||
);
|
);
|
||||||
Get.to(() => const CodeValidationScreen());
|
Get.to(() => CodeValidationScreen(
|
||||||
|
phoneNumber: completePhoneNumber.trim(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|||||||
@@ -33,13 +33,6 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
|||||||
.getState(uid.toString())
|
.getState(uid.toString())
|
||||||
.then((String s) => setState(() {
|
.then((String s) => setState(() {
|
||||||
_estado = s;
|
_estado = s;
|
||||||
|
|
||||||
if (_estado.isEmpty) {
|
|
||||||
FirebaseFirestore.instance
|
|
||||||
.collection('users')
|
|
||||||
.doc(uid)
|
|
||||||
.update({'estado': 'pendiente'});
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user