add: 取消打印
This commit is contained in:
parent
b946b65373
commit
9e13ce02b1
@ -35,7 +35,7 @@ EXTERNAL SOURCES:
|
|||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
integration_test: 13825b8a9334a850581300559b8839134b124670
|
integration_test: 13825b8a9334a850581300559b8839134b124670
|
||||||
jc_printer: c4a2906ddae176e1e82fbf52f337a6b6dfc95f99
|
jc_printer: 98d27e989a3129f784669a21dd5883eec26ba102
|
||||||
Protobuf: 351e9022fe13a6e2af00e9aefc22077cb88520f8
|
Protobuf: 351e9022fe13a6e2af00e9aefc22077cb88520f8
|
||||||
reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c
|
reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c
|
||||||
SwiftProtobuf: bcfd2bc231cf9ae552cdc7c4e877bd3b41fe57b1
|
SwiftProtobuf: bcfd2bc231cf9ae552cdc7c4e877bd3b41fe57b1
|
||||||
|
@ -106,7 +106,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
_count = int.tryParse(_countInput.value.text) ?? 0;
|
_count = int.tryParse(_countInput.value.text) ?? 0;
|
||||||
final content = _contentInput.value.text.trim();
|
final content = _contentInput.value.text.trim();
|
||||||
if (content.isEmpty || _count <= 0) return;
|
if (content.isEmpty || _count <= 0) return;
|
||||||
_printer.setTotalPrints(1);
|
_printer.setTotalPrints(_count);
|
||||||
await _printer.initDrawingBoard(
|
await _printer.initDrawingBoard(
|
||||||
width: labelWidth,
|
width: labelWidth,
|
||||||
height: labelHeight,
|
height: labelHeight,
|
||||||
|
@ -46,8 +46,10 @@
|
|||||||
[self getLabelData:result];
|
[self getLabelData:result];
|
||||||
} else if ([@"startJob" isEqualToString:call.method]) {
|
} else if ([@"startJob" isEqualToString:call.method]) {
|
||||||
[self startJob:call.arguments result:result];
|
[self startJob:call.arguments result:result];
|
||||||
} else if ([@"endJob" isEqualToString:call.method]) {
|
} else if ([@"cancelJob" isEqualToString:call.method]) {
|
||||||
[self endJob:result];
|
[self cancelJob:result];
|
||||||
|
} else if ([@"endPrint" isEqualToString:call.method]) {
|
||||||
|
[self endPrint:result];
|
||||||
} else if ([@"commit" isEqualToString:call.method]) {
|
} else if ([@"commit" isEqualToString:call.method]) {
|
||||||
[self commit:call.arguments result:result];
|
[self commit:call.arguments result:result];
|
||||||
} else {
|
} else {
|
||||||
@ -149,11 +151,17 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)endJob:(FlutterResult)result {
|
- (void)endPrint:(FlutterResult)result {
|
||||||
[JCAPI endPrint:^(BOOL isSuccess) {
|
[JCAPI endPrint:^(BOOL isSuccess) {
|
||||||
result(@(isSuccess));
|
result(@(isSuccess));
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)cancelJob:(FlutterResult)result {
|
||||||
|
[JCAPI cancelJob:^(BOOL isSuccess) {
|
||||||
|
result(@(isSuccess));
|
||||||
|
}];
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma mark - FlutterStreamHandler
|
#pragma mark - FlutterStreamHandler
|
||||||
|
@ -227,5 +227,9 @@ class JcPrinter {
|
|||||||
return _printer.commit(data: data, count: count);
|
return _printer.commit(data: data, count: count);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> endPrint() async => _printer.endJob();
|
/// 取消打印任务
|
||||||
|
Future<bool> cancelPrint() async => _printer.cancelJob();
|
||||||
|
|
||||||
|
/// 结束当前打印任务
|
||||||
|
Future<bool> endPrint() async => _printer.endPrint();
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,13 @@ class MethodChannelJcPrinter extends JcPrinterPlatform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> endJob() async {
|
Future<bool> cancelJob() async {
|
||||||
|
final result = await method.invokeMethod<bool>('cancelJob');
|
||||||
|
return result ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<bool> endPrint() async {
|
||||||
final result = await method.invokeMethod<bool>('endJob');
|
final result = await method.invokeMethod<bool>('endJob');
|
||||||
return result ?? false;
|
return result ?? false;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ abstract class JcPrinterPlatform extends PlatformInterface {
|
|||||||
int rotate = 0,
|
int rotate = 0,
|
||||||
int codeType = 20,
|
int codeType = 20,
|
||||||
int textPosition = 0,
|
int textPosition = 0,
|
||||||
}) {
|
}) {
|
||||||
throw UnimplementedError('drawLabelBarcode() has not been implemented.');
|
throw UnimplementedError('drawLabelBarcode() has not been implemented.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,8 +202,13 @@ abstract class JcPrinterPlatform extends PlatformInterface {
|
|||||||
throw UnimplementedError('startJob() has not been implemented.');
|
throw UnimplementedError('startJob() has not been implemented.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 结束打印任务
|
/// 取消打印任务
|
||||||
Future<bool> endJob() async {
|
Future<bool> cancelJob() async {
|
||||||
|
throw UnimplementedError('endJob() has not been implemented.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 结束当前打印任务
|
||||||
|
Future<bool> endPrint() async {
|
||||||
throw UnimplementedError('endJob() has not been implemented.');
|
throw UnimplementedError('endJob() has not been implemented.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user