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