print kitchen
This commit is contained in:
parent
8923ce737d
commit
3e6dce93fb
@ -29,29 +29,47 @@ class _SettingPrinterKitchenState extends State<SettingPrinterKitchen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocListener<PrinterFormBloc, PrinterFormState>(
|
return MultiBlocListener(
|
||||||
listenWhen: (p, c) =>
|
listeners: [
|
||||||
p.failureOrDeleteSuccess != c.failureOrDeleteSuccess,
|
BlocListener<PrinterFormBloc, PrinterFormState>(
|
||||||
listener: (context, state) {
|
listenWhen: (p, c) =>
|
||||||
state.failureOrDeleteSuccess.fold(
|
p.failureOrDeleteSuccess != c.failureOrDeleteSuccess,
|
||||||
() => null,
|
listener: (context, state) {
|
||||||
(either) => either.fold(
|
state.failureOrDeleteSuccess.fold(
|
||||||
(f) => AppFlushbar.showPrinterFailureToast(context, f),
|
() => null,
|
||||||
(_) {
|
(either) => either.fold(
|
||||||
if (context.mounted) {
|
(f) => AppFlushbar.showPrinterFailureToast(context, f),
|
||||||
context.read<PrinterLoaderBloc>().add(
|
(_) {
|
||||||
const PrinterLoaderEvent.getByCode('kitchen'),
|
if (context.mounted) {
|
||||||
);
|
context.read<PrinterLoaderBloc>().add(
|
||||||
}
|
const PrinterLoaderEvent.getByCode('kitchen'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
AppFlushbar.showSuccess(
|
AppFlushbar.showSuccess(
|
||||||
context,
|
context,
|
||||||
'Printer kitchen berhasil dihapus',
|
'Printer kitchen berhasil dihapus',
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
BlocListener<PrinterFormBloc, PrinterFormState>(
|
||||||
|
listenWhen: (p, c) => p.failureOrPrintTest != c.failureOrPrintTest,
|
||||||
|
listener: (context, state) {
|
||||||
|
state.failureOrPrintTest.fold(
|
||||||
|
() => null,
|
||||||
|
(either) => either.fold(
|
||||||
|
(f) => AppFlushbar.showPrinterFailureToast(context, f),
|
||||||
|
(either) {
|
||||||
|
AppFlushbar.showSuccess(context, 'Printer test berhasil');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
child: Material(
|
child: Material(
|
||||||
color: AppColor.background,
|
color: AppColor.background,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
@ -106,6 +124,14 @@ class _SettingPrinterKitchenState extends State<SettingPrinterKitchen> {
|
|||||||
PrinterFormEvent.deleted(state.printer.id),
|
PrinterFormEvent.deleted(state.printer.id),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
onTestPrint: () {
|
||||||
|
context.read<PrinterFormBloc>().add(
|
||||||
|
PrinterFormEvent.printTest(
|
||||||
|
code: 'kitchen',
|
||||||
|
macAccdress: state.printer.address,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
(f) => f.maybeMap(
|
(f) => f.maybeMap(
|
||||||
orElse: () => ErrorCard(
|
orElse: () => ErrorCard(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user