搜尋套件、儲存庫與 APP 分類

GitHub 儲存庫aljanshere/telpo-flutter-sdk

telpo-flutter-sdk

🖨 適用於Telpo熱敏打印機設備的Flutter外掛程式。

telpo-flutter-sdk 專案封面
星標
24
分支
17
最近推送(UTC)
2022年11月4日
專案狀態
未封存

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

telpo_flutter_sdk

Pub Version

A Flutter plugin for handling connection and communication with Telpo thermal printer devices.

cover

💡 Motivation

While developing MASHINPAY payment solution we've purchased Telpo thermal printers ("M1"s specifically) for printing invoice files after users' successful transaction. The Telpo devices come with a native SDK and documentation for it. Since there wasn't an official plugin for Flutter, we had to customize the plugin by ourselves. We've added so many useful methods for better handling exceptions, customizable print layout and etc.

⚙️ Android setup

  1. Add url "https://jitpack.io" for maven to project level build.gradle file (android/build.gradle).
allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
        ...
    }
}
  1. Set the minSdkVersion as 19 in application level build.gradle file (android/app/build.gradle).
android {
    defaultConfig {
        ...
        minSdkVersion 19
        ...
    }
}

🕹️ Usage

Initialization

To get started, create an instance of TelpoFlutterChannel:

final _telpoFlutterChannel = TelpoFlutterChannel();

Connecting with Telpo:

final bool connected = await _telpoFlutterChannel.connect();
// Result: true, false.

Checking Telpo's status:

final TelpoStatus status = await _telpoFlutterChannel.checkStatus();
// Result: ok, noPaper, overHeat, cacheIsFull, unknown.

Checking connection status with Telpo:

final bool status = await _telpoFlutterChannel.isConnected();
// Result: true, false.

Printing a sheet:

// Creating an empty sheet
final sheet = TelpoPrintSheet();

// Creating a text element
const textData = PrintData.text(
  'TelpoFlutterSdk',
  alignment: PrintAlignment.center,
  fontSize: PrintedFontSize.size34,
);

// Creating 8-line empty space
const spacing = PrintData.space(step: 8);

// Inserting previously created text element to the sheet.
sheet.addElement(textData);

// Inserting previously created spacing element to the sheet.
sheet.addElement(spacing);

final PrintResult result = await _telpoFlutterChannel.print(sheet);
// Result: success, noPaper, lowBattery, overHeat, dataCanNotBeTransmitted, other.

📝 Roadmap

✅ Well-written documentation 🤓
✅ Document the platform-specific configurations.
✅ Add explanations for Enum values of PrintResult and TelpoStatus.
⏳ Print image file.
⏳ Toggle printing event via NFC. 🤩
⏳ Toggle printing event via BlueTooth, may be?
⏳ Checking if Telpo is available on the device?

🤓 Contributors

🙏 Credits

While we were trying to understand and port the Telpo device to the Flutter framework we got very inspiring code samples and examples from Efikas's plugin (flutter_telpo) for Flutter which can be considered as a basic version of our plugin and our plugin can be considered as more customized of his since both of us used the same native implementation of the Telpo's Android SDK which comes together with the Telpo device.

🐞 Bugs/Requests

If you encounter any problems please open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and we'll look into it. Pull requests are welcome.

📃 License

MIT License

Aljan Shikhiyev GitHub avatar
GitHub 作者

Aljan Shikhiyev ↗

MegaSec LLCBaku, Azerbaijan
語言KotlinDartRubySwiftObjective-C

分類

使用的依賴

依賴清單 3 項

  • flutter{"sdk":"flutter"}
  • flutter_test開發依賴{"sdk":"flutter"}
  • flutter_lints開發依賴^2.0.0

如何選擇適合專案的儲存庫?

先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。

  1. 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
  2. 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
  3. 使用前在 GitHub 確認 README、授權條款與 Issues。

來源與維護

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗