fix:对比原型增加功能交互
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
class ReportQuery {
|
||||
const ReportQuery({
|
||||
this.search = '',
|
||||
this.topic,
|
||||
this.institutionId,
|
||||
this.hasAudio = false,
|
||||
this.sort = ReportSort.latest,
|
||||
});
|
||||
|
||||
final String search;
|
||||
final String? topic;
|
||||
final String? institutionId;
|
||||
final bool hasAudio;
|
||||
final ReportSort sort;
|
||||
|
||||
bool get hasActiveFilter =>
|
||||
search.trim().isNotEmpty ||
|
||||
topic != null ||
|
||||
institutionId != null ||
|
||||
hasAudio ||
|
||||
sort != ReportSort.latest;
|
||||
|
||||
ReportQuery copyWith({
|
||||
String? search,
|
||||
Object? topic = _sentinel,
|
||||
Object? institutionId = _sentinel,
|
||||
bool? hasAudio,
|
||||
ReportSort? sort,
|
||||
}) {
|
||||
return ReportQuery(
|
||||
search: search ?? this.search,
|
||||
topic: identical(topic, _sentinel) ? this.topic : topic as String?,
|
||||
institutionId: identical(institutionId, _sentinel)
|
||||
? this.institutionId
|
||||
: institutionId as String?,
|
||||
hasAudio: hasAudio ?? this.hasAudio,
|
||||
sort: sort ?? this.sort,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
enum ReportSort { latest, oldest }
|
||||
|
||||
const Object _sentinel = Object();
|
||||
Reference in New Issue
Block a user