refinements
This commit is contained in:
@@ -117,68 +117,83 @@ class TicketList extends StatelessWidget {
|
||||
AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
bottom: state.selectedTickets.isNotEmpty
|
||||
? 90
|
||||
: -100, // Nasconde o mostra
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: Card(
|
||||
elevation: 8,
|
||||
color: Theme.of(context).colorScheme.inverseSurface,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0,
|
||||
),
|
||||
// ECCO LA MAGIA: Wrap invece di Row!
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.spaceBetween, // Sostituisce lo Spacer!
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
spacing: 8.0, // Spazio orizzontale
|
||||
runSpacing: 8.0, // Spazio verticale se va a capo
|
||||
children: [
|
||||
// BLOCCO 1: Icona e Contatore
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize
|
||||
.min, // Fondamentale per non occupare tutto il Wrap
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () =>
|
||||
context.read<TicketListCubit>().clearSelection(),
|
||||
),
|
||||
Text(
|
||||
'${state.selectedTickets.length} selezionati',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
bottom: state.selectedTickets.isNotEmpty ? 90 : -100,
|
||||
// Mettiamo left e right a 0 per far occupare tutta la larghezza invisibile
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
// 1. IL LIMITE MASSIMO: Su desktop non supererà mai i 600px, su mobile si restringe da solo
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 600),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Card(
|
||||
elevation: 8,
|
||||
color: Theme.of(context).colorScheme.inverseSurface,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
16,
|
||||
), // Qui possiamo giocare coi bordi
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0,
|
||||
),
|
||||
// 2. LA ROW PRINCIPALE: Spinge tutto ai due estremi del nostro "dock"
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// BLOCCO SINISTRO: Chiusura e Contatore
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.onInverseSurface,
|
||||
onPressed: () => context
|
||||
.read<TicketListCubit>()
|
||||
.clearSelection(),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'${state.selectedTickets.length} selezionati',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.onInverseSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// BLOCCO 2: I Bottoni (Un altro Wrap per farli andare a capo tra loro se serve!)
|
||||
Wrap(
|
||||
spacing: 8.0,
|
||||
runSpacing: 8.0,
|
||||
alignment: WrapAlignment.end,
|
||||
children: [
|
||||
FilledButton.icon(
|
||||
onPressed: () => _setStatusClosed(context),
|
||||
icon: const Icon(Icons.approval),
|
||||
label: const Text('Riconsegna'),
|
||||
),
|
||||
FilledButton.icon(
|
||||
onPressed: () => _showShippingModal(context),
|
||||
icon: const Icon(Icons.local_shipping),
|
||||
label: const Text('Spedisci'),
|
||||
),
|
||||
],
|
||||
// BLOCCO DESTRO: Wrap confinato solo ai bottoni
|
||||
Wrap(
|
||||
spacing: 8.0,
|
||||
runSpacing: 8.0,
|
||||
alignment: WrapAlignment.end,
|
||||
children: [
|
||||
IconButton.filled(
|
||||
tooltip: 'Riconsegna',
|
||||
onPressed: () => _setStatusClosed(context),
|
||||
icon: const Icon(Icons.approval),
|
||||
),
|
||||
IconButton.filled(
|
||||
tooltip: 'Spedisci',
|
||||
onPressed: () => _showShippingModal(context),
|
||||
icon: const Icon(Icons.local_shipping),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user