feat: product image and printer type

This commit is contained in:
efrilm
2025-08-03 01:00:33 +07:00
parent 39e3fdc81c
commit e1825fe86f
7 changed files with 108 additions and 93 deletions
+41 -41
View File
@@ -991,27 +991,27 @@ class PrintDataoutputs {
: '--------------------------------',
styles: const PosStyles(bold: false, align: PosAlign.center));
bytes += generator.feed(1);
// final kitchenProducts =
// products.where((p) => p.product.printerType == 'kitchen');
// for (final product in kitchenProducts) {
// bytes += generator.text('${product.quantity} x ${product.product.name}',
// styles: const PosStyles(
// align: PosAlign.left,
// bold: false,
// height: PosTextSize.size2,
// width: PosTextSize.size1,
// ));
// if (product.notes.isNotEmpty) {
// bytes += generator.text(' Notes: ${product.notes}',
// styles: const PosStyles(
// align: PosAlign.left,
// bold: false,
// height: PosTextSize.size1,
// width: PosTextSize.size1,
// fontType: PosFontType.fontA,
// ));
// }
// }
final kitchenProducts =
products.where((p) => p.product.printerType == 'kitchen');
for (final product in kitchenProducts) {
bytes += generator.text('${product.quantity} x ${product.product.name}',
styles: const PosStyles(
align: PosAlign.left,
bold: false,
height: PosTextSize.size2,
width: PosTextSize.size1,
));
if (product.notes.isNotEmpty) {
bytes += generator.text(' Notes: ${product.notes}',
styles: const PosStyles(
align: PosAlign.left,
bold: false,
height: PosTextSize.size1,
width: PosTextSize.size1,
fontType: PosFontType.fontA,
));
}
}
bytes += generator.feed(1);
bytes += generator.text(
@@ -1105,26 +1105,26 @@ class PrintDataoutputs {
: '--------------------------------',
styles: const PosStyles(bold: false, align: PosAlign.center));
bytes += generator.feed(1);
// final barProducts = products.where((p) => p.product.printerType == 'bar');
// for (final product in barProducts) {
// bytes += generator.text('${product.quantity} x ${product.product.name}',
// styles: const PosStyles(
// align: PosAlign.left,
// bold: false,
// height: PosTextSize.size2,
// width: PosTextSize.size1,
// ));
// if (product.notes.isNotEmpty) {
// bytes += generator.text(' Notes: ${product.notes}',
// styles: const PosStyles(
// align: PosAlign.left,
// bold: false,
// height: PosTextSize.size1,
// width: PosTextSize.size1,
// fontType: PosFontType.fontA,
// ));
// }
// }
final barProducts = products.where((p) => p.product.printerType == 'bar');
for (final product in barProducts) {
bytes += generator.text('${product.quantity} x ${product.product.name}',
styles: const PosStyles(
align: PosAlign.left,
bold: false,
height: PosTextSize.size2,
width: PosTextSize.size1,
));
if (product.notes.isNotEmpty) {
bytes += generator.text(' Notes: ${product.notes}',
styles: const PosStyles(
align: PosAlign.left,
bold: false,
height: PosTextSize.size1,
width: PosTextSize.size1,
fontType: PosFontType.fontA,
));
}
}
bytes += generator.feed(1);
bytes += generator.text(
@@ -78,6 +78,8 @@ class Product {
final int? price;
final int? cost;
final String? businessType;
final String? imageUrl;
final String? printerType;
final Map<String, dynamic>? metadata;
final bool? isActive;
final DateTime? createdAt;
@@ -94,6 +96,8 @@ class Product {
this.price,
this.cost,
this.businessType,
this.imageUrl,
this.printerType,
this.metadata,
this.isActive,
this.createdAt,
@@ -115,6 +119,8 @@ class Product {
price: json["price"],
cost: json["cost"],
businessType: json["business_type"],
imageUrl: json["image_url"],
printerType: json["printer_type"],
metadata: json["metadata"] ?? {},
isActive: json["is_active"],
createdAt: json["created_at"] == null
@@ -144,6 +150,8 @@ class Product {
price: json["price"],
cost: json["cost"],
businessType: json["business_type"],
imageUrl: json["image_url"],
printerType: json["printer_type"],
metadata: json["metadata"] ?? {},
isActive: json["is_active"],
createdAt: json["created_at"] == null
@@ -168,6 +176,8 @@ class Product {
"price": price,
"cost": cost,
"business_type": businessType,
"image_url": imageUrl,
"printer_type": printerType,
"metadata": metadata,
"is_active": isActive,
"created_at": createdAt?.toIso8601String(),
@@ -187,6 +197,8 @@ class Product {
"price": price,
"cost": cost,
"business_type": businessType,
"image_url": imageUrl,
"printer_type": printerType,
"metadata": metadata,
"is_active": isActive,
"created_at": createdAt?.toIso8601String(),
@@ -209,6 +221,8 @@ class Product {
other.price == price &&
other.cost == cost &&
other.businessType == businessType &&
other.imageUrl == imageUrl &&
other.printerType == printerType &&
other.metadata == metadata &&
other.isActive == isActive &&
other.createdAt == createdAt &&
@@ -237,6 +251,8 @@ class Product {
price.hashCode ^
cost.hashCode ^
businessType.hashCode ^
imageUrl.hashCode ^
printerType.hashCode ^
metadata.hashCode ^
isActive.hashCode ^
createdAt.hashCode ^
@@ -254,6 +270,8 @@ class Product {
int? price,
int? cost,
String? businessType,
String? imageUrl,
String? printerType,
Map<String, dynamic>? metadata,
bool? isActive,
DateTime? createdAt,
@@ -270,6 +288,8 @@ class Product {
price: price ?? this.price,
cost: cost ?? this.cost,
businessType: businessType ?? this.businessType,
imageUrl: imageUrl ?? this.imageUrl,
printerType: printerType ?? this.printerType,
metadata: metadata ?? this.metadata,
isActive: isActive ?? this.isActive,
createdAt: createdAt ?? this.createdAt,