Files
jiu/client/lib/core/utils/label_data.dart
T
wangjia 104b98f4ac feat(client): 标签打印预览弹窗(打印机选择 + 份数 + 所见即所得预览)
- 新增 LabelData 模型统一聚合单张标签字段(qrBytes/copies 等)
- 抽取 _renderLabelBitmap 共享位图绘制逻辑,TSPL 裸发与预览渲染完全一致
- 新增 renderLabelPreview / listLabelPrinters / detectDefaultPrinter 公开 API
- printProductLabel 新增 printerName 参数,透传到热敏裸发路径
- 新建 LabelPreviewDialog:缩略图条+大图主视图,打印机下拉+记忆(SharedPrefs)
  份数调整、勾选跳过、逐张打印进度状态显示
- 库存/商品详情/入库单 打标签 均接入预览弹窗,移除旧 _LabelPrintDialog

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 11:49:37 +08:00

41 lines
982 B
Dart

import 'dart:typed_data';
/// 单张标签的全部打印字段,预览和打印共用同一份数据。
class LabelData {
/// 商品 ID,多张懒加载 QR 时用于拉取二维码字节。
final int? productId;
/// 二维码字节(PNG);单张场景调用方提前拉好;多张场景由 qrFetcher 懒加载填入。
Uint8List? qrBytes;
final String name;
final String code;
final String? spec;
final String? series;
final String? batchNo;
final String? productionDate;
final String? remark;
final String shopName;
final String shopAddress;
final String shopPhone;
/// 打印份数,默认 1,可在预览弹窗里调整。
int copies;
LabelData({
this.productId,
this.qrBytes,
required this.name,
required this.code,
this.spec,
this.series,
this.batchNo,
this.productionDate,
this.remark,
this.shopName = '',
this.shopAddress = '',
this.shopPhone = '',
this.copies = 1,
});
}