refinements
This commit is contained in:
@@ -54,6 +54,8 @@ class _StoreCardState extends State<StoreCard> {
|
||||
),
|
||||
title: Text(
|
||||
widget.store.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
subtitle: Text(
|
||||
@@ -65,44 +67,43 @@ class _StoreCardState extends State<StoreCard> {
|
||||
// context.read<StoreBloc>().add(ToggleStoreStatus(store.id, val));
|
||||
},
|
||||
),
|
||||
onTap: () => _openStoreForm(context, store: widget.store),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Mostra quanti dipendenti ci sono (usando lo StaffCubit)
|
||||
BlocBuilder<StoreCubit, StoreState>(
|
||||
builder: (context, storeState) {
|
||||
final staffCount =
|
||||
storeState.staffByStore[widget.store.id]?.length ?? 0;
|
||||
return Row(
|
||||
children: [
|
||||
ActionChip(
|
||||
avatar: const Icon(Icons.people, size: 16),
|
||||
label: Text("$staffCount Dipendenti"),
|
||||
onPressed: () => _manageStoreStaff(widget.store),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
ActionChip(
|
||||
avatar: const Icon(Icons.handshake, size: 16),
|
||||
label: Text(
|
||||
"${widget.store.associatedProviders.length} Providers",
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Mostra quanti dipendenti ci sono (usando lo StaffCubit)
|
||||
BlocBuilder<StoreCubit, StoreState>(
|
||||
builder: (context, storeState) {
|
||||
final staffCount =
|
||||
storeState.staffByStore[widget.store.id]?.length ?? 0;
|
||||
return Row(
|
||||
children: [
|
||||
ActionChip(
|
||||
avatar: const Icon(Icons.people, size: 16),
|
||||
label: Text("$staffCount Dipendenti"),
|
||||
onPressed: () => _manageStoreStaff(widget.store),
|
||||
),
|
||||
onPressed: () => _manageStoreProviders(widget.store),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
TextButton.icon(
|
||||
onPressed: () => _openStoreForm(context, store: widget.store),
|
||||
icon: const Icon(Icons.edit, size: 18),
|
||||
label: const Text("Modifica"),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 16),
|
||||
ActionChip(
|
||||
avatar: const Icon(Icons.handshake, size: 16),
|
||||
label: Text(
|
||||
"${widget.store.associatedProviders.length} Providers",
|
||||
),
|
||||
onPressed: () =>
|
||||
_manageStoreProviders(widget.store),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user