implementacion de codigo de pais

This commit is contained in:
Juan Felipe Duarte
2023-03-30 13:20:00 -05:00
parent f2f35d3966
commit c889509195
5 changed files with 83 additions and 76 deletions
+1 -26
View File
@@ -110,6 +110,7 @@ class _CodeValidationScreenState extends State<CodeValidationScreen> {
padding: EdgeInsets.only(bottom: 20),
child: OtpTextField(
numberOfFields: 6,
focusedBorderColor: Colors.blue,
fillColor: Colors.black.withOpacity(0.1),
filled: true,
keyboardType: TextInputType.number,
@@ -118,32 +119,6 @@ class _CodeValidationScreenState extends State<CodeValidationScreen> {
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: EdgeInsets.only(bottom: 40),
+42 -19
View File
@@ -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());
}
+31 -31
View File
@@ -138,37 +138,37 @@ class _RegisterScreenState extends State<RegisterScreen> {
key: _formKey,
child: Column(
children: [
const Padding(
padding: EdgeInsets.only(bottom: 5),
child: Align(
alignment: Alignment.topLeft,
child: Text('Nombre',
style: TextStyle(
fontSize: 18.0, color: Color(0xFF65676B))),
)),
Padding(
padding: EdgeInsets.only(bottom: 18),
child: TextFormField(
controller: controller.name,
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: 'Nombre y Apellido',
fillColor: Color.fromARGB(255, 239, 239, 239),
filled: true,
prefixIcon: Icon(Icons.person_outline)),
),
),
// const Padding(
// padding: EdgeInsets.only(bottom: 5),
// child: Align(
// alignment: Alignment.topLeft,
// child: Text('Nombre',
// style: TextStyle(
// fontSize: 18.0, color: Color(0xFF65676B))),
// )),
// Padding(
// padding: EdgeInsets.only(bottom: 18),
// child: TextFormField(
// controller: controller.name,
// 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: 'Nombre y Apellido',
// fillColor: Color.fromARGB(255, 239, 239, 239),
// filled: true,
// prefixIcon: Icon(Icons.person_outline)),
// ),
// ),
const Padding(
padding: EdgeInsets.only(bottom: 5),
child: Align(
+8
View File
@@ -232,6 +232,14 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: transitive
description:
+1
View File
@@ -44,6 +44,7 @@ dependencies:
get: ^4.6.5
font_awesome_flutter: ^10.4.0
flutter_otp_text_field: ^1.1.1
intl_phone_field: ^3.1.0
dev_dependencies:
flutter_test: