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,
),