fixed MasterDataPage buttons

This commit is contained in:
2026-04-20 19:30:36 +02:00
parent c3d4f3fac7
commit 31a56d37f8
4 changed files with 88 additions and 56 deletions

View File

@@ -15,6 +15,7 @@ class AuthScreen extends StatefulWidget {
class _AuthScreenState extends State<AuthScreen> {
final _emailController = TextEditingController();
final _passwordController = TextEditingController();
final _isPassword = true;
@override
void dispose() {

View File

@@ -34,10 +34,15 @@ class MasterDataHubContent extends StatelessWidget {
const SizedBox(height: 32),
Expanded(
child: GridView.count(
crossAxisCount: MediaQuery.of(context).size.width > 600 ? 3 : 2,
mainAxisSpacing: 16,
crossAxisSpacing: 16,
child: GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: MediaQuery.of(context).size.width > 600 ? 3 : 2,
mainAxisSpacing: 14,
crossAxisSpacing: 14,
// LA MAGIA: Fissiamo l'altezza della card a 200 pixel
// indipendentemente da quanto sia stretta la colonna!
mainAxisExtent: 200,
),
children: [
_buildHubCard(
context,
@@ -45,9 +50,7 @@ class MasterDataHubContent extends StatelessWidget {
subtitle: 'Anagrafica di Marche e Modelli',
icon: Icons.inventory_2_outlined,
color: Colors.blue,
onTap: () => onOpenPage(
const ProductsScreen(),
), // Apre ProductsScreen, // Indice per ProductsScreen
onTap: () => onOpenPage(const ProductsScreen()),
),
_buildHubCard(
context,
@@ -55,9 +58,7 @@ class MasterDataHubContent extends StatelessWidget {
subtitle: 'Anagrafica dei clienti del tuo business',
icon: Icons.people_outlined,
color: Colors.orange,
onTap: () => onOpenPage(
const CustomersContent(),
), // Indice per CustomersContent
onTap: () => onOpenPage(const CustomersContent()),
),
_buildHubCard(
context,
@@ -77,8 +78,9 @@ class MasterDataHubContent extends StatelessWidget {
),
_buildHubCard(
context,
title: 'Gestione Provider',
subtitle: 'Anagrafica mandati e servizi abilitati',
title:
'Provider', // Accorciato per non andare a capo male su mobile
subtitle: 'Anagrafica mandati e servizi',
icon: Icons.handshake_rounded,
color: Colors.indigo,
onTap: () {
@@ -110,43 +112,43 @@ Widget _buildHubCard(
return Card(
clipBehavior: Clip.antiAlias,
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
), // Un pelo più arrotondato
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
child: InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.all(
24.0,
), // Aumentiamo il padding per dare respiro
// Ridotto da 22 a 16 per dare più respiro orizzontale su mobile
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center, // CENTRA VERTICALMENTE
crossAxisAlignment:
CrossAxisAlignment.center, // CENTRA ORIZZONTALMENTE
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// Icona con un leggero sfondo circolare opaco per farla risaltare
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: color.withValues(alpha: 0.1), // <--- API moderna
color: color.withValues(alpha: 0.1),
shape: BoxShape.circle,
),
child: Icon(icon, size: 48, color: color),
child: Icon(icon, size: 40, color: color),
),
const SizedBox(height: 16),
const SizedBox(height: 12), // Leggermente ridotto
Text(
title,
textAlign: TextAlign.center, // Centra il testo
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
Text(
subtitle,
textAlign: TextAlign.center, // Centra il sottotitolo
style: TextStyle(fontSize: 13, color: Colors.grey.shade500),
maxLines: 2,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 4), // Leggermente ridotto
Expanded(
// Impedisce matematicamente l'overflow verticale
child: Text(
subtitle,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 13, color: Colors.grey.shade500),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
],
),
),