search popular

This commit is contained in:
wgh19
2024-05-15 12:56:27 +08:00
parent e59d15f685
commit 4673709dcb

View File

@@ -259,26 +259,43 @@ enum FavoriteNumber {
enum SearchSort { enum SearchSort {
newToOld, newToOld,
oldToNew, oldToNew,
popular; popular,
popularMale,
popularFemale;
bool get isPremium => appdata.account?.user.isPremium == true; bool get isPremium => appdata.account?.user.isPremium == true;
static List<SearchSort> get availableValues => [
SearchSort.newToOld,
SearchSort.oldToNew,
SearchSort.popular,
if(appdata.account?.user.isPremium == true)
SearchSort.popularMale,
if(appdata.account?.user.isPremium == true)
SearchSort.popularFemale
];
@override @override
toString() { toString() {
if(this == SearchSort.popular) { if(this == SearchSort.popular) {
return isPremium ? "Popular" : "Popular(limited)"; return isPremium ? "Popular" : "Popular(limited)";
} else if(this == SearchSort.newToOld) { } else if(this == SearchSort.newToOld) {
return "New to old"; return "New to old";
} else { } else if(this == SearchSort.oldToNew){
return "Old to new"; return "Old to new";
} else if(this == SearchSort.popularMale){
return "Popular(Male)";
} else {
return "Popular(Female)";
} }
} }
String toParam() => switch(this) { String toParam() => switch(this) {
SearchSort.newToOld => "date_desc", SearchSort.newToOld => "date_desc",
SearchSort.oldToNew => "date_asc", SearchSort.oldToNew => "date_asc",
// TODO: 等我开个会员 SearchSort.popular => "popular_desc",
SearchSort.popular => "", SearchSort.popularMale => "popular_male_desc",
SearchSort.popularFemale => "popular_female_desc",
}; };
} }