Files
bookshelf/books_flutter/lib/bloc/add_book/add_book_state.dart
2026-02-08 12:05:05 +06:00

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,
);
}
}