implementacion de codigo de pais
This commit is contained in:
@@ -110,6 +110,7 @@ class _CodeValidationScreenState extends State<CodeValidationScreen> {
|
|||||||
padding: EdgeInsets.only(bottom: 20),
|
padding: EdgeInsets.only(bottom: 20),
|
||||||
child: OtpTextField(
|
child: OtpTextField(
|
||||||
numberOfFields: 6,
|
numberOfFields: 6,
|
||||||
|
focusedBorderColor: Colors.blue,
|
||||||
fillColor: Colors.black.withOpacity(0.1),
|
fillColor: Colors.black.withOpacity(0.1),
|
||||||
filled: true,
|
filled: true,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
@@ -118,32 +119,6 @@ class _CodeValidationScreenState extends State<CodeValidationScreen> {
|
|||||||
OTPController.instance.verifyOTP(otp);
|
OTPController.instance.verifyOTP(otp);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// child: TextField(
|
|
||||||
// onSubmitted:
|
|
||||||
// maxLength: 6,
|
|
||||||
// keyboardType: TextInputType.number,
|
|
||||||
// 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: '_ _ _ _ _ _',
|
|
||||||
// fillColor: Color.fromARGB(255, 239, 239, 239),
|
|
||||||
// filled: true,
|
|
||||||
// ),
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: TextStyle(
|
|
||||||
// letterSpacing: 10.0,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(bottom: 40),
|
padding: EdgeInsets.only(bottom: 40),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.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/authentication/authentication_repository.dart';
|
||||||
import 'package:prosappco/src/controllers/phone_auth_controller.dart';
|
import 'package:prosappco/src/controllers/phone_auth_controller.dart';
|
||||||
import 'package:prosappco/src/screens/code_validation.dart';
|
import 'package:prosappco/src/screens/code_validation.dart';
|
||||||
@@ -16,6 +17,7 @@ class LoginScreen extends StatefulWidget {
|
|||||||
class _LoginScreenState extends State<LoginScreen> {
|
class _LoginScreenState extends State<LoginScreen> {
|
||||||
final controller = Get.put(PhoneAuthController());
|
final controller = Get.put(PhoneAuthController());
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
String completePhoneNumber = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -71,9 +73,13 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
Form(
|
Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(bottom: 10),
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
child: TextFormField(
|
child: IntlPhoneField(
|
||||||
controller: controller.phoneNo,
|
controller: controller.phoneNo,
|
||||||
|
initialCountryCode: 'CO',
|
||||||
|
onChanged: (phoneNo) {
|
||||||
|
completePhoneNumber = phoneNo.completeNumber;
|
||||||
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
@@ -85,27 +91,44 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
borderRadius: BorderRadius.all(
|
borderRadius: BorderRadius.all(
|
||||||
Radius.circular(50),
|
Radius.circular(50),
|
||||||
)),
|
)),
|
||||||
hintText: '+57',
|
|
||||||
fillColor: Color.fromARGB(255, 239, 239, 239),
|
fillColor: Color.fromARGB(255, 239, 239, 239),
|
||||||
filled: true,
|
filled: true,
|
||||||
prefixIcon: Icon(Icons.phone_android_outlined)),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// 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(
|
const Padding(
|
||||||
padding: EdgeInsets.only(bottom: 40),
|
padding: EdgeInsets.only(bottom: 30),
|
||||||
child: Text('Un código será enviado a este numero de celular.',
|
child: Text('Un código será enviado a este numero de celular.',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(fontSize: 13.0, color: Color(0xFF65676B))),
|
style: TextStyle(fontSize: 13.0, color: Color(0xFF65676B))),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(bottom: 40),
|
padding: EdgeInsets.only(bottom: 30),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
PhoneAuthController.instance.phoneAuthentication(
|
PhoneAuthController.instance.phoneAuthentication(
|
||||||
controller.phoneNo.text.trim(),
|
completePhoneNumber.trim(),
|
||||||
);
|
);
|
||||||
Get.to(() => const CodeValidationScreen());
|
Get.to(() => const CodeValidationScreen());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,37 +138,37 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const Padding(
|
// const Padding(
|
||||||
padding: EdgeInsets.only(bottom: 5),
|
// padding: EdgeInsets.only(bottom: 5),
|
||||||
child: Align(
|
// child: Align(
|
||||||
alignment: Alignment.topLeft,
|
// alignment: Alignment.topLeft,
|
||||||
child: Text('Nombre',
|
// child: Text('Nombre',
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
fontSize: 18.0, color: Color(0xFF65676B))),
|
// fontSize: 18.0, color: Color(0xFF65676B))),
|
||||||
)),
|
// )),
|
||||||
Padding(
|
// Padding(
|
||||||
padding: EdgeInsets.only(bottom: 18),
|
// padding: EdgeInsets.only(bottom: 18),
|
||||||
child: TextFormField(
|
// child: TextFormField(
|
||||||
controller: controller.name,
|
// controller: controller.name,
|
||||||
decoration: InputDecoration(
|
// decoration: InputDecoration(
|
||||||
enabledBorder: OutlineInputBorder(
|
// enabledBorder: OutlineInputBorder(
|
||||||
borderSide:
|
// borderSide:
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
// BorderSide(color: Color(0xFFECECEC)),
|
||||||
borderRadius: BorderRadius.all(
|
// borderRadius: BorderRadius.all(
|
||||||
Radius.circular(50),
|
// Radius.circular(50),
|
||||||
)),
|
// )),
|
||||||
focusedBorder: OutlineInputBorder(
|
// focusedBorder: OutlineInputBorder(
|
||||||
borderSide:
|
// borderSide:
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
// BorderSide(color: Color(0xFFECECEC)),
|
||||||
borderRadius: BorderRadius.all(
|
// borderRadius: BorderRadius.all(
|
||||||
Radius.circular(50),
|
// Radius.circular(50),
|
||||||
)),
|
// )),
|
||||||
hintText: 'Nombre y Apellido',
|
// hintText: 'Nombre y Apellido',
|
||||||
fillColor: Color.fromARGB(255, 239, 239, 239),
|
// fillColor: Color.fromARGB(255, 239, 239, 239),
|
||||||
filled: true,
|
// filled: true,
|
||||||
prefixIcon: Icon(Icons.person_outline)),
|
// prefixIcon: Icon(Icons.person_outline)),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
const Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.only(bottom: 5),
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
child: Align(
|
child: Align(
|
||||||
|
|||||||
@@ -232,6 +232,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.17.0"
|
version: "0.17.0"
|
||||||
|
intl_phone_field:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: intl_phone_field
|
||||||
|
sha256: "0d2b35d148ed28a454d50797e6c2fb297f0a295feab84641b02d3dd32294b3f3"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ dependencies:
|
|||||||
get: ^4.6.5
|
get: ^4.6.5
|
||||||
font_awesome_flutter: ^10.4.0
|
font_awesome_flutter: ^10.4.0
|
||||||
flutter_otp_text_field: ^1.1.1
|
flutter_otp_text_field: ^1.1.1
|
||||||
|
intl_phone_field: ^3.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user