所有一级页面和不分二级页面
This commit is contained in:
80
lib/features/v2/report/presentation/states/report_state.dart
Normal file
80
lib/features/v2/report/presentation/states/report_state.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import '../../domain/entities/report_entity.dart';
|
||||
import '../constants/report_constants.dart';
|
||||
|
||||
/// 上报页面状态抽象类
|
||||
abstract class ReportState extends Equatable {
|
||||
const ReportState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
/// 初始状态
|
||||
class ReportInitial extends ReportState {}
|
||||
|
||||
/// 加载中状态
|
||||
class ReportLoading extends ReportState {}
|
||||
|
||||
/// 提交中状态
|
||||
class ReportSubmitting extends ReportState {}
|
||||
|
||||
/// 提交成功状态
|
||||
class ReportSuccess extends ReportState {}
|
||||
|
||||
/// 提交失败状态
|
||||
class ReportFailure extends ReportState {
|
||||
final String message;
|
||||
|
||||
const ReportFailure(this.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
/// 表单数据状态
|
||||
class ReportFormState extends ReportState {
|
||||
final ReportEntity report;
|
||||
final ReportType? selectedReportType;
|
||||
final ProblemLevel? selectedProblemLevel;
|
||||
final String location;
|
||||
final String? selectedDevice;
|
||||
final List<String> mediaFiles;
|
||||
|
||||
const ReportFormState({
|
||||
required this.report,
|
||||
this.selectedReportType,
|
||||
this.selectedProblemLevel,
|
||||
this.location = '江苏省苏州市吴中区',
|
||||
this.selectedDevice,
|
||||
this.mediaFiles = const [],
|
||||
});
|
||||
|
||||
ReportFormState copyWith({
|
||||
ReportEntity? report,
|
||||
ReportType? selectedReportType,
|
||||
ProblemLevel? selectedProblemLevel,
|
||||
String? location,
|
||||
String? selectedDevice,
|
||||
List<String>? mediaFiles,
|
||||
}) {
|
||||
return ReportFormState(
|
||||
report: report ?? this.report,
|
||||
selectedReportType: selectedReportType ?? this.selectedReportType,
|
||||
selectedProblemLevel: selectedProblemLevel ?? this.selectedProblemLevel,
|
||||
location: location ?? this.location,
|
||||
selectedDevice: selectedDevice ?? this.selectedDevice,
|
||||
mediaFiles: mediaFiles ?? this.mediaFiles,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
report,
|
||||
selectedReportType,
|
||||
selectedProblemLevel,
|
||||
location,
|
||||
selectedDevice,
|
||||
mediaFiles,
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user