import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:ristoris/database/database.dart'; class InfoTab extends StatelessWidget { final Cliente cliente; final ThemeData theme; const InfoTab({required this.cliente, required this.theme}); @override Widget build(BuildContext context) { return SingleChildScrollView( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ _infoRow('Codice', cliente.codCliente ?? '-'), _infoRow('Ragione Sociale', cliente.ragioneSociale ?? '-'), _infoRow('Indirizzo', cliente.indirizzo ?? '-'), _infoRow( 'Città', '${cliente.citta ?? ""} ${cliente.provincia ?? ""} ${cliente.cap ?? ""}', ), _infoRow('Telefono', cliente.telefono ?? '-'), _infoRow('Cellulare', cliente.cellulare ?? '-'), _infoRow('Email', cliente.email ?? '-'), _infoRow('Partita IVA', cliente.partitaIva ?? '-'), _infoRow('Codice Fiscale', cliente.codiceFiscale ?? '-'), if (cliente.sdi != null && cliente.sdi!.isNotEmpty) _infoRow('SDI', cliente.sdi!), if (cliente.pec != null && cliente.pec!.isNotEmpty) _infoRow('PEC', cliente.pec!), if (cliente.note != null && cliente.note!.isNotEmpty) _infoRow('Note', cliente.note!), if (cliente.codBlocco != null && cliente.codBlocco!.isNotEmpty) Card( color: Colors.red.shade50, child: Padding( padding: const EdgeInsets.all(12), child: Row( children: [ Icon(Icons.block, color: Colors.red), const SizedBox(width: 8), Text('Blocco: ${cliente.codBlocco}'), ], ), ), ), ], ), ); } Widget _infoRow(String label, String value) { return Padding( padding: const EdgeInsets.symmetric(vertical: 4), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( width: 120, child: Text( label, style: theme.textTheme.bodySmall?.copyWith( color: theme.colorScheme.outline, ), ), ), Expanded(child: Text(value)), ], ), ); } }