printLogo static method
Print a logo at the top of a receipt.
Convenience method for printing a logo with standard formatting.
logoPath: Path to the logo image filewidth: Width to resize the logo (0 = printer default)addSpacing: Whether to add space after the logo
Returns true if printing was successful.
Implementation
static Future<bool> printLogo(
String logoPath, {
int width = 0,
bool addSpacing = true,
}) async {
try {
// Print the logo centered
final logoResult = await printImage(
logoPath,
width: width,
alignment: Alignment.center,
);
if (!logoResult) {
return false;
}
// Add spacing if requested
if (addSpacing) {
return await PrinterText.printBlankLines(1);
}
return true;
} catch (e) {
print('Error printing logo: $e');
return false;
}
}