2026-04-14 11:29:49 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flux/core/theme/theme.dart';
|
|
|
|
|
import 'package:flux/features/customers/ui/customers_content.dart';
|
|
|
|
|
import 'package:flux/features/master_data/products/ui/products_screen.dart';
|
2026-04-17 10:34:23 +02:00
|
|
|
import 'package:flux/features/master_data/providers/ui/providers_master_data_screen.dart';
|
2026-04-14 11:29:49 +02:00
|
|
|
import 'package:flux/features/master_data/staff/ui/staff_screen.dart';
|
|
|
|
|
import 'package:flux/features/master_data/store/ui/stores_screen.dart';
|
|
|
|
|
|
|
|
|
|
class MasterDataHubContent extends StatelessWidget {
|
|
|
|
|
final Function(Widget) onOpenPage;
|
|
|
|
|
|
|
|
|
|
const MasterDataHubContent({super.key, required this.onOpenPage});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.all(24.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Anagrafiche",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 28,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: context.accent,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
Text(
|
|
|
|
|
"Gestisci i dati fondamentali del tuo business",
|
|
|
|
|
style: TextStyle(color: context.secondaryText),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 32),
|
|
|
|
|
|
|
|
|
|
Expanded(
|
2026-04-20 19:30:36 +02:00
|
|
|
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,
|
|
|
|
|
),
|
2026-04-14 11:29:49 +02:00
|
|
|
children: [
|
2026-04-17 10:34:23 +02:00
|
|
|
_buildHubCard(
|
|
|
|
|
context,
|
|
|
|
|
title: 'Prodotti',
|
|
|
|
|
subtitle: 'Anagrafica di Marche e Modelli',
|
2026-04-14 11:29:49 +02:00
|
|
|
icon: Icons.inventory_2_outlined,
|
|
|
|
|
color: Colors.blue,
|
2026-04-20 19:30:36 +02:00
|
|
|
onTap: () => onOpenPage(const ProductsScreen()),
|
2026-04-14 11:29:49 +02:00
|
|
|
),
|
2026-04-17 10:34:23 +02:00
|
|
|
_buildHubCard(
|
|
|
|
|
context,
|
|
|
|
|
title: 'Clienti',
|
|
|
|
|
subtitle: 'Anagrafica dei clienti del tuo business',
|
2026-04-14 11:29:49 +02:00
|
|
|
icon: Icons.people_outlined,
|
|
|
|
|
color: Colors.orange,
|
2026-04-20 19:30:36 +02:00
|
|
|
onTap: () => onOpenPage(const CustomersContent()),
|
2026-04-14 11:29:49 +02:00
|
|
|
),
|
2026-04-17 10:34:23 +02:00
|
|
|
_buildHubCard(
|
|
|
|
|
context,
|
|
|
|
|
title: 'Addetti',
|
|
|
|
|
subtitle: 'Anagrafica del personale e dei collaboratori',
|
2026-04-14 11:29:49 +02:00
|
|
|
icon: Icons.badge_outlined,
|
|
|
|
|
color: Colors.teal,
|
|
|
|
|
onTap: () => onOpenPage(const StaffScreen()),
|
|
|
|
|
),
|
2026-04-17 10:34:23 +02:00
|
|
|
_buildHubCard(
|
|
|
|
|
context,
|
|
|
|
|
title: 'Negozi',
|
|
|
|
|
subtitle: 'Anagrafica punti vendita della tua azienda',
|
2026-04-14 11:29:49 +02:00
|
|
|
icon: Icons.storefront_outlined,
|
|
|
|
|
color: Colors.purple,
|
|
|
|
|
onTap: () => onOpenPage(const StoresScreen()),
|
|
|
|
|
),
|
2026-04-17 10:34:23 +02:00
|
|
|
_buildHubCard(
|
|
|
|
|
context,
|
2026-04-20 19:30:36 +02:00
|
|
|
title:
|
|
|
|
|
'Provider', // Accorciato per non andare a capo male su mobile
|
|
|
|
|
subtitle: 'Anagrafica mandati e servizi',
|
2026-04-17 10:34:23 +02:00
|
|
|
icon: Icons.handshake_rounded,
|
|
|
|
|
color: Colors.indigo,
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => const ProvidersMasterDataScreen(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-04-14 11:29:49 +02:00
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 10:34:23 +02:00
|
|
|
Widget _buildHubCard(
|
|
|
|
|
BuildContext context, {
|
|
|
|
|
required String title,
|
|
|
|
|
required String subtitle,
|
|
|
|
|
required IconData icon,
|
|
|
|
|
required Color color,
|
|
|
|
|
required VoidCallback onTap,
|
|
|
|
|
}) {
|
|
|
|
|
return Card(
|
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
|
elevation: 2,
|
2026-04-20 19:30:36 +02:00
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
2026-04-17 10:34:23 +02:00
|
|
|
child: InkWell(
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
child: Padding(
|
2026-04-20 19:30:36 +02:00
|
|
|
// Ridotto da 22 a 16 per dare più respiro orizzontale su mobile
|
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
2026-04-14 11:29:49 +02:00
|
|
|
child: Column(
|
2026-04-20 19:30:36 +02:00
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
2026-04-14 11:29:49 +02:00
|
|
|
children: [
|
2026-04-17 10:34:23 +02:00
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
|
decoration: BoxDecoration(
|
2026-04-20 19:30:36 +02:00
|
|
|
color: color.withValues(alpha: 0.1),
|
2026-04-17 10:34:23 +02:00
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
2026-04-20 19:30:36 +02:00
|
|
|
child: Icon(icon, size: 40, color: color),
|
2026-04-17 10:34:23 +02:00
|
|
|
),
|
2026-04-20 19:30:36 +02:00
|
|
|
const SizedBox(height: 12), // Leggermente ridotto
|
2026-04-17 10:34:23 +02:00
|
|
|
Text(
|
|
|
|
|
title,
|
2026-04-20 19:30:36 +02:00
|
|
|
textAlign: TextAlign.center,
|
2026-04-17 10:34:23 +02:00
|
|
|
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
2026-04-20 19:30:36 +02:00
|
|
|
maxLines: 1,
|
2026-04-17 10:34:23 +02:00
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
),
|
2026-04-20 19:30:36 +02:00
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-04-14 11:29:49 +02:00
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-04-17 10:34:23 +02:00
|
|
|
),
|
|
|
|
|
);
|
2026-04-14 11:29:49 +02:00
|
|
|
}
|