|
@@ -198,197 +198,6 @@ pw.Page generarPaginaPrimerTicket(Pedido pedido, pw.MemoryImage image) {
|
|
|
|
|
|
//Ticket PC
|
|
|
|
|
|
-// Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
-// BuildContext context, Pedido pedido) async {
|
|
|
-// final numberFormat = NumberFormat('#,##0.00', 'es_MX');
|
|
|
-// double subtotal = 0;
|
|
|
-// double totalConDescuento = 0;
|
|
|
-// double descuento = pedido.descuento?.toDouble() ?? 0.0;
|
|
|
-// double precioDescuento = 0;
|
|
|
-
|
|
|
-// final sucursalVariable =
|
|
|
-// await Provider.of<VariableViewModel>(context, listen: false)
|
|
|
-// .getVariableByClave('Sucursal');
|
|
|
-// final sucursalDescripcion = sucursalVariable?.descripcion ?? '';
|
|
|
-
|
|
|
-// List<pw.Widget> content = [
|
|
|
-// pw.Padding(
|
|
|
-// padding: pw.EdgeInsets.only(right: 10),
|
|
|
-// child: pw.Row(
|
|
|
-// mainAxisAlignment: pw.MainAxisAlignment.spaceAround,
|
|
|
-// children: [
|
|
|
-// pw.Text('${pedido.folio}/ ',
|
|
|
-// style:
|
|
|
-// pw.TextStyle(fontSize: 10.5, fontWeight: pw.FontWeight.bold)),
|
|
|
-// if (sucursalDescripcion.isNotEmpty)
|
|
|
-// pw.Text('$sucursalDescripcion/ ',
|
|
|
-// style: pw.TextStyle(
|
|
|
-// fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
-// ],
|
|
|
-// ),
|
|
|
-// ),
|
|
|
-// pw.SizedBox(height: 2),
|
|
|
-// pw.Row(
|
|
|
-// mainAxisAlignment: pw.MainAxisAlignment.spaceAround,
|
|
|
-// children: [
|
|
|
-// pw.Text('${_formatDateTime(pedido.peticion)}',
|
|
|
-// style:
|
|
|
-// pw.TextStyle(fontSize: 10.5, fontWeight: pw.FontWeight.bold)),
|
|
|
-// ],
|
|
|
-// ),
|
|
|
-// pw.SizedBox(height: 2),
|
|
|
-// if (pedido.nombreCliente != null && pedido.nombreCliente!.isNotEmpty)
|
|
|
-// pw.Text('Cliente: ${pedido.nombreCliente}',
|
|
|
-// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
-// pw.SizedBox(height: 2),
|
|
|
-// ];
|
|
|
-
|
|
|
-// // Mostrar los productos con la cantidad, el precio total y el precio de los toppings
|
|
|
-// content.addAll(pedido.productos
|
|
|
-// .map((producto) {
|
|
|
-// final productPrice = producto.producto?.precio ?? 0.0;
|
|
|
-// final productTotal = productPrice * (producto.cantidad ?? 1);
|
|
|
-// subtotal += productTotal;
|
|
|
-
|
|
|
-// final toppingsList = producto.toppings.map((topping) {
|
|
|
-// final toppingPrice = topping.topping?.precio ?? 0.0;
|
|
|
-// final toppingTotal = toppingPrice * (producto.cantidad ?? 1);
|
|
|
-// subtotal += toppingTotal;
|
|
|
-
|
|
|
-// return pw.Row(
|
|
|
-// mainAxisAlignment: pw.MainAxisAlignment.start,
|
|
|
-// children: [
|
|
|
-// pw.Expanded(
|
|
|
-// flex: 3,
|
|
|
-// child: pw.Text(
|
|
|
-// '-${topping.topping?.nombre ?? "Topping no especificado"}',
|
|
|
-// style: const pw.TextStyle(fontSize: 8.5)),
|
|
|
-// ),
|
|
|
-// if (toppingPrice > 0)
|
|
|
-// pw.Expanded(
|
|
|
-// flex: 1,
|
|
|
-// child: pw.Text(
|
|
|
-// '\$${numberFormat.format(toppingTotal)}',
|
|
|
-// style: const pw.TextStyle(fontSize: 8.5),
|
|
|
-// textAlign: pw.TextAlign.right,
|
|
|
-// ),
|
|
|
-// ),
|
|
|
-// ],
|
|
|
-// );
|
|
|
-// }).toList();
|
|
|
-
|
|
|
-// return [
|
|
|
-// pw.Row(
|
|
|
-// mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
-// children: [
|
|
|
-// pw.Expanded(
|
|
|
-// flex: 1,
|
|
|
-// child: pw.Text('${producto.cantidad}',
|
|
|
-// style: const pw.TextStyle(fontSize: 10.5)),
|
|
|
-// ),
|
|
|
-// pw.Expanded(
|
|
|
-// flex: 6,
|
|
|
-// child: pw.Text(
|
|
|
-// producto.producto?.nombre ?? "Producto no especificado",
|
|
|
-// style: const pw.TextStyle(fontSize: 10.5)),
|
|
|
-// ),
|
|
|
-// pw.Expanded(
|
|
|
-// flex: 4,
|
|
|
-// child: pw.Align(
|
|
|
-// alignment: pw.Alignment.centerLeft,
|
|
|
-// child: pw.Text(
|
|
|
-// '\$${numberFormat.format(productTotal)}',
|
|
|
-// style: const pw.TextStyle(fontSize: 10.5),
|
|
|
-// ),
|
|
|
-// )),
|
|
|
-// ],
|
|
|
-// ),
|
|
|
-// ...toppingsList,
|
|
|
-// ];
|
|
|
-// })
|
|
|
-// .expand((e) => e)
|
|
|
-// .toList());
|
|
|
-
|
|
|
-// // Calcular el descuento y el total final
|
|
|
-// precioDescuento = subtotal * (descuento / 100);
|
|
|
-// totalConDescuento = subtotal - precioDescuento;
|
|
|
-
|
|
|
-// content.add(pw.Divider());
|
|
|
-
|
|
|
-// if (descuento > 0) {
|
|
|
-// content.addAll([
|
|
|
-// pw.Row(
|
|
|
-// mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
-// children: [
|
|
|
-// pw.Text('Subtotal:',
|
|
|
-// style:
|
|
|
-// pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
-// pw.Padding(
|
|
|
-// padding: pw.EdgeInsets.only(right: 15),
|
|
|
-// child: pw.Text('\$${numberFormat.format(subtotal)}',
|
|
|
-// style: pw.TextStyle(
|
|
|
-// fontWeight: pw.FontWeight.bold, fontSize: 10.5))),
|
|
|
-// ],
|
|
|
-// ),
|
|
|
-// pw.Row(
|
|
|
-// mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
-// children: [
|
|
|
-// pw.Text('Descuento:',
|
|
|
-// style:
|
|
|
-// pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
-// pw.Padding(
|
|
|
-// padding: pw.EdgeInsets.only(right: 15),
|
|
|
-// child: pw.Text('-\$${numberFormat.format(precioDescuento)}',
|
|
|
-// style: pw.TextStyle(
|
|
|
-// fontWeight: pw.FontWeight.bold, fontSize: 10.5))),
|
|
|
-// ],
|
|
|
-// ),
|
|
|
-// ]);
|
|
|
-// }
|
|
|
-
|
|
|
-// content.add(
|
|
|
-// pw.Row(
|
|
|
-// mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
-// children: [
|
|
|
-// pw.Text('Total:',
|
|
|
-// style:
|
|
|
-// pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
-// pw.Padding(
|
|
|
-// padding: pw.EdgeInsets.only(right: 20),
|
|
|
-// child: pw.Text(
|
|
|
-// '\$${numberFormat.format(descuento > 0 ? totalConDescuento : subtotal)}',
|
|
|
-// style: pw.TextStyle(
|
|
|
-// fontWeight: pw.FontWeight.bold, fontSize: 10.5))),
|
|
|
-// ],
|
|
|
-// ),
|
|
|
-// );
|
|
|
-
|
|
|
-// if (pedido.comentarios != null && pedido.comentarios!.isNotEmpty) {
|
|
|
-// content.add(pw.SizedBox(height: 1));
|
|
|
-// content.add(pw.Text('Comentarios:',
|
|
|
-// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)));
|
|
|
-// content.add(pw.Padding(
|
|
|
-// padding: const pw.EdgeInsets.only(right: 15),
|
|
|
-// child: pw.Text(pedido.comentarios!,
|
|
|
-// style: const pw.TextStyle(fontSize: 10.5)),
|
|
|
-// ));
|
|
|
-// }
|
|
|
-
|
|
|
-// content.add(pw.SizedBox(height: 15));
|
|
|
-// content.add(pw.Text('.', style: pw.TextStyle(fontSize: 1)));
|
|
|
-
|
|
|
-// return pw.Page(
|
|
|
-// pageFormat: PdfPageFormat.roll57,
|
|
|
-// margin: pw.EdgeInsets.all(5),
|
|
|
-// build: (pw.Context context) {
|
|
|
-// return pw.Column(
|
|
|
-// crossAxisAlignment: pw.CrossAxisAlignment.center, children: content);
|
|
|
-// },
|
|
|
-// );
|
|
|
-// }
|
|
|
-
|
|
|
-//Ticket Tablet
|
|
|
-
|
|
|
Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
BuildContext context, Pedido pedido) async {
|
|
|
final numberFormat = NumberFormat('#,##0.00', 'es_MX');
|
|
@@ -403,28 +212,34 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
final sucursalDescripcion = sucursalVariable?.descripcion ?? '';
|
|
|
|
|
|
List<pw.Widget> content = [
|
|
|
- pw.Row(
|
|
|
- mainAxisAlignment: pw.MainAxisAlignment.spaceAround,
|
|
|
- children: [
|
|
|
- pw.Text('${pedido.folio}/ ',
|
|
|
- style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)),
|
|
|
- if (sucursalDescripcion.isNotEmpty)
|
|
|
- pw.Text('$sucursalDescripcion/ ',
|
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
- ],
|
|
|
+ pw.Padding(
|
|
|
+ padding: pw.EdgeInsets.only(right: 10),
|
|
|
+ child: pw.Row(
|
|
|
+ mainAxisAlignment: pw.MainAxisAlignment.spaceAround,
|
|
|
+ children: [
|
|
|
+ pw.Text('${pedido.folio}/ ',
|
|
|
+ style:
|
|
|
+ pw.TextStyle(fontSize: 10.5, fontWeight: pw.FontWeight.bold)),
|
|
|
+ if (sucursalDescripcion.isNotEmpty)
|
|
|
+ pw.Text('$sucursalDescripcion/ ',
|
|
|
+ style: pw.TextStyle(
|
|
|
+ fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
pw.SizedBox(height: 2),
|
|
|
pw.Row(
|
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceAround,
|
|
|
children: [
|
|
|
pw.Text('${_formatDateTime(pedido.peticion)}',
|
|
|
- style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)),
|
|
|
+ style:
|
|
|
+ pw.TextStyle(fontSize: 10.5, fontWeight: pw.FontWeight.bold)),
|
|
|
],
|
|
|
),
|
|
|
pw.SizedBox(height: 2),
|
|
|
if (pedido.nombreCliente != null && pedido.nombreCliente!.isNotEmpty)
|
|
|
pw.Text('Cliente: ${pedido.nombreCliente}',
|
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
pw.SizedBox(height: 2),
|
|
|
];
|
|
|
|
|
@@ -447,14 +262,14 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
flex: 3,
|
|
|
child: pw.Text(
|
|
|
'-${topping.topping?.nombre ?? "Topping no especificado"}',
|
|
|
- style: const pw.TextStyle(fontSize: 6)),
|
|
|
+ style: const pw.TextStyle(fontSize: 8.5)),
|
|
|
),
|
|
|
if (toppingPrice > 0)
|
|
|
pw.Expanded(
|
|
|
flex: 1,
|
|
|
child: pw.Text(
|
|
|
'\$${numberFormat.format(toppingTotal)}',
|
|
|
- style: const pw.TextStyle(fontSize: 6),
|
|
|
+ style: const pw.TextStyle(fontSize: 8.5),
|
|
|
textAlign: pw.TextAlign.right,
|
|
|
),
|
|
|
),
|
|
@@ -469,21 +284,21 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
pw.Expanded(
|
|
|
flex: 1,
|
|
|
child: pw.Text('${producto.cantidad}',
|
|
|
- style: const pw.TextStyle(fontSize: 7)),
|
|
|
+ style: const pw.TextStyle(fontSize: 10.5)),
|
|
|
),
|
|
|
pw.Expanded(
|
|
|
- flex: 5,
|
|
|
+ flex: 6,
|
|
|
child: pw.Text(
|
|
|
producto.producto?.nombre ?? "Producto no especificado",
|
|
|
- style: const pw.TextStyle(fontSize: 7)),
|
|
|
+ style: const pw.TextStyle(fontSize: 10.5)),
|
|
|
),
|
|
|
pw.Expanded(
|
|
|
- flex: 2,
|
|
|
+ flex: 4,
|
|
|
child: pw.Align(
|
|
|
- alignment: pw.Alignment.centerRight,
|
|
|
+ alignment: pw.Alignment.centerLeft,
|
|
|
child: pw.Text(
|
|
|
'\$${numberFormat.format(productTotal)}',
|
|
|
- style: const pw.TextStyle(fontSize: 7),
|
|
|
+ style: const pw.TextStyle(fontSize: 10.5),
|
|
|
),
|
|
|
)),
|
|
|
],
|
|
@@ -506,18 +321,26 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
pw.Text('Subtotal:',
|
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
- pw.Text('\$${numberFormat.format(subtotal)}',
|
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+ style:
|
|
|
+ pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
+ pw.Padding(
|
|
|
+ padding: pw.EdgeInsets.only(right: 15),
|
|
|
+ child: pw.Text('\$${numberFormat.format(subtotal)}',
|
|
|
+ style: pw.TextStyle(
|
|
|
+ fontWeight: pw.FontWeight.bold, fontSize: 10.5))),
|
|
|
],
|
|
|
),
|
|
|
pw.Row(
|
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
pw.Text('Descuento:',
|
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
- pw.Text('-\$${numberFormat.format(precioDescuento)}',
|
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+ style:
|
|
|
+ pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
+ pw.Padding(
|
|
|
+ padding: pw.EdgeInsets.only(right: 15),
|
|
|
+ child: pw.Text('-\$${numberFormat.format(precioDescuento)}',
|
|
|
+ style: pw.TextStyle(
|
|
|
+ fontWeight: pw.FontWeight.bold, fontSize: 10.5))),
|
|
|
],
|
|
|
),
|
|
|
]);
|
|
@@ -528,10 +351,14 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
pw.Text('Total:',
|
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
- pw.Text(
|
|
|
- '\$${numberFormat.format(descuento > 0 ? totalConDescuento : subtotal)}',
|
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+ style:
|
|
|
+ pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)),
|
|
|
+ pw.Padding(
|
|
|
+ padding: pw.EdgeInsets.only(right: 20),
|
|
|
+ child: pw.Text(
|
|
|
+ '\$${numberFormat.format(descuento > 0 ? totalConDescuento : subtotal)}',
|
|
|
+ style: pw.TextStyle(
|
|
|
+ fontWeight: pw.FontWeight.bold, fontSize: 10.5))),
|
|
|
],
|
|
|
),
|
|
|
);
|
|
@@ -539,15 +366,16 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
if (pedido.comentarios != null && pedido.comentarios!.isNotEmpty) {
|
|
|
content.add(pw.SizedBox(height: 1));
|
|
|
content.add(pw.Text('Comentarios:',
|
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)));
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 10.5)));
|
|
|
content.add(pw.Padding(
|
|
|
padding: const pw.EdgeInsets.only(right: 15),
|
|
|
- child:
|
|
|
- pw.Text(pedido.comentarios!, style: const pw.TextStyle(fontSize: 7)),
|
|
|
+ child: pw.Text(pedido.comentarios!,
|
|
|
+ style: const pw.TextStyle(fontSize: 10.5)),
|
|
|
));
|
|
|
}
|
|
|
|
|
|
- content.add(pw.SizedBox(height: 1));
|
|
|
+ content.add(pw.SizedBox(height: 15));
|
|
|
+ content.add(pw.Text('.', style: pw.TextStyle(fontSize: 1)));
|
|
|
|
|
|
return pw.Page(
|
|
|
pageFormat: PdfPageFormat.roll57,
|
|
@@ -559,6 +387,178 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+//Ticket Tablet
|
|
|
+
|
|
|
+// Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
+// BuildContext context, Pedido pedido) async {
|
|
|
+// final numberFormat = NumberFormat('#,##0.00', 'es_MX');
|
|
|
+// double subtotal = 0;
|
|
|
+// double totalConDescuento = 0;
|
|
|
+// double descuento = pedido.descuento?.toDouble() ?? 0.0;
|
|
|
+// double precioDescuento = 0;
|
|
|
+
|
|
|
+// final sucursalVariable =
|
|
|
+// await Provider.of<VariableViewModel>(context, listen: false)
|
|
|
+// .getVariableByClave('Sucursal');
|
|
|
+// final sucursalDescripcion = sucursalVariable?.descripcion ?? '';
|
|
|
+
|
|
|
+// List<pw.Widget> content = [
|
|
|
+// pw.Row(
|
|
|
+// mainAxisAlignment: pw.MainAxisAlignment.spaceAround,
|
|
|
+// children: [
|
|
|
+// pw.Text('${pedido.folio}/ ',
|
|
|
+// style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)),
|
|
|
+// if (sucursalDescripcion.isNotEmpty)
|
|
|
+// pw.Text('$sucursalDescripcion/ ',
|
|
|
+// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+// ],
|
|
|
+// ),
|
|
|
+// pw.SizedBox(height: 2),
|
|
|
+// pw.Row(
|
|
|
+// mainAxisAlignment: pw.MainAxisAlignment.spaceAround,
|
|
|
+// children: [
|
|
|
+// pw.Text('${_formatDateTime(pedido.peticion)}',
|
|
|
+// style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)),
|
|
|
+// ],
|
|
|
+// ),
|
|
|
+// pw.SizedBox(height: 2),
|
|
|
+// if (pedido.nombreCliente != null && pedido.nombreCliente!.isNotEmpty)
|
|
|
+// pw.Text('Cliente: ${pedido.nombreCliente}',
|
|
|
+// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+// pw.SizedBox(height: 2),
|
|
|
+// ];
|
|
|
+
|
|
|
+// // Mostrar los productos con la cantidad, el precio total y el precio de los toppings
|
|
|
+// content.addAll(pedido.productos
|
|
|
+// .map((producto) {
|
|
|
+// final productPrice = producto.producto?.precio ?? 0.0;
|
|
|
+// final productTotal = productPrice * (producto.cantidad ?? 1);
|
|
|
+// subtotal += productTotal;
|
|
|
+
|
|
|
+// final toppingsList = producto.toppings.map((topping) {
|
|
|
+// final toppingPrice = topping.topping?.precio ?? 0.0;
|
|
|
+// final toppingTotal = toppingPrice * (producto.cantidad ?? 1);
|
|
|
+// subtotal += toppingTotal;
|
|
|
+
|
|
|
+// return pw.Row(
|
|
|
+// mainAxisAlignment: pw.MainAxisAlignment.start,
|
|
|
+// children: [
|
|
|
+// pw.Expanded(
|
|
|
+// flex: 3,
|
|
|
+// child: pw.Text(
|
|
|
+// '-${topping.topping?.nombre ?? "Topping no especificado"}',
|
|
|
+// style: const pw.TextStyle(fontSize: 6)),
|
|
|
+// ),
|
|
|
+// if (toppingPrice > 0)
|
|
|
+// pw.Expanded(
|
|
|
+// flex: 1,
|
|
|
+// child: pw.Text(
|
|
|
+// '\$${numberFormat.format(toppingTotal)}',
|
|
|
+// style: const pw.TextStyle(fontSize: 6),
|
|
|
+// textAlign: pw.TextAlign.right,
|
|
|
+// ),
|
|
|
+// ),
|
|
|
+// ],
|
|
|
+// );
|
|
|
+// }).toList();
|
|
|
+
|
|
|
+// return [
|
|
|
+// pw.Row(
|
|
|
+// mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
+// children: [
|
|
|
+// pw.Expanded(
|
|
|
+// flex: 1,
|
|
|
+// child: pw.Text('${producto.cantidad}',
|
|
|
+// style: const pw.TextStyle(fontSize: 7)),
|
|
|
+// ),
|
|
|
+// pw.Expanded(
|
|
|
+// flex: 5,
|
|
|
+// child: pw.Text(
|
|
|
+// producto.producto?.nombre ?? "Producto no especificado",
|
|
|
+// style: const pw.TextStyle(fontSize: 7)),
|
|
|
+// ),
|
|
|
+// pw.Expanded(
|
|
|
+// flex: 2,
|
|
|
+// child: pw.Align(
|
|
|
+// alignment: pw.Alignment.centerRight,
|
|
|
+// child: pw.Text(
|
|
|
+// '\$${numberFormat.format(productTotal)}',
|
|
|
+// style: const pw.TextStyle(fontSize: 7),
|
|
|
+// ),
|
|
|
+// )),
|
|
|
+// ],
|
|
|
+// ),
|
|
|
+// ...toppingsList,
|
|
|
+// ];
|
|
|
+// })
|
|
|
+// .expand((e) => e)
|
|
|
+// .toList());
|
|
|
+
|
|
|
+// // Calcular el descuento y el total final
|
|
|
+// precioDescuento = subtotal * (descuento / 100);
|
|
|
+// totalConDescuento = subtotal - precioDescuento;
|
|
|
+
|
|
|
+// content.add(pw.Divider());
|
|
|
+
|
|
|
+// if (descuento > 0) {
|
|
|
+// content.addAll([
|
|
|
+// pw.Row(
|
|
|
+// mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
+// children: [
|
|
|
+// pw.Text('Subtotal:',
|
|
|
+// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+// pw.Text('\$${numberFormat.format(subtotal)}',
|
|
|
+// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+// ],
|
|
|
+// ),
|
|
|
+// pw.Row(
|
|
|
+// mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
+// children: [
|
|
|
+// pw.Text('Descuento:',
|
|
|
+// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+// pw.Text('-\$${numberFormat.format(precioDescuento)}',
|
|
|
+// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+// ],
|
|
|
+// ),
|
|
|
+// ]);
|
|
|
+// }
|
|
|
+
|
|
|
+// content.add(
|
|
|
+// pw.Row(
|
|
|
+// mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
|
+// children: [
|
|
|
+// pw.Text('Total:',
|
|
|
+// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+// pw.Text(
|
|
|
+// '\$${numberFormat.format(descuento > 0 ? totalConDescuento : subtotal)}',
|
|
|
+// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
+// ],
|
|
|
+// ),
|
|
|
+// );
|
|
|
+
|
|
|
+// if (pedido.comentarios != null && pedido.comentarios!.isNotEmpty) {
|
|
|
+// content.add(pw.SizedBox(height: 1));
|
|
|
+// content.add(pw.Text('Comentarios:',
|
|
|
+// style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)));
|
|
|
+// content.add(pw.Padding(
|
|
|
+// padding: const pw.EdgeInsets.only(right: 15),
|
|
|
+// child:
|
|
|
+// pw.Text(pedido.comentarios!, style: const pw.TextStyle(fontSize: 7)),
|
|
|
+// ));
|
|
|
+// }
|
|
|
+
|
|
|
+// content.add(pw.SizedBox(height: 1));
|
|
|
+
|
|
|
+// return pw.Page(
|
|
|
+// pageFormat: PdfPageFormat.roll57,
|
|
|
+// margin: pw.EdgeInsets.all(5),
|
|
|
+// build: (pw.Context context) {
|
|
|
+// return pw.Column(
|
|
|
+// crossAxisAlignment: pw.CrossAxisAlignment.center, children: content);
|
|
|
+// },
|
|
|
+// );
|
|
|
+// }
|
|
|
+
|
|
|
Future<void> printPdf(Uint8List pdfBytes) async {
|
|
|
await Printing.layoutPdf(
|
|
|
onLayout: (PdfPageFormat format) => pdfBytes,
|