Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
esc_pos_print_plus
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dio Maulana
esc_pos_print_plus
Commits
a8069a01
Commit
a8069a01
authored
Jan 16, 2020
by
Andrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PosPrintResult.msg as getter; PaperSize.width as getter.
parent
2005ed65
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
15 deletions
+15
-15
README.md
README.md
+2
-2
main.dart
example/blue/lib/main.dart
+1
-1
main.dart
example/discover_printers/lib/main.dart
+2
-2
example.dart
example/example.dart
+1
-1
enums.dart
lib/src/enums.dart
+8
-8
ticket.dart
lib/src/ticket.dart
+1
-1
No files found.
README.md
View file @
a8069a01
...
...
@@ -112,7 +112,7 @@ final PrinterNetworkManager printerManager = PrinterNetworkManager();
printerManager
.
selectPrinter
(
'192.168.0.123'
,
port:
9100
);
final
PosPrintResult
res
=
await
printerManager
.
printTicket
(
testTicket
());
print
(
'Print result:
${
PosPrintResult.msg(res)
}
'
);
print
(
'Print result:
${
res.msg
}
'
);
```
For more details, check
*example/example.dart*
and
*example/discover_printers*
.
...
...
@@ -131,7 +131,7 @@ printerManager.startScan(Duration(seconds: 4));
printerManager
.
selectPrinter
(
printer
);
final
PosPrintResult
res
=
await
printerManager
.
printTicket
(
testTicket
());
print
(
'Print result:
${
PosPrintResult.msg(res)
}
'
);
print
(
'Print result:
${
res.msg
}
'
);
```
For more details, check demo project
*example/blue*
.
...
...
example/blue/lib/main.dart
View file @
a8069a01
...
...
@@ -128,7 +128,7 @@ class _MyHomePageState extends State<MyHomePage> {
final
PosPrintResult
res
=
await
printerManager
.
printTicket
(
await
testTicket
());
showToast
(
PosPrintResult
.
msg
(
res
)
);
showToast
(
res
.
msg
);
}
@override
...
...
example/discover_printers/lib/main.dart
View file @
a8069a01
...
...
@@ -161,8 +161,8 @@ class _MyHomePageState extends State<MyHomePage> {
final
PosPrintResult
res
=
await
printerManager
.
printTicket
(
await
testTicket
());
final
snackBar
=
SnackBar
(
content:
Text
(
PosPrintResult
.
msg
(
res
)
,
textAlign:
TextAlign
.
center
));
final
snackBar
=
SnackBar
(
content:
Text
(
res
.
msg
,
textAlign:
TextAlign
.
center
));
Scaffold
.
of
(
ctx
).
showSnackBar
(
snackBar
);
}
...
...
example/example.dart
View file @
a8069a01
...
...
@@ -13,7 +13,7 @@ void main() async {
final
PosPrintResult
res
=
await
printerManager
.
printTicket
(
await
testTicket
());
print
(
'Print result:
${
PosPrintResult.msg(res)
}
'
);
print
(
'Print result:
${
res.msg
}
'
);
}
Future
<
Ticket
>
testTicket
()
async
{
...
...
lib/src/enums.dart
View file @
a8069a01
...
...
@@ -20,18 +20,18 @@ class PosPrintResult {
static
const
printInProgress
=
PosPrintResult
.
_internal
(
5
);
static
const
scanInProgress
=
PosPrintResult
.
_internal
(
6
);
static
String
msg
(
PosPrintResult
val
)
{
if
(
val
==
PosPrintResult
.
success
)
{
String
get
msg
{
if
(
val
ue
==
PosPrintResult
.
success
.
value
)
{
return
'Success'
;
}
else
if
(
val
==
PosPrintResult
.
timeout
)
{
}
else
if
(
val
ue
==
PosPrintResult
.
timeout
.
value
)
{
return
'Error. Printer connection timeout'
;
}
else
if
(
val
==
PosPrintResult
.
printerNotSelected
)
{
}
else
if
(
val
ue
==
PosPrintResult
.
printerNotSelected
.
value
)
{
return
'Error. Printer not selected'
;
}
else
if
(
val
==
PosPrintResult
.
ticketEmpty
)
{
}
else
if
(
val
ue
==
PosPrintResult
.
ticketEmpty
.
value
)
{
return
'Error. Ticket is empty'
;
}
else
if
(
val
==
PosPrintResult
.
printInProgress
)
{
}
else
if
(
val
ue
==
PosPrintResult
.
printInProgress
.
value
)
{
return
'Error. Another print in progress'
;
}
else
if
(
val
==
PosPrintResult
.
scanInProgress
)
{
}
else
if
(
val
ue
==
PosPrintResult
.
scanInProgress
.
value
)
{
return
'Error. Printer scanning in progress'
;
}
else
{
return
'Unknown error'
;
...
...
@@ -61,7 +61,7 @@ class PaperSize {
static
const
mm58
=
PaperSize
.
_internal
(
1
);
static
const
mm80
=
PaperSize
.
_internal
(
2
);
static
int
width
(
PaperSize
size
)
=>
size
==
PaperSize
.
mm58
?
350
:
512
;
int
get
width
=>
value
==
PaperSize
.
mm58
.
value
?
350
:
512
;
}
class
PosBeepDuration
{
...
...
lib/src/ticket.dart
View file @
a8069a01
...
...
@@ -37,7 +37,7 @@ class Ticket {
}
double
_colIndToPosition
(
int
colInd
)
{
final
int
width
=
PaperSize
.
width
(
_paperSize
)
;
final
int
width
=
_paperSize
.
width
;
return
colInd
==
0
?
0
:
(
width
*
colInd
/
11
-
1
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment