Initial draft
This commit is contained in:
309
lib/feature/delivery/detail/bloc/delivery_bloc.dart
Normal file
309
lib/feature/delivery/detail/bloc/delivery_bloc.dart
Normal file
@ -0,0 +1,309 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:hl_lieferservice/dto/discount_add_response.dart';
|
||||
import 'package:hl_lieferservice/dto/discount_update_response.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/delivery_event.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/delivery_state.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/repository/delivery_repository.dart';
|
||||
import 'package:hl_lieferservice/widget/operations/bloc/operation_bloc.dart';
|
||||
import 'package:hl_lieferservice/widget/operations/bloc/operation_event.dart';
|
||||
|
||||
import '../../../../dto/discount_remove_response.dart';
|
||||
import '../../../../model/article.dart';
|
||||
import '../../../../model/delivery.dart' as model;
|
||||
|
||||
class DeliveryBloc extends Bloc<DeliveryEvent, DeliveryState> {
|
||||
OperationBloc opBloc;
|
||||
DeliveryRepository repository;
|
||||
|
||||
DeliveryBloc({required this.opBloc, required this.repository})
|
||||
: super(DeliveryInitial()) {
|
||||
on<UnscanArticleEvent>(_unscan);
|
||||
on<ResetScanAmountEvent>(_resetAmount);
|
||||
on<LoadDeliveryEvent>(_load);
|
||||
on<AddDiscountEvent>(_addDiscount);
|
||||
on<RemoveDiscountEvent>(_removeDiscount);
|
||||
on<UpdateDiscountEvent>(_updateDiscount);
|
||||
on<UpdateDeliveryOption>(_updateDeliveryOptions);
|
||||
on<UpdateSelectedPaymentMethod>(_updatePayment);
|
||||
}
|
||||
|
||||
void _updatePayment(
|
||||
UpdateSelectedPaymentMethod event,
|
||||
Emitter<DeliveryState> emit,
|
||||
) {
|
||||
final currentState = state;
|
||||
|
||||
if (currentState is DeliveryLoaded) {
|
||||
emit(
|
||||
DeliveryLoaded(
|
||||
delivery: currentState.delivery.copyWith(payment: event.payment),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _updateDeliveryOptions(
|
||||
UpdateDeliveryOption event,
|
||||
Emitter<DeliveryState> emit,
|
||||
) {
|
||||
final currentState = state;
|
||||
|
||||
if (currentState is DeliveryLoaded) {
|
||||
List<model.DeliveryOption> options =
|
||||
currentState.delivery.options.map((option) {
|
||||
if (option.key == event.key) {
|
||||
return option.copyWith(value: event.value.toString());
|
||||
}
|
||||
|
||||
return option;
|
||||
}).toList();
|
||||
|
||||
emit(
|
||||
DeliveryLoaded(
|
||||
delivery: currentState.delivery.copyWith(options: options),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _updateDiscount(
|
||||
UpdateDiscountEvent event,
|
||||
Emitter<DeliveryState> emit,
|
||||
) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
final currentState = state;
|
||||
|
||||
if (currentState is DeliveryLoaded) {
|
||||
DiscountUpdateResponseDTO response = await repository.updateDiscount(
|
||||
event.deliveryId,
|
||||
event.reason,
|
||||
event.value,
|
||||
);
|
||||
|
||||
model.Delivery delivery = currentState.delivery;
|
||||
|
||||
if (response.values?.receipt != null) {
|
||||
delivery.totalNetValue = response.values!.receipt.net;
|
||||
delivery.totalGrossValue = response.values!.receipt.gross;
|
||||
}
|
||||
|
||||
String discountArticleNumber = delivery.discount!.article.articleNumber;
|
||||
delivery.discount = model.Discount(
|
||||
article:
|
||||
response.values?.article != null
|
||||
? Article.fromDTO(response.values!.article)
|
||||
: delivery.discount!.article,
|
||||
note:
|
||||
response.values?.note != null
|
||||
? response.values!.note.noteDescription
|
||||
: delivery.discount!.note,
|
||||
noteId:
|
||||
response.values?.note != null
|
||||
? response.values!.note.rowId
|
||||
: delivery.discount!.noteId,
|
||||
);
|
||||
|
||||
delivery.articles = [
|
||||
...delivery.articles.where(
|
||||
(article) => article.articleNumber != discountArticleNumber,
|
||||
),
|
||||
delivery.discount!.article,
|
||||
];
|
||||
|
||||
emit(currentState.copyWith(delivery));
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
}
|
||||
} catch (e, st) {
|
||||
debugPrint(
|
||||
"Fehler beim Hinzufügen eins Discounts zur Lieferung: ${event.deliveryId}:",
|
||||
);
|
||||
debugPrint("$e");
|
||||
debugPrint("$st");
|
||||
|
||||
opBloc.add(
|
||||
FailOperation(message: "Fehler beim Hinzufügen des Discounts: $e"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _removeDiscount(
|
||||
RemoveDiscountEvent event,
|
||||
Emitter<DeliveryState> emit,
|
||||
) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
final currentState = state;
|
||||
|
||||
if (currentState is DeliveryLoaded) {
|
||||
model.Delivery delivery = currentState.delivery;
|
||||
|
||||
DiscountRemoveResponseDTO response = await repository.removeDiscount(
|
||||
event.deliveryId,
|
||||
);
|
||||
|
||||
delivery.articles =
|
||||
delivery.articles
|
||||
.where(
|
||||
(article) =>
|
||||
article.internalId !=
|
||||
delivery.discount?.article.internalId,
|
||||
)
|
||||
.toList();
|
||||
|
||||
delivery.discount = null;
|
||||
delivery.totalGrossValue = response.receipt.gross;
|
||||
delivery.totalNetValue = response.receipt.net;
|
||||
|
||||
emit(currentState.copyWith(delivery));
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
}
|
||||
} catch (e, st) {
|
||||
debugPrint(
|
||||
"Fehler beim Löschen des Discounts der Lieferung: ${event.deliveryId}:",
|
||||
);
|
||||
debugPrint("$e");
|
||||
debugPrint("$st");
|
||||
|
||||
opBloc.add(
|
||||
FailOperation(message: "Fehler beim Löschen des Discounts: $e"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _addDiscount(AddDiscountEvent event, Emitter<DeliveryState> emit) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
final currentState = state;
|
||||
|
||||
if (currentState is DeliveryLoaded) {
|
||||
DiscountAddResponseDTO response = await repository.addDiscount(
|
||||
event.deliveryId,
|
||||
event.reason,
|
||||
event.value,
|
||||
);
|
||||
|
||||
model.Delivery delivery = currentState.delivery;
|
||||
delivery.totalNetValue = response.values.receipt.net;
|
||||
delivery.totalGrossValue = response.values.receipt.gross;
|
||||
|
||||
delivery.discount = model.Discount(
|
||||
article: Article.fromDTO(response.values.article),
|
||||
note: response.values.note.noteDescription,
|
||||
noteId: response.values.note.rowId,
|
||||
);
|
||||
|
||||
delivery.articles = [...delivery.articles, delivery.discount!.article];
|
||||
|
||||
emit(currentState.copyWith(delivery));
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
}
|
||||
} catch (e, st) {
|
||||
debugPrint(
|
||||
"Fehler beim Hinzufügen eins Discounts zur Lieferung: ${event.deliveryId}:",
|
||||
);
|
||||
debugPrint("$e");
|
||||
debugPrint("$st");
|
||||
|
||||
opBloc.add(
|
||||
FailOperation(message: "Fehler beim Hinzufügen des Discounts: $e"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _load(LoadDeliveryEvent event, Emitter<DeliveryState> emit) async {
|
||||
debugPrint("Discount; ${event.delivery.discount?.note}");
|
||||
emit(DeliveryLoaded(delivery: event.delivery));
|
||||
}
|
||||
|
||||
void _unscan(UnscanArticleEvent event, Emitter<DeliveryState> emit) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
String? noteId = await repository.unscan(
|
||||
event.articleId,
|
||||
event.newAmount,
|
||||
event.reason,
|
||||
);
|
||||
|
||||
if (noteId != null) {
|
||||
final currentState = state;
|
||||
|
||||
if (currentState is DeliveryLoaded) {
|
||||
Article article = currentState.delivery.articles.firstWhere(
|
||||
(article) => article.internalId == int.parse(event.articleId),
|
||||
);
|
||||
|
||||
article.removeNoteId = noteId;
|
||||
article.scannedRemovedAmount += event.newAmount;
|
||||
article.scannedAmount -= event.newAmount;
|
||||
|
||||
List<Article> articles = [
|
||||
...currentState.delivery.articles.where(
|
||||
(article) => article.internalId != int.parse(event.articleId),
|
||||
),
|
||||
article,
|
||||
];
|
||||
currentState.delivery.articles = articles;
|
||||
|
||||
emit.call(currentState.copyWith(currentState.delivery));
|
||||
}
|
||||
}
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
} catch (e, st) {
|
||||
debugPrint("Fehler beim Unscan des Artikels: ${event.articleId}:");
|
||||
debugPrint("$e");
|
||||
debugPrint("$st");
|
||||
|
||||
opBloc.add(FailOperation(message: "Fehler beim Unscan des Artikels: $e"));
|
||||
}
|
||||
}
|
||||
|
||||
void _resetAmount(
|
||||
ResetScanAmountEvent event,
|
||||
Emitter<DeliveryState> emit,
|
||||
) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
final currentState = state;
|
||||
await repository.resetScan(event.articleId);
|
||||
|
||||
if (currentState is DeliveryLoaded) {
|
||||
Article article = currentState.delivery.articles.firstWhere(
|
||||
(article) => article.internalId == int.parse(event.articleId),
|
||||
);
|
||||
|
||||
article.removeNoteId = null;
|
||||
article.scannedRemovedAmount = 0;
|
||||
article.scannedAmount = article.amount;
|
||||
|
||||
List<Article> articles = [
|
||||
...currentState.delivery.articles.where(
|
||||
(article) => article.internalId != int.parse(event.articleId),
|
||||
),
|
||||
article,
|
||||
];
|
||||
currentState.delivery.articles = articles;
|
||||
|
||||
emit.call(currentState.copyWith(currentState.delivery));
|
||||
}
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
} catch (e, st) {
|
||||
debugPrint("Fehler beim Unscan des Artikels: ${event.articleId}:");
|
||||
debugPrint("$e");
|
||||
debugPrint("$st");
|
||||
|
||||
opBloc.add(FailOperation(message: "Fehler beim Zurücksetzen: $e"));
|
||||
}
|
||||
}
|
||||
}
|
||||
71
lib/feature/delivery/detail/bloc/delivery_event.dart
Normal file
71
lib/feature/delivery/detail/bloc/delivery_event.dart
Normal file
@ -0,0 +1,71 @@
|
||||
import 'package:hl_lieferservice/model/delivery.dart';
|
||||
import 'package:hl_lieferservice/model/tour.dart';
|
||||
|
||||
abstract class DeliveryEvent {}
|
||||
|
||||
class LoadDeliveryEvent extends DeliveryEvent {
|
||||
LoadDeliveryEvent({required this.delivery});
|
||||
|
||||
Delivery delivery;
|
||||
}
|
||||
|
||||
class UnscanArticleEvent extends DeliveryEvent {
|
||||
UnscanArticleEvent({
|
||||
required this.articleId,
|
||||
required this.newAmount,
|
||||
required this.reason,
|
||||
});
|
||||
|
||||
String articleId;
|
||||
String reason;
|
||||
int newAmount;
|
||||
}
|
||||
|
||||
class ResetScanAmountEvent extends DeliveryEvent {
|
||||
ResetScanAmountEvent({required this.articleId});
|
||||
|
||||
String articleId;
|
||||
}
|
||||
|
||||
class AddDiscountEvent extends DeliveryEvent {
|
||||
AddDiscountEvent({
|
||||
required this.deliveryId,
|
||||
required this.value,
|
||||
required this.reason,
|
||||
});
|
||||
|
||||
String deliveryId;
|
||||
String reason;
|
||||
int value;
|
||||
}
|
||||
|
||||
class RemoveDiscountEvent extends DeliveryEvent {
|
||||
RemoveDiscountEvent({required this.deliveryId});
|
||||
|
||||
String deliveryId;
|
||||
}
|
||||
|
||||
class UpdateDiscountEvent extends DeliveryEvent {
|
||||
UpdateDiscountEvent({
|
||||
required this.deliveryId,
|
||||
required this.value,
|
||||
required this.reason,
|
||||
});
|
||||
|
||||
String deliveryId;
|
||||
String? reason;
|
||||
int? value;
|
||||
}
|
||||
|
||||
class UpdateDeliveryOption extends DeliveryEvent {
|
||||
UpdateDeliveryOption({required this.key, required this.value});
|
||||
|
||||
String key;
|
||||
dynamic value;
|
||||
}
|
||||
|
||||
class UpdateSelectedPaymentMethod extends DeliveryEvent {
|
||||
UpdateSelectedPaymentMethod({required this.payment});
|
||||
|
||||
Payment payment;
|
||||
}
|
||||
15
lib/feature/delivery/detail/bloc/delivery_state.dart
Normal file
15
lib/feature/delivery/detail/bloc/delivery_state.dart
Normal file
@ -0,0 +1,15 @@
|
||||
import 'package:hl_lieferservice/model/delivery.dart';
|
||||
|
||||
abstract class DeliveryState {}
|
||||
|
||||
class DeliveryInitial extends DeliveryState {}
|
||||
|
||||
class DeliveryLoaded extends DeliveryState {
|
||||
DeliveryLoaded({required this.delivery});
|
||||
|
||||
Delivery delivery;
|
||||
|
||||
DeliveryLoaded copyWith(Delivery? delivery) {
|
||||
return DeliveryLoaded(delivery: delivery ?? this.delivery);
|
||||
}
|
||||
}
|
||||
188
lib/feature/delivery/detail/bloc/note_bloc.dart
Normal file
188
lib/feature/delivery/detail/bloc/note_bloc.dart
Normal file
@ -0,0 +1,188 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:hl_lieferservice/model/delivery.dart';
|
||||
import 'package:hl_lieferservice/widget/operations/bloc/operation_bloc.dart';
|
||||
import 'package:hl_lieferservice/widget/operations/bloc/operation_event.dart';
|
||||
|
||||
import 'note_event.dart';
|
||||
import 'note_state.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/repository/note_repository.dart';
|
||||
|
||||
class NoteBloc extends Bloc<NoteEvent, NoteState> {
|
||||
final NoteRepository repository;
|
||||
final OperationBloc opBloc;
|
||||
|
||||
NoteBloc({required this.repository, required this.opBloc})
|
||||
: super(NoteInitial()) {
|
||||
on<LoadNote>(_load);
|
||||
on<AddNote>(_add);
|
||||
on<EditNote>(_edit);
|
||||
on<RemoveNote>(_remove);
|
||||
on<AddImageNote>(_upload);
|
||||
on<RemoveImageNote>(_removeImage);
|
||||
}
|
||||
|
||||
Future<void> _removeImage(
|
||||
RemoveImageNote event,
|
||||
Emitter<NoteState> emit,
|
||||
) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
final currentState = state;
|
||||
await repository.deleteImage(event.deliveryId, event.objectId);
|
||||
|
||||
if (currentState is NoteLoaded) {
|
||||
emit.call(
|
||||
currentState.copyWith(
|
||||
images:
|
||||
currentState.images
|
||||
.where((image) => image.$1.objectId != event.objectId)
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
} catch (e, st) {
|
||||
debugPrint("Fehler beim Löschen des Bildes: $e");
|
||||
debugPrint(st.toString());
|
||||
|
||||
opBloc.add(FailOperation(message: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _upload(AddImageNote event, Emitter<NoteState> emit) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
final currentState = state;
|
||||
Uint8List imageBytes = await event.file.readAsBytes();
|
||||
ImageNote note = await repository.addImage(event.deliveryId, imageBytes);
|
||||
|
||||
if (currentState is NoteLoaded) {
|
||||
emit.call(
|
||||
currentState.copyWith(
|
||||
images: [...currentState.images, (note, imageBytes)],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
} catch (e, st) {
|
||||
debugPrint("Fehler beim Hinzufügen des Bildes: $e");
|
||||
debugPrint(st.toString());
|
||||
|
||||
opBloc.add(FailOperation(message: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _load(LoadNote event, Emitter<NoteState> emit) async {
|
||||
emit.call(NoteLoading());
|
||||
|
||||
try {
|
||||
List<String> urls =
|
||||
event.delivery.images.map((image) => image.url).toList();
|
||||
List<Note> notes = await repository.loadNotes(event.delivery.id);
|
||||
List<NoteTemplate> templates = await repository.loadTemplates();
|
||||
List<Uint8List> images = await repository.loadImages(urls);
|
||||
|
||||
emit.call(
|
||||
NoteLoaded(
|
||||
notes: notes,
|
||||
templates: templates,
|
||||
images: List.generate(
|
||||
images.length,
|
||||
(index) => (event.delivery.images[index], images[index]),
|
||||
),
|
||||
),
|
||||
);
|
||||
opBloc.add(FinishOperation());
|
||||
} catch (e, st) {
|
||||
debugPrint("Fehler beim Herunterladen der Notizen: $e");
|
||||
debugPrint(st.toString());
|
||||
|
||||
opBloc.add(
|
||||
FailOperation(message: "Notizen konnten nicht heruntergeladen werden."),
|
||||
);
|
||||
|
||||
emit.call(NoteLoadingFailed());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _add(AddNote event, Emitter<NoteState> emit) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
final currentState = state;
|
||||
Note note = await repository.addNote(event.deliveryId, event.note);
|
||||
|
||||
if (currentState is NoteLoaded) {
|
||||
List<Note> refreshedNotes = [...currentState.notes, note];
|
||||
emit.call(currentState.copyWith(notes: refreshedNotes));
|
||||
}
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
} catch (e, st) {
|
||||
debugPrint("Fehler beim Hinzufügen der Notiz: $e");
|
||||
debugPrint(st.toString());
|
||||
|
||||
opBloc.add(FailOperation(message: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _edit(EditNote event, Emitter<NoteState> emit) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
final currentState = state;
|
||||
await repository.editNote(event.noteId, event.content);
|
||||
|
||||
if (currentState is NoteLoaded) {
|
||||
List<Note> refreshedNotes = [
|
||||
...currentState.notes.where(
|
||||
(note) => note.id != int.parse(event.noteId),
|
||||
),
|
||||
Note(content: event.content, id: int.parse(event.noteId)),
|
||||
];
|
||||
emit.call(currentState.copyWith(notes: refreshedNotes));
|
||||
}
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
} catch (e, st) {
|
||||
debugPrint("Fehler beim Hinzufügen der Notiz: $e");
|
||||
debugPrint(st.toString());
|
||||
|
||||
opBloc.add(FailOperation(message: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _remove(RemoveNote event, Emitter<NoteState> emit) async {
|
||||
opBloc.add(LoadOperation());
|
||||
|
||||
try {
|
||||
final currentState = state;
|
||||
await repository.deleteNote(event.noteId);
|
||||
|
||||
if (currentState is NoteLoaded) {
|
||||
List<Note> refreshedNotes =
|
||||
currentState.notes
|
||||
.where((note) => note.id != int.parse(event.noteId))
|
||||
.toList();
|
||||
|
||||
emit.call(currentState.copyWith(notes: refreshedNotes));
|
||||
}
|
||||
|
||||
opBloc.add(FinishOperation());
|
||||
} catch (e, st) {
|
||||
debugPrint("Fehler beim Hinzufügen der Notiz: $e");
|
||||
debugPrint(st.toString());
|
||||
|
||||
opBloc.add(
|
||||
FailOperation(message: "Notizen konnte nicht gelöscht werden."),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
44
lib/feature/delivery/detail/bloc/note_event.dart
Normal file
44
lib/feature/delivery/detail/bloc/note_event.dart
Normal file
@ -0,0 +1,44 @@
|
||||
import 'package:hl_lieferservice/model/delivery.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
|
||||
abstract class NoteEvent {}
|
||||
|
||||
class LoadNote extends NoteEvent {
|
||||
LoadNote({required this.delivery});
|
||||
|
||||
final Delivery delivery;
|
||||
}
|
||||
|
||||
class AddNote extends NoteEvent {
|
||||
AddNote({required this.note, required this.deliveryId});
|
||||
|
||||
final String note;
|
||||
final String deliveryId;
|
||||
}
|
||||
|
||||
class RemoveNote extends NoteEvent {
|
||||
RemoveNote({required this.noteId});
|
||||
|
||||
final String noteId;
|
||||
}
|
||||
|
||||
class EditNote extends NoteEvent {
|
||||
EditNote({required this.content, required this.noteId});
|
||||
|
||||
final String noteId;
|
||||
final String content;
|
||||
}
|
||||
|
||||
class AddImageNote extends NoteEvent {
|
||||
AddImageNote({required this.file, required this.deliveryId});
|
||||
|
||||
final XFile file;
|
||||
final String deliveryId;
|
||||
}
|
||||
|
||||
class RemoveImageNote extends NoteEvent {
|
||||
RemoveImageNote({required this.objectId, required this.deliveryId});
|
||||
|
||||
final String objectId;
|
||||
final String deliveryId;
|
||||
}
|
||||
35
lib/feature/delivery/detail/bloc/note_state.dart
Normal file
35
lib/feature/delivery/detail/bloc/note_state.dart
Normal file
@ -0,0 +1,35 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:hl_lieferservice/model/delivery.dart';
|
||||
|
||||
abstract class NoteState {}
|
||||
|
||||
class NoteInitial extends NoteState {}
|
||||
|
||||
class NoteLoading extends NoteState {}
|
||||
|
||||
class NoteLoadingFailed extends NoteState {}
|
||||
|
||||
class NoteLoaded extends NoteState {
|
||||
NoteLoaded({
|
||||
required this.notes,
|
||||
required this.templates,
|
||||
required this.images,
|
||||
});
|
||||
|
||||
List<Note> notes;
|
||||
List<NoteTemplate> templates;
|
||||
List<(ImageNote, Uint8List)> images;
|
||||
|
||||
NoteLoaded copyWith({
|
||||
List<Note>? notes,
|
||||
List<NoteTemplate>? templates,
|
||||
List<(ImageNote, Uint8List)>? images,
|
||||
}) {
|
||||
return NoteLoaded(
|
||||
notes: notes ?? this.notes,
|
||||
templates: templates ?? this.templates,
|
||||
images: images ?? this.images,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user