From 3733fbc29722f341941ab589bf9f546f9cb39003 Mon Sep 17 00:00:00 2001 From: Juan Felipe Duarte <70235683+DuarteJFelipe@users.noreply.github.com> Date: Mon, 5 Jun 2023 14:11:36 -0500 Subject: [PATCH] fix --- lib/src/screens/login.dart | 206 ++++++++++++++++++------------------- 1 file changed, 98 insertions(+), 108 deletions(-) diff --git a/lib/src/screens/login.dart b/lib/src/screens/login.dart index d258109..21dfb7e 100644 --- a/lib/src/screens/login.dart +++ b/lib/src/screens/login.dart @@ -97,62 +97,12 @@ class _LoginScreenState extends State { ), ), const SizedBox(height: 20), - PrimaryButtom( - onPressed: () { - if (_formKey.currentState!.validate()) { - PhoneAuthController.instance.phoneAuthentication( - completePhoneNumber.trim(), - ); - Get.to( - () => CodeValidationScreen( - phoneNumber: completePhoneNumber.trim(), - ), - ); - } - }, - label: 'Enviar código', - ), + ButtonBottom( + formKey: _formKey, completePhoneNumber: completePhoneNumber), const SizedBox(height: 20), - GestureDetector( - onTap: () { - Navigator.pushNamed(context, '/login'); - }, - child: const Text( - 'Entrar con correo electronico', - style: TextStyle( - fontSize: 15.0, color: Color(0xFF65676B), - decoration: TextDecoration.underline, // Subrayado - ), - ), - ), + const GestureBottom(), const SizedBox(height: 20), - RichText( - text: TextSpan( - style: const TextStyle( - fontSize: 16.0, - color: Color(0xFF65676B), - fontFamily: 'Poppins', - ), - children: [ - const TextSpan(text: 'No estas registrado? '), - WidgetSpan( - child: GestureDetector( - onTap: () { - Navigator.pushNamed(context, '/register'); - }, - child: const Text( - 'Registrarse', - style: TextStyle( - fontSize: 16.0, - color: Color(0xFF2BA4EC), - fontWeight: FontWeight.w600, - ), - ), - ), - ), - ], - ), - ), + const RichTxTBottom(), const SizedBox(height: 20), ], ); @@ -256,62 +206,13 @@ class _LoginScreenState extends State { ), ), const SizedBox(height: 20), - PrimaryButtom( - onPressed: () { - if (_formKey.currentState!.validate()) { - PhoneAuthController.instance.phoneAuthentication( - completePhoneNumber.trim(), - ); - Get.to( - () => CodeValidationScreen( - phoneNumber: completePhoneNumber.trim(), - ), - ); - } - }, - label: 'Enviar código', - ), + ButtonBottom( + formKey: _formKey, + completePhoneNumber: completePhoneNumber), const SizedBox(height: 20), - GestureDetector( - onTap: () { - Navigator.pushNamed(context, '/login'); - }, - child: const Text( - 'Entrar con correo electronico', - style: TextStyle( - fontSize: 15.0, color: Color(0xFF65676B), - decoration: TextDecoration.underline, // Subrayado - ), - ), - ), + const GestureBottom(), const SizedBox(height: 20), - RichText( - text: TextSpan( - style: const TextStyle( - fontSize: 16.0, - color: Color(0xFF65676B), - fontFamily: 'Poppins', - ), - children: [ - const TextSpan(text: 'No estas registrado? '), - WidgetSpan( - child: GestureDetector( - onTap: () { - Navigator.pushNamed(context, '/register'); - }, - child: const Text( - 'Registrarse', - style: TextStyle( - fontSize: 16.0, - color: Color(0xFF2BA4EC), - fontWeight: FontWeight.w600, - ), - ), - ), - ), - ], - ), - ), + const RichTxTBottom(), ], ), ), @@ -322,3 +223,92 @@ class _LoginScreenState extends State { ); } } + +class ButtonBottom extends StatelessWidget { + const ButtonBottom({ + super.key, + required GlobalKey formKey, + required this.completePhoneNumber, + }) : _formKey = formKey; + + final GlobalKey _formKey; + final String completePhoneNumber; + + @override + Widget build(BuildContext context) { + return PrimaryButtom( + onPressed: () { + if (_formKey.currentState!.validate()) { + PhoneAuthController.instance.phoneAuthentication( + completePhoneNumber.trim(), + ); + Get.to( + () => CodeValidationScreen( + phoneNumber: completePhoneNumber.trim(), + ), + ); + } + }, + label: 'Enviar código', + ); + } +} + +class GestureBottom extends StatelessWidget { + const GestureBottom({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + Navigator.pushNamed(context, '/login'); + }, + child: const Text( + 'Entrar con correo electronico', + style: TextStyle( + fontSize: 15.0, color: Color(0xFF65676B), + decoration: TextDecoration.underline, // Subrayado + ), + ), + ); + } +} + +class RichTxTBottom extends StatelessWidget { + const RichTxTBottom({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return RichText( + text: TextSpan( + style: const TextStyle( + fontSize: 16.0, + color: Color(0xFF65676B), + fontFamily: 'Poppins', + ), + children: [ + const TextSpan(text: 'No estas registrado? '), + WidgetSpan( + child: GestureDetector( + onTap: () { + Navigator.pushNamed(context, '/register'); + }, + child: const Text( + 'Registrarse', + style: TextStyle( + fontSize: 16.0, + color: Color(0xFF2BA4EC), + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ], + ), + ); + } +}