diff --git a/lib/src/pages/formulario_categoria.dart b/lib/src/pages/formulario_categoria.dart index 616ceb0..07e4d52 100644 --- a/lib/src/pages/formulario_categoria.dart +++ b/lib/src/pages/formulario_categoria.dart @@ -19,11 +19,11 @@ class _FormularioCategoriaState extends State { } void _guardarCategoria() { - final nombre = _nombreController.text; + final nombre = _nombreController.text; // se obtiene el calor de nombre y clave final clave = _claveController.text; if (nombre.isEmpty || clave.isEmpty) { - // Mostrar un mensaje de error si algún campo está vacío + ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('Por favor, complete todos los campos')), ); @@ -38,11 +38,8 @@ class _FormularioCategoriaState extends State { "nombre": nombre, }; - print(categoria); // Imprime el mensaje en consola - - // Aquí puedes agregar lógica adicional para guardar los datos en una base de datos o enviar a una API + print(categoria); - // Volver a la pantalla anterior Navigator.pop(context); } @@ -53,7 +50,7 @@ class _FormularioCategoriaState extends State { title: const Text('Agregar Categoría'), ), body: Padding( - padding: const EdgeInsets.all(180.0), + padding: const EdgeInsets.all(16.0), child: Column( children: [ TextField( @@ -61,13 +58,13 @@ class _FormularioCategoriaState extends State { decoration: const InputDecoration(labelText: 'Clave'), keyboardType: TextInputType.text, ), - const SizedBox(height:40), + const SizedBox(height: 16), TextField( controller: _nombreController, decoration: const InputDecoration(labelText: 'Nombre'), keyboardType: TextInputType.text, ), - const SizedBox(height: 30), + const SizedBox(height: 16), ElevatedButton( onPressed: _guardarCategoria, child: const Text('GUARDAR'),