diff --git a/example/blue/android/.gitignore b/example/blue/android/.gitignore deleted file mode 100644 index bc2100d..0000000 --- a/example/blue/android/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -gradle-wrapper.jar -/.gradle -/captures/ -/gradlew -/gradlew.bat -/local.properties -GeneratedPluginRegistrant.java diff --git a/example/blue/android/app/src/main/AndroidManifest.xml b/example/blue/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index ebf0490..0000000 --- a/example/blue/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - diff --git a/example/blue/android/app/src/main/kotlin/com/example/blue/MainActivity.kt b/example/blue/android/app/src/main/kotlin/com/example/blue/MainActivity.kt deleted file mode 100644 index a32b948..0000000 --- a/example/blue/android/app/src/main/kotlin/com/example/blue/MainActivity.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.example.blue - -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/blue/android/app/src/main/res/values/styles.xml b/example/blue/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 00fa441..0000000 --- a/example/blue/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/example/blue/android/settings.gradle b/example/blue/android/settings.gradle deleted file mode 100644 index 5a2f14f..0000000 --- a/example/blue/android/settings.gradle +++ /dev/null @@ -1,15 +0,0 @@ -include ':app' - -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() - -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} - -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} diff --git a/example/blue/ios/Flutter/Debug.xcconfig b/example/blue/ios/Flutter/Debug.xcconfig deleted file mode 100644 index e8efba1..0000000 --- a/example/blue/ios/Flutter/Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Generated.xcconfig" diff --git a/example/blue/ios/Flutter/Release.xcconfig b/example/blue/ios/Flutter/Release.xcconfig deleted file mode 100644 index 399e934..0000000 --- a/example/blue/ios/Flutter/Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "Generated.xcconfig" diff --git a/example/blue/ios/Podfile b/example/blue/ios/Podfile deleted file mode 100644 index 3aee41e..0000000 --- a/example/blue/ios/Podfile +++ /dev/null @@ -1,91 +0,0 @@ -# Uncomment this line to define a global platform for your project -# platform :ios, '9.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; - end - generated_key_values = {} - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) do |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - generated_key_values[podname] = podpath - else - puts "Invalid plugin specification: #{line}" - end - end - generated_key_values -end - -target 'Runner' do - use_frameworks! - use_modular_headers! - - # Flutter Pod - - copied_flutter_dir = File.join(__dir__, 'Flutter') - copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') - copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') - unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) - # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. - # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. - # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. - - generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') - unless File.exist?(generated_xcode_build_settings_path) - raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) - cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; - - unless File.exist?(copied_framework_path) - FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) - end - unless File.exist?(copied_podspec_path) - FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) - end - end - - # Keep pod path relative so it can be checked into Podfile.lock. - pod 'Flutter', :path => 'Flutter' - - # Plugin Pods - - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.each do |name, path| - symlink = File.join('.symlinks', 'plugins', name) - File.symlink(path, symlink) - pod name, :path => File.join(symlink, 'ios') - end -end - -# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. -install! 'cocoapods', :disable_input_output_paths => true - -post_install do |installer| - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - config.build_settings['SWIFT_VERSION'] = '4.2' # <--- add this - end - end -end diff --git a/example/blue/ios/Podfile.lock b/example/blue/ios/Podfile.lock deleted file mode 100644 index 3b21092..0000000 --- a/example/blue/ios/Podfile.lock +++ /dev/null @@ -1,40 +0,0 @@ -PODS: - - charset_converter (0.0.1): - - Flutter - - Flutter (1.0.0) - - flutter_bluetooth_basic (0.0.1): - - Flutter - - path_provider (0.0.1): - - Flutter - - path_provider_macos (0.0.1): - - Flutter - -DEPENDENCIES: - - charset_converter (from `.symlinks/plugins/charset_converter/ios`) - - Flutter (from `Flutter`) - - flutter_bluetooth_basic (from `.symlinks/plugins/flutter_bluetooth_basic/ios`) - - path_provider (from `.symlinks/plugins/path_provider/ios`) - - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) - -EXTERNAL SOURCES: - charset_converter: - :path: ".symlinks/plugins/charset_converter/ios" - Flutter: - :path: Flutter - flutter_bluetooth_basic: - :path: ".symlinks/plugins/flutter_bluetooth_basic/ios" - path_provider: - :path: ".symlinks/plugins/path_provider/ios" - path_provider_macos: - :path: ".symlinks/plugins/path_provider_macos/ios" - -SPEC CHECKSUMS: - charset_converter: 215c7b04932ec2b9ba43be96a9bc34afed3e5322 - Flutter: 0e3d915762c693b495b44d77113d4970485de6ec - flutter_bluetooth_basic: 0e4e27e22b50b3a25cc1d1e131953feb4af414f4 - path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d - path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 - -PODFILE CHECKSUM: ae34db30f861e93537b77c454f870f0f18e8deef - -COCOAPODS: 1.8.4 diff --git a/example/blue/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/blue/ios/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 21a3cc1..0000000 --- a/example/blue/ios/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/example/blue/ios/Runner/AppDelegate.h b/example/blue/ios/Runner/AppDelegate.h deleted file mode 100644 index 36e21bb..0000000 --- a/example/blue/ios/Runner/AppDelegate.h +++ /dev/null @@ -1,6 +0,0 @@ -#import -#import - -@interface AppDelegate : FlutterAppDelegate - -@end diff --git a/example/blue/ios/Runner/AppDelegate.m b/example/blue/ios/Runner/AppDelegate.m deleted file mode 100644 index 70e8393..0000000 --- a/example/blue/ios/Runner/AppDelegate.m +++ /dev/null @@ -1,13 +0,0 @@ -#import "AppDelegate.h" -#import "GeneratedPluginRegistrant.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [GeneratedPluginRegistrant registerWithRegistry:self]; - // Override point for customization after application launch. - return [super application:application didFinishLaunchingWithOptions:launchOptions]; -} - -@end diff --git a/example/blue/ios/Runner/main.m b/example/blue/ios/Runner/main.m deleted file mode 100644 index dff6597..0000000 --- a/example/blue/ios/Runner/main.m +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import -#import "AppDelegate.h" - -int main(int argc, char* argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/example/blue/lib/main.dart b/example/blue/lib/main.dart deleted file mode 100644 index f9d2786..0000000 --- a/example/blue/lib/main.dart +++ /dev/null @@ -1,360 +0,0 @@ -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/services.dart'; -import 'package:image/image.dart'; -import 'package:esc_pos_utils/esc_pos_utils.dart'; -import 'package:esc_pos_bluetooth/esc_pos_bluetooth.dart'; -import 'package:flutter/material.dart' hide Image; -import 'package:oktoast/oktoast.dart'; - -void main() => runApp(MyApp()); - -class MyApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return OKToast( - child: MaterialApp( - title: 'Bluetooth demo', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - home: MyHomePage(title: 'Bluetooth demo'), - ), - ); - } -} - -class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); - final String title; - - @override - _MyHomePageState createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - PrinterBluetoothManager printerManager = PrinterBluetoothManager(); - List _devices = []; - - @override - void initState() { - super.initState(); - - printerManager.scanResults.listen((devices) async { - // print('UI: Devices found ${devices.length}'); - setState(() { - _devices = devices; - }); - }); - } - - void _startScanDevices() { - setState(() { - _devices = []; - }); - printerManager.startScan(Duration(seconds: 4)); - } - - void _stopScanDevices() { - printerManager.stopScan(); - } - - Future demoReceipt(PaperSize paper) async { - final Ticket ticket = Ticket(paper); - - // Print image - final ByteData data = await rootBundle.load('assets/rabbit_black.jpg'); - final Uint8List bytes = data.buffer.asUint8List(); - final Image image = decodeImage(bytes); - // ticket.image(image); - - ticket.text('GROCERYLY', - styles: PosStyles( - align: PosAlign.center, - height: PosTextSize.size2, - width: PosTextSize.size2, - ), - linesAfter: 1); - - ticket.text('889 Watson Lane', styles: PosStyles(align: PosAlign.center)); - ticket.text('New Braunfels, TX', styles: PosStyles(align: PosAlign.center)); - ticket.text('Tel: 830-221-1234', styles: PosStyles(align: PosAlign.center)); - ticket.text('Web: www.example.com', - styles: PosStyles(align: PosAlign.center), linesAfter: 1); - - ticket.hr(); - ticket.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)), - ]); - - ticket.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)), - ]); - ticket.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)), - ]); - ticket.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)), - ]); - ticket.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)), - ]); - ticket.hr(); - - ticket.row([ - PosColumn( - text: 'TOTAL', - width: 6, - styles: PosStyles( - height: PosTextSize.size2, - width: PosTextSize.size2, - )), - PosColumn( - text: '\$10.97', - width: 6, - styles: PosStyles( - align: PosAlign.right, - height: PosTextSize.size2, - width: PosTextSize.size2, - )), - ]); - - ticket.hr(ch: '=', linesAfter: 1); - - ticket.row([ - PosColumn( - text: 'Cash', - width: 7, - styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), - PosColumn( - text: '\$15.00', - width: 5, - styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), - ]); - ticket.row([ - PosColumn( - text: 'Change', - width: 7, - styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), - PosColumn( - text: '\$4.03', - width: 5, - styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), - ]); - - ticket.feed(2); - ticket.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); - ticket.text(timestamp, - styles: PosStyles(align: PosAlign.center), linesAfter: 2); - - // Print QR Code from image - // try { - // const String qrData = 'example.com'; - // const double qrSize = 200; - // final uiImg = await QrPainter( - // data: qrData, - // version: QrVersions.auto, - // gapless: false, - // ).toImageData(qrSize); - // final dir = await getTemporaryDirectory(); - // final pathName = '${dir.path}/qr_tmp.png'; - // final qrFile = File(pathName); - // final imgFile = await qrFile.writeAsBytes(uiImg.buffer.asUint8List()); - // final img = decodeImage(imgFile.readAsBytesSync()); - - // ticket.image(img); - // } catch (e) { - // print(e); - // } - - // Print QR Code using native function - // ticket.qrcode('example.com'); - - ticket.feed(2); - ticket.cut(); - return ticket; - } - - Future testTicket(PaperSize paper) async { - final Ticket ticket = Ticket(paper); - - ticket.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'); - ticket.text('Special 1: àÀ èÈ éÉ ûÛ üÜ çÇ ôÔ', - styles: PosStyles(codeTable: PosCodeTable.westEur)); - ticket.text('Special 2: blåbærgrød', - styles: PosStyles(codeTable: PosCodeTable.westEur)); - - ticket.text('Bold text', styles: PosStyles(bold: true)); - ticket.text('Reverse text', styles: PosStyles(reverse: true)); - ticket.text('Underlined text', - styles: PosStyles(underline: true), linesAfter: 1); - ticket.text('Align left', styles: PosStyles(align: PosAlign.left)); - ticket.text('Align center', styles: PosStyles(align: PosAlign.center)); - ticket.text('Align right', - styles: PosStyles(align: PosAlign.right), linesAfter: 1); - - ticket.row([ - PosColumn( - text: 'col3', - width: 3, - styles: PosStyles(align: PosAlign.center, underline: true), - ), - PosColumn( - text: 'col6', - width: 6, - styles: PosStyles(align: PosAlign.center, underline: true), - ), - PosColumn( - text: 'col3', - width: 3, - styles: PosStyles(align: PosAlign.center, underline: true), - ), - ]); - - ticket.text('Text size 200%', - styles: PosStyles( - height: PosTextSize.size2, - width: PosTextSize.size2, - )); - - // Print image - final ByteData data = await rootBundle.load('assets/logo.png'); - final Uint8List bytes = data.buffer.asUint8List(); - final Image image = decodeImage(bytes); - ticket.image(image); - // Print image using alternative commands - // ticket.imageRaster(image); - // ticket.imageRaster(image, imageFn: PosImageFn.graphics); - - // Print barcode - final List barData = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 4]; - ticket.barcode(Barcode.upcA(barData)); - - // Print mixed (chinese + latin) text. Only for printers supporting Kanji mode - // ticket.text( - // 'hello ! 中文字 # world @ éphémère &', - // styles: PosStyles(codeTable: PosCodeTable.westEur), - // containsChinese: true, - // ); - - ticket.feed(2); - - ticket.cut(); - return ticket; - } - - void _testPrint(PrinterBluetooth printer) async { - printerManager.selectPrinter(printer); - - // TODO Don't forget to choose printer's paper - const PaperSize paper = PaperSize.mm80; - - // TEST PRINT - // final PosPrintResult res = - // await printerManager.printTicket(await testTicket(paper)); - - // DEMO RECEIPT - final PosPrintResult res = - await printerManager.printTicket(await demoReceipt(paper)); - - showToast(res.msg); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(widget.title), - ), - body: ListView.builder( - itemCount: _devices.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - onTap: () => _testPrint(_devices[index]), - child: Column( - children: [ - Container( - height: 60, - padding: EdgeInsets.only(left: 10), - alignment: Alignment.centerLeft, - child: Row( - children: [ - Icon(Icons.print), - SizedBox(width: 10), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(_devices[index].name ?? ''), - Text(_devices[index].address), - Text( - 'Click to print a test receipt', - style: TextStyle(color: Colors.grey[700]), - ), - ], - ), - ) - ], - ), - ), - Divider(), - ], - ), - ); - }), - floatingActionButton: StreamBuilder( - stream: printerManager.isScanningStream, - initialData: false, - builder: (c, snapshot) { - if (snapshot.data) { - return FloatingActionButton( - child: Icon(Icons.stop), - onPressed: _stopScanDevices, - backgroundColor: Colors.red, - ); - } else { - return FloatingActionButton( - child: Icon(Icons.search), - onPressed: _startScanDevices, - ); - } - }, - ), - ); - } -} diff --git a/example/blue/pubspec.yaml b/example/blue/pubspec.yaml deleted file mode 100644 index a55b96a..0000000 --- a/example/blue/pubspec.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: blue -description: A new Flutter project. -version: 1.0.0+1 - -environment: - sdk: ">=2.1.0 <3.0.0" - -dependencies: - flutter: - sdk: flutter - cupertino_icons: ^0.1.2 - oktoast: ^2.3.0 - image: ^2.1.4 - esc_pos_bluetooth: - path: ../../ - esc_pos_utils: ^0.3.6 - # esc_pos_utils: - # path: ../../../esc_pos_utils - charset_converter: ^1.0.3 - intl: ^0.16.1 - qr_flutter: ^3.2.0 - path_provider: ^1.6.5 - -dev_dependencies: - flutter_test: - sdk: flutter - -flutter: - uses-material-design: true - assets: - - assets/logo.png - - assets/logo216.png - - assets/logo222.png - - assets/rabbit_black.jpg diff --git a/example/blue/.gitignore b/example/print_bluetooth_termal/.gitignore similarity index 70% rename from example/blue/.gitignore rename to example/print_bluetooth_termal/.gitignore index ae1f183..0fa6b67 100644 --- a/example/blue/.gitignore +++ b/example/print_bluetooth_termal/.gitignore @@ -22,6 +22,7 @@ # Flutter/Dart/Pub related **/doc/api/ +**/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins .flutter-plugins-dependencies @@ -33,5 +34,13 @@ # Web related lib/generated_plugin_registrant.dart -# Exceptions to above rules. -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/example/blue/.metadata b/example/print_bluetooth_termal/.metadata similarity index 76% rename from example/blue/.metadata rename to example/print_bluetooth_termal/.metadata index 1b5cec0..99f9393 100644 --- a/example/blue/.metadata +++ b/example/print_bluetooth_termal/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: 27321ebbad34b0a3fafe99fac037102196d655ff - channel: stable + revision: d9044a8a61e4d7d0afbd4fe8bad6d40762c289dd + channel: master project_type: app diff --git a/example/blue/README.md b/example/print_bluetooth_termal/README.md similarity index 90% rename from example/blue/README.md rename to example/print_bluetooth_termal/README.md index 92925cb..9a735be 100644 --- a/example/blue/README.md +++ b/example/print_bluetooth_termal/README.md @@ -1,6 +1,6 @@ -# blue +# print_bluetooth_termal -A new Flutter project. +A new Flutter application. ## Getting Started diff --git a/example/print_bluetooth_termal/android/.gitignore b/example/print_bluetooth_termal/android/.gitignore new file mode 100644 index 0000000..0a741cb --- /dev/null +++ b/example/print_bluetooth_termal/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/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 diff --git a/example/blue/android/app/build.gradle b/example/print_bluetooth_termal/android/app/build.gradle similarity index 78% rename from example/blue/android/app/build.gradle rename to example/print_bluetooth_termal/android/app/build.gradle index 9be8e53..4a6c0de 100644 --- a/example/blue/android/app/build.gradle +++ b/example/print_bluetooth_termal/android/app/build.gradle @@ -26,24 +26,19 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 30 sourceSets { main.java.srcDirs += 'src/main/kotlin' } - lintOptions { - disable 'InvalidPackage' - } - defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.blue" - minSdkVersion 21 - targetSdkVersion 28 + applicationId "com.example.print_bluetooth_termal" + minSdkVersion 19 + targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -61,7 +56,4 @@ flutter { 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' } diff --git a/example/blue/android/app/src/profile/AndroidManifest.xml b/example/print_bluetooth_termal/android/app/src/debug/AndroidManifest.xml similarity index 85% rename from example/blue/android/app/src/profile/AndroidManifest.xml rename to example/print_bluetooth_termal/android/app/src/debug/AndroidManifest.xml index 0952c9a..e32b4eb 100644 --- a/example/blue/android/app/src/profile/AndroidManifest.xml +++ b/example/print_bluetooth_termal/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.print_bluetooth_termal"> diff --git a/example/print_bluetooth_termal/android/app/src/main/AndroidManifest.xml b/example/print_bluetooth_termal/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..b3ef4a4 --- /dev/null +++ b/example/print_bluetooth_termal/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + diff --git a/example/print_bluetooth_termal/android/app/src/main/kotlin/com/example/print_bluetooth_termal/MainActivity.kt b/example/print_bluetooth_termal/android/app/src/main/kotlin/com/example/print_bluetooth_termal/MainActivity.kt new file mode 100644 index 0000000..fbcd5a2 --- /dev/null +++ b/example/print_bluetooth_termal/android/app/src/main/kotlin/com/example/print_bluetooth_termal/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.print_bluetooth_termal + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/example/print_bluetooth_termal/android/app/src/main/res/drawable-v21/launch_background.xml b/example/print_bluetooth_termal/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/example/print_bluetooth_termal/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/blue/android/app/src/main/res/drawable/launch_background.xml b/example/print_bluetooth_termal/android/app/src/main/res/drawable/launch_background.xml similarity index 100% rename from example/blue/android/app/src/main/res/drawable/launch_background.xml rename to example/print_bluetooth_termal/android/app/src/main/res/drawable/launch_background.xml diff --git a/example/blue/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/print_bluetooth_termal/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from example/blue/android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to example/print_bluetooth_termal/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/example/blue/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/print_bluetooth_termal/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from example/blue/android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to example/print_bluetooth_termal/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/example/blue/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/print_bluetooth_termal/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from example/blue/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to example/print_bluetooth_termal/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/example/blue/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/print_bluetooth_termal/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from example/blue/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to example/print_bluetooth_termal/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/example/blue/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/print_bluetooth_termal/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from example/blue/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to example/print_bluetooth_termal/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/example/print_bluetooth_termal/android/app/src/main/res/values-night/styles.xml b/example/print_bluetooth_termal/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..449a9f9 --- /dev/null +++ b/example/print_bluetooth_termal/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/print_bluetooth_termal/android/app/src/main/res/values/styles.xml b/example/print_bluetooth_termal/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..d74aa35 --- /dev/null +++ b/example/print_bluetooth_termal/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/blue/android/app/src/debug/AndroidManifest.xml b/example/print_bluetooth_termal/android/app/src/profile/AndroidManifest.xml similarity index 85% rename from example/blue/android/app/src/debug/AndroidManifest.xml rename to example/print_bluetooth_termal/android/app/src/profile/AndroidManifest.xml index 0952c9a..e32b4eb 100644 --- a/example/blue/android/app/src/debug/AndroidManifest.xml +++ b/example/print_bluetooth_termal/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.print_bluetooth_termal"> diff --git a/example/blue/android/build.gradle b/example/print_bluetooth_termal/android/build.gradle similarity index 90% rename from example/blue/android/build.gradle rename to example/print_bluetooth_termal/android/build.gradle index 3100ad2..c505a86 100644 --- a/example/blue/android/build.gradle +++ b/example/print_bluetooth_termal/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:4.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/blue/android/gradle.properties b/example/print_bluetooth_termal/android/gradle.properties similarity index 100% rename from example/blue/android/gradle.properties rename to example/print_bluetooth_termal/android/gradle.properties index 38c8d45..a673820 100644 --- a/example/blue/android/gradle.properties +++ b/example/print_bluetooth_termal/android/gradle.properties @@ -1,4 +1,4 @@ org.gradle.jvmargs=-Xmx1536M -android.enableR8=true android.useAndroidX=true android.enableJetifier=true +android.enableR8=true diff --git a/example/blue/android/gradle/wrapper/gradle-wrapper.properties b/example/print_bluetooth_termal/android/gradle/wrapper/gradle-wrapper.properties similarity index 93% rename from example/blue/android/gradle/wrapper/gradle-wrapper.properties rename to example/print_bluetooth_termal/android/gradle/wrapper/gradle-wrapper.properties index 296b146..bc6a58a 100644 --- a/example/blue/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/print_bluetooth_termal/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ 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-6.7-all.zip diff --git a/example/print_bluetooth_termal/android/settings.gradle b/example/print_bluetooth_termal/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/example/print_bluetooth_termal/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/example/blue/assets/logo.png b/example/print_bluetooth_termal/assets/logo.png similarity index 100% rename from example/blue/assets/logo.png rename to example/print_bluetooth_termal/assets/logo.png diff --git a/example/blue/assets/logo216.png b/example/print_bluetooth_termal/assets/logo216.png similarity index 100% rename from example/blue/assets/logo216.png rename to example/print_bluetooth_termal/assets/logo216.png diff --git a/example/blue/assets/logo222.png b/example/print_bluetooth_termal/assets/logo222.png similarity index 100% rename from example/blue/assets/logo222.png rename to example/print_bluetooth_termal/assets/logo222.png diff --git a/example/blue/assets/rabbit_black.jpg b/example/print_bluetooth_termal/assets/rabbit_black.jpg similarity index 100% rename from example/blue/assets/rabbit_black.jpg rename to example/print_bluetooth_termal/assets/rabbit_black.jpg diff --git a/example/blue/ios/.gitignore b/example/print_bluetooth_termal/ios/.gitignore similarity index 100% rename from example/blue/ios/.gitignore rename to example/print_bluetooth_termal/ios/.gitignore diff --git a/example/blue/ios/Flutter/AppFrameworkInfo.plist b/example/print_bluetooth_termal/ios/Flutter/AppFrameworkInfo.plist similarity index 94% rename from example/blue/ios/Flutter/AppFrameworkInfo.plist rename to example/print_bluetooth_termal/ios/Flutter/AppFrameworkInfo.plist index 6b4c0f7..9367d48 100644 --- a/example/blue/ios/Flutter/AppFrameworkInfo.plist +++ b/example/print_bluetooth_termal/ios/Flutter/AppFrameworkInfo.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable App CFBundleIdentifier diff --git a/example/print_bluetooth_termal/ios/Flutter/Debug.xcconfig b/example/print_bluetooth_termal/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/example/print_bluetooth_termal/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/example/print_bluetooth_termal/ios/Flutter/Release.xcconfig b/example/print_bluetooth_termal/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/example/print_bluetooth_termal/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/example/blue/ios/Runner.xcodeproj/project.pbxproj b/example/print_bluetooth_termal/ios/Runner.xcodeproj/project.pbxproj similarity index 73% rename from example/blue/ios/Runner.xcodeproj/project.pbxproj rename to example/print_bluetooth_termal/ios/Runner.xcodeproj/project.pbxproj index 6063b8c..068e856 100644 --- a/example/blue/ios/Runner.xcodeproj/project.pbxproj +++ b/example/print_bluetooth_termal/ios/Runner.xcodeproj/project.pbxproj @@ -9,12 +9,10 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; - 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - 9BF580C952D09CCF033A2F91 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28A617744456BDAEBB0A61C4 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -33,22 +31,17 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 28A617744456BDAEBB0A61C4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 31A8528493424BB47F417B49 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 4DBC88598EB83611427B342E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E1B87060C53FEC09BE1B0C7C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -56,23 +49,12 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9BF580C952D09CCF033A2F91 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 877A50BEF1C0FB284671560C /* Pods */ = { - isa = PBXGroup; - children = ( - 31A8528493424BB47F417B49 /* Pods-Runner.debug.xcconfig */, - 4DBC88598EB83611427B342E /* Pods-Runner.release.xcconfig */, - E1B87060C53FEC09BE1B0C7C /* Pods-Runner.profile.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -90,8 +72,6 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - 877A50BEF1C0FB284671560C /* Pods */, - A12430A4DEE0E50A7AF77B73 /* Frameworks */, ); sourceTree = ""; }; @@ -106,35 +86,18 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, ); path = Runner; sourceTree = ""; }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 97C146F21CF9000F007C117D /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - A12430A4DEE0E50A7AF77B73 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 28A617744456BDAEBB0A61C4 /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -142,14 +105,12 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 10D669D5285F24E58D74D4E8 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - DE9090B956159A2A305EA0E1 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -167,16 +128,16 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - ORGANIZATIONNAME = "The Chromium Authors"; + ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 8YA3WTV6AF; + LastSwiftMigration = 1100; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -208,28 +169,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 10D669D5285F24E58D74D4E8 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -258,21 +197,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - DE9090B956159A2A305EA0E1 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -280,8 +204,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, - 97C146F31CF9000F007C117D /* main.m in Sources */, + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -310,7 +233,6 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -350,7 +272,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -364,28 +286,21 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8YA3WTV6AF; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.flutterdev.blue; + PRODUCT_BUNDLE_IDENTIFIER = com.example.printBluetoothTermal; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -431,7 +346,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -441,7 +356,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -481,10 +395,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -495,21 +410,16 @@ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8YA3WTV6AF; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.flutterdev.blue; + PRODUCT_BUNDLE_IDENTIFIER = com.example.printBluetoothTermal; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -519,21 +429,15 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8YA3WTV6AF; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.flutterdev.blue; + PRODUCT_BUNDLE_IDENTIFIER = com.example.printBluetoothTermal; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/example/print_bluetooth_termal/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/print_bluetooth_termal/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/example/print_bluetooth_termal/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/blue/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/print_bluetooth_termal/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from example/blue/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to example/print_bluetooth_termal/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/example/print_bluetooth_termal/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/print_bluetooth_termal/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/print_bluetooth_termal/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/blue/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/print_bluetooth_termal/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 95% rename from example/blue/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to example/print_bluetooth_termal/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index ad6250a..a28140c 100644 --- a/example/blue/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/print_bluetooth_termal/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ + + - - + + + + + + + + PreviewsEnabled + + + diff --git a/example/print_bluetooth_termal/ios/Runner/AppDelegate.swift b/example/print_bluetooth_termal/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..70693e4 --- /dev/null +++ b/example/print_bluetooth_termal/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json diff --git a/example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png diff --git a/example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png diff --git a/example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md similarity index 100% rename from example/blue/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md rename to example/print_bluetooth_termal/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md diff --git a/example/blue/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/print_bluetooth_termal/ios/Runner/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from example/blue/ios/Runner/Base.lproj/LaunchScreen.storyboard rename to example/print_bluetooth_termal/ios/Runner/Base.lproj/LaunchScreen.storyboard diff --git a/example/blue/ios/Runner/Base.lproj/Main.storyboard b/example/print_bluetooth_termal/ios/Runner/Base.lproj/Main.storyboard similarity index 100% rename from example/blue/ios/Runner/Base.lproj/Main.storyboard rename to example/print_bluetooth_termal/ios/Runner/Base.lproj/Main.storyboard diff --git a/example/blue/ios/Runner/Info.plist b/example/print_bluetooth_termal/ios/Runner/Info.plist similarity index 79% rename from example/blue/ios/Runner/Info.plist rename to example/print_bluetooth_termal/ios/Runner/Info.plist index e69d8ef..9370a96 100644 --- a/example/blue/ios/Runner/Info.plist +++ b/example/print_bluetooth_termal/ios/Runner/Info.plist @@ -11,7 +11,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - blue + print_bluetooth_termal CFBundlePackageType APPL CFBundleShortVersionString @@ -39,16 +39,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - NSBluetoothAlwaysUsageDescription - Bluetooth is used to scan for printers and send the data UIViewControllerBasedStatusBarAppearance - NSBluetoothPeripheralUsageDescription - Bluetooth is used to scan for printers and send the data - UIBackgroundModes - - bluetooth-central - bluetooth-peripheral - diff --git a/example/print_bluetooth_termal/ios/Runner/Runner-Bridging-Header.h b/example/print_bluetooth_termal/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/example/print_bluetooth_termal/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/example/print_bluetooth_termal/lib/main.dart b/example/print_bluetooth_termal/lib/main.dart new file mode 100644 index 0000000..f86218e --- /dev/null +++ b/example/print_bluetooth_termal/lib/main.dart @@ -0,0 +1,451 @@ +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/services.dart'; +import 'package:image/image.dart'; +import 'package:esc_pos_utils/esc_pos_utils.dart'; +import 'package:esc_pos_bluetooth/esc_pos_bluetooth.dart'; +import 'package:flutter/material.dart' hide Image; +import 'package:oktoast/oktoast.dart'; + +void main() => runApp(MyApp()); + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return OKToast( + child: MaterialApp( + title: 'Bluetooth demo', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: MyHomePage(title: 'Bluetooth demo'), + ), + ); + } +} + +class MyHomePage extends StatefulWidget { + MyHomePage({Key key, this.title}) : super(key: key); + final String title; + + @override + _MyHomePageState createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + PrinterBluetoothManager printerManager = PrinterBluetoothManager(); + List _devices = []; + + @override + void initState() { + super.initState(); + printerManager.startScan(Duration(seconds: 1)); + printerManager.scanResults.listen((devices) async { + // print('UI: Devices found ${devices.length}'); + setState(() { + _devices = devices; + }); + }); + print(_devices.length); + } + + void _startScanDevices() { + setState(() { + _devices = []; + }); + printerManager.startScan(Duration(seconds: 4)); + } + + void _stopScanDevices() { + printerManager.stopScan(); + } + + Future> demoReceipt(PaperSize paper) async { + //final Ticket ticket = Ticket(paper); + + // Using default profile + final profile = await CapabilityProfile.load(); + final generator = Generator(PaperSize.mm80, profile); + List ticket = []; + + + // Print image + final ByteData data = await rootBundle.load('assets/rabbit_black.jpg'); + final Uint8List bytes = data.buffer.asUint8List(); + final Image image = decodeImage(bytes); + // ticket.image(image); + + ticket += generator.text(" "); //===========> IMPORTAN!!! + + ticket += generator.text('GROCERYLY', + styles: PosStyles( + align: PosAlign.center, + height: PosTextSize.size2, + width: PosTextSize.size2, + ), + linesAfter: 1); + + ticket += generator.text('889 Watson Lane', styles: PosStyles(align: PosAlign.center)); + ticket += generator.text('New Braunfels, TX', styles: PosStyles(align: PosAlign.center)); + ticket += generator.text('Tel: 830-221-1234', styles: PosStyles(align: PosAlign.center)); + ticket += generator.text('Web: www.example.com', + styles: PosStyles(align: PosAlign.center), linesAfter: 1); + + ticket += generator.hr(ch: '-', linesAfter: 1); + + ticket += generator.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)), + ]); + + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + + ticket += generator.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)), + ]); + + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + + ticket += generator.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)), + ]); + + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + ticket += generator.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)), + ]); + + ticket += generator.hr(ch: '-', linesAfter: 1); + + ticket += generator.row([ + PosColumn( + text: 'TOTAL ', + width: 6, + styles: PosStyles( + height: PosTextSize.size2, + width: PosTextSize.size2, + )), + PosColumn( + text: '\$10.97', + width: 6, + styles: PosStyles( + align: PosAlign.right, + height: PosTextSize.size2, + width: PosTextSize.size2, + )), + ]); + + ticket += generator.hr(ch: '=', linesAfter: 1); + + ticket += generator.row([ + PosColumn( + text: 'Cash', + width: 7, + styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), + PosColumn( + text: '\$15.00', + width: 5, + styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), + ]); + ticket += generator.row([ + PosColumn( + text: 'Change', + width: 7, + styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), + PosColumn( + text: '\$4.03', + width: 5, + styles: PosStyles(align: PosAlign.right, width: PosTextSize.size2)), + ]); + + ticket += generator.feed(2); + ticket += generator.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); + ticket += generator.text(timestamp, + styles: PosStyles(align: PosAlign.center), linesAfter: 2); + + ticket += generator.feed(2); + ticket += generator.cut(); + return ticket; + + } + + void _testPrint(PrinterBluetooth printer) async { + printerManager.selectPrinter(printer); + + // TODO Don't forget to choose printer's paper + const PaperSize paper = PaperSize.mm58; + + // TEST PRINT + // final PosPrintResult res = + // await printerManager.printTicket(await testTicket(paper)); + + // DEMO RECEIPT + final PosPrintResult res = + await printerManager.printTicket(await demoReceipt(paper)); + showToast(res.msg); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: ListView.builder( + itemCount: _devices.length, + itemBuilder: (BuildContext context, int index) { + if(_devices[index].name.isNotEmpty || _devices[index].name != ""){ + return InkWell( + onTap: () => _testPrint(_devices[index]), + child: Column( + children: [ + Container( + height: 60, + padding: EdgeInsets.only(left: 10), + alignment: Alignment.centerLeft, + child: Row( + children: [ + Icon(Icons.print), + SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(_devices[index].name ?? ''), + Text(_devices[index].address ?? ''), + Text(_devices[index].type.toString() ?? ''), + Text( + 'Click to print a test receipt', + style: TextStyle(color: Colors.grey[700]), + ), + ], + ), + ) + ], + ), + ), + Divider(), + ], + ), + ); + } + + return Container(); + + }), + floatingActionButton: StreamBuilder( + stream: printerManager.isScanningStream, + initialData: false, + builder: (c, snapshot) { + if (snapshot.data) { + return FloatingActionButton( + child: Icon(Icons.stop), + onPressed: _stopScanDevices, + backgroundColor: Colors.red, + ); + } else { + return FloatingActionButton( + child: Icon(Icons.search), + onPressed: _startScanDevices, + ); + } + }, + ), + ); + } +} diff --git a/example/print_bluetooth_termal/pubspec.lock b/example/print_bluetooth_termal/pubspec.lock new file mode 100644 index 0000000..001497f --- /dev/null +++ b/example/print_bluetooth_termal/pubspec.lock @@ -0,0 +1,392 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.13" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.0" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.5.0-nullsafety.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.1" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + charset_converter: + dependency: "direct main" + description: + name: charset_converter + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0-nullsafety.3" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.2" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + esc_pos_bluetooth: + dependency: "direct main" + description: + path: "../.." + relative: true + source: path + version: "0.2.8" + esc_pos_utils: + dependency: "direct main" + description: + name: esc_pos_utils + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "5.2.1" + fixnum: + dependency: transitive + description: + name: fixnum + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.11" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_blue: + dependency: transitive + description: + name: flutter_blue + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.3" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + gbk_codec: + dependency: transitive + description: + name: gbk_codec + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.2" + hex: + dependency: transitive + description: + name: hex + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0+4" + image: + dependency: "direct main" + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.19" + intl: + dependency: "direct main" + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.1" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.10-nullsafety.1" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.3" + oktoast: + dependency: "direct main" + description: + name: oktoast + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.2" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety.1" + path_provider: + dependency: "direct main" + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.27" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+2" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+8" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+3" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + process: + dependency: transitive + description: + name: process + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.13" + protobuf: + dependency: transitive + description: + name: protobuf + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + qr: + dependency: transitive + description: + name: qr + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + qr_flutter: + dependency: "direct main" + description: + name: qr_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.0" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.24.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0-nullsafety.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.19-nullsafety.2" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.3" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.3" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.4" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "4.5.1" +sdks: + dart: ">=2.10.0-110 <2.11.0" + flutter: ">=1.12.13+hotfix.6 <2.0.0" diff --git a/example/print_bluetooth_termal/pubspec.yaml b/example/print_bluetooth_termal/pubspec.yaml new file mode 100644 index 0000000..b9dd051 --- /dev/null +++ b/example/print_bluetooth_termal/pubspec.yaml @@ -0,0 +1,84 @@ +name: print_bluetooth_termal +description: A new Flutter application. + +# The following line prevents the package from being accidentally published to +# pub.dev using `pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +version: 1.0.0+1 + +environment: + sdk: ">=2.7.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + cupertino_icons: ^0.1.2 + oktoast: ^2.3.0 + image: ^2.1.4 + esc_pos_bluetooth: + path: ../../ + esc_pos_utils: ^1.0.0 + charset_converter: ^1.0.3 + intl: ^0.16.1 + qr_flutter: ^3.2.0 + path_provider: ^1.6.5 + + +dev_dependencies: + flutter_test: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + assets: + - assets/logo.png + - assets/logo216.png + - assets/logo222.png + - assets/rabbit_black.jpg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/example/blue/test/widget_test.dart b/example/print_bluetooth_termal/test/widget_test.dart similarity index 95% rename from example/blue/test/widget_test.dart rename to example/print_bluetooth_termal/test/widget_test.dart index 4bf5f04..16da0f9 100644 --- a/example/blue/test/widget_test.dart +++ b/example/print_bluetooth_termal/test/widget_test.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:blue/main.dart'; +import 'package:print_bluetooth_termal/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { diff --git a/example/print_bluetooth_termal/web/favicon.png b/example/print_bluetooth_termal/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/example/print_bluetooth_termal/web/favicon.png differ diff --git a/example/print_bluetooth_termal/web/icons/Icon-192.png b/example/print_bluetooth_termal/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/example/print_bluetooth_termal/web/icons/Icon-192.png differ diff --git a/example/print_bluetooth_termal/web/icons/Icon-512.png b/example/print_bluetooth_termal/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/example/print_bluetooth_termal/web/icons/Icon-512.png differ diff --git a/example/print_bluetooth_termal/web/index.html b/example/print_bluetooth_termal/web/index.html new file mode 100644 index 0000000..7ec2d07 --- /dev/null +++ b/example/print_bluetooth_termal/web/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + print_bluetooth_termal + + + + + + + + diff --git a/example/print_bluetooth_termal/web/manifest.json b/example/print_bluetooth_termal/web/manifest.json new file mode 100644 index 0000000..63d2bb0 --- /dev/null +++ b/example/print_bluetooth_termal/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "print_bluetooth_termal", + "short_name": "print_bluetooth_termal", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter application.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/lib/src/enums.dart b/lib/src/enums.dart index d8211ab..2c12441 100644 --- a/lib/src/enums.dart +++ b/lib/src/enums.dart @@ -15,6 +15,7 @@ class PosPrintResult { static const ticketEmpty = PosPrintResult._internal(4); static const printInProgress = PosPrintResult._internal(5); static const scanInProgress = PosPrintResult._internal(6); + static const print = PosPrintResult._internal(7); String get msg { if (value == PosPrintResult.success.value) { @@ -29,6 +30,8 @@ class PosPrintResult { return 'Error. Another print in progress'; } else if (value == PosPrintResult.scanInProgress.value) { return 'Error. Printer scanning in progress'; + } else if (value == PosPrintResult.print.value) { + return 'Print in progress'; } else { return 'Unknown error'; } diff --git a/lib/src/printer_bluetooth_manager.dart b/lib/src/printer_bluetooth_manager.dart index ba78b32..e4ade37 100644 --- a/lib/src/printer_bluetooth_manager.dart +++ b/lib/src/printer_bluetooth_manager.dart @@ -7,10 +7,10 @@ */ import 'dart:async'; +import 'dart:convert'; import 'dart:io'; -import 'package:esc_pos_utils/esc_pos_utils.dart'; +import 'package:flutter_blue/flutter_blue.dart'; import 'package:rxdart/rxdart.dart'; -import 'package:flutter_bluetooth_basic/flutter_bluetooth_basic.dart'; import './enums.dart'; /// Bluetooth printer @@ -18,19 +18,28 @@ class PrinterBluetooth { PrinterBluetooth(this._device); final BluetoothDevice _device; + String _deviceName; + + String get deviceName => _deviceName; + set deviceName(String val){ + this._deviceName = val; + } + String get name => _device.name; - String get address => _device.address; - int get type => _device.type; + String get address => _device.id.id; + int get type => _device.type.index; } /// Printer Bluetooth Manager class PrinterBluetoothManager { - final BluetoothManager _bluetoothManager = BluetoothManager.instance; + final FlutterBlue _flutterBlue = FlutterBlue.instance; bool _isPrinting = false; bool _isConnected = false; + StreamSubscription _scanResultsSubscription; StreamSubscription _isScanningSubscription; PrinterBluetooth _selectedPrinter; + List _bluetoothServices; final BehaviorSubject _isScanning = BehaviorSubject.seeded(false); Stream get isScanningStream => _isScanning.stream; @@ -46,14 +55,14 @@ class PrinterBluetoothManager { void startScan(Duration timeout) async { _scanResults.add([]); - _bluetoothManager.startScan(timeout: timeout); + _flutterBlue.startScan(timeout: timeout); - _scanResultsSubscription = _bluetoothManager.scanResults.listen((devices) { - _scanResults.add(devices.map((d) => PrinterBluetooth(d)).toList()); + _scanResultsSubscription = _flutterBlue.scanResults.listen((devices) { + _scanResults.add(devices.map((d) => PrinterBluetooth(d.device)).toList()); }); _isScanningSubscription = - _bluetoothManager.isScanning.listen((isScanningCurrent) async { + _flutterBlue.isScanning.listen((isScanningCurrent) async { // If isScanning value changed (scan just stopped) if (_isScanning.value && !isScanningCurrent) { _scanResultsSubscription.cancel(); @@ -64,13 +73,18 @@ class PrinterBluetoothManager { } void stopScan() async { - await _bluetoothManager.stopScan(); + await _flutterBlue.stopScan(); } void selectPrinter(PrinterBluetooth printer) { _selectedPrinter = printer; } + Future disconnect() async{ + await _selectedPrinter._device.disconnect(); + _isPrinting = false; + } + Future writeBytes( List bytes, { int chunkSizeBytes = 20, @@ -80,78 +94,156 @@ class PrinterBluetoothManager { const int timeout = 5; if (_selectedPrinter == null) { + print(1); return Future.value(PosPrintResult.printerNotSelected); } else if (_isScanning.value) { + print(2); return Future.value(PosPrintResult.scanInProgress); } else if (_isPrinting) { + print(3); return Future.value(PosPrintResult.printInProgress); + } else{ + completer.complete(PosPrintResult.print); } _isPrinting = true; - + bool isFirst = true; + bool _isFinish = false; // We have to rescan before connecting, otherwise we can connect only once - await _bluetoothManager.startScan(timeout: Duration(seconds: 1)); - await _bluetoothManager.stopScan(); // Connect - await _bluetoothManager.connect(_selectedPrinter._device); - - // Subscribe to the events - _bluetoothManager.state.listen((state) async { - switch (state) { - case BluetoothManager.CONNECTED: - // To avoid double call - if (!_isConnected) { - final len = bytes.length; - List> chunks = []; - for (var i = 0; i < len; i += chunkSizeBytes) { - var end = (i + chunkSizeBytes < len) ? i + chunkSizeBytes : len; - chunks.add(bytes.sublist(i, end)); - } + if(!_isConnected) { + await _selectedPrinter._device.connect(); + _isConnected = true; + } + final len = bytes.length; + List> chunks = []; + for (var i = 0; i < len; i += chunkSizeBytes) { + var end = (i + chunkSizeBytes < len) ? i + chunkSizeBytes : len; + chunks.add(bytes.sublist(i, end)); + } + if (_isConnected) { + List services = await _selectedPrinter._device + .discoverServices(); + for (BluetoothService service in services) { + List characteristics = service.characteristics; + for (BluetoothCharacteristic characteristic in characteristics) { + if (isFirst) { for (var i = 0; i < chunks.length; i += 1) { - await _bluetoothManager.writeData(chunks[i]); - sleep(Duration(milliseconds: queueSleepTimeMs)); + try { + await characteristic.write(chunks[i], withoutResponse: true); + await characteristic.read(); + isFirst = false; + _isFinish = true; + } catch (e) { + break; + } + } + if (_isFinish) { + _isPrinting = false; + _isConnected = false; + await _selectedPrinter._device.disconnect(); + } + } + } + } + } + + + /* + _selectedPrinter._device.state.listen((state)async { + switch(state){ + case BluetoothDeviceState.connected : + final len = bytes.length; + List> chunks = []; + for (var i = 0; i < len; i += chunkSizeBytes) { + var end = (i + chunkSizeBytes < len) ? i + chunkSizeBytes : len; + chunks.add(bytes.sublist(i, end)); + } + + if (_isConnected) { + List services = await _selectedPrinter._device.discoverServices(); + for(BluetoothService service in services){ + List characteristics = service.characteristics; + for(BluetoothCharacteristic characteristic in characteristics){ + if(isFirst){ + for (var i = 0; i < chunks.length; i += 1) { + try { + await characteristic.write(chunks[i], withoutResponse: true); + await characteristic.read(); + isFirst = false; + _isFinish = true; + } catch (e) { + break; + } + } + if(_isFinish){ + _isPrinting = false; + _isConnected = false; + await _selectedPrinter._device.disconnect(); + } + } + } + } - completer.complete(PosPrintResult.success); + /* + _selectedPrinter._device.services.listen((event) async { + _bluetoothServices = event; + for (BluetoothService bluetoothService in _bluetoothServices) { + + List characteristics = bluetoothService + .characteristics; + for (BluetoothCharacteristic characteristic in characteristics) { + if(isFirst){ + for (var i = 0; i < chunks.length; i += 1) { + try { + await characteristic.write(chunks[i], withoutResponse: true); + await characteristic.read(); + isFirst = false; + _isFinish = true; + } catch (e) { + break; + } + } + if(_isFinish){ + _isPrinting = false; + _isConnected = false; + await _selectedPrinter._device.disconnect(); + } + } + } + } + }); + + */ } - // TODO sending disconnect signal should be event-based - _runDelayed(3).then((dynamic v) async { - await _bluetoothManager.disconnect(); - _isPrinting = false; - }); - _isConnected = true; + break; - case BluetoothManager.DISCONNECTED: + case BluetoothDeviceState.disconnected : _isConnected = false; break; default: break; - } - }); - // Printing timeout - _runDelayed(timeout).then((dynamic v) async { - if (_isPrinting) { - _isPrinting = false; - completer.complete(PosPrintResult.timeout); } }); + */ return completer.future; } Future printTicket( - Ticket ticket, { + List bytes, { int chunkSizeBytes = 20, int queueSleepTimeMs = 20, }) async { - if (ticket == null || ticket.bytes.isEmpty) { + if (bytes == null || bytes.isEmpty) { return Future.value(PosPrintResult.ticketEmpty); } return writeBytes( - ticket.bytes, + bytes, chunkSizeBytes: chunkSizeBytes, queueSleepTimeMs: queueSleepTimeMs, ); diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..5e3ba41 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,259 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.13" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.0" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.5.0-nullsafety.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.1" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0-nullsafety.3" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.2" + esc_pos_utils: + dependency: "direct main" + description: + name: esc_pos_utils + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + fixnum: + dependency: transitive + description: + name: fixnum + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.11" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_blue: + dependency: "direct main" + description: + name: flutter_blue + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.3" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + gbk_codec: + dependency: transitive + description: + name: gbk_codec + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.2" + hex: + dependency: transitive + description: + name: hex + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0+4" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.19" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.10-nullsafety.1" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.3" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety.1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + protobuf: + dependency: transitive + description: + name: protobuf + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + rxdart: + dependency: "direct main" + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.24.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0-nullsafety.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.19-nullsafety.2" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.3" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.3" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "4.5.1" +sdks: + dart: ">=2.10.0-110 <2.11.0" + flutter: ">=1.12.13+hotfix.6 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 7167b60..827de1a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,11 +9,11 @@ environment: dependencies: flutter: sdk: flutter - rxdart: ^0.23.1 - esc_pos_utils: ^0.3.6 + rxdart: ^0.24.0 + esc_pos_utils: ^1.0.0 # esc_pos_utils: # path: ../esc_pos_utils - flutter_bluetooth_basic: ^0.1.5 + flutter_blue: ^0.7.3 dev_dependencies: flutter_test: