Barcode Printing Utility Done

This commit is contained in:
2026-09-04 18:30:26 +05:30
parent 5e9b3f2122
commit 2c04a993f7
33 changed files with 8481 additions and 5 deletions

View File

@@ -0,0 +1,152 @@
class DynamicFieldDefinition {
final String source; // e.g. "product"
final String fieldKey; // e.g. "name", "sellingPrice", "barcode"
final String displayName; // e.g. "Product Name"
final String category; // e.g. "Identification", "Pricing", "Specifications"
final String dataType; // "string", "currency", "weight", "number"
final bool isBarcodeCompatible;
final String? defaultPrefix;
final String? defaultSuffix;
const DynamicFieldDefinition({
required this.source,
required this.fieldKey,
required this.displayName,
required this.category,
this.dataType = 'string',
this.isBarcodeCompatible = false,
this.defaultPrefix,
this.defaultSuffix,
});
String get placeholder => '{{$source.$fieldKey}}';
static const List<DynamicFieldDefinition> productFields = [
DynamicFieldDefinition(
source: 'product',
fieldKey: 'name',
displayName: 'Product Name',
category: 'General',
dataType: 'string',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'sku',
displayName: 'SKU',
category: 'Identification',
dataType: 'string',
isBarcodeCompatible: true,
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'barcode',
displayName: 'Barcode',
category: 'Identification',
dataType: 'string',
isBarcodeCompatible: true,
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'sellingPrice',
displayName: 'Selling Price',
category: 'Pricing',
dataType: 'currency',
defaultPrefix: '',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'mrp',
displayName: 'MRP',
category: 'Pricing',
dataType: 'currency',
defaultPrefix: 'MRP ₹',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'weightInG',
displayName: 'Weight',
category: 'Measurements',
dataType: 'weight',
defaultSuffix: ' g',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'hsnCode',
displayName: 'HSN Code',
category: 'Tax & Compliance',
dataType: 'string',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'gstRate',
displayName: 'GST Rate',
category: 'Tax & Compliance',
dataType: 'number',
defaultSuffix: '%',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'brandName',
displayName: 'Brand',
category: 'General',
dataType: 'string',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'material',
displayName: 'Material / Metal',
category: 'Specifications',
dataType: 'string',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'size',
displayName: 'Size',
category: 'Specifications',
dataType: 'string',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'color',
displayName: 'Color',
category: 'Specifications',
dataType: 'string',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'manufacturerCode',
displayName: 'Tag / Serial / Code',
category: 'Identification',
dataType: 'string',
isBarcodeCompatible: true,
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'purityFactor',
displayName: 'Purity Factor',
category: 'Specifications',
dataType: 'number',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'description',
displayName: 'Description',
category: 'General',
dataType: 'string',
),
DynamicFieldDefinition(
source: 'product',
fieldKey: 'currentStock',
displayName: 'Current Stock',
category: 'Inventory',
dataType: 'number',
),
];
static DynamicFieldDefinition? find(String source, String fieldKey) {
if (source == 'product') {
return productFields.where((f) => f.fieldKey == fieldKey).firstOrNull;
}
return null;
}
}