diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies new file mode 100644 index 0000000..9c61100 --- /dev/null +++ b/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"charset_converter","path":"/Users/bilonik/.pub-cache/hosted/pub.dev/charset_converter-2.2.0/","native_build":true,"dependencies":[]}],"android":[{"name":"charset_converter","path":"/Users/bilonik/.pub-cache/hosted/pub.dev/charset_converter-2.2.0/","native_build":true,"dependencies":[]}],"macos":[],"linux":[{"name":"charset_converter","path":"/Users/bilonik/.pub-cache/hosted/pub.dev/charset_converter-2.2.0/","native_build":true,"dependencies":[]}],"windows":[{"name":"charset_converter","path":"/Users/bilonik/.pub-cache/hosted/pub.dev/charset_converter-2.2.0/","native_build":true,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"charset_converter","dependencies":[]}],"date_created":"2024-07-31 18:39:56.506203","version":"3.22.2"} \ No newline at end of file diff --git a/example/discover_printers/.metadata b/example/discover_printers/.metadata index 01d2dcb..a778330 100644 --- a/example/discover_printers/.metadata +++ b/example/discover_printers/.metadata @@ -4,7 +4,42 @@ # This file should be version controlled and should not be manually edited. version: - revision: 0b8abb4724aa590dd0f429683339b1e045a1594d - channel: stable + revision: "d211f42860350d914a5ad8102f9ec32764dc6d06" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + - platform: android + create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + - platform: ios + create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + - platform: linux + create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + - platform: macos + create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + - platform: web + create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + - platform: windows + create_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + base_revision: d211f42860350d914a5ad8102f9ec32764dc6d06 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/discover_printers/analysis_options.yaml b/example/discover_printers/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/example/discover_printers/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/example/discover_printers/android/.gitignore b/example/discover_printers/android/.gitignore index bc2100d..6f56801 100644 --- a/example/discover_printers/android/.gitignore +++ b/example/discover_printers/android/.gitignore @@ -5,3 +5,9 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/example/discover_printers/android/app/build.gradle b/example/discover_printers/android/app/build.gradle index 4959307..bc23ec8 100644 --- a/example/discover_printers/android/app/build.gradle +++ b/example/discover_printers/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,29 +22,33 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion 28 + namespace "com.example.discover_printers" + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion - sourceSets { - main.java.srcDirs += 'src/main/kotlin' + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' } - lintOptions { - disable 'InvalidPackage' + sourceSets { + main.java.srcDirs += 'src/main/kotlin' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.discover_printers" - minSdkVersion 16 - targetSdkVersion 28 + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -59,9 +64,4 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' -} +dependencies {} diff --git a/example/discover_printers/android/app/src/debug/AndroidManifest.xml b/example/discover_printers/android/app/src/debug/AndroidManifest.xml index 827be65..399f698 100644 --- a/example/discover_printers/android/app/src/debug/AndroidManifest.xml +++ b/example/discover_printers/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/example/discover_printers/android/app/src/main/AndroidManifest.xml b/example/discover_printers/android/app/src/main/AndroidManifest.xml index 2385bcb..1e2455e 100644 --- a/example/discover_printers/android/app/src/main/AndroidManifest.xml +++ b/example/discover_printers/android/app/src/main/AndroidManifest.xml @@ -1,21 +1,27 @@ - - + + + + + + diff --git a/example/discover_printers/android/app/src/main/kotlin/com/example/discover_printers/MainActivity.kt b/example/discover_printers/android/app/src/main/kotlin/com/example/discover_printers/MainActivity.kt index 7d187f3..20874d1 100644 --- a/example/discover_printers/android/app/src/main/kotlin/com/example/discover_printers/MainActivity.kt +++ b/example/discover_printers/android/app/src/main/kotlin/com/example/discover_printers/MainActivity.kt @@ -1,12 +1,6 @@ package com.example.discover_printers -import androidx.annotation.NonNull; import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugins.GeneratedPluginRegistrant class MainActivity: FlutterActivity() { - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } } diff --git a/example/discover_printers/android/app/src/main/res/drawable-v21/launch_background.xml b/example/discover_printers/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/example/discover_printers/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/discover_printers/android/app/src/main/res/values-night/styles.xml b/example/discover_printers/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/example/discover_printers/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/discover_printers/android/app/src/main/res/values/styles.xml b/example/discover_printers/android/app/src/main/res/values/styles.xml index 00fa441..cb1ef88 100644 --- a/example/discover_printers/android/app/src/main/res/values/styles.xml +++ b/example/discover_printers/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/example/discover_printers/android/app/src/profile/AndroidManifest.xml b/example/discover_printers/android/app/src/profile/AndroidManifest.xml index 827be65..399f698 100644 --- a/example/discover_printers/android/app/src/profile/AndroidManifest.xml +++ b/example/discover_printers/android/app/src/profile/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/example/discover_printers/android/build.gradle b/example/discover_printers/android/build.gradle index 3100ad2..f7eb7f6 100644 --- a/example/discover_printers/android/build.gradle +++ b/example/discover_printers/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.7.10' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -14,7 +14,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/discover_printers/android/gradle.properties b/example/discover_printers/android/gradle.properties index 38c8d45..94adc3a 100644 --- a/example/discover_printers/android/gradle.properties +++ b/example/discover_printers/android/gradle.properties @@ -1,4 +1,3 @@ org.gradle.jvmargs=-Xmx1536M -android.enableR8=true android.useAndroidX=true android.enableJetifier=true diff --git a/example/discover_printers/android/gradle/wrapper/gradle-wrapper.properties b/example/discover_printers/android/gradle/wrapper/gradle-wrapper.properties index 296b146..3c472b9 100644 --- a/example/discover_printers/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/discover_printers/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/example/discover_printers/android/settings.gradle b/example/discover_printers/android/settings.gradle index 5a2f14f..55c4ca8 100644 --- a/example/discover_printers/android/settings.gradle +++ b/example/discover_printers/android/settings.gradle @@ -1,15 +1,20 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + } + settings.ext.flutterSdkPath = flutterSdkPath() -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } + plugins { + id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false + } } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} +include ":app" + +apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/example/discover_printers/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/discover_printers/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/discover_printers/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/discover_printers/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/discover_printers/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/discover_printers/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/discover_printers/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/discover_printers/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/discover_printers/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/discover_printers/ios/RunnerTests/RunnerTests.swift b/example/discover_printers/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/example/discover_printers/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/example/discover_printers/lib/main.dart b/example/discover_printers/lib/main.dart index 9b39a48..aadd7ff 100644 --- a/example/discover_printers/lib/main.dart +++ b/example/discover_printers/lib/main.dart @@ -1,15 +1,11 @@ -import 'dart:io'; -import 'dart:typed_data'; -import 'package:intl/intl.dart'; -import 'package:qr_flutter/qr_flutter.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:flutter/material.dart' hide Image; import 'package:esc_pos_printer/esc_pos_printer.dart'; +import 'package:flutter/material.dart' hide Image; import 'package:flutter/services.dart'; -import 'package:ping_discover_network/ping_discover_network.dart'; -import 'package:esc_pos_utils/esc_pos_utils.dart'; +import 'package:flutter_esc_pos_utils/flutter_esc_pos_utils.dart'; import 'package:image/image.dart'; -import 'package:wifi/wifi.dart'; +import 'package:intl/intl.dart'; +import 'package:network_info_plus/network_info_plus.dart'; +import 'package:ping_discover_network_forked/ping_discover_network_forked.dart'; void main() => runApp(MyApp()); @@ -47,12 +43,11 @@ class _MyHomePageState extends State { String ip; try { - ip = await Wifi.ip; + ip = await NetworkInfo().getWifiIP() ?? ""; print('local ip:\t$ip'); } catch (e) { - final snackBar = SnackBar( - content: Text('WiFi is not connected', textAlign: TextAlign.center)); - Scaffold.of(ctx).showSnackBar(snackBar); + final snackBar = SnackBar(content: Text('WiFi is not connected', textAlign: TextAlign.center)); + ScaffoldMessenger.of(ctx).showSnackBar(snackBar); return; } setState(() { @@ -86,28 +81,22 @@ class _MyHomePageState extends State { }); }) ..onError((dynamic e) { - final snackBar = SnackBar( - content: Text('Unexpected exception', textAlign: TextAlign.center)); - Scaffold.of(ctx).showSnackBar(snackBar); + final snackBar = SnackBar(content: Text('Unexpected exception', textAlign: TextAlign.center)); + ScaffoldMessenger.of(ctx).showSnackBar(snackBar); }); } Future testReceipt(NetworkPrinter printer) async { - printer.text( - 'Regular: aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ'); - printer.text('Special 1: àÀ èÈ éÉ ûÛ üÜ çÇ ôÔ', - styles: PosStyles(codeTable: 'CP1252')); - printer.text('Special 2: blåbærgrød', - styles: PosStyles(codeTable: 'CP1252')); + printer.text('Regular: aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ'); + printer.text('Special 1: àÀ èÈ éÉ ûÛ üÜ çÇ ôÔ', styles: PosStyles(codeTable: 'CP1252')); + printer.text('Special 2: blåbærgrød', styles: PosStyles(codeTable: 'CP1252')); printer.text('Bold text', styles: PosStyles(bold: true)); printer.text('Reverse text', styles: PosStyles(reverse: true)); - printer.text('Underlined text', - styles: PosStyles(underline: true), linesAfter: 1); + printer.text('Underlined text', styles: PosStyles(underline: true), linesAfter: 1); printer.text('Align left', styles: PosStyles(align: PosAlign.left)); printer.text('Align center', styles: PosStyles(align: PosAlign.center)); - printer.text('Align right', - styles: PosStyles(align: PosAlign.right), linesAfter: 1); + printer.text('Align right', styles: PosStyles(align: PosAlign.right), linesAfter: 1); printer.row([ PosColumn( @@ -136,8 +125,8 @@ class _MyHomePageState extends State { // Print image final ByteData data = await rootBundle.load('assets/logo.png'); final Uint8List bytes = data.buffer.asUint8List(); - final Image image = decodeImage(bytes); - printer.image(image); + final Image? image = decodeImage(bytes); + printer.image(image!); // Print image using alternative commands // printer.imageRaster(image); // printer.imageRaster(image, imageFn: PosImageFn.graphics); @@ -161,8 +150,8 @@ class _MyHomePageState extends State { // Print image final ByteData data = await rootBundle.load('assets/rabbit_black.jpg'); final Uint8List bytes = data.buffer.asUint8List(); - final Image image = decodeImage(bytes); - printer.image(image); + final Image? image = decodeImage(bytes); + printer.image(image!); printer.text('GROCERYLY', styles: PosStyles( @@ -173,54 +162,41 @@ class _MyHomePageState extends State { linesAfter: 1); printer.text('889 Watson Lane', styles: PosStyles(align: PosAlign.center)); - printer.text('New Braunfels, TX', - styles: PosStyles(align: PosAlign.center)); - printer.text('Tel: 830-221-1234', - styles: PosStyles(align: PosAlign.center)); - printer.text('Web: www.example.com', - styles: PosStyles(align: PosAlign.center), linesAfter: 1); + printer.text('New Braunfels, TX', styles: PosStyles(align: PosAlign.center)); + printer.text('Tel: 830-221-1234', styles: PosStyles(align: PosAlign.center)); + printer.text('Web: www.example.com', styles: PosStyles(align: PosAlign.center), linesAfter: 1); printer.hr(); printer.row([ PosColumn(text: 'Qty', width: 1), PosColumn(text: 'Item', width: 7), - PosColumn( - text: 'Price', width: 2, styles: PosStyles(align: PosAlign.right)), - PosColumn( - text: 'Total', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: 'Price', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: 'Total', width: 2, styles: PosStyles(align: PosAlign.right)), ]); printer.row([ PosColumn(text: '2', width: 1), PosColumn(text: 'ONION RINGS', width: 7), - PosColumn( - text: '0.99', width: 2, styles: PosStyles(align: PosAlign.right)), - PosColumn( - text: '1.98', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: '0.99', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: '1.98', width: 2, styles: PosStyles(align: PosAlign.right)), ]); printer.row([ PosColumn(text: '1', width: 1), PosColumn(text: 'PIZZA', width: 7), - PosColumn( - text: '3.45', width: 2, styles: PosStyles(align: PosAlign.right)), - PosColumn( - text: '3.45', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: '3.45', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: '3.45', width: 2, styles: PosStyles(align: PosAlign.right)), ]); printer.row([ PosColumn(text: '1', width: 1), PosColumn(text: 'SPRING ROLLS', width: 7), - PosColumn( - text: '2.99', width: 2, styles: PosStyles(align: PosAlign.right)), - PosColumn( - text: '2.99', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: '2.99', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: '2.99', width: 2, styles: PosStyles(align: PosAlign.right)), ]); printer.row([ PosColumn(text: '3', width: 1), PosColumn(text: 'CRUNCHY STICKS', width: 7), - PosColumn( - text: '0.85', width: 2, styles: PosStyles(align: PosAlign.right)), - PosColumn( - text: '2.55', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: '0.85', width: 2, styles: PosStyles(align: PosAlign.right)), + PosColumn(text: '2.55', width: 2, styles: PosStyles(align: PosAlign.right)), ]); printer.hr(); @@ -245,35 +221,21 @@ class _MyHomePageState extends State { printer.hr(ch: '=', linesAfter: 1); printer.row([ - PosColumn( - text: 'Cash', - width: 8, - styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), - PosColumn( - text: '\$15.00', - width: 4, - styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), + PosColumn(text: 'Cash', width: 8, styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), + PosColumn(text: '\$15.00', width: 4, styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), ]); printer.row([ - PosColumn( - text: 'Change', - width: 8, - styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), - PosColumn( - text: '\$4.03', - width: 4, - styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), + PosColumn(text: 'Change', width: 8, styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), + PosColumn(text: '\$4.03', width: 4, styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), ]); printer.feed(2); - printer.text('Thank you!', - styles: PosStyles(align: PosAlign.center, bold: true)); + printer.text('Thank you!', styles: PosStyles(align: PosAlign.center, bold: true)); final now = DateTime.now(); final formatter = DateFormat('MM/dd/yyyy H:m'); final String timestamp = formatter.format(now); - printer.text(timestamp, - styles: PosStyles(align: PosAlign.center), linesAfter: 2); + printer.text(timestamp, styles: PosStyles(align: PosAlign.center), linesAfter: 2); // Print QR Code from image // try { @@ -318,9 +280,8 @@ class _MyHomePageState extends State { printer.disconnect(); } - final snackBar = - SnackBar(content: Text(res.msg, textAlign: TextAlign.center)); - Scaffold.of(ctx).showSnackBar(snackBar); + final snackBar = SnackBar(content: Text(res.msg, textAlign: TextAlign.center)); + ScaffoldMessenger.of(ctx).showSnackBar(snackBar); } @override @@ -347,15 +308,9 @@ class _MyHomePageState extends State { SizedBox(height: 10), Text('Local ip: $localIp', style: TextStyle(fontSize: 16)), SizedBox(height: 15), - RaisedButton( - child: Text( - '${isDiscovering ? 'Discovering...' : 'Discover'}'), - onPressed: isDiscovering ? null : () => discover(context)), + ElevatedButton(child: Text('${isDiscovering ? 'Discovering...' : 'Discover'}'), onPressed: isDiscovering ? null : () => discover(context)), SizedBox(height: 15), - found >= 0 - ? Text('Found: $found device(s)', - style: TextStyle(fontSize: 16)) - : Container(), + found >= 0 ? Text('Found: $found device(s)', style: TextStyle(fontSize: 16)) : Container(), Expanded( child: ListView.builder( itemCount: devices.length, @@ -374,10 +329,8 @@ class _MyHomePageState extends State { SizedBox(width: 10), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ Text( '${devices[index]}:${portController.text}', @@ -385,8 +338,7 @@ class _MyHomePageState extends State { ), Text( 'Click to print a test receipt', - style: TextStyle( - color: Colors.grey[700]), + style: TextStyle(color: Colors.grey[700]), ), ], ), diff --git a/example/discover_printers/pubspec.lock b/example/discover_printers/pubspec.lock index a3c59e2..02aadb1 100644 --- a/example/discover_printers/pubspec.lock +++ b/example/discover_printers/pubspec.lock @@ -5,278 +5,385 @@ packages: dependency: transitive description: name: archive - url: "https://pub.dartlang.org" + sha256: "7e0d52067d05f2e0324268097ba723b71cb41ac8a6a2b24d1edf9c536b987b03" + url: "https://pub.dev" source: hosted - version: "2.0.13" + version: "3.4.6" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" source: hosted - version: "1.6.0" + version: "2.4.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.0" charset_converter: dependency: "direct main" description: name: charset_converter - url: "https://pub.dartlang.org" + sha256: e4827b2d623ab75c2b6767d69e03485ea5bc894db6f6bdcb2ffeda58446bbe26 + url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "2.1.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.18.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "3.1.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "3.0.3" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" source: hosted - version: "0.16.2" + version: "1.0.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + url: "https://pub.dev" + source: hosted + version: "1.0.6" + dbus: + dependency: transitive + description: + name: dbus + sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263" + url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.7.8" esc_pos_printer: dependency: "direct main" description: path: "../.." relative: true source: path - version: "4.0.3" - esc_pos_utils: - dependency: "direct main" - description: - name: esc_pos_utils - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" + version: "4.1.1" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" ffi: dependency: transitive description: name: ffi - url: "https://pub.dartlang.org" + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" source: hosted - version: "1.1.2" - file: - dependency: transitive - description: - name: file - url: "https://pub.dartlang.org" - source: hosted - version: "6.1.2" + version: "2.1.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_esc_pos_utils: + dependency: "direct main" + description: + path: "." + ref: main + resolved-ref: aa2d7e01d09e94e994649d2c70d55f604c97cba6 + url: "https://github.com/Bilonik/flutter_esc_pos_utils" + source: git + version: "1.0.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" gbk_codec: dependency: transitive description: name: gbk_codec - url: "https://pub.dartlang.org" + sha256: "3af5311fc9393115e3650ae6023862adf998051a804a08fb804f042724999f61" + url: "https://pub.dev" source: hosted - version: "0.3.2" + version: "0.4.0" hex: dependency: transitive description: name: hex - url: "https://pub.dartlang.org" + sha256: "4e7cd54e4b59ba026432a6be2dd9d96e4c5205725194997193bf871703b82c4a" + url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "0.2.0" html: dependency: transitive description: name: html - url: "https://pub.dartlang.org" + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" source: hosted - version: "0.14.0+4" + version: "0.15.4" image: dependency: "direct main" description: name: image - url: "https://pub.dartlang.org" + sha256: "028f61960d56f26414eb616b48b04eb37d700cbe477b7fb09bf1d7ce57fd9271" + url: "https://pub.dev" source: hosted - version: "2.1.19" + version: "4.1.3" intl: dependency: "direct main" description: name: intl - url: "https://pub.dartlang.org" + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + url: "https://pub.dev" + source: hosted + version: "0.18.1" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" source: hosted - version: "0.16.1" + version: "0.6.7" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.12.0" + network_info_plus: + dependency: "direct main" + description: + name: network_info_plus + sha256: "2d9e88b9a459e5d4e224f828d26cc38ea140511e89b943116939994324be5c96" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + network_info_plus_platform_interface: + dependency: transitive + description: + name: network_info_plus_platform_interface + sha256: "881f5029c5edaf19c616c201d3d8b366c5b1384afd5c1da5a49e4345de82fb8b" + url: "https://pub.dev" + source: hosted + version: "1.1.3" + nm: + dependency: transitive + description: + name: nm + sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" + url: "https://pub.dev" + source: hosted + version: "0.5.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.0" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.dartlang.org" + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + url: "https://pub.dev" source: hosted - version: "1.6.28" - path_provider_linux: + version: "2.1.1" + path_provider_android: dependency: transitive description: - name: path_provider_linux - url: "https://pub.dartlang.org" + name: path_provider_android + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 + url: "https://pub.dev" source: hosted - version: "0.0.1+2" - path_provider_macos: + version: "2.2.1" + path_provider_foundation: + dependency: "direct main" + description: + name: path_provider_foundation + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_linux: dependency: transitive description: - name: path_provider_macos - url: "https://pub.dartlang.org" + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" source: hosted - version: "0.0.4+8" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.dartlang.org" + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "2.1.1" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.dartlang.org" + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" source: hosted - version: "0.0.5" + version: "2.2.1" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + url: "https://pub.dev" source: hosted - version: "3.1.0" - ping_discover_network: + version: "5.4.0" + ping_discover_network_forked: dependency: "direct main" description: - name: ping_discover_network - url: "https://pub.dartlang.org" + name: ping_discover_network_forked + sha256: d3975c4f3fbaa388f78fb4037ad9c33059d8e2ec0e804ed45e05277d2451fe77 + url: "https://pub.dev" source: hosted - version: "0.2.0+1" + version: "0.0.1" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.1.3" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + url: "https://pub.dev" source: hosted - version: "1.0.3" - process: + version: "2.1.6" + pointycastle: dependency: transitive description: - name: process - url: "https://pub.dartlang.org" + name: pointycastle + sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" + url: "https://pub.dev" source: hosted - version: "4.2.3" + version: "3.7.3" qr: dependency: transitive description: name: qr - url: "https://pub.dartlang.org" + sha256: "64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "3.0.1" qr_flutter: dependency: "direct main" description: name: qr_flutter - url: "https://pub.dartlang.org" + sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097" + url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "4.1.0" sky_engine: dependency: transitive description: flutter @@ -286,86 +393,98 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" source: hosted - version: "0.4.3" + version: "0.7.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.0" - wifi: - dependency: "direct main" + version: "2.1.4" + vm_service: + dependency: transitive description: - name: wifi - url: "https://pub.dartlang.org" + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "14.2.1" win32: dependency: transitive description: name: win32 - url: "https://pub.dartlang.org" + sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3" + url: "https://pub.dev" source: hosted - version: "2.2.9" + version: "5.0.9" xdg_directories: dependency: transitive description: name: xdg_directories - url: "https://pub.dartlang.org" + sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "1.0.3" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + url: "https://pub.dev" source: hosted - version: "4.5.1" + version: "6.3.0" sdks: - dart: ">=2.13.0 <3.0.0" - flutter: ">=1.20.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/example/discover_printers/pubspec.yaml b/example/discover_printers/pubspec.yaml index 4646432..99cb2c5 100644 --- a/example/discover_printers/pubspec.yaml +++ b/example/discover_printers/pubspec.yaml @@ -7,21 +7,27 @@ environment: sdk: ">=2.12.0 <3.0.0" dependencies: - charset_converter: ^1.0.3 - cupertino_icons: ^0.1.2 - esc_pos_printer: - path: ../../ - esc_pos_utils: ^1.0.0 flutter: sdk: flutter - image: ^2.1.4 - intl: ^0.16.1 - path_provider: ^1.6.5 - ping_discover_network: ^0.2.0+1 - qr_flutter: ^3.2.0 - wifi: ^0.1.5 + charset_converter: ^2.1.1 + cupertino_icons: ^1.0.6 + esc_pos_printer: + path: ../../ + flutter_esc_pos_utils: + git: + url: https://github.com/Bilonik/flutter_esc_pos_utils + ref: main + image: ^4.1.3 + intl: ^0.18.1 + path_provider: ^2.1.1 + path_provider_foundation: ^2.3.1 + qr_flutter: ^4.1.0 + ping_discover_network_forked: ^0.0.1 + network_info_plus: ^4.1.0 # esc_pos_utils: # path: ../../../esc_pos_utils +dependency_overrides: + image: ^4.1.3 dev_dependencies: flutter_test: diff --git a/lib/src/network_printer.dart b/lib/src/network_printer.dart index abec81f..75d7158 100644 --- a/lib/src/network_printer.dart +++ b/lib/src/network_printer.dart @@ -8,15 +8,16 @@ import 'dart:io'; import 'dart:typed_data' show Uint8List; -import 'package:esc_pos_utils/esc_pos_utils.dart'; + +import 'package:flutter_esc_pos_utils/flutter_esc_pos_utils.dart'; import 'package:image/image.dart'; + import './enums.dart'; /// Network Printer class NetworkPrinter { NetworkPrinter(this._paperSize, this._profile, {int spaceBetweenRows = 5}) { - _generator = - Generator(paperSize, profile, spaceBetweenRows: spaceBetweenRows); + _generator = Generator(paperSize, profile, spaceBetweenRows: spaceBetweenRows); } final PaperSize _paperSize; @@ -31,8 +32,7 @@ class NetworkPrinter { PaperSize get paperSize => _paperSize; CapabilityProfile get profile => _profile; - Future connect(String host, - {int port = 91000, Duration timeout = const Duration(seconds: 5)}) async { + Future connect(String host, {int port = 91000, Duration timeout = const Duration(seconds: 5)}) async { _host = host; _port = port; try { @@ -64,11 +64,7 @@ class NetworkPrinter { bool containsChinese = false, int? maxCharsPerLine, }) { - _socket.add(_generator.text(text, - styles: styles, - linesAfter: linesAfter, - containsChinese: containsChinese, - maxCharsPerLine: maxCharsPerLine)); + _socket.add(_generator.text(text, styles: styles, linesAfter: linesAfter, containsChinese: containsChinese, maxCharsPerLine: maxCharsPerLine)); } void setGlobalCodeTable(String codeTable) { @@ -76,8 +72,7 @@ class NetworkPrinter { } void setGlobalFont(PosFontType font, {int? maxCharsPerLine}) { - _socket - .add(_generator.setGlobalFont(font, maxCharsPerLine: maxCharsPerLine)); + _socket.add(_generator.setGlobalFont(font, maxCharsPerLine: maxCharsPerLine)); } void setStyles(PosStyles styles, {bool isKanji = false}) { @@ -157,7 +152,7 @@ class NetworkPrinter { void qrcode( String text, { PosAlign align = PosAlign.center, - QRSize size = QRSize.Size4, + QRSize size = QRSize.size4, QRCorrection cor = QRCorrection.L, }) { _socket.add(_generator.qrcode(text, align: align, size: size, cor: cor)); diff --git a/pubspec.lock b/pubspec.lock index aaeaca1..4cb47db 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,91 +5,96 @@ packages: dependency: transitive description: name: archive - url: "https://pub.dartlang.org" + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.6.1" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.3.0" charset_converter: dependency: "direct main" description: name: charset_converter - url: "https://pub.dartlang.org" + sha256: eebf818b83552a84fc9f0d2ee7bdd151b36d10548be1c8205bb65295107c5c89 + url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "2.2.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.18.0" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.3" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.17.0" - esc_pos_utils: - dependency: "direct main" - description: - name: esc_pos_utils - url: "https://pub.dartlang.org" + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.0.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_esc_pos_utils: + dependency: "direct main" + description: + path: "." + ref: main + resolved-ref: aa2d7e01d09e94e994649d2c70d55f604c97cba6 + url: "https://github.com/Bilonik/flutter_esc_pos_utils" + source: git + version: "1.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -99,58 +104,98 @@ packages: dependency: transitive description: name: gbk_codec - url: "https://pub.dartlang.org" + sha256: "3af5311fc9393115e3650ae6023862adf998051a804a08fb804f042724999f61" + url: "https://pub.dev" source: hosted version: "0.4.0" hex: dependency: transitive description: name: hex - url: "https://pub.dartlang.org" + sha256: "4e7cd54e4b59ba026432a6be2dd9d96e4c5205725194997193bf871703b82c4a" + url: "https://pub.dev" source: hosted version: "0.2.0" html: dependency: transitive description: name: html - url: "https://pub.dartlang.org" + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" source: hosted - version: "0.15.0" + version: "0.15.4" image: dependency: "direct main" description: name: image - url: "https://pub.dartlang.org" + sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8" + url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "4.2.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.8.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.12.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.0" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" source: hosted - version: "4.3.0" + version: "6.0.2" sky_engine: dependency: transitive description: flutter @@ -160,65 +205,82 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" source: hosted - version: "0.4.3" + version: "0.7.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "14.2.1" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" source: hosted - version: "5.3.0" + version: "6.5.0" sdks: - dart: ">=2.14.0 <3.0.0" - flutter: ">=1.10.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index e637a09..ce71ce7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,19 +1,24 @@ name: esc_pos_printer description: The library allows to print receipts using an ESC/POS thermal WiFi printer. -version: 4.1.0 +version: 4.1.1 homepage: https://github.com/andrey-ushakov/esc_pos_printer environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: charset_converter: ^2.0.0 - esc_pos_utils: ^1.1.0 + flutter_esc_pos_utils: + git: + url: https://github.com/Bilonik/flutter_esc_pos_utils + ref: main flutter: sdk: flutter # esc_pos_utils: # path: ../esc_pos_utils - image: ^3.0.2 + image: ^4.1.3 +dependency_overrides: + image: ^4.1.3 dev_dependencies: flutter_test: