Files
flux/lib/features/anagrafiche/master_data_hub_content.dart
2026-04-13 18:26:17 +02:00

116 lines
3.5 KiB
Dart

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/products/ui/products_screen.dart';
import 'package:flux/features/staff/ui/staff_screen.dart';
import 'package:flux/features/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(
child: GridView.count(
crossAxisCount: MediaQuery.of(context).size.width > 600 ? 3 : 2,
mainAxisSpacing: 16,
crossAxisSpacing: 16,
children: [
_HubCard(
label: 'Prodotti',
icon: Icons.inventory_2_outlined,
color: Colors.blue,
onTap: () => onOpenPage(
const ProductsScreen(),
), // Apre ProductsScreen, // Indice per ProductsScreen
),
_HubCard(
label: 'Clienti',
icon: Icons.people_outlined,
color: Colors.orange,
onTap: () => onOpenPage(
const CustomersContent(),
), // Indice per CustomersContent
),
_HubCard(
label: 'Commessi',
icon: Icons.badge_outlined,
color: Colors.teal,
onTap: () => onOpenPage(const StaffScreen()), // Coming soon
),
_HubCard(
label: 'Negozi',
icon: Icons.storefront_outlined,
color: Colors.purple,
onTap: () => onOpenPage(const StoresScreen()), // Coming soon
),
],
),
),
],
),
);
}
}
// Widget semplice per le card dell'hub
class _HubCard extends StatelessWidget {
final String label;
final IconData icon;
final Color color;
final VoidCallback onTap;
const _HubCard({
required this.label,
required this.icon,
required this.color,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return Card(
elevation: 0,
color: context.background,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(color: context.accent.withValues(alpha: 0.1)),
),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, color: color, size: 40),
const SizedBox(height: 12),
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
],
),
),
);
}
}