implementacion de codigo de pais
This commit is contained in:
+42
-19
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl_phone_field/intl_phone_field.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/controllers/phone_auth_controller.dart';
|
||||
import 'package:prosappco/src/screens/code_validation.dart';
|
||||
@@ -16,6 +17,7 @@ class LoginScreen extends StatefulWidget {
|
||||
class _LoginScreenState extends State<LoginScreen> {
|
||||
final controller = Get.put(PhoneAuthController());
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
String completePhoneNumber = '';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -71,41 +73,62 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
Form(
|
||||
key: _formKey,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 10),
|
||||
child: TextFormField(
|
||||
padding: EdgeInsets.only(bottom: 5),
|
||||
child: IntlPhoneField(
|
||||
controller: controller.phoneNo,
|
||||
initialCountryCode: 'CO',
|
||||
onChanged: (phoneNo) {
|
||||
completePhoneNumber = phoneNo.completeNumber;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(50),
|
||||
)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(50),
|
||||
)),
|
||||
hintText: '+57',
|
||||
fillColor: Color.fromARGB(255, 239, 239, 239),
|
||||
filled: true,
|
||||
prefixIcon: Icon(Icons.phone_android_outlined)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(50),
|
||||
)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(50),
|
||||
)),
|
||||
fillColor: Color.fromARGB(255, 239, 239, 239),
|
||||
filled: true,
|
||||
),
|
||||
),
|
||||
// child: TextFormField(
|
||||
// controller: controller.phoneNo,
|
||||
// decoration: InputDecoration(
|
||||
// enabledBorder: OutlineInputBorder(
|
||||
// borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||
// borderRadius: BorderRadius.all(
|
||||
// Radius.circular(50),
|
||||
// )),
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||
// borderRadius: BorderRadius.all(
|
||||
// Radius.circular(50),
|
||||
// )),
|
||||
// hintText: '+57',
|
||||
// fillColor: Color.fromARGB(255, 239, 239, 239),
|
||||
// filled: true,
|
||||
// prefixIcon: Icon(Icons.phone_android_outlined)),
|
||||
// ),
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(bottom: 40),
|
||||
padding: EdgeInsets.only(bottom: 30),
|
||||
child: Text('Un código será enviado a este numero de celular.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 13.0, color: Color(0xFF65676B))),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 40),
|
||||
padding: EdgeInsets.only(bottom: 30),
|
||||
child: Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
PhoneAuthController.instance.phoneAuthentication(
|
||||
controller.phoneNo.text.trim(),
|
||||
completePhoneNumber.trim(),
|
||||
);
|
||||
Get.to(() => const CodeValidationScreen());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user