From 4673709dcba00a555b7b23756b21d291340ab266 Mon Sep 17 00:00:00 2001 From: wgh19 Date: Wed, 15 May 2024 12:56:27 +0800 Subject: [PATCH] search popular --- lib/network/models.dart | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/network/models.dart b/lib/network/models.dart index 2cc9e6d..38624df 100644 --- a/lib/network/models.dart +++ b/lib/network/models.dart @@ -259,26 +259,43 @@ enum FavoriteNumber { enum SearchSort { newToOld, oldToNew, - popular; + popular, + popularMale, + popularFemale; bool get isPremium => appdata.account?.user.isPremium == true; + static List 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 toString() { if(this == SearchSort.popular) { return isPremium ? "Popular" : "Popular(limited)"; } else if(this == SearchSort.newToOld) { return "New to old"; - } else { + } else if(this == SearchSort.oldToNew){ return "Old to new"; + } else if(this == SearchSort.popularMale){ + return "Popular(Male)"; + } else { + return "Popular(Female)"; } } String toParam() => switch(this) { SearchSort.newToOld => "date_desc", SearchSort.oldToNew => "date_asc", - // TODO: 等我开个会员 - SearchSort.popular => "", + SearchSort.popular => "popular_desc", + SearchSort.popularMale => "popular_male_desc", + SearchSort.popularFemale => "popular_female_desc", }; }