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 {
final VoidCallback onPressed;
final String label;
final bool
isEnabled; // Nuevo parámetro para indicar si el botón está habilitado
const PrimaryButtom(
{super.key, required this.onPressed, required this.label});
const PrimaryButtom({
Key? key,
required this.onPressed,
required this.label,
this.isEnabled = true, // Valor predeterminado: habilitado
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onPressed,
onPressed: isEnabled
? onPressed
: null, // Habilita/deshabilita el botón según isEnabled
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC),
backgroundColor: isEnabled
? const Color(0xFF2BA4EC)
: Colors.grey, // Cambia el color de fondo
shape: RoundedRectangleBorder(
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),
),
child: Text(
label,
style: const TextStyle(
color: Colors.white,
style: TextStyle(
color: isEnabled
? Colors.white
: Colors.black, // Cambia el color del texto
fontWeight: FontWeight.bold,
fontSize: 18,
),
+51 -2
View File
@@ -19,6 +19,7 @@ class _LoginScreenState extends State<LoginScreen> {
final controller = Get.put(PhoneAuthController());
final _formKey = GlobalKey<FormState>();
String completePhoneNumber = '';
bool _isChecked = false;
@override
Widget build(BuildContext context) {
@@ -98,7 +99,30 @@ class _LoginScreenState extends State<LoginScreen> {
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(
onPressed: () {
if (_formKey.currentState!.validate()) {
@@ -112,6 +136,7 @@ class _LoginScreenState extends State<LoginScreen> {
);
}
},
isEnabled: _isChecked,
label: 'Enviar código',
),
const SizedBox(height: 20),
@@ -223,7 +248,30 @@ class _LoginScreenState extends State<LoginScreen> {
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(
onPressed: () {
if (_formKey.currentState!.validate()) {
@@ -237,6 +285,7 @@ class _LoginScreenState extends State<LoginScreen> {
);
}
},
isEnabled: _isChecked,
label: 'Enviar código',
),
const SizedBox(height: 20),
+66 -70
View File
@@ -21,6 +21,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
bool _obscureText = true;
final controller = Get.put(RegisterController());
final _formKey = GlobalKey<FormState>();
bool _isChecked = false;
@override
Widget build(BuildContext context) {
@@ -205,8 +206,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
)),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color.fromARGB(
255, 184, 0, 0)),
color:
Color.fromARGB(255, 184, 0, 0)),
borderRadius: BorderRadius.all(
Radius.circular(50),
)),
@@ -249,26 +250,26 @@ class _RegisterScreenState extends State<RegisterScreen> {
Radius.circular(50),
)),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xFFECECEC)),
borderSide:
BorderSide(color: Color(0xFFECECEC)),
borderRadius: BorderRadius.all(
Radius.circular(50),
)),
border: const OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xFFECECEC)),
borderSide:
BorderSide(color: Color(0xFFECECEC)),
borderRadius: BorderRadius.all(
Radius.circular(50),
)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xFFECECEC)),
borderSide:
BorderSide(color: Color(0xFFECECEC)),
borderRadius: BorderRadius.all(
Radius.circular(50),
)),
hintText: 'Contraseña',
fillColor: const Color.fromARGB(
255, 239, 239, 239),
fillColor:
const Color.fromARGB(255, 239, 239, 239),
filled: true,
prefixIcon: const Icon(Icons.lock_outline),
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: const EdgeInsets.only(bottom: 25),
child: Center(
@@ -302,6 +327,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
}
},
label: 'Registrarme',
isEnabled: _isChecked,
),
),
),
@@ -407,60 +433,6 @@ class _RegisterScreenState extends State<RegisterScreen> {
horizontal: 0, vertical: 20),
child: Column(
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(
key: _formKey,
child: Column(
@@ -516,11 +488,10 @@ class _RegisterScreenState extends State<RegisterScreen> {
Radius.circular(50),
)),
hintText: 'Hello@gmail.com',
fillColor: Color.fromARGB(
255, 239, 239, 239),
fillColor:
Color.fromARGB(255, 239, 239, 239),
filled: true,
prefixIcon:
Icon(Icons.email_outlined)),
prefixIcon: Icon(Icons.email_outlined)),
),
),
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: const EdgeInsets.only(bottom: 25),
child: Center(
@@ -608,6 +603,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
);
}
},
isEnabled: _isChecked,
label: 'Registrarme',
),
),