This commit is contained in:
Felipe
2023-08-26 20:37:44 -05:00
parent 9c885daebc
commit 9361d609d1
3 changed files with 366 additions and 307 deletions
+21 -7
View File
@@ -3,26 +3,40 @@ import 'package:flutter/material.dart';
class PrimaryButtom extends StatelessWidget { class PrimaryButtom extends StatelessWidget {
final VoidCallback onPressed; final VoidCallback onPressed;
final String label; final String label;
final bool
isEnabled; // Nuevo parámetro para indicar si el botón está habilitado
const PrimaryButtom( const PrimaryButtom({
{super.key, required this.onPressed, required this.label}); Key? key,
required this.onPressed,
required this.label,
this.isEnabled = true, // Valor predeterminado: habilitado
}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ElevatedButton( return ElevatedButton(
onPressed: onPressed, onPressed: isEnabled
? onPressed
: null, // Habilita/deshabilita el botón según isEnabled
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC), backgroundColor: isEnabled
? const Color(0xFF2BA4EC)
: Colors.grey, // Cambia el color de fondo
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50), borderRadius: BorderRadius.circular(50),
), ),
elevation: 0, elevation: isEnabled
? 0
: 0, // Cambia la elevación para dar una sensación de clickeabilidad
minimumSize: const Size(230, 60), minimumSize: const Size(230, 60),
), ),
child: Text( child: Text(
label, label,
style: const TextStyle( style: TextStyle(
color: Colors.white, color: isEnabled
? Colors.white
: Colors.black, // Cambia el color del texto
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 18, fontSize: 18,
), ),
+51 -2
View File
@@ -19,6 +19,7 @@ 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 = ''; String completePhoneNumber = '';
bool _isChecked = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -98,7 +99,30 @@ class _LoginScreenState extends State<LoginScreen> {
color: Color(0xFF65676B), color: Color(0xFF65676B),
), ),
), ),
const SizedBox(height: 20), Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center, // Centra horizontalmente
children: <Widget>[
Checkbox(
value: _isChecked,
onChanged: (value) {
setState(() {
_isChecked = value!;
});
},
),
const Text(
'Acepto los términos y condiciones.',
style: TextStyle(
fontSize: 13.0,
color: Color(0xFF65676B),
),
),
],
),
),
PrimaryButtom( PrimaryButtom(
onPressed: () { onPressed: () {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
@@ -112,6 +136,7 @@ class _LoginScreenState extends State<LoginScreen> {
); );
} }
}, },
isEnabled: _isChecked,
label: 'Enviar código', label: 'Enviar código',
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
@@ -223,7 +248,30 @@ class _LoginScreenState extends State<LoginScreen> {
color: Color(0xFF65676B), color: Color(0xFF65676B),
), ),
), ),
const SizedBox(height: 20), Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center, // Centra horizontalmente
children: <Widget>[
Checkbox(
value: _isChecked,
onChanged: (value) {
setState(() {
_isChecked = value!;
});
},
),
const Text(
'Acepto los términos y condiciones.',
style: TextStyle(
fontSize: 13.0,
color: Color(0xFF65676B),
),
),
],
),
),
PrimaryButtom( PrimaryButtom(
onPressed: () { onPressed: () {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
@@ -237,6 +285,7 @@ class _LoginScreenState extends State<LoginScreen> {
); );
} }
}, },
isEnabled: _isChecked,
label: 'Enviar código', label: 'Enviar código',
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
+66 -70
View File
@@ -21,6 +21,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
bool _obscureText = true; bool _obscureText = true;
final controller = Get.put(RegisterController()); final controller = Get.put(RegisterController());
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
bool _isChecked = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -205,8 +206,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
)), )),
errorBorder: OutlineInputBorder( errorBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Color.fromARGB( color:
255, 184, 0, 0)), Color.fromARGB(255, 184, 0, 0)),
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(50), Radius.circular(50),
)), )),
@@ -249,26 +250,26 @@ class _RegisterScreenState extends State<RegisterScreen> {
Radius.circular(50), Radius.circular(50),
)), )),
enabledBorder: const OutlineInputBorder( enabledBorder: const OutlineInputBorder(
borderSide: BorderSide( borderSide:
color: Color(0xFFECECEC)), BorderSide(color: Color(0xFFECECEC)),
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(50), Radius.circular(50),
)), )),
border: const OutlineInputBorder( border: const OutlineInputBorder(
borderSide: BorderSide( borderSide:
color: Color(0xFFECECEC)), BorderSide(color: Color(0xFFECECEC)),
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(50), Radius.circular(50),
)), )),
focusedBorder: const OutlineInputBorder( focusedBorder: const OutlineInputBorder(
borderSide: BorderSide( borderSide:
color: Color(0xFFECECEC)), BorderSide(color: Color(0xFFECECEC)),
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(50), Radius.circular(50),
)), )),
hintText: 'Contraseña', hintText: 'Contraseña',
fillColor: const Color.fromARGB( fillColor:
255, 239, 239, 239), const Color.fromARGB(255, 239, 239, 239),
filled: true, filled: true,
prefixIcon: const Icon(Icons.lock_outline), prefixIcon: const Icon(Icons.lock_outline),
suffixIcon: IconButton( suffixIcon: IconButton(
@@ -288,7 +289,31 @@ class _RegisterScreenState extends State<RegisterScreen> {
), ),
), ),
], ],
)), ),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment
.center, // Centra horizontalmente
children: <Widget>[
Checkbox(
value: _isChecked,
onChanged: (value) {
setState(() {
_isChecked = value!;
});
},
),
const Text(
'Acepto los términos y condiciones.',
style: TextStyle(
color: Color(0xFF65676B),
),
),
],
),
),
Padding( Padding(
padding: const EdgeInsets.only(bottom: 25), padding: const EdgeInsets.only(bottom: 25),
child: Center( child: Center(
@@ -302,6 +327,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
} }
}, },
label: 'Registrarme', label: 'Registrarme',
isEnabled: _isChecked,
), ),
), ),
), ),
@@ -407,60 +433,6 @@ class _RegisterScreenState extends State<RegisterScreen> {
horizontal: 0, vertical: 20), horizontal: 0, vertical: 20),
child: Column( child: Column(
children: [ children: [
// Padding(
// padding: const EdgeInsets.only(bottom: 20),
// child: ElevatedButton(
// onPressed: () async {
// await AuthenticationRepository.instance
// .signInWithGoogle();
// },
// style: ElevatedButton.styleFrom(
// backgroundColor: const Color(0xFF2BA4EC),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(50),
// ),
// elevation: 0,
// minimumSize: const Size(230, 60),
// ),
// child: const Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Text(
// 'Entrar con Google ',
// style: TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// fontSize: 18,
// ),
// ),
// SizedBox(width: 5),
// FaIcon(FontAwesomeIcons.google),
// ],
// )),
// ),
// const Padding(
// padding: EdgeInsets.symmetric(vertical: 0),
// child: Row(
// children: <Widget>[
// Expanded(
// child: Divider(
// color: Colors.black38,
// thickness: 1,
// ),
// ),
// Padding(
// padding: EdgeInsets.symmetric(horizontal: 10),
// child: Text("ó"),
// ),
// Expanded(
// child: Divider(
// color: Colors.black38,
// thickness: 1,
// ),
// ),
// ],
// ),
// ),
Form( Form(
key: _formKey, key: _formKey,
child: Column( child: Column(
@@ -516,11 +488,10 @@ class _RegisterScreenState extends State<RegisterScreen> {
Radius.circular(50), Radius.circular(50),
)), )),
hintText: 'Hello@gmail.com', hintText: 'Hello@gmail.com',
fillColor: Color.fromARGB( fillColor:
255, 239, 239, 239), Color.fromARGB(255, 239, 239, 239),
filled: true, filled: true,
prefixIcon: prefixIcon: Icon(Icons.email_outlined)),
Icon(Icons.email_outlined)),
), ),
), ),
const Padding( const Padding(
@@ -595,7 +566,31 @@ class _RegisterScreenState extends State<RegisterScreen> {
), ),
), ),
], ],
)), ),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment
.center, // Centra horizontalmente
children: <Widget>[
Checkbox(
value: _isChecked,
onChanged: (value) {
setState(() {
_isChecked = value!;
});
},
),
const Text(
'Acepto los términos y condiciones.',
style: TextStyle(
color: Color(0xFF65676B),
),
),
],
),
),
Padding( Padding(
padding: const EdgeInsets.only(bottom: 25), padding: const EdgeInsets.only(bottom: 25),
child: Center( child: Center(
@@ -608,6 +603,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
); );
} }
}, },
isEnabled: _isChecked,
label: 'Registrarme', label: 'Registrarme',
), ),
), ),