printer delete
This commit is contained in:
parent
4ed7721bbe
commit
896ea6c28c
@ -90,6 +90,20 @@ class PrinterFormBloc extends Bloc<PrinterFormEvent, PrinterFormState> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
deleted: (e) async {
|
||||||
|
Either<PrinterFailure, Unit> failureOrPrinter;
|
||||||
|
|
||||||
|
emit(state.copyWith(isDeleting: true, failureOrDeleteSuccess: none()));
|
||||||
|
|
||||||
|
failureOrPrinter = await _printerRepository.deletePrinter(e.id);
|
||||||
|
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
isDeleting: false,
|
||||||
|
failureOrDeleteSuccess: optionOf(failureOrPrinter),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ mixin _$PrinterFormEvent {
|
|||||||
required TResult Function(String paper) paperChanged,
|
required TResult Function(String paper) paperChanged,
|
||||||
required TResult Function() created,
|
required TResult Function() created,
|
||||||
required TResult Function(int id) updated,
|
required TResult Function(int id) updated,
|
||||||
|
required TResult Function(int id) deleted,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
@ -36,6 +37,7 @@ mixin _$PrinterFormEvent {
|
|||||||
TResult? Function(String paper)? paperChanged,
|
TResult? Function(String paper)? paperChanged,
|
||||||
TResult? Function()? created,
|
TResult? Function()? created,
|
||||||
TResult? Function(int id)? updated,
|
TResult? Function(int id)? updated,
|
||||||
|
TResult? Function(int id)? deleted,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
@ -46,6 +48,7 @@ mixin _$PrinterFormEvent {
|
|||||||
TResult Function(String paper)? paperChanged,
|
TResult Function(String paper)? paperChanged,
|
||||||
TResult Function()? created,
|
TResult Function()? created,
|
||||||
TResult Function(int id)? updated,
|
TResult Function(int id)? updated,
|
||||||
|
TResult Function(int id)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -57,6 +60,7 @@ mixin _$PrinterFormEvent {
|
|||||||
required TResult Function(_PaperChanged value) paperChanged,
|
required TResult Function(_PaperChanged value) paperChanged,
|
||||||
required TResult Function(_Created value) created,
|
required TResult Function(_Created value) created,
|
||||||
required TResult Function(_Updated value) updated,
|
required TResult Function(_Updated value) updated,
|
||||||
|
required TResult Function(_Deleted value) deleted,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
@ -67,6 +71,7 @@ mixin _$PrinterFormEvent {
|
|||||||
TResult? Function(_PaperChanged value)? paperChanged,
|
TResult? Function(_PaperChanged value)? paperChanged,
|
||||||
TResult? Function(_Created value)? created,
|
TResult? Function(_Created value)? created,
|
||||||
TResult? Function(_Updated value)? updated,
|
TResult? Function(_Updated value)? updated,
|
||||||
|
TResult? Function(_Deleted value)? deleted,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
@ -77,6 +82,7 @@ mixin _$PrinterFormEvent {
|
|||||||
TResult Function(_PaperChanged value)? paperChanged,
|
TResult Function(_PaperChanged value)? paperChanged,
|
||||||
TResult Function(_Created value)? created,
|
TResult Function(_Created value)? created,
|
||||||
TResult Function(_Updated value)? updated,
|
TResult Function(_Updated value)? updated,
|
||||||
|
TResult Function(_Deleted value)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
@ -180,6 +186,7 @@ class _$CodeChangedImpl implements _CodeChanged {
|
|||||||
required TResult Function(String paper) paperChanged,
|
required TResult Function(String paper) paperChanged,
|
||||||
required TResult Function() created,
|
required TResult Function() created,
|
||||||
required TResult Function(int id) updated,
|
required TResult Function(int id) updated,
|
||||||
|
required TResult Function(int id) deleted,
|
||||||
}) {
|
}) {
|
||||||
return codeChanged(code);
|
return codeChanged(code);
|
||||||
}
|
}
|
||||||
@ -194,6 +201,7 @@ class _$CodeChangedImpl implements _CodeChanged {
|
|||||||
TResult? Function(String paper)? paperChanged,
|
TResult? Function(String paper)? paperChanged,
|
||||||
TResult? Function()? created,
|
TResult? Function()? created,
|
||||||
TResult? Function(int id)? updated,
|
TResult? Function(int id)? updated,
|
||||||
|
TResult? Function(int id)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return codeChanged?.call(code);
|
return codeChanged?.call(code);
|
||||||
}
|
}
|
||||||
@ -208,6 +216,7 @@ class _$CodeChangedImpl implements _CodeChanged {
|
|||||||
TResult Function(String paper)? paperChanged,
|
TResult Function(String paper)? paperChanged,
|
||||||
TResult Function()? created,
|
TResult Function()? created,
|
||||||
TResult Function(int id)? updated,
|
TResult Function(int id)? updated,
|
||||||
|
TResult Function(int id)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (codeChanged != null) {
|
if (codeChanged != null) {
|
||||||
@ -226,6 +235,7 @@ class _$CodeChangedImpl implements _CodeChanged {
|
|||||||
required TResult Function(_PaperChanged value) paperChanged,
|
required TResult Function(_PaperChanged value) paperChanged,
|
||||||
required TResult Function(_Created value) created,
|
required TResult Function(_Created value) created,
|
||||||
required TResult Function(_Updated value) updated,
|
required TResult Function(_Updated value) updated,
|
||||||
|
required TResult Function(_Deleted value) deleted,
|
||||||
}) {
|
}) {
|
||||||
return codeChanged(this);
|
return codeChanged(this);
|
||||||
}
|
}
|
||||||
@ -240,6 +250,7 @@ class _$CodeChangedImpl implements _CodeChanged {
|
|||||||
TResult? Function(_PaperChanged value)? paperChanged,
|
TResult? Function(_PaperChanged value)? paperChanged,
|
||||||
TResult? Function(_Created value)? created,
|
TResult? Function(_Created value)? created,
|
||||||
TResult? Function(_Updated value)? updated,
|
TResult? Function(_Updated value)? updated,
|
||||||
|
TResult? Function(_Deleted value)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return codeChanged?.call(this);
|
return codeChanged?.call(this);
|
||||||
}
|
}
|
||||||
@ -254,6 +265,7 @@ class _$CodeChangedImpl implements _CodeChanged {
|
|||||||
TResult Function(_PaperChanged value)? paperChanged,
|
TResult Function(_PaperChanged value)? paperChanged,
|
||||||
TResult Function(_Created value)? created,
|
TResult Function(_Created value)? created,
|
||||||
TResult Function(_Updated value)? updated,
|
TResult Function(_Updated value)? updated,
|
||||||
|
TResult Function(_Deleted value)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (codeChanged != null) {
|
if (codeChanged != null) {
|
||||||
@ -352,6 +364,7 @@ class _$NameChangedImpl implements _NameChanged {
|
|||||||
required TResult Function(String paper) paperChanged,
|
required TResult Function(String paper) paperChanged,
|
||||||
required TResult Function() created,
|
required TResult Function() created,
|
||||||
required TResult Function(int id) updated,
|
required TResult Function(int id) updated,
|
||||||
|
required TResult Function(int id) deleted,
|
||||||
}) {
|
}) {
|
||||||
return nameChanged(name);
|
return nameChanged(name);
|
||||||
}
|
}
|
||||||
@ -366,6 +379,7 @@ class _$NameChangedImpl implements _NameChanged {
|
|||||||
TResult? Function(String paper)? paperChanged,
|
TResult? Function(String paper)? paperChanged,
|
||||||
TResult? Function()? created,
|
TResult? Function()? created,
|
||||||
TResult? Function(int id)? updated,
|
TResult? Function(int id)? updated,
|
||||||
|
TResult? Function(int id)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return nameChanged?.call(name);
|
return nameChanged?.call(name);
|
||||||
}
|
}
|
||||||
@ -380,6 +394,7 @@ class _$NameChangedImpl implements _NameChanged {
|
|||||||
TResult Function(String paper)? paperChanged,
|
TResult Function(String paper)? paperChanged,
|
||||||
TResult Function()? created,
|
TResult Function()? created,
|
||||||
TResult Function(int id)? updated,
|
TResult Function(int id)? updated,
|
||||||
|
TResult Function(int id)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (nameChanged != null) {
|
if (nameChanged != null) {
|
||||||
@ -398,6 +413,7 @@ class _$NameChangedImpl implements _NameChanged {
|
|||||||
required TResult Function(_PaperChanged value) paperChanged,
|
required TResult Function(_PaperChanged value) paperChanged,
|
||||||
required TResult Function(_Created value) created,
|
required TResult Function(_Created value) created,
|
||||||
required TResult Function(_Updated value) updated,
|
required TResult Function(_Updated value) updated,
|
||||||
|
required TResult Function(_Deleted value) deleted,
|
||||||
}) {
|
}) {
|
||||||
return nameChanged(this);
|
return nameChanged(this);
|
||||||
}
|
}
|
||||||
@ -412,6 +428,7 @@ class _$NameChangedImpl implements _NameChanged {
|
|||||||
TResult? Function(_PaperChanged value)? paperChanged,
|
TResult? Function(_PaperChanged value)? paperChanged,
|
||||||
TResult? Function(_Created value)? created,
|
TResult? Function(_Created value)? created,
|
||||||
TResult? Function(_Updated value)? updated,
|
TResult? Function(_Updated value)? updated,
|
||||||
|
TResult? Function(_Deleted value)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return nameChanged?.call(this);
|
return nameChanged?.call(this);
|
||||||
}
|
}
|
||||||
@ -426,6 +443,7 @@ class _$NameChangedImpl implements _NameChanged {
|
|||||||
TResult Function(_PaperChanged value)? paperChanged,
|
TResult Function(_PaperChanged value)? paperChanged,
|
||||||
TResult Function(_Created value)? created,
|
TResult Function(_Created value)? created,
|
||||||
TResult Function(_Updated value)? updated,
|
TResult Function(_Updated value)? updated,
|
||||||
|
TResult Function(_Deleted value)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (nameChanged != null) {
|
if (nameChanged != null) {
|
||||||
@ -527,6 +545,7 @@ class _$AddressChangedImpl implements _AddressChanged {
|
|||||||
required TResult Function(String paper) paperChanged,
|
required TResult Function(String paper) paperChanged,
|
||||||
required TResult Function() created,
|
required TResult Function() created,
|
||||||
required TResult Function(int id) updated,
|
required TResult Function(int id) updated,
|
||||||
|
required TResult Function(int id) deleted,
|
||||||
}) {
|
}) {
|
||||||
return addressChanged(address);
|
return addressChanged(address);
|
||||||
}
|
}
|
||||||
@ -541,6 +560,7 @@ class _$AddressChangedImpl implements _AddressChanged {
|
|||||||
TResult? Function(String paper)? paperChanged,
|
TResult? Function(String paper)? paperChanged,
|
||||||
TResult? Function()? created,
|
TResult? Function()? created,
|
||||||
TResult? Function(int id)? updated,
|
TResult? Function(int id)? updated,
|
||||||
|
TResult? Function(int id)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return addressChanged?.call(address);
|
return addressChanged?.call(address);
|
||||||
}
|
}
|
||||||
@ -555,6 +575,7 @@ class _$AddressChangedImpl implements _AddressChanged {
|
|||||||
TResult Function(String paper)? paperChanged,
|
TResult Function(String paper)? paperChanged,
|
||||||
TResult Function()? created,
|
TResult Function()? created,
|
||||||
TResult Function(int id)? updated,
|
TResult Function(int id)? updated,
|
||||||
|
TResult Function(int id)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (addressChanged != null) {
|
if (addressChanged != null) {
|
||||||
@ -573,6 +594,7 @@ class _$AddressChangedImpl implements _AddressChanged {
|
|||||||
required TResult Function(_PaperChanged value) paperChanged,
|
required TResult Function(_PaperChanged value) paperChanged,
|
||||||
required TResult Function(_Created value) created,
|
required TResult Function(_Created value) created,
|
||||||
required TResult Function(_Updated value) updated,
|
required TResult Function(_Updated value) updated,
|
||||||
|
required TResult Function(_Deleted value) deleted,
|
||||||
}) {
|
}) {
|
||||||
return addressChanged(this);
|
return addressChanged(this);
|
||||||
}
|
}
|
||||||
@ -587,6 +609,7 @@ class _$AddressChangedImpl implements _AddressChanged {
|
|||||||
TResult? Function(_PaperChanged value)? paperChanged,
|
TResult? Function(_PaperChanged value)? paperChanged,
|
||||||
TResult? Function(_Created value)? created,
|
TResult? Function(_Created value)? created,
|
||||||
TResult? Function(_Updated value)? updated,
|
TResult? Function(_Updated value)? updated,
|
||||||
|
TResult? Function(_Deleted value)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return addressChanged?.call(this);
|
return addressChanged?.call(this);
|
||||||
}
|
}
|
||||||
@ -601,6 +624,7 @@ class _$AddressChangedImpl implements _AddressChanged {
|
|||||||
TResult Function(_PaperChanged value)? paperChanged,
|
TResult Function(_PaperChanged value)? paperChanged,
|
||||||
TResult Function(_Created value)? created,
|
TResult Function(_Created value)? created,
|
||||||
TResult Function(_Updated value)? updated,
|
TResult Function(_Updated value)? updated,
|
||||||
|
TResult Function(_Deleted value)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (addressChanged != null) {
|
if (addressChanged != null) {
|
||||||
@ -699,6 +723,7 @@ class _$TypeChangedImpl implements _TypeChanged {
|
|||||||
required TResult Function(String paper) paperChanged,
|
required TResult Function(String paper) paperChanged,
|
||||||
required TResult Function() created,
|
required TResult Function() created,
|
||||||
required TResult Function(int id) updated,
|
required TResult Function(int id) updated,
|
||||||
|
required TResult Function(int id) deleted,
|
||||||
}) {
|
}) {
|
||||||
return typeChanged(type);
|
return typeChanged(type);
|
||||||
}
|
}
|
||||||
@ -713,6 +738,7 @@ class _$TypeChangedImpl implements _TypeChanged {
|
|||||||
TResult? Function(String paper)? paperChanged,
|
TResult? Function(String paper)? paperChanged,
|
||||||
TResult? Function()? created,
|
TResult? Function()? created,
|
||||||
TResult? Function(int id)? updated,
|
TResult? Function(int id)? updated,
|
||||||
|
TResult? Function(int id)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return typeChanged?.call(type);
|
return typeChanged?.call(type);
|
||||||
}
|
}
|
||||||
@ -727,6 +753,7 @@ class _$TypeChangedImpl implements _TypeChanged {
|
|||||||
TResult Function(String paper)? paperChanged,
|
TResult Function(String paper)? paperChanged,
|
||||||
TResult Function()? created,
|
TResult Function()? created,
|
||||||
TResult Function(int id)? updated,
|
TResult Function(int id)? updated,
|
||||||
|
TResult Function(int id)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (typeChanged != null) {
|
if (typeChanged != null) {
|
||||||
@ -745,6 +772,7 @@ class _$TypeChangedImpl implements _TypeChanged {
|
|||||||
required TResult Function(_PaperChanged value) paperChanged,
|
required TResult Function(_PaperChanged value) paperChanged,
|
||||||
required TResult Function(_Created value) created,
|
required TResult Function(_Created value) created,
|
||||||
required TResult Function(_Updated value) updated,
|
required TResult Function(_Updated value) updated,
|
||||||
|
required TResult Function(_Deleted value) deleted,
|
||||||
}) {
|
}) {
|
||||||
return typeChanged(this);
|
return typeChanged(this);
|
||||||
}
|
}
|
||||||
@ -759,6 +787,7 @@ class _$TypeChangedImpl implements _TypeChanged {
|
|||||||
TResult? Function(_PaperChanged value)? paperChanged,
|
TResult? Function(_PaperChanged value)? paperChanged,
|
||||||
TResult? Function(_Created value)? created,
|
TResult? Function(_Created value)? created,
|
||||||
TResult? Function(_Updated value)? updated,
|
TResult? Function(_Updated value)? updated,
|
||||||
|
TResult? Function(_Deleted value)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return typeChanged?.call(this);
|
return typeChanged?.call(this);
|
||||||
}
|
}
|
||||||
@ -773,6 +802,7 @@ class _$TypeChangedImpl implements _TypeChanged {
|
|||||||
TResult Function(_PaperChanged value)? paperChanged,
|
TResult Function(_PaperChanged value)? paperChanged,
|
||||||
TResult Function(_Created value)? created,
|
TResult Function(_Created value)? created,
|
||||||
TResult Function(_Updated value)? updated,
|
TResult Function(_Updated value)? updated,
|
||||||
|
TResult Function(_Deleted value)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (typeChanged != null) {
|
if (typeChanged != null) {
|
||||||
@ -871,6 +901,7 @@ class _$PaperChangedImpl implements _PaperChanged {
|
|||||||
required TResult Function(String paper) paperChanged,
|
required TResult Function(String paper) paperChanged,
|
||||||
required TResult Function() created,
|
required TResult Function() created,
|
||||||
required TResult Function(int id) updated,
|
required TResult Function(int id) updated,
|
||||||
|
required TResult Function(int id) deleted,
|
||||||
}) {
|
}) {
|
||||||
return paperChanged(paper);
|
return paperChanged(paper);
|
||||||
}
|
}
|
||||||
@ -885,6 +916,7 @@ class _$PaperChangedImpl implements _PaperChanged {
|
|||||||
TResult? Function(String paper)? paperChanged,
|
TResult? Function(String paper)? paperChanged,
|
||||||
TResult? Function()? created,
|
TResult? Function()? created,
|
||||||
TResult? Function(int id)? updated,
|
TResult? Function(int id)? updated,
|
||||||
|
TResult? Function(int id)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return paperChanged?.call(paper);
|
return paperChanged?.call(paper);
|
||||||
}
|
}
|
||||||
@ -899,6 +931,7 @@ class _$PaperChangedImpl implements _PaperChanged {
|
|||||||
TResult Function(String paper)? paperChanged,
|
TResult Function(String paper)? paperChanged,
|
||||||
TResult Function()? created,
|
TResult Function()? created,
|
||||||
TResult Function(int id)? updated,
|
TResult Function(int id)? updated,
|
||||||
|
TResult Function(int id)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (paperChanged != null) {
|
if (paperChanged != null) {
|
||||||
@ -917,6 +950,7 @@ class _$PaperChangedImpl implements _PaperChanged {
|
|||||||
required TResult Function(_PaperChanged value) paperChanged,
|
required TResult Function(_PaperChanged value) paperChanged,
|
||||||
required TResult Function(_Created value) created,
|
required TResult Function(_Created value) created,
|
||||||
required TResult Function(_Updated value) updated,
|
required TResult Function(_Updated value) updated,
|
||||||
|
required TResult Function(_Deleted value) deleted,
|
||||||
}) {
|
}) {
|
||||||
return paperChanged(this);
|
return paperChanged(this);
|
||||||
}
|
}
|
||||||
@ -931,6 +965,7 @@ class _$PaperChangedImpl implements _PaperChanged {
|
|||||||
TResult? Function(_PaperChanged value)? paperChanged,
|
TResult? Function(_PaperChanged value)? paperChanged,
|
||||||
TResult? Function(_Created value)? created,
|
TResult? Function(_Created value)? created,
|
||||||
TResult? Function(_Updated value)? updated,
|
TResult? Function(_Updated value)? updated,
|
||||||
|
TResult? Function(_Deleted value)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return paperChanged?.call(this);
|
return paperChanged?.call(this);
|
||||||
}
|
}
|
||||||
@ -945,6 +980,7 @@ class _$PaperChangedImpl implements _PaperChanged {
|
|||||||
TResult Function(_PaperChanged value)? paperChanged,
|
TResult Function(_PaperChanged value)? paperChanged,
|
||||||
TResult Function(_Created value)? created,
|
TResult Function(_Created value)? created,
|
||||||
TResult Function(_Updated value)? updated,
|
TResult Function(_Updated value)? updated,
|
||||||
|
TResult Function(_Deleted value)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (paperChanged != null) {
|
if (paperChanged != null) {
|
||||||
@ -1016,6 +1052,7 @@ class _$CreatedImpl implements _Created {
|
|||||||
required TResult Function(String paper) paperChanged,
|
required TResult Function(String paper) paperChanged,
|
||||||
required TResult Function() created,
|
required TResult Function() created,
|
||||||
required TResult Function(int id) updated,
|
required TResult Function(int id) updated,
|
||||||
|
required TResult Function(int id) deleted,
|
||||||
}) {
|
}) {
|
||||||
return created();
|
return created();
|
||||||
}
|
}
|
||||||
@ -1030,6 +1067,7 @@ class _$CreatedImpl implements _Created {
|
|||||||
TResult? Function(String paper)? paperChanged,
|
TResult? Function(String paper)? paperChanged,
|
||||||
TResult? Function()? created,
|
TResult? Function()? created,
|
||||||
TResult? Function(int id)? updated,
|
TResult? Function(int id)? updated,
|
||||||
|
TResult? Function(int id)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return created?.call();
|
return created?.call();
|
||||||
}
|
}
|
||||||
@ -1044,6 +1082,7 @@ class _$CreatedImpl implements _Created {
|
|||||||
TResult Function(String paper)? paperChanged,
|
TResult Function(String paper)? paperChanged,
|
||||||
TResult Function()? created,
|
TResult Function()? created,
|
||||||
TResult Function(int id)? updated,
|
TResult Function(int id)? updated,
|
||||||
|
TResult Function(int id)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (created != null) {
|
if (created != null) {
|
||||||
@ -1062,6 +1101,7 @@ class _$CreatedImpl implements _Created {
|
|||||||
required TResult Function(_PaperChanged value) paperChanged,
|
required TResult Function(_PaperChanged value) paperChanged,
|
||||||
required TResult Function(_Created value) created,
|
required TResult Function(_Created value) created,
|
||||||
required TResult Function(_Updated value) updated,
|
required TResult Function(_Updated value) updated,
|
||||||
|
required TResult Function(_Deleted value) deleted,
|
||||||
}) {
|
}) {
|
||||||
return created(this);
|
return created(this);
|
||||||
}
|
}
|
||||||
@ -1076,6 +1116,7 @@ class _$CreatedImpl implements _Created {
|
|||||||
TResult? Function(_PaperChanged value)? paperChanged,
|
TResult? Function(_PaperChanged value)? paperChanged,
|
||||||
TResult? Function(_Created value)? created,
|
TResult? Function(_Created value)? created,
|
||||||
TResult? Function(_Updated value)? updated,
|
TResult? Function(_Updated value)? updated,
|
||||||
|
TResult? Function(_Deleted value)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return created?.call(this);
|
return created?.call(this);
|
||||||
}
|
}
|
||||||
@ -1090,6 +1131,7 @@ class _$CreatedImpl implements _Created {
|
|||||||
TResult Function(_PaperChanged value)? paperChanged,
|
TResult Function(_PaperChanged value)? paperChanged,
|
||||||
TResult Function(_Created value)? created,
|
TResult Function(_Created value)? created,
|
||||||
TResult Function(_Updated value)? updated,
|
TResult Function(_Updated value)? updated,
|
||||||
|
TResult Function(_Deleted value)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (created != null) {
|
if (created != null) {
|
||||||
@ -1180,6 +1222,7 @@ class _$UpdatedImpl implements _Updated {
|
|||||||
required TResult Function(String paper) paperChanged,
|
required TResult Function(String paper) paperChanged,
|
||||||
required TResult Function() created,
|
required TResult Function() created,
|
||||||
required TResult Function(int id) updated,
|
required TResult Function(int id) updated,
|
||||||
|
required TResult Function(int id) deleted,
|
||||||
}) {
|
}) {
|
||||||
return updated(id);
|
return updated(id);
|
||||||
}
|
}
|
||||||
@ -1194,6 +1237,7 @@ class _$UpdatedImpl implements _Updated {
|
|||||||
TResult? Function(String paper)? paperChanged,
|
TResult? Function(String paper)? paperChanged,
|
||||||
TResult? Function()? created,
|
TResult? Function()? created,
|
||||||
TResult? Function(int id)? updated,
|
TResult? Function(int id)? updated,
|
||||||
|
TResult? Function(int id)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return updated?.call(id);
|
return updated?.call(id);
|
||||||
}
|
}
|
||||||
@ -1208,6 +1252,7 @@ class _$UpdatedImpl implements _Updated {
|
|||||||
TResult Function(String paper)? paperChanged,
|
TResult Function(String paper)? paperChanged,
|
||||||
TResult Function()? created,
|
TResult Function()? created,
|
||||||
TResult Function(int id)? updated,
|
TResult Function(int id)? updated,
|
||||||
|
TResult Function(int id)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (updated != null) {
|
if (updated != null) {
|
||||||
@ -1226,6 +1271,7 @@ class _$UpdatedImpl implements _Updated {
|
|||||||
required TResult Function(_PaperChanged value) paperChanged,
|
required TResult Function(_PaperChanged value) paperChanged,
|
||||||
required TResult Function(_Created value) created,
|
required TResult Function(_Created value) created,
|
||||||
required TResult Function(_Updated value) updated,
|
required TResult Function(_Updated value) updated,
|
||||||
|
required TResult Function(_Deleted value) deleted,
|
||||||
}) {
|
}) {
|
||||||
return updated(this);
|
return updated(this);
|
||||||
}
|
}
|
||||||
@ -1240,6 +1286,7 @@ class _$UpdatedImpl implements _Updated {
|
|||||||
TResult? Function(_PaperChanged value)? paperChanged,
|
TResult? Function(_PaperChanged value)? paperChanged,
|
||||||
TResult? Function(_Created value)? created,
|
TResult? Function(_Created value)? created,
|
||||||
TResult? Function(_Updated value)? updated,
|
TResult? Function(_Updated value)? updated,
|
||||||
|
TResult? Function(_Deleted value)? deleted,
|
||||||
}) {
|
}) {
|
||||||
return updated?.call(this);
|
return updated?.call(this);
|
||||||
}
|
}
|
||||||
@ -1254,6 +1301,7 @@ class _$UpdatedImpl implements _Updated {
|
|||||||
TResult Function(_PaperChanged value)? paperChanged,
|
TResult Function(_PaperChanged value)? paperChanged,
|
||||||
TResult Function(_Created value)? created,
|
TResult Function(_Created value)? created,
|
||||||
TResult Function(_Updated value)? updated,
|
TResult Function(_Updated value)? updated,
|
||||||
|
TResult Function(_Deleted value)? deleted,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (updated != null) {
|
if (updated != null) {
|
||||||
@ -1275,6 +1323,184 @@ abstract class _Updated implements PrinterFormEvent {
|
|||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$DeletedImplCopyWith<$Res> {
|
||||||
|
factory _$$DeletedImplCopyWith(
|
||||||
|
_$DeletedImpl value,
|
||||||
|
$Res Function(_$DeletedImpl) then,
|
||||||
|
) = __$$DeletedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({int id});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$DeletedImplCopyWithImpl<$Res>
|
||||||
|
extends _$PrinterFormEventCopyWithImpl<$Res, _$DeletedImpl>
|
||||||
|
implements _$$DeletedImplCopyWith<$Res> {
|
||||||
|
__$$DeletedImplCopyWithImpl(
|
||||||
|
_$DeletedImpl _value,
|
||||||
|
$Res Function(_$DeletedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of PrinterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? id = null}) {
|
||||||
|
return _then(
|
||||||
|
_$DeletedImpl(
|
||||||
|
null == id
|
||||||
|
? _value.id
|
||||||
|
: id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$DeletedImpl implements _Deleted {
|
||||||
|
const _$DeletedImpl(this.id);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'PrinterFormEvent.deleted(id: $id)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$DeletedImpl &&
|
||||||
|
(identical(other.id, id) || other.id == id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, id);
|
||||||
|
|
||||||
|
/// Create a copy of PrinterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$DeletedImplCopyWith<_$DeletedImpl> get copyWith =>
|
||||||
|
__$$DeletedImplCopyWithImpl<_$DeletedImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(String code) codeChanged,
|
||||||
|
required TResult Function(String name) nameChanged,
|
||||||
|
required TResult Function(String address) addressChanged,
|
||||||
|
required TResult Function(String type) typeChanged,
|
||||||
|
required TResult Function(String paper) paperChanged,
|
||||||
|
required TResult Function() created,
|
||||||
|
required TResult Function(int id) updated,
|
||||||
|
required TResult Function(int id) deleted,
|
||||||
|
}) {
|
||||||
|
return deleted(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(String code)? codeChanged,
|
||||||
|
TResult? Function(String name)? nameChanged,
|
||||||
|
TResult? Function(String address)? addressChanged,
|
||||||
|
TResult? Function(String type)? typeChanged,
|
||||||
|
TResult? Function(String paper)? paperChanged,
|
||||||
|
TResult? Function()? created,
|
||||||
|
TResult? Function(int id)? updated,
|
||||||
|
TResult? Function(int id)? deleted,
|
||||||
|
}) {
|
||||||
|
return deleted?.call(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(String code)? codeChanged,
|
||||||
|
TResult Function(String name)? nameChanged,
|
||||||
|
TResult Function(String address)? addressChanged,
|
||||||
|
TResult Function(String type)? typeChanged,
|
||||||
|
TResult Function(String paper)? paperChanged,
|
||||||
|
TResult Function()? created,
|
||||||
|
TResult Function(int id)? updated,
|
||||||
|
TResult Function(int id)? deleted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (deleted != null) {
|
||||||
|
return deleted(id);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_CodeChanged value) codeChanged,
|
||||||
|
required TResult Function(_NameChanged value) nameChanged,
|
||||||
|
required TResult Function(_AddressChanged value) addressChanged,
|
||||||
|
required TResult Function(_TypeChanged value) typeChanged,
|
||||||
|
required TResult Function(_PaperChanged value) paperChanged,
|
||||||
|
required TResult Function(_Created value) created,
|
||||||
|
required TResult Function(_Updated value) updated,
|
||||||
|
required TResult Function(_Deleted value) deleted,
|
||||||
|
}) {
|
||||||
|
return deleted(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_CodeChanged value)? codeChanged,
|
||||||
|
TResult? Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult? Function(_AddressChanged value)? addressChanged,
|
||||||
|
TResult? Function(_TypeChanged value)? typeChanged,
|
||||||
|
TResult? Function(_PaperChanged value)? paperChanged,
|
||||||
|
TResult? Function(_Created value)? created,
|
||||||
|
TResult? Function(_Updated value)? updated,
|
||||||
|
TResult? Function(_Deleted value)? deleted,
|
||||||
|
}) {
|
||||||
|
return deleted?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_CodeChanged value)? codeChanged,
|
||||||
|
TResult Function(_NameChanged value)? nameChanged,
|
||||||
|
TResult Function(_AddressChanged value)? addressChanged,
|
||||||
|
TResult Function(_TypeChanged value)? typeChanged,
|
||||||
|
TResult Function(_PaperChanged value)? paperChanged,
|
||||||
|
TResult Function(_Created value)? created,
|
||||||
|
TResult Function(_Updated value)? updated,
|
||||||
|
TResult Function(_Deleted value)? deleted,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (deleted != null) {
|
||||||
|
return deleted(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Deleted implements PrinterFormEvent {
|
||||||
|
const factory _Deleted(final int id) = _$DeletedImpl;
|
||||||
|
|
||||||
|
int get id;
|
||||||
|
|
||||||
|
/// Create a copy of PrinterFormEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$DeletedImplCopyWith<_$DeletedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$PrinterFormState {
|
mixin _$PrinterFormState {
|
||||||
String get code => throw _privateConstructorUsedError;
|
String get code => throw _privateConstructorUsedError;
|
||||||
@ -1286,8 +1512,11 @@ mixin _$PrinterFormState {
|
|||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
Option<Either<PrinterFailure, Unit>> get failureOrUpdateSuccess =>
|
Option<Either<PrinterFailure, Unit>> get failureOrUpdateSuccess =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
|
Option<Either<PrinterFailure, Unit>> get failureOrDeleteSuccess =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
dynamic get isCreating => throw _privateConstructorUsedError;
|
dynamic get isCreating => throw _privateConstructorUsedError;
|
||||||
dynamic get isUpdate => throw _privateConstructorUsedError;
|
dynamic get isUpdate => throw _privateConstructorUsedError;
|
||||||
|
dynamic get isDeleting => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Create a copy of PrinterFormState
|
/// Create a copy of PrinterFormState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -1311,8 +1540,10 @@ abstract class $PrinterFormStateCopyWith<$Res> {
|
|||||||
String type,
|
String type,
|
||||||
Option<Either<PrinterFailure, Unit>> failureOrCreateSuccess,
|
Option<Either<PrinterFailure, Unit>> failureOrCreateSuccess,
|
||||||
Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess,
|
Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess,
|
||||||
|
Option<Either<PrinterFailure, Unit>> failureOrDeleteSuccess,
|
||||||
dynamic isCreating,
|
dynamic isCreating,
|
||||||
dynamic isUpdate,
|
dynamic isUpdate,
|
||||||
|
dynamic isDeleting,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1338,8 +1569,10 @@ class _$PrinterFormStateCopyWithImpl<$Res, $Val extends PrinterFormState>
|
|||||||
Object? type = null,
|
Object? type = null,
|
||||||
Object? failureOrCreateSuccess = null,
|
Object? failureOrCreateSuccess = null,
|
||||||
Object? failureOrUpdateSuccess = null,
|
Object? failureOrUpdateSuccess = null,
|
||||||
|
Object? failureOrDeleteSuccess = null,
|
||||||
Object? isCreating = freezed,
|
Object? isCreating = freezed,
|
||||||
Object? isUpdate = freezed,
|
Object? isUpdate = freezed,
|
||||||
|
Object? isDeleting = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_value.copyWith(
|
_value.copyWith(
|
||||||
@ -1371,6 +1604,10 @@ class _$PrinterFormStateCopyWithImpl<$Res, $Val extends PrinterFormState>
|
|||||||
? _value.failureOrUpdateSuccess
|
? _value.failureOrUpdateSuccess
|
||||||
: failureOrUpdateSuccess // ignore: cast_nullable_to_non_nullable
|
: failureOrUpdateSuccess // ignore: cast_nullable_to_non_nullable
|
||||||
as Option<Either<PrinterFailure, Unit>>,
|
as Option<Either<PrinterFailure, Unit>>,
|
||||||
|
failureOrDeleteSuccess: null == failureOrDeleteSuccess
|
||||||
|
? _value.failureOrDeleteSuccess
|
||||||
|
: failureOrDeleteSuccess // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<PrinterFailure, Unit>>,
|
||||||
isCreating: freezed == isCreating
|
isCreating: freezed == isCreating
|
||||||
? _value.isCreating
|
? _value.isCreating
|
||||||
: isCreating // ignore: cast_nullable_to_non_nullable
|
: isCreating // ignore: cast_nullable_to_non_nullable
|
||||||
@ -1379,6 +1616,10 @@ class _$PrinterFormStateCopyWithImpl<$Res, $Val extends PrinterFormState>
|
|||||||
? _value.isUpdate
|
? _value.isUpdate
|
||||||
: isUpdate // ignore: cast_nullable_to_non_nullable
|
: isUpdate // ignore: cast_nullable_to_non_nullable
|
||||||
as dynamic,
|
as dynamic,
|
||||||
|
isDeleting: freezed == isDeleting
|
||||||
|
? _value.isDeleting
|
||||||
|
: isDeleting // ignore: cast_nullable_to_non_nullable
|
||||||
|
as dynamic,
|
||||||
)
|
)
|
||||||
as $Val,
|
as $Val,
|
||||||
);
|
);
|
||||||
@ -1402,8 +1643,10 @@ abstract class _$$PrinterFormStateImplCopyWith<$Res>
|
|||||||
String type,
|
String type,
|
||||||
Option<Either<PrinterFailure, Unit>> failureOrCreateSuccess,
|
Option<Either<PrinterFailure, Unit>> failureOrCreateSuccess,
|
||||||
Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess,
|
Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess,
|
||||||
|
Option<Either<PrinterFailure, Unit>> failureOrDeleteSuccess,
|
||||||
dynamic isCreating,
|
dynamic isCreating,
|
||||||
dynamic isUpdate,
|
dynamic isUpdate,
|
||||||
|
dynamic isDeleting,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1428,8 +1671,10 @@ class __$$PrinterFormStateImplCopyWithImpl<$Res>
|
|||||||
Object? type = null,
|
Object? type = null,
|
||||||
Object? failureOrCreateSuccess = null,
|
Object? failureOrCreateSuccess = null,
|
||||||
Object? failureOrUpdateSuccess = null,
|
Object? failureOrUpdateSuccess = null,
|
||||||
|
Object? failureOrDeleteSuccess = null,
|
||||||
Object? isCreating = freezed,
|
Object? isCreating = freezed,
|
||||||
Object? isUpdate = freezed,
|
Object? isUpdate = freezed,
|
||||||
|
Object? isDeleting = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_$PrinterFormStateImpl(
|
_$PrinterFormStateImpl(
|
||||||
@ -1461,8 +1706,13 @@ class __$$PrinterFormStateImplCopyWithImpl<$Res>
|
|||||||
? _value.failureOrUpdateSuccess
|
? _value.failureOrUpdateSuccess
|
||||||
: failureOrUpdateSuccess // ignore: cast_nullable_to_non_nullable
|
: failureOrUpdateSuccess // ignore: cast_nullable_to_non_nullable
|
||||||
as Option<Either<PrinterFailure, Unit>>,
|
as Option<Either<PrinterFailure, Unit>>,
|
||||||
|
failureOrDeleteSuccess: null == failureOrDeleteSuccess
|
||||||
|
? _value.failureOrDeleteSuccess
|
||||||
|
: failureOrDeleteSuccess // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Option<Either<PrinterFailure, Unit>>,
|
||||||
isCreating: freezed == isCreating ? _value.isCreating! : isCreating,
|
isCreating: freezed == isCreating ? _value.isCreating! : isCreating,
|
||||||
isUpdate: freezed == isUpdate ? _value.isUpdate! : isUpdate,
|
isUpdate: freezed == isUpdate ? _value.isUpdate! : isUpdate,
|
||||||
|
isDeleting: freezed == isDeleting ? _value.isDeleting! : isDeleting,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1479,8 +1729,10 @@ class _$PrinterFormStateImpl implements _PrinterFormState {
|
|||||||
required this.type,
|
required this.type,
|
||||||
required this.failureOrCreateSuccess,
|
required this.failureOrCreateSuccess,
|
||||||
required this.failureOrUpdateSuccess,
|
required this.failureOrUpdateSuccess,
|
||||||
|
required this.failureOrDeleteSuccess,
|
||||||
this.isCreating = false,
|
this.isCreating = false,
|
||||||
this.isUpdate = false,
|
this.isUpdate = false,
|
||||||
|
this.isDeleting = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -1498,15 +1750,20 @@ class _$PrinterFormStateImpl implements _PrinterFormState {
|
|||||||
@override
|
@override
|
||||||
final Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess;
|
final Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess;
|
||||||
@override
|
@override
|
||||||
|
final Option<Either<PrinterFailure, Unit>> failureOrDeleteSuccess;
|
||||||
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
final dynamic isCreating;
|
final dynamic isCreating;
|
||||||
@override
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
final dynamic isUpdate;
|
final dynamic isUpdate;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final dynamic isDeleting;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'PrinterFormState(code: $code, name: $name, address: $address, paper: $paper, type: $type, failureOrCreateSuccess: $failureOrCreateSuccess, failureOrUpdateSuccess: $failureOrUpdateSuccess, isCreating: $isCreating, isUpdate: $isUpdate)';
|
return 'PrinterFormState(code: $code, name: $name, address: $address, paper: $paper, type: $type, failureOrCreateSuccess: $failureOrCreateSuccess, failureOrUpdateSuccess: $failureOrUpdateSuccess, failureOrDeleteSuccess: $failureOrDeleteSuccess, isCreating: $isCreating, isUpdate: $isUpdate, isDeleting: $isDeleting)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -1523,11 +1780,17 @@ class _$PrinterFormStateImpl implements _PrinterFormState {
|
|||||||
other.failureOrCreateSuccess == failureOrCreateSuccess) &&
|
other.failureOrCreateSuccess == failureOrCreateSuccess) &&
|
||||||
(identical(other.failureOrUpdateSuccess, failureOrUpdateSuccess) ||
|
(identical(other.failureOrUpdateSuccess, failureOrUpdateSuccess) ||
|
||||||
other.failureOrUpdateSuccess == failureOrUpdateSuccess) &&
|
other.failureOrUpdateSuccess == failureOrUpdateSuccess) &&
|
||||||
|
(identical(other.failureOrDeleteSuccess, failureOrDeleteSuccess) ||
|
||||||
|
other.failureOrDeleteSuccess == failureOrDeleteSuccess) &&
|
||||||
const DeepCollectionEquality().equals(
|
const DeepCollectionEquality().equals(
|
||||||
other.isCreating,
|
other.isCreating,
|
||||||
isCreating,
|
isCreating,
|
||||||
) &&
|
) &&
|
||||||
const DeepCollectionEquality().equals(other.isUpdate, isUpdate));
|
const DeepCollectionEquality().equals(other.isUpdate, isUpdate) &&
|
||||||
|
const DeepCollectionEquality().equals(
|
||||||
|
other.isDeleting,
|
||||||
|
isDeleting,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -1540,8 +1803,10 @@ class _$PrinterFormStateImpl implements _PrinterFormState {
|
|||||||
type,
|
type,
|
||||||
failureOrCreateSuccess,
|
failureOrCreateSuccess,
|
||||||
failureOrUpdateSuccess,
|
failureOrUpdateSuccess,
|
||||||
|
failureOrDeleteSuccess,
|
||||||
const DeepCollectionEquality().hash(isCreating),
|
const DeepCollectionEquality().hash(isCreating),
|
||||||
const DeepCollectionEquality().hash(isUpdate),
|
const DeepCollectionEquality().hash(isUpdate),
|
||||||
|
const DeepCollectionEquality().hash(isDeleting),
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Create a copy of PrinterFormState
|
/// Create a copy of PrinterFormState
|
||||||
@ -1565,8 +1830,10 @@ abstract class _PrinterFormState implements PrinterFormState {
|
|||||||
required final String type,
|
required final String type,
|
||||||
required final Option<Either<PrinterFailure, Unit>> failureOrCreateSuccess,
|
required final Option<Either<PrinterFailure, Unit>> failureOrCreateSuccess,
|
||||||
required final Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess,
|
required final Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess,
|
||||||
|
required final Option<Either<PrinterFailure, Unit>> failureOrDeleteSuccess,
|
||||||
final dynamic isCreating,
|
final dynamic isCreating,
|
||||||
final dynamic isUpdate,
|
final dynamic isUpdate,
|
||||||
|
final dynamic isDeleting,
|
||||||
}) = _$PrinterFormStateImpl;
|
}) = _$PrinterFormStateImpl;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -1584,9 +1851,13 @@ abstract class _PrinterFormState implements PrinterFormState {
|
|||||||
@override
|
@override
|
||||||
Option<Either<PrinterFailure, Unit>> get failureOrUpdateSuccess;
|
Option<Either<PrinterFailure, Unit>> get failureOrUpdateSuccess;
|
||||||
@override
|
@override
|
||||||
|
Option<Either<PrinterFailure, Unit>> get failureOrDeleteSuccess;
|
||||||
|
@override
|
||||||
dynamic get isCreating;
|
dynamic get isCreating;
|
||||||
@override
|
@override
|
||||||
dynamic get isUpdate;
|
dynamic get isUpdate;
|
||||||
|
@override
|
||||||
|
dynamic get isDeleting;
|
||||||
|
|
||||||
/// Create a copy of PrinterFormState
|
/// Create a copy of PrinterFormState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@ -10,4 +10,5 @@ class PrinterFormEvent with _$PrinterFormEvent {
|
|||||||
const factory PrinterFormEvent.paperChanged(String paper) = _PaperChanged;
|
const factory PrinterFormEvent.paperChanged(String paper) = _PaperChanged;
|
||||||
const factory PrinterFormEvent.created() = _Created;
|
const factory PrinterFormEvent.created() = _Created;
|
||||||
const factory PrinterFormEvent.updated(int id) = _Updated;
|
const factory PrinterFormEvent.updated(int id) = _Updated;
|
||||||
|
const factory PrinterFormEvent.deleted(int id) = _Deleted;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,8 +10,10 @@ class PrinterFormState with _$PrinterFormState {
|
|||||||
required String type,
|
required String type,
|
||||||
required Option<Either<PrinterFailure, Unit>> failureOrCreateSuccess,
|
required Option<Either<PrinterFailure, Unit>> failureOrCreateSuccess,
|
||||||
required Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess,
|
required Option<Either<PrinterFailure, Unit>> failureOrUpdateSuccess,
|
||||||
|
required Option<Either<PrinterFailure, Unit>> failureOrDeleteSuccess,
|
||||||
@Default(false) isCreating,
|
@Default(false) isCreating,
|
||||||
@Default(false) isUpdate,
|
@Default(false) isUpdate,
|
||||||
|
@Default(false) isDeleting,
|
||||||
}) = _PrinterFormState;
|
}) = _PrinterFormState;
|
||||||
|
|
||||||
factory PrinterFormState.initial() => PrinterFormState(
|
factory PrinterFormState.initial() => PrinterFormState(
|
||||||
@ -22,5 +24,6 @@ class PrinterFormState with _$PrinterFormState {
|
|||||||
type: 'Bluetooth',
|
type: 'Bluetooth',
|
||||||
failureOrCreateSuccess: none(),
|
failureOrCreateSuccess: none(),
|
||||||
failureOrUpdateSuccess: none(),
|
failureOrUpdateSuccess: none(),
|
||||||
|
failureOrDeleteSuccess: none(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../../../../application/printer/printer_form/printer_form_bloc.dart';
|
||||||
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
||||||
import '../../../../../../../common/theme/theme.dart';
|
import '../../../../../../../common/theme/theme.dart';
|
||||||
import '../../../../../../components/card/error_card.dart';
|
import '../../../../../../components/card/error_card.dart';
|
||||||
import '../../../../../../components/loader/loader_with_text.dart';
|
import '../../../../../../components/loader/loader_with_text.dart';
|
||||||
|
import '../../../../../../components/toast/flushbar.dart';
|
||||||
import '../../widgets/printer_card.dart';
|
import '../../widgets/printer_card.dart';
|
||||||
import 'setting_printer_form.dart';
|
import 'setting_printer_form.dart';
|
||||||
|
|
||||||
@ -27,75 +29,101 @@ class _SettingPrinterBarState extends State<SettingPrinterBar> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return BlocListener<PrinterFormBloc, PrinterFormState>(
|
||||||
color: AppColor.background,
|
listenWhen: (p, c) =>
|
||||||
child: SingleChildScrollView(
|
p.failureOrDeleteSuccess != c.failureOrDeleteSuccess,
|
||||||
padding: const EdgeInsets.all(16.0),
|
listener: (context, state) {
|
||||||
child: Column(
|
state.failureOrDeleteSuccess.fold(
|
||||||
children: [
|
() => null,
|
||||||
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
(either) => either.fold(
|
||||||
builder: (context, state) {
|
(f) => AppFlushbar.showPrinterFailureToast(context, f),
|
||||||
if (state.isFetching) {
|
(_) {
|
||||||
return const Center(child: LoaderWithText());
|
if (context.mounted) {
|
||||||
}
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
const PrinterLoaderEvent.getByCode('bar'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (state.printer.code == '') {
|
AppFlushbar.showSuccess(context, 'Printer bar berhasil dihapus');
|
||||||
return SettingPrinterForm(
|
},
|
||||||
code: 'bar',
|
),
|
||||||
onSuccess: () {
|
);
|
||||||
context.read<PrinterLoaderBloc>().add(
|
},
|
||||||
PrinterLoaderEvent.getByCode('bar'),
|
child: Material(
|
||||||
);
|
color: AppColor.background,
|
||||||
},
|
child: SingleChildScrollView(
|
||||||
);
|
padding: const EdgeInsets.all(16.0),
|
||||||
}
|
child: Column(
|
||||||
|
children: [
|
||||||
|
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state.isFetching) {
|
||||||
|
return const Center(child: LoaderWithText());
|
||||||
|
}
|
||||||
|
|
||||||
return state.failureOption.fold(
|
if (state.printer.code == '') {
|
||||||
() => isEdit
|
return SettingPrinterForm(
|
||||||
? SettingPrinterForm(
|
|
||||||
code: 'bar',
|
|
||||||
printer: state.printer,
|
|
||||||
onCancel: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('bar'),
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: PrinterCard(
|
|
||||||
printer: state.printer,
|
|
||||||
onEdit: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(f) => f.maybeMap(
|
|
||||||
orElse: () => ErrorCard(
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Terjadi Kesalahan',
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
empty: (value) => SettingPrinterForm(
|
|
||||||
code: 'bar',
|
code: 'bar',
|
||||||
onSuccess: () {
|
onSuccess: () {
|
||||||
context.read<PrinterLoaderBloc>().add(
|
context.read<PrinterLoaderBloc>().add(
|
||||||
PrinterLoaderEvent.getByCode('bar'),
|
PrinterLoaderEvent.getByCode('bar'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.failureOption.fold(
|
||||||
|
() => isEdit
|
||||||
|
? SettingPrinterForm(
|
||||||
|
code: 'bar',
|
||||||
|
printer: state.printer,
|
||||||
|
onCancel: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('bar'),
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: PrinterCard(
|
||||||
|
printer: state.printer,
|
||||||
|
onEdit: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onDelete: () {
|
||||||
|
context.read<PrinterFormBloc>().add(
|
||||||
|
PrinterFormEvent.deleted(state.printer.id),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(f) => f.maybeMap(
|
||||||
|
orElse: () => ErrorCard(
|
||||||
|
title: 'Error',
|
||||||
|
message: 'Terjadi Kesalahan',
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
empty: (value) => SettingPrinterForm(
|
||||||
|
code: 'bar',
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('bar'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../../../../application/printer/printer_form/printer_form_bloc.dart';
|
||||||
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
||||||
import '../../../../../../../common/theme/theme.dart';
|
import '../../../../../../../common/theme/theme.dart';
|
||||||
import '../../../../../../components/card/error_card.dart';
|
import '../../../../../../components/card/error_card.dart';
|
||||||
import '../../../../../../components/loader/loader_with_text.dart';
|
import '../../../../../../components/loader/loader_with_text.dart';
|
||||||
|
import '../../../../../../components/toast/flushbar.dart';
|
||||||
import '../../widgets/printer_card.dart';
|
import '../../widgets/printer_card.dart';
|
||||||
import 'setting_printer_form.dart';
|
import 'setting_printer_form.dart';
|
||||||
|
|
||||||
@ -27,75 +29,104 @@ class _SettingPrinterCheckerState extends State<SettingPrinterChecker> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return BlocListener<PrinterFormBloc, PrinterFormState>(
|
||||||
color: AppColor.background,
|
listenWhen: (p, c) =>
|
||||||
child: SingleChildScrollView(
|
p.failureOrDeleteSuccess != c.failureOrDeleteSuccess,
|
||||||
padding: const EdgeInsets.all(16.0),
|
listener: (context, state) {
|
||||||
child: Column(
|
state.failureOrDeleteSuccess.fold(
|
||||||
children: [
|
() => null,
|
||||||
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
(either) => either.fold(
|
||||||
builder: (context, state) {
|
(f) => AppFlushbar.showPrinterFailureToast(context, f),
|
||||||
if (state.isFetching) {
|
(_) {
|
||||||
return const Center(child: LoaderWithText());
|
if (context.mounted) {
|
||||||
}
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
const PrinterLoaderEvent.getByCode('checker'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (state.printer.code == '') {
|
AppFlushbar.showSuccess(
|
||||||
return SettingPrinterForm(
|
context,
|
||||||
code: 'checker',
|
'Printer checker berhasil dihapus',
|
||||||
onSuccess: () {
|
);
|
||||||
context.read<PrinterLoaderBloc>().add(
|
},
|
||||||
PrinterLoaderEvent.getByCode('checker'),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
child: Material(
|
||||||
}
|
color: AppColor.background,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state.isFetching) {
|
||||||
|
return const Center(child: LoaderWithText());
|
||||||
|
}
|
||||||
|
|
||||||
return state.failureOption.fold(
|
if (state.printer.code == '') {
|
||||||
() => isEdit
|
return SettingPrinterForm(
|
||||||
? SettingPrinterForm(
|
|
||||||
code: 'checker',
|
|
||||||
printer: state.printer,
|
|
||||||
onCancel: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('checker'),
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: PrinterCard(
|
|
||||||
printer: state.printer,
|
|
||||||
onEdit: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(f) => f.maybeMap(
|
|
||||||
orElse: () => ErrorCard(
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Terjadi Kesalahan',
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
empty: (value) => SettingPrinterForm(
|
|
||||||
code: 'checker',
|
code: 'checker',
|
||||||
onSuccess: () {
|
onSuccess: () {
|
||||||
context.read<PrinterLoaderBloc>().add(
|
context.read<PrinterLoaderBloc>().add(
|
||||||
PrinterLoaderEvent.getByCode('checker'),
|
PrinterLoaderEvent.getByCode('checker'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.failureOption.fold(
|
||||||
|
() => isEdit
|
||||||
|
? SettingPrinterForm(
|
||||||
|
code: 'checker',
|
||||||
|
printer: state.printer,
|
||||||
|
onCancel: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('checker'),
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: PrinterCard(
|
||||||
|
printer: state.printer,
|
||||||
|
onEdit: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onDelete: () {
|
||||||
|
context.read<PrinterFormBloc>().add(
|
||||||
|
PrinterFormEvent.deleted(state.printer.id),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(f) => f.maybeMap(
|
||||||
|
orElse: () => ErrorCard(
|
||||||
|
title: 'Error',
|
||||||
|
message: 'Terjadi Kesalahan',
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
empty: (value) => SettingPrinterForm(
|
||||||
|
code: 'checker',
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('checker'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../../../../application/printer/printer_form/printer_form_bloc.dart';
|
||||||
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
||||||
import '../../../../../../../common/theme/theme.dart';
|
import '../../../../../../../common/theme/theme.dart';
|
||||||
import '../../../../../../components/card/error_card.dart';
|
import '../../../../../../components/card/error_card.dart';
|
||||||
import '../../../../../../components/loader/loader_with_text.dart';
|
import '../../../../../../components/loader/loader_with_text.dart';
|
||||||
|
import '../../../../../../components/toast/flushbar.dart';
|
||||||
import '../../widgets/printer_card.dart';
|
import '../../widgets/printer_card.dart';
|
||||||
import 'setting_printer_form.dart';
|
import 'setting_printer_form.dart';
|
||||||
|
|
||||||
@ -27,75 +29,104 @@ class _SettingPrinterKitchenState extends State<SettingPrinterKitchen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return BlocListener<PrinterFormBloc, PrinterFormState>(
|
||||||
color: AppColor.background,
|
listenWhen: (p, c) =>
|
||||||
child: SingleChildScrollView(
|
p.failureOrDeleteSuccess != c.failureOrDeleteSuccess,
|
||||||
padding: const EdgeInsets.all(16.0),
|
listener: (context, state) {
|
||||||
child: Column(
|
state.failureOrDeleteSuccess.fold(
|
||||||
children: [
|
() => null,
|
||||||
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
(either) => either.fold(
|
||||||
builder: (context, state) {
|
(f) => AppFlushbar.showPrinterFailureToast(context, f),
|
||||||
if (state.isFetching) {
|
(_) {
|
||||||
return const Center(child: LoaderWithText());
|
if (context.mounted) {
|
||||||
}
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
const PrinterLoaderEvent.getByCode('kitchen'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (state.printer.code == '') {
|
AppFlushbar.showSuccess(
|
||||||
return SettingPrinterForm(
|
context,
|
||||||
code: 'kitchen',
|
'Printer kitchen berhasil dihapus',
|
||||||
onSuccess: () {
|
);
|
||||||
context.read<PrinterLoaderBloc>().add(
|
},
|
||||||
PrinterLoaderEvent.getByCode('kitchen'),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
child: Material(
|
||||||
}
|
color: AppColor.background,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state.isFetching) {
|
||||||
|
return const Center(child: LoaderWithText());
|
||||||
|
}
|
||||||
|
|
||||||
return state.failureOption.fold(
|
if (state.printer.code == '') {
|
||||||
() => isEdit
|
return SettingPrinterForm(
|
||||||
? SettingPrinterForm(
|
|
||||||
code: 'kitchen',
|
|
||||||
printer: state.printer,
|
|
||||||
onCancel: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('kitchen'),
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: PrinterCard(
|
|
||||||
printer: state.printer,
|
|
||||||
onEdit: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(f) => f.maybeMap(
|
|
||||||
orElse: () => ErrorCard(
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Terjadi Kesalahan',
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
empty: (value) => SettingPrinterForm(
|
|
||||||
code: 'kitchen',
|
code: 'kitchen',
|
||||||
onSuccess: () {
|
onSuccess: () {
|
||||||
context.read<PrinterLoaderBloc>().add(
|
context.read<PrinterLoaderBloc>().add(
|
||||||
PrinterLoaderEvent.getByCode('kitchen'),
|
PrinterLoaderEvent.getByCode('kitchen'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.failureOption.fold(
|
||||||
|
() => isEdit
|
||||||
|
? SettingPrinterForm(
|
||||||
|
code: 'kitchen',
|
||||||
|
printer: state.printer,
|
||||||
|
onCancel: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('kitchen'),
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: PrinterCard(
|
||||||
|
printer: state.printer,
|
||||||
|
onEdit: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onDelete: () {
|
||||||
|
context.read<PrinterFormBloc>().add(
|
||||||
|
PrinterFormEvent.deleted(state.printer.id),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(f) => f.maybeMap(
|
||||||
|
orElse: () => ErrorCard(
|
||||||
|
title: 'Error',
|
||||||
|
message: 'Terjadi Kesalahan',
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
empty: (value) => SettingPrinterForm(
|
||||||
|
code: 'kitchen',
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('kitchen'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../../../../application/printer/printer_form/printer_form_bloc.dart';
|
||||||
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
||||||
import '../../../../../../../common/theme/theme.dart';
|
import '../../../../../../../common/theme/theme.dart';
|
||||||
import '../../../../../../components/card/error_card.dart';
|
import '../../../../../../components/card/error_card.dart';
|
||||||
import '../../../../../../components/loader/loader_with_text.dart';
|
import '../../../../../../components/loader/loader_with_text.dart';
|
||||||
|
import '../../../../../../components/toast/flushbar.dart';
|
||||||
import '../../widgets/printer_card.dart';
|
import '../../widgets/printer_card.dart';
|
||||||
import 'setting_printer_form.dart';
|
import 'setting_printer_form.dart';
|
||||||
|
|
||||||
@ -27,75 +29,104 @@ class _SettingPrinterReceiptState extends State<SettingPrinterReceipt> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return BlocListener<PrinterFormBloc, PrinterFormState>(
|
||||||
color: AppColor.background,
|
listenWhen: (p, c) =>
|
||||||
child: SingleChildScrollView(
|
p.failureOrDeleteSuccess != c.failureOrDeleteSuccess,
|
||||||
padding: const EdgeInsets.all(16.0),
|
listener: (context, state) {
|
||||||
child: Column(
|
state.failureOrDeleteSuccess.fold(
|
||||||
children: [
|
() => null,
|
||||||
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
(either) => either.fold(
|
||||||
builder: (context, state) {
|
(f) => AppFlushbar.showPrinterFailureToast(context, f),
|
||||||
if (state.isFetching) {
|
(_) {
|
||||||
return const Center(child: LoaderWithText());
|
if (context.mounted) {
|
||||||
}
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
const PrinterLoaderEvent.getByCode('receipt'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (state.printer.code == '') {
|
AppFlushbar.showSuccess(
|
||||||
return SettingPrinterForm(
|
context,
|
||||||
code: 'receipt',
|
'Printer receipt berhasil dihapus',
|
||||||
onSuccess: () {
|
);
|
||||||
context.read<PrinterLoaderBloc>().add(
|
},
|
||||||
PrinterLoaderEvent.getByCode('receipt'),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
child: Material(
|
||||||
}
|
color: AppColor.background,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state.isFetching) {
|
||||||
|
return const Center(child: LoaderWithText());
|
||||||
|
}
|
||||||
|
|
||||||
return state.failureOption.fold(
|
if (state.printer.code == '') {
|
||||||
() => isEdit
|
return SettingPrinterForm(
|
||||||
? SettingPrinterForm(
|
|
||||||
code: 'receipt',
|
|
||||||
printer: state.printer,
|
|
||||||
onCancel: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('receipt'),
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: PrinterCard(
|
|
||||||
printer: state.printer,
|
|
||||||
onEdit: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(f) => f.maybeMap(
|
|
||||||
orElse: () => ErrorCard(
|
|
||||||
title: "Error",
|
|
||||||
message: "Terjadi kesalahan saat memuat printer",
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
empty: (value) => SettingPrinterForm(
|
|
||||||
code: 'receipt',
|
code: 'receipt',
|
||||||
onSuccess: () {
|
onSuccess: () {
|
||||||
context.read<PrinterLoaderBloc>().add(
|
context.read<PrinterLoaderBloc>().add(
|
||||||
PrinterLoaderEvent.getByCode('receipt'),
|
PrinterLoaderEvent.getByCode('receipt'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.failureOption.fold(
|
||||||
|
() => isEdit
|
||||||
|
? SettingPrinterForm(
|
||||||
|
code: 'receipt',
|
||||||
|
printer: state.printer,
|
||||||
|
onCancel: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('receipt'),
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: PrinterCard(
|
||||||
|
printer: state.printer,
|
||||||
|
onEdit: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onDelete: () {
|
||||||
|
context.read<PrinterFormBloc>().add(
|
||||||
|
PrinterFormEvent.deleted(state.printer.id),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(f) => f.maybeMap(
|
||||||
|
orElse: () => ErrorCard(
|
||||||
|
title: "Error",
|
||||||
|
message: "Terjadi kesalahan saat memuat printer",
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
empty: (value) => SettingPrinterForm(
|
||||||
|
code: 'receipt',
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('receipt'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../../../../application/printer/printer_form/printer_form_bloc.dart';
|
||||||
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
import '../../../../../../../application/printer/printer_loader/printer_loader_bloc.dart';
|
||||||
import '../../../../../../../common/theme/theme.dart';
|
import '../../../../../../../common/theme/theme.dart';
|
||||||
import '../../../../../../components/card/error_card.dart';
|
import '../../../../../../components/card/error_card.dart';
|
||||||
import '../../../../../../components/loader/loader_with_text.dart';
|
import '../../../../../../components/loader/loader_with_text.dart';
|
||||||
|
import '../../../../../../components/toast/flushbar.dart';
|
||||||
import '../../widgets/printer_card.dart';
|
import '../../widgets/printer_card.dart';
|
||||||
import 'setting_printer_form.dart';
|
import 'setting_printer_form.dart';
|
||||||
|
|
||||||
@ -27,75 +29,103 @@ class _SettingPrinterTicketState extends State<SettingPrinterTicket> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return BlocListener<PrinterFormBloc, PrinterFormState>(
|
||||||
color: AppColor.background,
|
listenWhen: (p, c) =>
|
||||||
child: SingleChildScrollView(
|
p.failureOrDeleteSuccess != c.failureOrDeleteSuccess,
|
||||||
padding: const EdgeInsets.all(16.0),
|
listener: (context, state) {
|
||||||
child: Column(
|
state.failureOrDeleteSuccess.fold(
|
||||||
children: [
|
() => null,
|
||||||
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
(either) => either.fold(
|
||||||
builder: (context, state) {
|
(f) => AppFlushbar.showPrinterFailureToast(context, f),
|
||||||
if (state.isFetching) {
|
(_) {
|
||||||
return const Center(child: LoaderWithText());
|
if (context.mounted) {
|
||||||
}
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
const PrinterLoaderEvent.getByCode('ticket'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (state.printer.code == '') {
|
AppFlushbar.showSuccess(
|
||||||
return SettingPrinterForm(
|
context,
|
||||||
code: 'ticket',
|
'Printer ticket berhasil dihapus',
|
||||||
onSuccess: () {
|
);
|
||||||
context.read<PrinterLoaderBloc>().add(
|
},
|
||||||
PrinterLoaderEvent.getByCode('ticket'),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
child: Material(
|
||||||
}
|
color: AppColor.background,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
BlocBuilder<PrinterLoaderBloc, PrinterLoaderState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state.isFetching) {
|
||||||
|
return const Center(child: LoaderWithText());
|
||||||
|
}
|
||||||
|
|
||||||
return state.failureOption.fold(
|
if (state.printer.code == '') {
|
||||||
() => isEdit
|
return SettingPrinterForm(
|
||||||
? SettingPrinterForm(
|
|
||||||
code: 'ticket',
|
|
||||||
printer: state.printer,
|
|
||||||
onCancel: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSuccess: () {
|
|
||||||
context.read<PrinterLoaderBloc>().add(
|
|
||||||
PrinterLoaderEvent.getByCode('ticket'),
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
isEdit = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: PrinterCard(
|
|
||||||
printer: state.printer,
|
|
||||||
onEdit: () {
|
|
||||||
setState(() {
|
|
||||||
isEdit = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(f) => f.maybeMap(
|
|
||||||
orElse: () => ErrorCard(
|
|
||||||
title: 'Error',
|
|
||||||
message: 'Terjadi Kesalahan',
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
empty: (value) => SettingPrinterForm(
|
|
||||||
code: 'ticket',
|
code: 'ticket',
|
||||||
onSuccess: () {
|
onSuccess: () {
|
||||||
context.read<PrinterLoaderBloc>().add(
|
context.read<PrinterLoaderBloc>().add(
|
||||||
PrinterLoaderEvent.getByCode('ticket'),
|
PrinterLoaderEvent.getByCode('ticket'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.failureOption.fold(
|
||||||
|
() => isEdit
|
||||||
|
? SettingPrinterForm(
|
||||||
|
code: 'ticket',
|
||||||
|
printer: state.printer,
|
||||||
|
onCancel: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('ticket'),
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
isEdit = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: PrinterCard(
|
||||||
|
printer: state.printer,
|
||||||
|
onEdit: () {
|
||||||
|
setState(() {
|
||||||
|
isEdit = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onDelete: () => context.read<PrinterFormBloc>().add(
|
||||||
|
PrinterFormEvent.deleted(state.printer.id),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(f) => f.maybeMap(
|
||||||
|
orElse: () => ErrorCard(
|
||||||
|
title: 'Error',
|
||||||
|
message: 'Terjadi Kesalahan',
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
empty: (value) => SettingPrinterForm(
|
||||||
|
code: 'ticket',
|
||||||
|
onSuccess: () {
|
||||||
|
context.read<PrinterLoaderBloc>().add(
|
||||||
|
PrinterLoaderEvent.getByCode('ticket'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user