lao_roadtax_eticker

Last updated:

0 purchases

lao_roadtax_eticker Image
lao_roadtax_eticker Images
Add to Cart

Description:

lao roadtax eticker

lao_roadtax_esticker #

Flutter package create lao road tax E-sticker


pull requests is welcome

Install #
add lao_roadtax_esticker to pubspec.yaml
lao_roadtax_esticker:<release>
copied to clipboard
then add theses fonts from this package to your project
fonts:
- family: PhetsarathOT
fonts:
- asset: packages/lao_roadtax_eticker/fonts/Phetsarath_OT.ttf
- family: RoadTaxIcons
fonts:
- asset: packages/lao_roadtax_eticker/fonts/RoadTaxIcons.ttf
copied to clipboard
Usage #
Using default template #
final LaoRoadTaxSticker createSticker = CreateLaoRoadTaxSticker();

final stickerByte = createSticker.createSticker(
RoadTaxData(
vehicleCode: "01",
vehicleName: "ລົດຈັກ",
licensePlateNumber: "ຍຫ 5578",
licenseTypeName: "ເອກະຊົນ",
province: "ກຳແພງນະຄອນ",
chassisNumber: "RLHHC1207BY468177",
engineDisplacement: "200",
barcode: "M191090001020",
amount: "550000",
year: "2023",
time: DateTime.now(),
),
);

if (stickerByte != null) {
final imagePath = File('example_roadTaxSticker.png');
if (!(await imagePath.exists())) {
await imagePath.create();
}
// write to temporary directory
await imagePath.writeAsBytes(stickerByte.buffer.asUint8List());
}
copied to clipboard
Using your background image template #
final data = await rootBundle.load("assets/<your_road_tax_background_image_template>.png");

final LaoRoadTaxSticker createSticker = CreateLaoRoadTaxSticker(roadTaxBackgroundTemplateImage: data);

final stickerByte = createSticker.createSticker(
RoadTaxData(
vehicleCode: "01",
vehicleName: "ລົດຈັກ",
licensePlateNumber: "ຍຫ 5578",
licenseTypeName: "ເອກະຊົນ",
province: "ກຳແພງນະຄອນ",
chassisNumber: "RLHHC1207BY468177",
engineDisplacement: "200",
barcode: "M191090001020",
amount: "550000",
year: "2023",
time: DateTime.now(),
),
);
copied to clipboard
Save sticker to gallery #
if you need to save sticker image to gallery please using gallery_saver

void saveSticker() async {
try {
final imageByte = await _createStickerFromLib();

if (imageByte != null) {
final directory = await getTemporaryDirectory();
final imagePath = File('${directory.path}/roadTaxSticker.png');
if (!(await imagePath.exists())) {
await imagePath.create();
}
// write to temporary directory
await imagePath.writeAsBytes(imageByte.buffer.asUint8List());

final saveImage =
await GallerySaver.saveImage(imagePath.path, albumName: "Road Tax");

// delete image from temporary directory
await imagePath.delete();
if (saveImage == true) {
print("---------- save success");
}
}
} catch (e) {
print("----------$e");
}
}

Future<ByteData?> _createStickerFromLib() async {
final data = await rootBundle.load("assets/tam3.png");

final LaoRoadTaxSticker createSticker =
CreateLaoRoadTaxSticker(roadTaxBackgroundTemplateImage: data);
final stickerByte = createSticker.createSticker(
RoadTaxData(
vehicleCode: "01",
vehicleName: "ລົດຈັກ",
licensePlateNumber: "ຍຫ 5578",
licenseTypeName: "ເອກະຊົນ",
province: "ກຳແພງນະຄອນ",
chassisNumber: "RLHHC1207BY468177",
engineDisplacement: "200",
barcode: "M191090001020",
amount: "550000",
year: "2023",
time: DateTime.now(),
),
);

return stickerByte;
}

copied to clipboard
Display sticker #

class StrikerRoadTax extends StatelessWidget {
const StrikerRoadTax({super.key});

@override
Widget build(BuildContext context) {
return FutureBuilder<ByteData?>(
future: _createStickerFromLib(),
builder: (BuildContext context, AsyncSnapshot<ByteData?> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Text("Loading...");
}
if (snapshot.hasError) {
return Text("${snapshot.error}");
}
return Image.memory(Uint8List.view(snapshot.data!.buffer));
},
);
}
}


Future<ByteData?> _createStickerFromLib() async {
final data = await rootBundle.load("assets/tam3.png");

final LaoRoadTaxSticker createSticker =
CreateLaoRoadTaxSticker(roadTaxBackgroundTemplateImage: data);
final stickerByte = createSticker.createSticker(
RoadTaxData(
vehicleCode: "01",
vehicleName: "ລົດຈັກ",
licensePlateNumber: "ຍຫ 5578",
licenseTypeName: "ເອກະຊົນ",
province: "ກຳແພງນະຄອນ",
chassisNumber: "RLHHC1207BY468177",
engineDisplacement: "200",
barcode: "M191090001020",
amount: "550000",
year: "2023",
time: DateTime.now(),
),
);

return stickerByte;
}

copied to clipboard
Donation #
if this package useful you can donate me by
Bank

Binance Pay

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.