-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
86 lines (78 loc) · 2.56 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import 'package:flutter/material.dart';
import 'package:flutter_star_prnt_example/impresora.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_print_gen/star_print_gen.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final permison = await Permission.location.request();
final blue = await Permission.bluetoothConnect.request();
final blueS = await Permission.bluetoothScan.request();
print("permison ${blue.isGranted}");
print("blue ${permison.isGranted}");
print("blueS ${blue.isGranted}");
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool isLoading = false;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Plugin example app')),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
TextButton(
onPressed: () async {
PrintCommands commands = PrintCommands();
commands.appendBitmapText(text: texto);
await Impresora.imprimir(commands: commands);
await Impresora.imprimir(
reimpresion: true,
commands: commands,
);
},
child: Text('Print from text'),
),
],
),
),
),
);
}
}
const String texto = " Star Clothing Boutique\n" +
" 123 Star Road\n" +
" City, State 12345\n" +
"\n" +
"Date:MM/DD/YYYY Time:HH:MM PM\n" +
"--------------------------------------\n" +
"SALE\n" +
"SKU Description Total\n" +
"300678566 PLAIN T-SHIRT 10.99\n" +
"300692003 BLACK DENIM 29.99\n" +
"300651148 BLUE DENIM 29.99\n" +
"300642980 STRIPED DRESS 49.99\n" +
"30063847 BLACK BOOTS 35.99\n" +
"\n" +
"Subtotal 156.95\n" +
"Tax 0.00\n" +
"--------------------------------------\n" +
"Total 156.95\n" +
"--------------------------------------\n" +
"\n" +
"Charge\n" +
"156.95\n" +
"Visa XXXX-XXXX-XXXX-0123\n" +
"Refunds and Exchanges\n" +
"Within 30 days with receipt\n" +
"And tags attached\n";