4 changed files with 300 additions and 239 deletions
@ -60,6 +60,8 @@ class PlatformPrintService { |
|||
'ville': 'Madagascar', |
|||
'contact': '261348415301', |
|||
'email': '[email protected]', |
|||
'nif': '4002141594', |
|||
'stat': '10715 33 2025 0 00414', |
|||
}; |
|||
|
|||
final factureNumber = |
|||
@ -69,12 +71,18 @@ class PlatformPrintService { |
|||
pdf.addPage( |
|||
pw.Page( |
|||
pageFormat: ticket58mmFormat, |
|||
margin: const pw.EdgeInsets.all(2), // 🔧 Marges minimales |
|||
build: (pw.Context context) { |
|||
return pw.Column( |
|||
crossAxisAlignment: pw.CrossAxisAlignment.center, |
|||
return pw.Container( |
|||
width: double.infinity, // 🔧 Forcer la largeur complète |
|||
child: pw.Column( |
|||
crossAxisAlignment: |
|||
pw.CrossAxisAlignment.start, // 🔧 Alignement à gauche |
|||
children: [ |
|||
// En-tête Restaurant (centré et compact) |
|||
pw.Text( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
restaurantInfo['nom']!, |
|||
style: pw.TextStyle( |
|||
fontSize: titleSize, |
|||
@ -82,26 +90,36 @@ class PlatformPrintService { |
|||
), |
|||
textAlign: pw.TextAlign.center, |
|||
), |
|||
), |
|||
|
|||
pw.SizedBox(height: 1), |
|||
|
|||
pw.Text( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
restaurantInfo['adresse']!, |
|||
style: pw.TextStyle(fontSize: smallSize), |
|||
textAlign: pw.TextAlign.center, |
|||
), |
|||
), |
|||
|
|||
pw.Text( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
restaurantInfo['ville']!, |
|||
style: pw.TextStyle(fontSize: smallSize), |
|||
textAlign: pw.TextAlign.center, |
|||
), |
|||
), |
|||
|
|||
pw.Text( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
'Tel: ${restaurantInfo['contact']!}', |
|||
style: pw.TextStyle(fontSize: smallSize), |
|||
textAlign: pw.TextAlign.center, |
|||
), |
|||
), |
|||
|
|||
pw.SizedBox(height: 3), |
|||
|
|||
@ -115,7 +133,9 @@ class PlatformPrintService { |
|||
pw.SizedBox(height: 2), |
|||
|
|||
// Informations ticket |
|||
pw.Row( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Row( |
|||
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween, |
|||
children: [ |
|||
pw.Text( |
|||
@ -125,16 +145,15 @@ class PlatformPrintService { |
|||
fontWeight: pw.FontWeight.bold, |
|||
), |
|||
), |
|||
pw.Text( |
|||
'Via: ${commande.tablename ?? 'Table inconnue'}', |
|||
style: pw.TextStyle(fontSize: bodySize), |
|||
), |
|||
], |
|||
), |
|||
), |
|||
|
|||
pw.SizedBox(height: 1), |
|||
|
|||
pw.Row( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Row( |
|||
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween, |
|||
children: [ |
|||
pw.Text( |
|||
@ -147,6 +166,7 @@ class PlatformPrintService { |
|||
), |
|||
], |
|||
), |
|||
), |
|||
|
|||
pw.SizedBox(height: 2), |
|||
|
|||
@ -163,19 +183,25 @@ class PlatformPrintService { |
|||
...commande.items |
|||
.map( |
|||
(item) => pw.Container( |
|||
width: double.infinity, // 🔧 Largeur complète |
|||
margin: const pw.EdgeInsets.only(bottom: 1), |
|||
child: pw.Column( |
|||
crossAxisAlignment: pw.CrossAxisAlignment.start, |
|||
children: [ |
|||
// Nom du plat |
|||
pw.Text( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
'${item.menuNom}', |
|||
style: pw.TextStyle(fontSize: bodySize), |
|||
maxLines: 2, |
|||
), |
|||
), |
|||
|
|||
// Quantité, prix unitaire et total sur une ligne |
|||
pw.Row( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Row( |
|||
mainAxisAlignment: |
|||
pw.MainAxisAlignment.spaceBetween, |
|||
children: [ |
|||
@ -192,6 +218,7 @@ class PlatformPrintService { |
|||
), |
|||
], |
|||
), |
|||
), |
|||
], |
|||
), |
|||
), |
|||
@ -210,7 +237,9 @@ class PlatformPrintService { |
|||
pw.SizedBox(height: 2), |
|||
|
|||
// Total |
|||
pw.Row( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Row( |
|||
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween, |
|||
children: [ |
|||
pw.Text( |
|||
@ -229,15 +258,19 @@ class PlatformPrintService { |
|||
), |
|||
], |
|||
), |
|||
), |
|||
|
|||
pw.SizedBox(height: 3), |
|||
|
|||
// Mode de paiement |
|||
pw.Text( |
|||
'Paiement: ${_getPaymentMethodText(paymentMethod)}', |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
'Paiement: ${paymentMethod.toLowerCase()}', |
|||
style: pw.TextStyle(fontSize: bodySize), |
|||
textAlign: pw.TextAlign.center, |
|||
), |
|||
), |
|||
|
|||
pw.SizedBox(height: 3), |
|||
|
|||
@ -251,7 +284,9 @@ class PlatformPrintService { |
|||
pw.SizedBox(height: 2), |
|||
|
|||
// Message de remerciement |
|||
pw.Text( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
'Merci de votre visite !', |
|||
style: pw.TextStyle( |
|||
fontSize: bodySize, |
|||
@ -259,33 +294,44 @@ class PlatformPrintService { |
|||
), |
|||
textAlign: pw.TextAlign.center, |
|||
), |
|||
), |
|||
|
|||
pw.Text( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
'A bientôt !', |
|||
style: pw.TextStyle(fontSize: smallSize), |
|||
textAlign: pw.TextAlign.center, |
|||
), |
|||
), |
|||
|
|||
pw.SizedBox(height: 3), |
|||
|
|||
// Code de suivi (optionnel) |
|||
pw.Text( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
'Code: ${factureNumber}', |
|||
style: pw.TextStyle(fontSize: smallSize), |
|||
textAlign: pw.TextAlign.center, |
|||
), |
|||
), |
|||
|
|||
pw.SizedBox(height: 4), |
|||
|
|||
// Ligne de découpe |
|||
pw.Text( |
|||
pw.Container( |
|||
width: double.infinity, |
|||
child: pw.Text( |
|||
'- - - - - - - - - - - - - - - -', |
|||
style: pw.TextStyle(fontSize: smallSize), |
|||
textAlign: pw.TextAlign.center, |
|||
), |
|||
), |
|||
|
|||
pw.SizedBox(height: 2), |
|||
], |
|||
), |
|||
); |
|||
}, |
|||
), |
|||
|
|||
Loading…
Reference in new issue