45 lines
964 B
Dart
Raw Normal View History

2024-11-28 15:46:10 +04:00
import 'package:equatable/equatable.dart';
2024-12-17 11:50:32 +04:00
import 'package:copy_with_extension/copy_with_extension.dart';
2024-11-28 15:46:10 +04:00
import 'package:pmd_lab/domain/models/card.dart';
2024-12-17 11:50:32 +04:00
import 'package:pmd_lab/domain/models/home.dart';
2024-11-28 15:46:10 +04:00
2024-12-17 11:50:32 +04:00
part 'state.g.dart';
2024-11-28 15:46:10 +04:00
2024-12-17 11:50:32 +04:00
@CopyWith()
2024-11-28 15:46:10 +04:00
class HomeState extends Equatable {
2024-12-17 11:50:32 +04:00
final HomeData? data;
2024-11-28 15:46:10 +04:00
final bool isLoading;
2024-12-17 11:50:32 +04:00
final bool isPaginationLoading;
final String? error;
2024-11-28 15:46:10 +04:00
const HomeState({
this.data,
this.isLoading = false,
2024-12-17 11:50:32 +04:00
this.isPaginationLoading = false,
this.error,
2024-11-28 15:46:10 +04:00
});
HomeState copyWith({
2024-12-17 11:50:32 +04:00
HomeData? data,
2024-11-28 15:46:10 +04:00
bool? isLoading,
2024-12-17 11:50:32 +04:00
bool? isPaginationLoading,
String? error,
2024-11-28 15:46:10 +04:00
}) =>
HomeState(
data: data ?? this.data,
isLoading: isLoading ?? this.isLoading,
2024-12-17 11:50:32 +04:00
isPaginationLoading: isPaginationLoading ?? this.isPaginationLoading,
error: error ?? this.error,
2024-11-28 15:46:10 +04:00
);
@override
List<Object?> get props => [
data,
isLoading,
2024-12-17 11:50:32 +04:00
isPaginationLoading,
error,
2024-11-28 15:46:10 +04:00
];
}