Last updated:
0 purchases
phomemo
phomemo #
A Flutter plugin to create information to send to phomemo printers.
Getting started #
To get started with phomemo add the package to your pubspec.yaml file.
Generate a widget image #
Generates an image to send to the printer to print. Set the size as the size of the label. The example below has a height of 12mm with a infinately long length.
GlobalKey key = GlobalKey();
Size labelSize = const Size(double.infinity,12);
Widget widget = Container(
width: (labelSize.width * 3)+30,
height: (labelSize.height * 3)+30,
margin: const EdgeInsets.only(top:5),
padding: const EdgeInsets.fromLTRB(15, 15, 15, 15),
color: Theme.of(context).focusColor,
child: RepaintBoundary(
key: key,
child: child,
)
);
img.Image? image = await PhomemoHelper.generateImageFromWidget(key);
copied to clipboard
Generate a text image #
Generates an image to send to the printer to print. Set the size as the size of the label. The example below has a height of 12mm with a infinately long length.
img.Image? text = await PhomemoHelper.generateImageFromText(
TextSpan(
text: 'text here',
style: const TextStyle(
fontSize: 34,
color: Colors.black
),
),
size: Size(double.inifity,12), //Change this to the lable size
);
copied to clipboard
Send info to the printer #
Generate the data to send to the printer. Put the function to send to your printer in the class itself. In this case it is sending to a ble printer usng flutter_blue_plus.
Phomemo label = Phomemo(send: bluetooth.write, read: bluetooth.read);
PhomemoPrinter printer = helper.getPrinterFromName(bluetooth.device!.name);
await label.printLabel(
[img.decodePng(qrCode!.buffer.asUint8List()),letter],// the images to send to the printer
printer: printer, //The printer that will be printed on
spacing: 5, //space between images. Only works for D30, and D35 printers
rotate: printer != PhomemoPrinter.m220 // do not rotate the image if using the m220 or m110
labelSize: Size(double.infinity,12), //size of the label
);
copied to clipboard
Example #
Find the example app here.
Contributing #
Contributions are welcome.
In case of any problems look at existing issues, if you cannot find anything related to your problem then open an issue.
Create an issue before opening a pull request for non trivial fixes.
In case of trivial fixes open a pull request directly.
Additional Information #
This plugin is only for creating the information to send to phomemo printers. This has been tested on P12Pro, D35, D30 and M220.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.