Add Providers Management to Master Data Hub and Enhance Provider Model
This commit is contained in:
@@ -2,6 +2,7 @@ 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';
|
||||
import 'package:flux/features/master_data/providers/ui/providers_master_data_screen.dart';
|
||||
import 'package:flux/features/master_data/staff/ui/staff_screen.dart';
|
||||
import 'package:flux/features/master_data/store/ui/stores_screen.dart';
|
||||
|
||||
@@ -38,34 +39,57 @@ class MasterDataHubContent extends StatelessWidget {
|
||||
mainAxisSpacing: 16,
|
||||
crossAxisSpacing: 16,
|
||||
children: [
|
||||
_HubCard(
|
||||
label: 'Prodotti',
|
||||
_buildHubCard(
|
||||
context,
|
||||
title: 'Prodotti',
|
||||
subtitle: 'Anagrafica di Marche e Modelli',
|
||||
icon: Icons.inventory_2_outlined,
|
||||
color: Colors.blue,
|
||||
onTap: () => onOpenPage(
|
||||
const ProductsScreen(),
|
||||
), // Apre ProductsScreen, // Indice per ProductsScreen
|
||||
),
|
||||
_HubCard(
|
||||
label: 'Clienti',
|
||||
_buildHubCard(
|
||||
context,
|
||||
title: 'Clienti',
|
||||
subtitle: 'Anagrafica dei clienti del tuo business',
|
||||
icon: Icons.people_outlined,
|
||||
color: Colors.orange,
|
||||
onTap: () => onOpenPage(
|
||||
const CustomersContent(),
|
||||
), // Indice per CustomersContent
|
||||
),
|
||||
_HubCard(
|
||||
label: 'Commessi',
|
||||
_buildHubCard(
|
||||
context,
|
||||
title: 'Addetti',
|
||||
subtitle: 'Anagrafica del personale e dei collaboratori',
|
||||
icon: Icons.badge_outlined,
|
||||
color: Colors.teal,
|
||||
onTap: () => onOpenPage(const StaffScreen()),
|
||||
),
|
||||
_HubCard(
|
||||
label: 'Negozi',
|
||||
_buildHubCard(
|
||||
context,
|
||||
title: 'Negozi',
|
||||
subtitle: 'Anagrafica punti vendita della tua azienda',
|
||||
icon: Icons.storefront_outlined,
|
||||
color: Colors.purple,
|
||||
onTap: () => onOpenPage(const StoresScreen()),
|
||||
),
|
||||
_buildHubCard(
|
||||
context,
|
||||
title: 'Gestione Provider',
|
||||
subtitle: 'Anagrafica mandati e servizi abilitati',
|
||||
icon: Icons.handshake_rounded,
|
||||
color: Colors.indigo,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ProvidersMasterDataScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -75,41 +99,57 @@ class MasterDataHubContent extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// 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),
|
||||
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,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
), // Un pelo più arrotondato
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
24.0,
|
||||
), // Aumentiamo il padding per dare respiro
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center, // CENTRA VERTICALMENTE
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center, // CENTRA ORIZZONTALMENTE
|
||||
children: [
|
||||
Icon(icon, color: color, size: 40),
|
||||
const SizedBox(height: 12),
|
||||
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
// 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
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(icon, size: 48, color: color),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
title,
|
||||
textAlign: TextAlign.center, // Centra il testo
|
||||
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,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user