40 lines
842 B
Dart
40 lines
842 B
Dart
import '../../models/models.dart';
|
|
|
|
class AddBookState {
|
|
final String title;
|
|
final String author;
|
|
final String annotation;
|
|
final String genre;
|
|
final Book? editBook;
|
|
final bool isSaved;
|
|
|
|
const AddBookState({
|
|
this.title = '',
|
|
this.author = '',
|
|
this.annotation = '',
|
|
this.genre = 'fiction',
|
|
this.editBook,
|
|
this.isSaved = false,
|
|
});
|
|
|
|
bool get isEditing => editBook != null;
|
|
|
|
AddBookState copyWith({
|
|
String? title,
|
|
String? author,
|
|
String? annotation,
|
|
String? genre,
|
|
Book? editBook,
|
|
bool? isSaved,
|
|
}) {
|
|
return AddBookState(
|
|
title: title ?? this.title,
|
|
author: author ?? this.author,
|
|
annotation: annotation ?? this.annotation,
|
|
genre: genre ?? this.genre,
|
|
editBook: editBook ?? this.editBook,
|
|
isSaved: isSaved ?? this.isSaved,
|
|
);
|
|
}
|
|
}
|