mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
Compare commits
4 Commits
26a5b7b7a7
...
edb5ea7a7a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edb5ea7a7a | ||
|
|
b4c1568869 | ||
|
|
83e25ec0bf | ||
|
|
6d55321699 |
@@ -850,6 +850,12 @@ class Api {
|
|||||||
|
|
||||||
static const String dynReserve = '/x/dynamic/feed/reserve/click';
|
static const String dynReserve = '/x/dynamic/feed/reserve/click';
|
||||||
|
|
||||||
|
static const String favPugv = '/pugv/app/web/favorite/page';
|
||||||
|
|
||||||
|
static const String addFavPugv = '/pugv/app/web/favorite/add';
|
||||||
|
|
||||||
|
static const String delFavPugv = '/pugv/app/web/favorite/del';
|
||||||
|
|
||||||
static const String favTopicList = '/x/topic/web/fav/list';
|
static const String favTopicList = '/x/topic/web/fav/list';
|
||||||
|
|
||||||
static const String addFavTopic = '/x/topic/fav/sub/add';
|
static const String addFavTopic = '/x/topic/fav/sub/add';
|
||||||
@@ -920,6 +926,8 @@ class Api {
|
|||||||
|
|
||||||
static const String spaceAudio = '/audio/music-service/web/song/upper';
|
static const String spaceAudio = '/audio/music-service/web/song/upper';
|
||||||
|
|
||||||
|
static const String spaceCheese = '/pugv/app/web/season/page';
|
||||||
|
|
||||||
static const String dynMention = '/x/polymer/web-dynamic/v1/mention/search';
|
static const String dynMention = '/x/polymer/web-dynamic/v1/mention/search';
|
||||||
|
|
||||||
static const String createVote = '/x/vote/create';
|
static const String createVote = '/x/vote/create';
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:PiliPlus/models_new/fav/fav_folder/list.dart';
|
|||||||
import 'package:PiliPlus/models_new/fav/fav_note/list.dart';
|
import 'package:PiliPlus/models_new/fav/fav_note/list.dart';
|
||||||
import 'package:PiliPlus/models_new/fav/fav_pgc/data.dart';
|
import 'package:PiliPlus/models_new/fav/fav_pgc/data.dart';
|
||||||
import 'package:PiliPlus/models_new/fav/fav_topic/data.dart';
|
import 'package:PiliPlus/models_new/fav/fav_topic/data.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/data.dart';
|
||||||
import 'package:PiliPlus/models_new/space/space_fav/data.dart';
|
import 'package:PiliPlus/models_new/space/space_fav/data.dart';
|
||||||
import 'package:PiliPlus/models_new/sub/sub_detail/data.dart';
|
import 'package:PiliPlus/models_new/sub/sub_detail/data.dart';
|
||||||
import 'package:PiliPlus/utils/accounts.dart';
|
import 'package:PiliPlus/utils/accounts.dart';
|
||||||
@@ -142,6 +143,58 @@ class FavHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<LoadingState<SpaceCheeseData>> favPugv({
|
||||||
|
required int mid,
|
||||||
|
required int page,
|
||||||
|
}) async {
|
||||||
|
var res = await Request().get(
|
||||||
|
Api.favPugv,
|
||||||
|
queryParameters: {
|
||||||
|
'mid': mid,
|
||||||
|
'ps': 20,
|
||||||
|
'pn': page,
|
||||||
|
'web_location': 333.1387,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return Success(SpaceCheeseData.fromJson(res.data['data']));
|
||||||
|
} else {
|
||||||
|
return Error(res.data['message']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future addFavPugv(seasonId) async {
|
||||||
|
var res = await Request().post(
|
||||||
|
Api.addFavPugv,
|
||||||
|
data: {
|
||||||
|
'season_id': seasonId,
|
||||||
|
'csrf': Accounts.main.csrf,
|
||||||
|
},
|
||||||
|
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {'status': true};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'msg': res.data['message']};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future delFavPugv(seasonId) async {
|
||||||
|
var res = await Request().post(
|
||||||
|
Api.delFavPugv,
|
||||||
|
data: {
|
||||||
|
'season_id': seasonId,
|
||||||
|
'csrf': Accounts.main.csrf,
|
||||||
|
},
|
||||||
|
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {'status': true};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'msg': res.data['message']};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Future<LoadingState<FavTopicData>> favTopic({
|
static Future<LoadingState<FavTopicData>> favTopic({
|
||||||
required int page,
|
required int page,
|
||||||
}) async {
|
}) async {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import 'package:PiliPlus/models_new/space/space/data.dart';
|
|||||||
import 'package:PiliPlus/models_new/space/space_archive/data.dart';
|
import 'package:PiliPlus/models_new/space/space_archive/data.dart';
|
||||||
import 'package:PiliPlus/models_new/space/space_article/data.dart';
|
import 'package:PiliPlus/models_new/space/space_article/data.dart';
|
||||||
import 'package:PiliPlus/models_new/space/space_audio/data.dart';
|
import 'package:PiliPlus/models_new/space/space_audio/data.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/data.dart';
|
||||||
import 'package:PiliPlus/models_new/space/space_opus/data.dart';
|
import 'package:PiliPlus/models_new/space/space_opus/data.dart';
|
||||||
import 'package:PiliPlus/models_new/space/space_season_series/item.dart';
|
import 'package:PiliPlus/models_new/space/space_season_series/item.dart';
|
||||||
import 'package:PiliPlus/models_new/upower_rank/data.dart';
|
import 'package:PiliPlus/models_new/upower_rank/data.dart';
|
||||||
@@ -186,6 +187,26 @@ class MemberHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<LoadingState<SpaceCheeseData>> spaceCheese({
|
||||||
|
required int page,
|
||||||
|
required mid,
|
||||||
|
}) async {
|
||||||
|
var res = await Request().get(
|
||||||
|
Api.spaceCheese,
|
||||||
|
queryParameters: {
|
||||||
|
'pn': page,
|
||||||
|
'ps': 30,
|
||||||
|
'mid': mid,
|
||||||
|
'web_location': 333.1387,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return Success(SpaceCheeseData.fromJson(res.data['data']));
|
||||||
|
} else {
|
||||||
|
return Error(res.data['message']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Future<LoadingState> spaceStory({
|
static Future<LoadingState> spaceStory({
|
||||||
required mid,
|
required mid,
|
||||||
required aid,
|
required aid,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:PiliPlus/pages/fav/article/view.dart';
|
import 'package:PiliPlus/pages/fav/article/view.dart';
|
||||||
|
import 'package:PiliPlus/pages/fav/cheese/view.dart';
|
||||||
import 'package:PiliPlus/pages/fav/note/view.dart';
|
import 'package:PiliPlus/pages/fav/note/view.dart';
|
||||||
import 'package:PiliPlus/pages/fav/pgc/view.dart';
|
import 'package:PiliPlus/pages/fav/pgc/view.dart';
|
||||||
import 'package:PiliPlus/pages/fav/topic/view.dart';
|
import 'package:PiliPlus/pages/fav/topic/view.dart';
|
||||||
@@ -11,7 +12,8 @@ enum FavTabType {
|
|||||||
cinema('追剧', FavPgcPage(type: 2)),
|
cinema('追剧', FavPgcPage(type: 2)),
|
||||||
article('专栏', FavArticlePage()),
|
article('专栏', FavArticlePage()),
|
||||||
note('笔记', FavNotePage()),
|
note('笔记', FavNotePage()),
|
||||||
topic('话题', FavTopicPage());
|
topic('话题', FavTopicPage()),
|
||||||
|
cheese('课堂', FavCheesePage());
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final Widget page;
|
final Widget page;
|
||||||
|
|||||||
@@ -4,7 +4,17 @@ enum MemberTabType {
|
|||||||
dynamic('动态'),
|
dynamic('动态'),
|
||||||
contribute('投稿'),
|
contribute('投稿'),
|
||||||
favorite('收藏'),
|
favorite('收藏'),
|
||||||
bangumi('番剧');
|
bangumi('番剧'),
|
||||||
|
cheese('课堂');
|
||||||
|
|
||||||
|
static bool contains(String type) {
|
||||||
|
for (var e in MemberTabType.values) {
|
||||||
|
if (e.name == type) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
const MemberTabType(this.title);
|
const MemberTabType(this.title);
|
||||||
|
|||||||
27
lib/models/common/search/article_search_type.dart
Normal file
27
lib/models/common/search/article_search_type.dart
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
enum ArticleOrderType {
|
||||||
|
totalrank('综合排序'),
|
||||||
|
pubdate('最新发布'),
|
||||||
|
click('最多点击'),
|
||||||
|
attention('最多喜欢'),
|
||||||
|
scores('最多评论');
|
||||||
|
|
||||||
|
String get order => name;
|
||||||
|
final String label;
|
||||||
|
const ArticleOrderType(this.label);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ArticleZoneType {
|
||||||
|
all('全部分区', 0),
|
||||||
|
douga('动画', 2),
|
||||||
|
game('游戏', 1),
|
||||||
|
cinephile('影视', 28),
|
||||||
|
life('生活', 3),
|
||||||
|
interest('兴趣', 29),
|
||||||
|
novel('轻小说', 16),
|
||||||
|
tech('科技', 17),
|
||||||
|
note('笔记', 41);
|
||||||
|
|
||||||
|
final String label;
|
||||||
|
final int categoryId;
|
||||||
|
const ArticleZoneType(this.label, this.categoryId);
|
||||||
|
}
|
||||||
22
lib/models/common/search/user_search_type.dart
Normal file
22
lib/models/common/search/user_search_type.dart
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
enum UserOrderType {
|
||||||
|
def('默认排序', 0, ''),
|
||||||
|
fansDesc('粉丝数由高到低', 0, 'fans'),
|
||||||
|
fansAsc('粉丝数由低到高', 1, 'fans'),
|
||||||
|
levelDesc('Lv等级由高到低', 0, 'level'),
|
||||||
|
levelAsc('Lv等级由低到高', 1, 'level');
|
||||||
|
|
||||||
|
final String label;
|
||||||
|
final int orderSort;
|
||||||
|
final String order;
|
||||||
|
const UserOrderType(this.label, this.orderSort, this.order);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum UserType {
|
||||||
|
all('全部用户'),
|
||||||
|
up('UP主'),
|
||||||
|
common('普通用户'),
|
||||||
|
verified('认证用户');
|
||||||
|
|
||||||
|
final String label;
|
||||||
|
const UserType(this.label);
|
||||||
|
}
|
||||||
49
lib/models/common/search/video_search_type.dart
Normal file
49
lib/models/common/search/video_search_type.dart
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
enum VideoPubTimeType {
|
||||||
|
all('不限'),
|
||||||
|
day('最近一天'),
|
||||||
|
week('最近一周'),
|
||||||
|
halfYear('最近半年');
|
||||||
|
|
||||||
|
final String label;
|
||||||
|
const VideoPubTimeType(this.label);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum VideoDurationType {
|
||||||
|
all('全部时长'),
|
||||||
|
tenMins('0-10分钟'),
|
||||||
|
halfHour('0-30分钟'),
|
||||||
|
hour('30-60分钟'),
|
||||||
|
hourPlus('60分钟+');
|
||||||
|
|
||||||
|
final String label;
|
||||||
|
const VideoDurationType(this.label);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum VideoZoneType {
|
||||||
|
all('全部'),
|
||||||
|
douga('动画', tids: 1),
|
||||||
|
anime('番剧', tids: 13),
|
||||||
|
guochuang('国创', tids: 167),
|
||||||
|
music('音乐', tids: 3),
|
||||||
|
dance('舞蹈', tids: 129),
|
||||||
|
game('游戏', tids: 4),
|
||||||
|
knowledge('知识', tids: 36),
|
||||||
|
tech('科技', tids: 188),
|
||||||
|
sports('运动', tids: 234),
|
||||||
|
car('汽车', tids: 223),
|
||||||
|
life('生活', tids: 160),
|
||||||
|
food('美食', tids: 221),
|
||||||
|
animal('动物', tids: 217),
|
||||||
|
kichiku('鬼畜', tids: 119),
|
||||||
|
fashion('时尚', tids: 115),
|
||||||
|
info('资讯', tids: 202),
|
||||||
|
ent('娱乐', tids: 5),
|
||||||
|
cinephile('影视', tids: 181),
|
||||||
|
documentary('记录', tids: 177),
|
||||||
|
movie('电影', tids: 23),
|
||||||
|
tv('电视', tids: 11);
|
||||||
|
|
||||||
|
final String label;
|
||||||
|
final int? tids;
|
||||||
|
const VideoZoneType(this.label, {this.tids});
|
||||||
|
}
|
||||||
@@ -11,16 +11,16 @@ class Brief {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Img {
|
class Img {
|
||||||
num? aspectRatio;
|
num aspectRatio;
|
||||||
String? url;
|
String? url;
|
||||||
|
|
||||||
Img({
|
Img({
|
||||||
this.aspectRatio,
|
required this.aspectRatio,
|
||||||
this.url,
|
this.url,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Img.fromJson(Map<String, dynamic> json) => Img(
|
factory Img.fromJson(Map<String, dynamic> json) => Img(
|
||||||
aspectRatio: json['aspect_ratio'],
|
aspectRatio: json['aspect_ratio'] ?? 1,
|
||||||
url: json['url'] as String?,
|
url: json['url'] as String?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class UserStatus {
|
|||||||
int? payPackPaid;
|
int? payPackPaid;
|
||||||
int? sponsor;
|
int? sponsor;
|
||||||
UserProgress? progress;
|
UserProgress? progress;
|
||||||
|
int? favored;
|
||||||
|
|
||||||
UserStatus({
|
UserStatus({
|
||||||
this.areaLimit,
|
this.areaLimit,
|
||||||
@@ -21,6 +22,7 @@ class UserStatus {
|
|||||||
this.payPackPaid,
|
this.payPackPaid,
|
||||||
this.sponsor,
|
this.sponsor,
|
||||||
this.progress,
|
this.progress,
|
||||||
|
this.favored,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory UserStatus.fromJson(Map<String, dynamic> json) => UserStatus(
|
factory UserStatus.fromJson(Map<String, dynamic> json) => UserStatus(
|
||||||
@@ -35,5 +37,6 @@ class UserStatus {
|
|||||||
progress: json['progress'] == null
|
progress: json['progress'] == null
|
||||||
? null
|
? null
|
||||||
: UserProgress.fromJson(json['progress']),
|
: UserProgress.fromJson(json['progress']),
|
||||||
|
favored: json['favored'] as int?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
19
lib/models_new/space/space_cheese/data.dart
Normal file
19
lib/models_new/space/space_cheese/data.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/item.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/page.dart';
|
||||||
|
|
||||||
|
class SpaceCheeseData {
|
||||||
|
List<SpaceCheeseItem>? items;
|
||||||
|
SpaceCheesePage? page;
|
||||||
|
|
||||||
|
SpaceCheeseData({this.items, this.page});
|
||||||
|
|
||||||
|
factory SpaceCheeseData.fromJson(Map<String, dynamic> json) =>
|
||||||
|
SpaceCheeseData(
|
||||||
|
items: (json['items'] as List<dynamic>?)
|
||||||
|
?.map((e) => SpaceCheeseItem.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
page: json['page'] == null
|
||||||
|
? null
|
||||||
|
: SpaceCheesePage.fromJson(json['page'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
}
|
||||||
48
lib/models_new/space/space_cheese/item.dart
Normal file
48
lib/models_new/space/space_cheese/item.dart
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
class SpaceCheeseItem {
|
||||||
|
bool? cooperated;
|
||||||
|
String? cooperationMark;
|
||||||
|
String? cover;
|
||||||
|
int? epCount;
|
||||||
|
String? link;
|
||||||
|
List<String>? marks;
|
||||||
|
int? page;
|
||||||
|
int? play;
|
||||||
|
int? seasonId;
|
||||||
|
String? status;
|
||||||
|
String? subtitle;
|
||||||
|
String? title;
|
||||||
|
String? ctime;
|
||||||
|
|
||||||
|
SpaceCheeseItem({
|
||||||
|
this.cooperated,
|
||||||
|
this.cooperationMark,
|
||||||
|
this.cover,
|
||||||
|
this.epCount,
|
||||||
|
this.link,
|
||||||
|
this.marks,
|
||||||
|
this.page,
|
||||||
|
this.play,
|
||||||
|
this.seasonId,
|
||||||
|
this.status,
|
||||||
|
this.subtitle,
|
||||||
|
this.title,
|
||||||
|
this.ctime,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory SpaceCheeseItem.fromJson(Map<String, dynamic> json) =>
|
||||||
|
SpaceCheeseItem(
|
||||||
|
cooperated: json['cooperated'] as bool?,
|
||||||
|
cooperationMark: json['cooperation_mark'] as String?,
|
||||||
|
cover: json['cover'] as String?,
|
||||||
|
epCount: json['ep_count'] as int?,
|
||||||
|
link: json['link'] as String?,
|
||||||
|
marks: (json['marks'] as List?)?.cast(),
|
||||||
|
page: json['page'] as int?,
|
||||||
|
play: json['play'] as int?,
|
||||||
|
seasonId: json['season_id'] as int?,
|
||||||
|
status: json['status'] as String?,
|
||||||
|
subtitle: json['subtitle'] as String?,
|
||||||
|
title: json['title'] as String?,
|
||||||
|
ctime: json['ctime'] as String?,
|
||||||
|
);
|
||||||
|
}
|
||||||
16
lib/models_new/space/space_cheese/page.dart
Normal file
16
lib/models_new/space/space_cheese/page.dart
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class SpaceCheesePage {
|
||||||
|
bool? next;
|
||||||
|
int? num;
|
||||||
|
int? size;
|
||||||
|
int? total;
|
||||||
|
|
||||||
|
SpaceCheesePage({this.next, this.num, this.size, this.total});
|
||||||
|
|
||||||
|
factory SpaceCheesePage.fromJson(Map<String, dynamic> json) =>
|
||||||
|
SpaceCheesePage(
|
||||||
|
next: json['next'] as bool?,
|
||||||
|
num: json['num'] as int?,
|
||||||
|
size: json['size'] as int?,
|
||||||
|
total: json['total'] as int?,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -81,10 +81,10 @@ mixin DeleteItemMixin<R, T extends MultiSelectData>
|
|||||||
} else {
|
} else {
|
||||||
list.removeWhere(removeList.contains);
|
list.removeWhere(removeList.contains);
|
||||||
}
|
}
|
||||||
if (!isEnd) {
|
if (list.isNotEmpty || isEnd) {
|
||||||
onReload();
|
|
||||||
} else {
|
|
||||||
loadingState.refresh();
|
loadingState.refresh();
|
||||||
|
} else {
|
||||||
|
onReload();
|
||||||
}
|
}
|
||||||
if (enableMultiSelect.value) {
|
if (enableMultiSelect.value) {
|
||||||
rxCount.value = 0;
|
rxCount.value = 0;
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import 'package:PiliPlus/http/loading_state.dart';
|
|||||||
import 'package:PiliPlus/models_new/dynamic/dyn_mention/group.dart';
|
import 'package:PiliPlus/models_new/dynamic/dyn_mention/group.dart';
|
||||||
import 'package:PiliPlus/pages/dynamics_mention/controller.dart';
|
import 'package:PiliPlus/pages/dynamics_mention/controller.dart';
|
||||||
import 'package:PiliPlus/pages/dynamics_mention/widgets/item.dart';
|
import 'package:PiliPlus/pages/dynamics_mention/widgets/item.dart';
|
||||||
|
import 'package:PiliPlus/pages/search/controller.dart';
|
||||||
import 'package:PiliPlus/utils/context_ext.dart';
|
import 'package:PiliPlus/utils/context_ext.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart' hide ContextExtensionss;
|
import 'package:get/get.dart' hide ContextExtensionss;
|
||||||
import 'package:stream_transform/stream_transform.dart';
|
|
||||||
|
|
||||||
class DynMentionPanel extends StatefulWidget {
|
class DynMentionPanel extends StatefulWidget {
|
||||||
const DynMentionPanel({
|
const DynMentionPanel({
|
||||||
@@ -58,10 +58,11 @@ class DynMentionPanel extends StatefulWidget {
|
|||||||
State<DynMentionPanel> createState() => _DynMentionPanelState();
|
State<DynMentionPanel> createState() => _DynMentionPanelState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DynMentionPanelState extends State<DynMentionPanel> {
|
class _DynMentionPanelState extends State<DynMentionPanel>
|
||||||
|
with SearchKeywordMixin {
|
||||||
final _controller = Get.put(DynMentionController());
|
final _controller = Get.put(DynMentionController());
|
||||||
final StreamController<String> _ctr = StreamController<String>();
|
@override
|
||||||
late StreamSubscription<String> _sub;
|
Duration get duration => const Duration(milliseconds: 300);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -69,26 +70,25 @@ class _DynMentionPanelState extends State<DynMentionPanel> {
|
|||||||
if (_controller.loadingState.value is Error) {
|
if (_controller.loadingState.value is Error) {
|
||||||
_controller.onReload();
|
_controller.onReload();
|
||||||
}
|
}
|
||||||
_sub = _ctr.stream
|
subInit();
|
||||||
.debounce(const Duration(milliseconds: 300), trailing: true)
|
|
||||||
.listen((value) {
|
|
||||||
_controller
|
|
||||||
..enableClear.value = value.isNotEmpty
|
|
||||||
..onRefresh().whenComplete(
|
|
||||||
() => WidgetsBinding.instance.addPostFrameCallback(
|
|
||||||
(_) => widget.scrollController?.jumpToTop(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_sub.cancel();
|
subDispose();
|
||||||
_ctr.close();
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
ValueChanged<String> get onKeywordChanged =>
|
||||||
|
(value) => _controller
|
||||||
|
..enableClear.value = value.isNotEmpty
|
||||||
|
..onRefresh().whenComplete(
|
||||||
|
() => WidgetsBinding.instance.addPostFrameCallback(
|
||||||
|
(_) => widget.scrollController?.jumpToTop(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
@@ -114,7 +114,7 @@ class _DynMentionPanelState extends State<DynMentionPanel> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: _controller.focusNode,
|
focusNode: _controller.focusNode,
|
||||||
controller: _controller.controller,
|
controller: _controller.controller,
|
||||||
onChanged: _ctr.add,
|
onChanged: ctr!.add,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: const OutlineInputBorder(
|
border: const OutlineInputBorder(
|
||||||
gapPadding: 0,
|
gapPadding: 0,
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ import 'package:PiliPlus/http/loading_state.dart';
|
|||||||
import 'package:PiliPlus/models_new/dynamic/dyn_topic_top/topic_item.dart';
|
import 'package:PiliPlus/models_new/dynamic/dyn_topic_top/topic_item.dart';
|
||||||
import 'package:PiliPlus/pages/dynamics_select_topic/controller.dart';
|
import 'package:PiliPlus/pages/dynamics_select_topic/controller.dart';
|
||||||
import 'package:PiliPlus/pages/dynamics_select_topic/widgets/item.dart';
|
import 'package:PiliPlus/pages/dynamics_select_topic/widgets/item.dart';
|
||||||
|
import 'package:PiliPlus/pages/search/controller.dart';
|
||||||
import 'package:PiliPlus/utils/context_ext.dart';
|
import 'package:PiliPlus/utils/context_ext.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart' hide ContextExtensionss;
|
import 'package:get/get.dart' hide ContextExtensionss;
|
||||||
import 'package:stream_transform/stream_transform.dart';
|
|
||||||
|
|
||||||
class SelectTopicPanel extends StatefulWidget {
|
class SelectTopicPanel extends StatefulWidget {
|
||||||
const SelectTopicPanel({
|
const SelectTopicPanel({
|
||||||
@@ -56,10 +56,11 @@ class SelectTopicPanel extends StatefulWidget {
|
|||||||
State<SelectTopicPanel> createState() => _SelectTopicPanelState();
|
State<SelectTopicPanel> createState() => _SelectTopicPanelState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SelectTopicPanelState extends State<SelectTopicPanel> {
|
class _SelectTopicPanelState extends State<SelectTopicPanel>
|
||||||
|
with SearchKeywordMixin {
|
||||||
final _controller = Get.put(SelectTopicController());
|
final _controller = Get.put(SelectTopicController());
|
||||||
final StreamController<String> _ctr = StreamController<String>();
|
@override
|
||||||
late StreamSubscription<String> _sub;
|
Duration get duration => const Duration(milliseconds: 300);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -67,26 +68,25 @@ class _SelectTopicPanelState extends State<SelectTopicPanel> {
|
|||||||
if (_controller.loadingState.value is Error) {
|
if (_controller.loadingState.value is Error) {
|
||||||
_controller.onReload();
|
_controller.onReload();
|
||||||
}
|
}
|
||||||
_sub = _ctr.stream
|
subInit();
|
||||||
.debounce(const Duration(milliseconds: 300), trailing: true)
|
|
||||||
.listen((value) {
|
|
||||||
_controller
|
|
||||||
..enableClear.value = value.isNotEmpty
|
|
||||||
..onRefresh().whenComplete(
|
|
||||||
() => WidgetsBinding.instance.addPostFrameCallback(
|
|
||||||
(_) => widget.scrollController?.jumpToTop(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_sub.cancel();
|
subDispose();
|
||||||
_ctr.close();
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
ValueChanged<String> get onKeywordChanged =>
|
||||||
|
(value) => _controller
|
||||||
|
..enableClear.value = value.isNotEmpty
|
||||||
|
..onRefresh().whenComplete(
|
||||||
|
() => WidgetsBinding.instance.addPostFrameCallback(
|
||||||
|
(_) => widget.scrollController?.jumpToTop(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
@@ -110,7 +110,7 @@ class _SelectTopicPanelState extends State<SelectTopicPanel> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: _controller.focusNode,
|
focusNode: _controller.focusNode,
|
||||||
controller: _controller.controller,
|
controller: _controller.controller,
|
||||||
onChanged: _ctr.add,
|
onChanged: ctr!.add,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: const OutlineInputBorder(
|
border: const OutlineInputBorder(
|
||||||
gapPadding: 0,
|
gapPadding: 0,
|
||||||
|
|||||||
40
lib/pages/fav/cheese/controller.dart
Normal file
40
lib/pages/fav/cheese/controller.dart
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import 'package:PiliPlus/http/fav.dart';
|
||||||
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/data.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/item.dart';
|
||||||
|
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||||
|
import 'package:PiliPlus/utils/accounts.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
|
||||||
|
class FavCheeseController
|
||||||
|
extends CommonListController<SpaceCheeseData, SpaceCheeseItem> {
|
||||||
|
final mid = Accounts.main.mid;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
queryData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<SpaceCheeseItem>? getDataList(SpaceCheeseData response) {
|
||||||
|
isEnd = response.page?.next == false;
|
||||||
|
return response.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<LoadingState<SpaceCheeseData>> customGetData() =>
|
||||||
|
FavHttp.favPugv(mid: mid, page: page);
|
||||||
|
|
||||||
|
Future<void> onRemove(int index, int? sid) async {
|
||||||
|
var res = await FavHttp.delFavPugv(sid);
|
||||||
|
if (res['status']) {
|
||||||
|
loadingState
|
||||||
|
..value.data!.removeAt(index)
|
||||||
|
..refresh();
|
||||||
|
SmartDialog.showToast('已取消收藏');
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
87
lib/pages/fav/cheese/view.dart
Normal file
87
lib/pages/fav/cheese/view.dart
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||||
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/item.dart';
|
||||||
|
import 'package:PiliPlus/pages/fav/cheese/controller.dart';
|
||||||
|
import 'package:PiliPlus/pages/member_cheese/widgets/item.dart';
|
||||||
|
import 'package:PiliPlus/utils/grid.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class FavCheesePage extends StatefulWidget {
|
||||||
|
const FavCheesePage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<FavCheesePage> createState() => _FavCheesePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FavCheesePageState extends State<FavCheesePage>
|
||||||
|
with AutomaticKeepAliveClientMixin {
|
||||||
|
final FavCheeseController _controller = Get.put(FavCheeseController());
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
super.build(context);
|
||||||
|
final ThemeData theme = Theme.of(context);
|
||||||
|
return refreshIndicator(
|
||||||
|
onRefresh: _controller.onRefresh,
|
||||||
|
child: CustomScrollView(
|
||||||
|
controller: _controller.scrollController,
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
slivers: [
|
||||||
|
SliverPadding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 7,
|
||||||
|
bottom: MediaQuery.paddingOf(context).bottom + 80,
|
||||||
|
),
|
||||||
|
sliver: Obx(
|
||||||
|
() => _buildBody(theme, _controller.loadingState.value),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildBody(
|
||||||
|
ThemeData theme,
|
||||||
|
LoadingState<List<SpaceCheeseItem>?> loadingState,
|
||||||
|
) {
|
||||||
|
return switch (loadingState) {
|
||||||
|
Loading() => linearLoading,
|
||||||
|
Success(:var response) =>
|
||||||
|
response?.isNotEmpty == true
|
||||||
|
? SliverGrid(
|
||||||
|
gridDelegate: Grid.videoCardHDelegate(context),
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) {
|
||||||
|
if (index == response.length - 1) {
|
||||||
|
_controller.onLoadMore();
|
||||||
|
}
|
||||||
|
final item = response[index];
|
||||||
|
return MemberCheeseItem(
|
||||||
|
item: item,
|
||||||
|
onRemove: () => showConfirmDialog(
|
||||||
|
context: context,
|
||||||
|
title: '确定取消收藏该课堂?',
|
||||||
|
onConfirm: () =>
|
||||||
|
_controller.onRemove(index, item.seasonId),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
childCount: response!.length,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: HttpError(onReload: _controller.onReload),
|
||||||
|
Error(:var errMsg) => HttpError(
|
||||||
|
errMsg: errMsg,
|
||||||
|
onReload: _controller.onReload,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ import 'package:PiliPlus/http/loading_state.dart';
|
|||||||
import 'package:PiliPlus/models/common/fav_type.dart';
|
import 'package:PiliPlus/models/common/fav_type.dart';
|
||||||
import 'package:PiliPlus/models_new/fav/fav_folder/list.dart';
|
import 'package:PiliPlus/models_new/fav/fav_folder/list.dart';
|
||||||
import 'package:PiliPlus/pages/fav/article/controller.dart';
|
import 'package:PiliPlus/pages/fav/article/controller.dart';
|
||||||
|
import 'package:PiliPlus/pages/fav/cheese/controller.dart';
|
||||||
import 'package:PiliPlus/pages/fav/topic/controller.dart';
|
import 'package:PiliPlus/pages/fav/topic/controller.dart';
|
||||||
import 'package:PiliPlus/pages/fav/video/controller.dart';
|
import 'package:PiliPlus/pages/fav/video/controller.dart';
|
||||||
import 'package:PiliPlus/pages/fav_folder_sort/view.dart';
|
import 'package:PiliPlus/pages/fav_folder_sort/view.dart';
|
||||||
@@ -141,6 +142,9 @@ class _FavPageState extends State<FavPage> with SingleTickerProviderStateMixin {
|
|||||||
.animToTop();
|
.animToTop();
|
||||||
case FavTabType.topic:
|
case FavTabType.topic:
|
||||||
Get.find<FavTopicController>().scrollController.animToTop();
|
Get.find<FavTopicController>().scrollController.animToTop();
|
||||||
|
case FavTabType.cheese:
|
||||||
|
Get.find<FavCheeseController>().scrollController
|
||||||
|
.animToTop();
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ class VideoCardHLater extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -249,7 +250,7 @@ class VideoCardHLater extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: -8,
|
||||||
child: iconButton(
|
child: iconButton(
|
||||||
tooltip: '移除',
|
tooltip: '移除',
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@@ -41,13 +41,6 @@ class MemberController extends CommonDataController<SpaceData, SpaceData?>
|
|||||||
late List<Tab> tabs;
|
late List<Tab> tabs;
|
||||||
TabController? tabController;
|
TabController? tabController;
|
||||||
RxInt contributeInitialIndex = 0.obs;
|
RxInt contributeInitialIndex = 0.obs;
|
||||||
late final implTabs = const [
|
|
||||||
'home',
|
|
||||||
'dynamic',
|
|
||||||
'contribute',
|
|
||||||
'favorite',
|
|
||||||
'bangumi',
|
|
||||||
];
|
|
||||||
|
|
||||||
bool? hasSeasonOrSeries;
|
bool? hasSeasonOrSeries;
|
||||||
|
|
||||||
@@ -83,7 +76,7 @@ class MemberController extends CommonDataController<SpaceData, SpaceData?>
|
|||||||
data.series?.item?.isNotEmpty == true) {
|
data.series?.item?.isNotEmpty == true) {
|
||||||
hasSeasonOrSeries = true;
|
hasSeasonOrSeries = true;
|
||||||
}
|
}
|
||||||
tab2?.retainWhere((item) => implTabs.contains(item.param));
|
tab2?.retainWhere((item) => MemberTabType.contains(item.param!));
|
||||||
if (tab2?.isNotEmpty == true) {
|
if (tab2?.isNotEmpty == true) {
|
||||||
if (data.hasItem != true && tab2!.first.param == 'home') {
|
if (data.hasItem != true && tab2!.first.param == 'home') {
|
||||||
// remove empty home tab
|
// remove empty home tab
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:PiliPlus/pages/exp_log/view.dart';
|
|||||||
import 'package:PiliPlus/pages/login_log/view.dart';
|
import 'package:PiliPlus/pages/login_log/view.dart';
|
||||||
import 'package:PiliPlus/pages/member/controller.dart';
|
import 'package:PiliPlus/pages/member/controller.dart';
|
||||||
import 'package:PiliPlus/pages/member/widget/user_info_card.dart';
|
import 'package:PiliPlus/pages/member/widget/user_info_card.dart';
|
||||||
|
import 'package:PiliPlus/pages/member_cheese/view.dart';
|
||||||
import 'package:PiliPlus/pages/member_contribute/view.dart';
|
import 'package:PiliPlus/pages/member_contribute/view.dart';
|
||||||
import 'package:PiliPlus/pages/member_dynamics/view.dart';
|
import 'package:PiliPlus/pages/member_dynamics/view.dart';
|
||||||
import 'package:PiliPlus/pages/member_favorite/view.dart';
|
import 'package:PiliPlus/pages/member_favorite/view.dart';
|
||||||
@@ -325,6 +326,10 @@ class _MemberPageState extends State<MemberPage> {
|
|||||||
heroTag: _heroTag,
|
heroTag: _heroTag,
|
||||||
mid: _mid,
|
mid: _mid,
|
||||||
),
|
),
|
||||||
|
'cheese' => MemberCheese(
|
||||||
|
heroTag: _heroTag,
|
||||||
|
mid: _mid,
|
||||||
|
),
|
||||||
_ => Center(child: Text(item.title ?? '')),
|
_ => Center(child: Text(item.title ?? '')),
|
||||||
};
|
};
|
||||||
}).toList(),
|
}).toList(),
|
||||||
|
|||||||
31
lib/pages/member_cheese/controller.dart
Normal file
31
lib/pages/member_cheese/controller.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/http/member.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/data.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/item.dart';
|
||||||
|
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||||
|
|
||||||
|
class MemberCheeseController
|
||||||
|
extends CommonListController<SpaceCheeseData, SpaceCheeseItem> {
|
||||||
|
MemberCheeseController(this.mid);
|
||||||
|
|
||||||
|
final int mid;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
queryData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<SpaceCheeseItem>? getDataList(SpaceCheeseData response) {
|
||||||
|
isEnd = response.page?.next == false;
|
||||||
|
return response.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<LoadingState<SpaceCheeseData>> customGetData() =>
|
||||||
|
MemberHttp.spaceCheese(
|
||||||
|
page: page,
|
||||||
|
mid: mid,
|
||||||
|
);
|
||||||
|
}
|
||||||
80
lib/pages/member_cheese/view.dart
Normal file
80
lib/pages/member_cheese/view.dart
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||||
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/item.dart';
|
||||||
|
import 'package:PiliPlus/pages/member_cheese/controller.dart';
|
||||||
|
import 'package:PiliPlus/pages/member_cheese/widgets/item.dart';
|
||||||
|
import 'package:PiliPlus/utils/grid.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class MemberCheese extends StatefulWidget {
|
||||||
|
const MemberCheese({
|
||||||
|
super.key,
|
||||||
|
required this.heroTag,
|
||||||
|
required this.mid,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String? heroTag;
|
||||||
|
final int mid;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MemberCheese> createState() => _MemberCheeseState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MemberCheeseState extends State<MemberCheese>
|
||||||
|
with AutomaticKeepAliveClientMixin {
|
||||||
|
late final _controller = Get.put(
|
||||||
|
MemberCheeseController(widget.mid),
|
||||||
|
tag: widget.heroTag,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
super.build(context);
|
||||||
|
return refreshIndicator(
|
||||||
|
onRefresh: _controller.onRefresh,
|
||||||
|
child: CustomScrollView(
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
slivers: [
|
||||||
|
SliverPadding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 7,
|
||||||
|
bottom: MediaQuery.paddingOf(context).bottom + 80,
|
||||||
|
),
|
||||||
|
sliver: Obx(() => _buildBody(_controller.loadingState.value)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
|
Widget _buildBody(LoadingState<List<SpaceCheeseItem>?> loadingState) {
|
||||||
|
return switch (loadingState) {
|
||||||
|
Loading() => linearLoading,
|
||||||
|
Success(:var response) =>
|
||||||
|
response?.isNotEmpty == true
|
||||||
|
? SliverGrid(
|
||||||
|
gridDelegate: Grid.videoCardHDelegate(context),
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) {
|
||||||
|
if (index == response.length - 1) {
|
||||||
|
_controller.onLoadMore();
|
||||||
|
}
|
||||||
|
return MemberCheeseItem(item: response[index]);
|
||||||
|
},
|
||||||
|
childCount: response!.length,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: HttpError(onReload: _controller.onReload),
|
||||||
|
Error(:var errMsg) => HttpError(
|
||||||
|
errMsg: errMsg,
|
||||||
|
onReload: _controller.onReload,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
124
lib/pages/member_cheese/widgets/item.dart
Normal file
124
lib/pages/member_cheese/widgets/item.dart
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||||
|
import 'package:PiliPlus/models_new/space/space_cheese/item.dart';
|
||||||
|
import 'package:PiliPlus/utils/date_util.dart';
|
||||||
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MemberCheeseItem extends StatelessWidget {
|
||||||
|
const MemberCheeseItem({
|
||||||
|
super.key,
|
||||||
|
required this.item,
|
||||||
|
this.onRemove,
|
||||||
|
});
|
||||||
|
|
||||||
|
final SpaceCheeseItem item;
|
||||||
|
final VoidCallback? onRemove;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
Widget child = Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
item.title!,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
if (item.status != null) ...[
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Text(
|
||||||
|
item.status!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (item.ctime != null) ...[
|
||||||
|
const Spacer(),
|
||||||
|
Text(
|
||||||
|
'收藏于${DateUtil.dateFormat(int.parse(item.ctime!))}',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: theme.colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
if (onRemove != null) {
|
||||||
|
child = Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
children: [
|
||||||
|
child,
|
||||||
|
Positioned(
|
||||||
|
right: 0,
|
||||||
|
bottom: -8,
|
||||||
|
child: iconButton(
|
||||||
|
tooltip: '移除',
|
||||||
|
context: context,
|
||||||
|
onPressed: onRemove,
|
||||||
|
icon: Icons.clear,
|
||||||
|
iconColor: theme.colorScheme.outline,
|
||||||
|
bgColor: Colors.transparent,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Material(
|
||||||
|
type: MaterialType.transparency,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => PageUtils.viewPugv(seasonId: item.seasonId),
|
||||||
|
onLongPress: () =>
|
||||||
|
imageSaveDialog(title: item.title, cover: item.cover),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: StyleString.safeSpace,
|
||||||
|
vertical: 5,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AspectRatio(
|
||||||
|
aspectRatio: StyleString.aspectRatio,
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (context, boxConstraints) {
|
||||||
|
Widget child = NetworkImgLayer(
|
||||||
|
radius: 4,
|
||||||
|
src: item.cover,
|
||||||
|
width: boxConstraints.maxWidth,
|
||||||
|
height: boxConstraints.maxHeight,
|
||||||
|
);
|
||||||
|
if (item.marks?.isNotEmpty == true) {
|
||||||
|
return Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
children: [
|
||||||
|
child,
|
||||||
|
PBadge(
|
||||||
|
right: 6,
|
||||||
|
top: 6,
|
||||||
|
text: item.marks!.join('|'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return child;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(child: child),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,26 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:stream_transform/stream_transform.dart';
|
import 'package:stream_transform/stream_transform.dart';
|
||||||
|
|
||||||
class SSearchController extends GetxController {
|
mixin SearchKeywordMixin {
|
||||||
|
Duration duration = const Duration(milliseconds: 200);
|
||||||
|
StreamController<String>? ctr;
|
||||||
|
StreamSubscription<String>? sub;
|
||||||
|
ValueChanged<String> get onKeywordChanged;
|
||||||
|
|
||||||
|
void subInit() {
|
||||||
|
ctr = StreamController<String>();
|
||||||
|
sub = ctr!.stream
|
||||||
|
.debounce(duration, trailing: true)
|
||||||
|
.listen(onKeywordChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void subDispose() {
|
||||||
|
sub?.cancel();
|
||||||
|
ctr?.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SSearchController extends GetxController with SearchKeywordMixin {
|
||||||
SSearchController(this.tag);
|
SSearchController(this.tag);
|
||||||
final String tag;
|
final String tag;
|
||||||
|
|
||||||
@@ -34,8 +53,7 @@ class SSearchController extends GetxController {
|
|||||||
|
|
||||||
// suggestion
|
// suggestion
|
||||||
final bool searchSuggestion = Pref.searchSuggestion;
|
final bool searchSuggestion = Pref.searchSuggestion;
|
||||||
StreamController<String>? _ctr;
|
|
||||||
StreamSubscription<String>? _sub;
|
|
||||||
late final RxList<SearchSuggestItem> searchSuggestList;
|
late final RxList<SearchSuggestItem> searchSuggestList;
|
||||||
|
|
||||||
// trending
|
// trending
|
||||||
@@ -61,10 +79,7 @@ class SSearchController extends GetxController {
|
|||||||
).obs;
|
).obs;
|
||||||
|
|
||||||
if (searchSuggestion) {
|
if (searchSuggestion) {
|
||||||
_ctr = StreamController<String>();
|
subInit();
|
||||||
_sub = _ctr!.stream
|
|
||||||
.debounce(const Duration(milliseconds: 200), trailing: true)
|
|
||||||
.listen(querySearchSuggest);
|
|
||||||
searchSuggestList = <SearchSuggestItem>[].obs;
|
searchSuggestList = <SearchSuggestItem>[].obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +104,7 @@ class SSearchController extends GetxController {
|
|||||||
if (value.isEmpty) {
|
if (value.isEmpty) {
|
||||||
searchSuggestList.clear();
|
searchSuggestList.clear();
|
||||||
} else {
|
} else {
|
||||||
_ctr!.add(value);
|
ctr!.add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,7 +169,8 @@ class SSearchController extends GetxController {
|
|||||||
submit();
|
submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> querySearchSuggest(String value) async {
|
@override
|
||||||
|
ValueChanged<String> get onKeywordChanged => (String value) async {
|
||||||
var res = await SearchHttp.searchSuggest(term: value);
|
var res = await SearchHttp.searchSuggest(term: value);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SearchSuggestModel data = res['data'];
|
SearchSuggestModel data = res['data'];
|
||||||
@@ -162,7 +178,7 @@ class SSearchController extends GetxController {
|
|||||||
searchSuggestList.value = data.tag!;
|
searchSuggestList.value = data.tag!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
void onLongSelect(String word) {
|
void onLongSelect(String word) {
|
||||||
historyList.remove(word);
|
historyList.remove(word);
|
||||||
@@ -182,10 +198,9 @@ class SSearchController extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
|
subDispose();
|
||||||
searchFocusNode.dispose();
|
searchFocusNode.dispose();
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
_sub?.cancel();
|
|
||||||
_ctr?.close();
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ class SearchAllController
|
|||||||
Future<LoadingState<SearchAllData>> customGetData() => SearchHttp.searchAll(
|
Future<LoadingState<SearchAllData>> customGetData() => SearchHttp.searchAll(
|
||||||
keyword: keyword,
|
keyword: keyword,
|
||||||
page: page,
|
page: page,
|
||||||
order: order.value,
|
order: order,
|
||||||
duration: searchType == SearchType.video ? duration.value : null,
|
duration: null,
|
||||||
tids: tids,
|
tids: videoZoneType?.tids,
|
||||||
orderSort: orderSort,
|
orderSort: userOrderType?.value.orderSort,
|
||||||
userType: userType,
|
userType: userType?.value.index,
|
||||||
categoryId: categoryId,
|
categoryId: articleZoneType?.value.categoryId,
|
||||||
pubBegin: pubBegin,
|
pubBegin: pubBegin,
|
||||||
pubEnd: pubEnd,
|
pubEnd: pubEnd,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:PiliPlus/models/common/search/article_search_type.dart';
|
||||||
import 'package:PiliPlus/models/search/result.dart';
|
import 'package:PiliPlus/models/search/result.dart';
|
||||||
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
||||||
import 'package:PiliPlus/pages/search_panel/controller.dart';
|
import 'package:PiliPlus/pages/search_panel/controller.dart';
|
||||||
import 'package:PiliPlus/utils/context_ext.dart';
|
import 'package:PiliPlus/utils/context_ext.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:get/get.dart' hide ContextExtensionss;
|
import 'package:get/get.dart' hide ContextExtensionss;
|
||||||
|
|
||||||
class SearchArticleController
|
class SearchArticleController
|
||||||
@@ -19,6 +19,7 @@ class SearchArticleController
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
articleZoneType = ArticleZoneType.all.obs;
|
||||||
jump2Article();
|
jump2Article();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,27 +41,7 @@ class SearchArticleController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort
|
Rx<ArticleOrderType> articleOrderType = ArticleOrderType.totalrank.obs;
|
||||||
late final List orderFiltersList = [
|
|
||||||
{'label': '综合排序', 'value': 0, 'order': 'totalrank'},
|
|
||||||
{'label': '最新发布', 'value': 1, 'order': 'pubdate'},
|
|
||||||
{'label': '最多点击', 'value': 2, 'order': 'click'},
|
|
||||||
{'label': '最多喜欢', 'value': 3, 'order': 'attention'},
|
|
||||||
{'label': '最多评论', 'value': 4, 'order': 'scores'},
|
|
||||||
];
|
|
||||||
late final List zoneFiltersList = [
|
|
||||||
{'label': '全部分区', 'value': 0, 'categoryId': 0},
|
|
||||||
{'label': '动画', 'value': 1, 'categoryId': 2},
|
|
||||||
{'label': '游戏', 'value': 2, 'categoryId': 1},
|
|
||||||
{'label': '影视', 'value': 3, 'categoryId': 28},
|
|
||||||
{'label': '生活', 'value': 4, 'categoryId': 3},
|
|
||||||
{'label': '兴趣', 'value': 5, 'categoryId': 29},
|
|
||||||
{'label': '轻小说', 'value': 6, 'categoryId': 16},
|
|
||||||
{'label': '科技', 'value': 7, 'categoryId': 17},
|
|
||||||
{'label': '笔记', 'value': 8, 'categoryId': 41},
|
|
||||||
];
|
|
||||||
RxInt currentOrderFilterval = 0.obs;
|
|
||||||
RxInt currentZoneFilterval = 0.obs;
|
|
||||||
|
|
||||||
void onShowFilterDialog(BuildContext context) {
|
void onShowFilterDialog(BuildContext context) {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
@@ -91,30 +72,25 @@ class SearchArticleController
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: orderFiltersList
|
children: ArticleOrderType.values.map(
|
||||||
.map(
|
(e) {
|
||||||
(item) => SearchText(
|
final isCurr = e == articleOrderType.value;
|
||||||
text: item['label'],
|
return SearchText(
|
||||||
onTap: (_) async {
|
text: e.label,
|
||||||
Get.back();
|
onTap: (_) {
|
||||||
currentOrderFilterval.value = item['value'];
|
articleOrderType.value = e;
|
||||||
SmartDialog.dismiss();
|
order = e.order;
|
||||||
SmartDialog.showToast("「${item['label']}」的筛选结果");
|
onSortSearch(label: e.label);
|
||||||
order.value = item['order'];
|
},
|
||||||
SmartDialog.showLoading(msg: 'loading');
|
bgColor: isCurr
|
||||||
await onReload();
|
? theme.colorScheme.secondaryContainer
|
||||||
SmartDialog.dismiss();
|
: null,
|
||||||
},
|
textColor: isCurr
|
||||||
bgColor: item['value'] == currentOrderFilterval.value
|
? theme.colorScheme.onSecondaryContainer
|
||||||
? theme.colorScheme.secondaryContainer
|
: null,
|
||||||
: null,
|
);
|
||||||
textColor:
|
},
|
||||||
item['value'] == currentOrderFilterval.value
|
).toList(),
|
||||||
? theme.colorScheme.onSecondaryContainer
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Text('分区', style: TextStyle(fontSize: 16)),
|
const Text('分区', style: TextStyle(fontSize: 16)),
|
||||||
@@ -122,29 +98,24 @@ class SearchArticleController
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: zoneFiltersList
|
children: ArticleZoneType.values.map(
|
||||||
.map(
|
(e) {
|
||||||
(item) => SearchText(
|
final isCurr = e == articleZoneType!.value;
|
||||||
text: item['label'],
|
return SearchText(
|
||||||
onTap: (_) async {
|
text: e.label,
|
||||||
Get.back();
|
onTap: (_) {
|
||||||
currentZoneFilterval.value = item['value'];
|
articleZoneType!.value = e;
|
||||||
SmartDialog.dismiss();
|
onSortSearch(label: e.label);
|
||||||
SmartDialog.showToast("「${item['label']}」的筛选结果");
|
},
|
||||||
categoryId = item['categoryId'];
|
bgColor: isCurr
|
||||||
SmartDialog.showLoading(msg: 'loading');
|
? theme.colorScheme.secondaryContainer
|
||||||
await onReload();
|
: null,
|
||||||
SmartDialog.dismiss();
|
textColor: isCurr
|
||||||
},
|
? theme.colorScheme.onSecondaryContainer
|
||||||
bgColor: item['value'] == currentZoneFilterval.value
|
: null,
|
||||||
? theme.colorScheme.secondaryContainer
|
);
|
||||||
: null,
|
},
|
||||||
textColor: item['value'] == currentZoneFilterval.value
|
).toList(),
|
||||||
? theme.colorScheme.onSecondaryContainer
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class _SearchArticlePanelState
|
|||||||
children: [
|
children: [
|
||||||
Obx(
|
Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
'排序: ${controller.orderFiltersList[controller.currentOrderFilterval.value]['label']}',
|
'排序: ${controller.articleOrderType.value.label}',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(color: theme.colorScheme.outline),
|
style: TextStyle(color: theme.colorScheme.outline),
|
||||||
),
|
),
|
||||||
@@ -59,7 +59,7 @@ class _SearchArticlePanelState
|
|||||||
const Spacer(),
|
const Spacer(),
|
||||||
Obx(
|
Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
'分区: ${controller.zoneFiltersList[controller.currentZoneFilterval.value]['label']}',
|
'分区: ${controller.articleZoneType!.value.label}',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(color: theme.colorScheme.outline),
|
style: TextStyle(color: theme.colorScheme.outline),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/search.dart';
|
import 'package:PiliPlus/http/search.dart';
|
||||||
|
import 'package:PiliPlus/models/common/search/article_search_type.dart';
|
||||||
|
import 'package:PiliPlus/models/common/search/user_search_type.dart';
|
||||||
|
import 'package:PiliPlus/models/common/search/video_search_type.dart';
|
||||||
import 'package:PiliPlus/models/common/search_type.dart';
|
import 'package:PiliPlus/models/common/search_type.dart';
|
||||||
import 'package:PiliPlus/models/search/result.dart';
|
import 'package:PiliPlus/models/search/result.dart';
|
||||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||||
import 'package:PiliPlus/pages/search_result/controller.dart';
|
import 'package:PiliPlus/pages/search_result/controller.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class SearchPanelController<R extends SearchNumData<T>, T>
|
class SearchPanelController<R extends SearchNumData<T>, T>
|
||||||
@@ -19,17 +23,37 @@ class SearchPanelController<R extends SearchNumData<T>, T>
|
|||||||
final SearchType searchType;
|
final SearchType searchType;
|
||||||
|
|
||||||
// sort
|
// sort
|
||||||
final RxString order = ''.obs;
|
// common
|
||||||
late final RxInt duration = 0.obs;
|
String order = '';
|
||||||
int? tids;
|
|
||||||
int? orderSort;
|
// video
|
||||||
int? userType;
|
VideoDurationType? videoDurationType; // int duration
|
||||||
int? categoryId;
|
VideoZoneType? videoZoneType; // int? tids;
|
||||||
int? pubBegin;
|
int? pubBegin;
|
||||||
int? pubEnd;
|
int? pubEnd;
|
||||||
|
|
||||||
|
// user
|
||||||
|
Rx<UserOrderType>? userOrderType;
|
||||||
|
Rx<UserType>? userType;
|
||||||
|
|
||||||
|
// article
|
||||||
|
Rx<ArticleZoneType>? articleZoneType; // int? categoryId;
|
||||||
|
|
||||||
SearchResultController? searchResultController;
|
SearchResultController? searchResultController;
|
||||||
|
|
||||||
|
void onSortSearch({
|
||||||
|
bool getBack = true,
|
||||||
|
String? label,
|
||||||
|
}) {
|
||||||
|
if (getBack) Get.back();
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
if (label != null) {
|
||||||
|
SmartDialog.showToast("「$label」的筛选结果");
|
||||||
|
}
|
||||||
|
SmartDialog.showLoading(msg: 'loading');
|
||||||
|
onReload().whenComplete(SmartDialog.dismiss);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -55,12 +79,12 @@ class SearchPanelController<R extends SearchNumData<T>, T>
|
|||||||
searchType: searchType,
|
searchType: searchType,
|
||||||
keyword: keyword,
|
keyword: keyword,
|
||||||
page: page,
|
page: page,
|
||||||
order: order.value,
|
order: order,
|
||||||
duration: searchType == SearchType.video ? duration.value : null,
|
duration: videoDurationType?.index,
|
||||||
tids: tids,
|
tids: videoZoneType?.tids,
|
||||||
orderSort: orderSort,
|
orderSort: userOrderType?.value.orderSort,
|
||||||
userType: userType,
|
userType: userType?.value.index,
|
||||||
categoryId: categoryId,
|
categoryId: articleZoneType?.value.categoryId,
|
||||||
pubBegin: pubBegin,
|
pubBegin: pubBegin,
|
||||||
pubEnd: pubEnd,
|
pubEnd: pubEnd,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:PiliPlus/models/common/search/user_search_type.dart';
|
||||||
import 'package:PiliPlus/models/search/result.dart';
|
import 'package:PiliPlus/models/search/result.dart';
|
||||||
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
||||||
import 'package:PiliPlus/pages/search_panel/controller.dart';
|
import 'package:PiliPlus/pages/search_panel/controller.dart';
|
||||||
import 'package:PiliPlus/utils/context_ext.dart';
|
import 'package:PiliPlus/utils/context_ext.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:get/get.dart' hide ContextExtensionss;
|
import 'package:get/get.dart' hide ContextExtensionss;
|
||||||
|
|
||||||
class SearchUserController
|
class SearchUserController
|
||||||
@@ -16,22 +16,12 @@ class SearchUserController
|
|||||||
required super.tag,
|
required super.tag,
|
||||||
});
|
});
|
||||||
|
|
||||||
// sort
|
@override
|
||||||
late final List orderFiltersList = [
|
void onInit() {
|
||||||
{'label': '默认排序', 'value': 0, 'orderSort': 0, 'order': ''},
|
super.onInit();
|
||||||
{'label': '粉丝数由高到低', 'value': 1, 'orderSort': 0, 'order': 'fans'},
|
userType = UserType.all.obs;
|
||||||
{'label': '粉丝数由低到高', 'value': 2, 'orderSort': 1, 'order': 'fans'},
|
userOrderType = UserOrderType.def.obs;
|
||||||
{'label': 'Lv等级由高到低', 'value': 3, 'orderSort': 0, 'order': 'level'},
|
}
|
||||||
{'label': 'Lv等级由低到高', 'value': 4, 'orderSort': 1, 'order': 'level'},
|
|
||||||
];
|
|
||||||
late final List userTypeFiltersList = [
|
|
||||||
{'label': '全部用户', 'value': 0, 'userType': 0},
|
|
||||||
{'label': 'UP主', 'value': 1, 'userType': 1},
|
|
||||||
{'label': '普通用户', 'value': 2, 'userType': 2},
|
|
||||||
{'label': '认证用户', 'value': 3, 'userType': 3},
|
|
||||||
];
|
|
||||||
RxInt currentOrderFilterval = 0.obs;
|
|
||||||
RxInt currentUserTypeFilterval = 0.obs;
|
|
||||||
|
|
||||||
void onShowFilterDialog(BuildContext context) {
|
void onShowFilterDialog(BuildContext context) {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
@@ -62,31 +52,25 @@ class SearchUserController
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: orderFiltersList
|
children: UserOrderType.values.map(
|
||||||
.map(
|
(e) {
|
||||||
(item) => SearchText(
|
final isCurr = e == userOrderType!.value;
|
||||||
text: item['label'],
|
return SearchText(
|
||||||
onTap: (_) async {
|
text: e.label,
|
||||||
Get.back();
|
onTap: (_) {
|
||||||
currentOrderFilterval.value = item['value'];
|
userOrderType!.value = e;
|
||||||
SmartDialog.dismiss();
|
order = e.order;
|
||||||
SmartDialog.showToast("「${item['label']}」的筛选结果");
|
onSortSearch(label: e.label);
|
||||||
orderSort = item['orderSort'];
|
},
|
||||||
order.value = item['order'];
|
bgColor: isCurr
|
||||||
SmartDialog.showLoading(msg: 'loading');
|
? theme.colorScheme.secondaryContainer
|
||||||
await onReload();
|
: null,
|
||||||
SmartDialog.dismiss();
|
textColor: isCurr
|
||||||
},
|
? theme.colorScheme.onSecondaryContainer
|
||||||
bgColor: item['value'] == currentOrderFilterval.value
|
: null,
|
||||||
? theme.colorScheme.secondaryContainer
|
);
|
||||||
: null,
|
},
|
||||||
textColor:
|
).toList(),
|
||||||
item['value'] == currentOrderFilterval.value
|
|
||||||
? theme.colorScheme.onSecondaryContainer
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Text('用户分类', style: TextStyle(fontSize: 16)),
|
const Text('用户分类', style: TextStyle(fontSize: 16)),
|
||||||
@@ -94,31 +78,24 @@ class SearchUserController
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: userTypeFiltersList
|
children: UserType.values.map(
|
||||||
.map(
|
(e) {
|
||||||
(item) => SearchText(
|
final isCurr = e == userType!.value;
|
||||||
text: item['label'],
|
return SearchText(
|
||||||
onTap: (_) async {
|
text: e.label,
|
||||||
Get.back();
|
onTap: (_) {
|
||||||
currentUserTypeFilterval.value = item['value'];
|
userType!.value = e;
|
||||||
SmartDialog.dismiss();
|
onSortSearch(label: e.label);
|
||||||
SmartDialog.showToast("「${item['label']}」的筛选结果");
|
},
|
||||||
userType = item['userType'];
|
bgColor: isCurr
|
||||||
SmartDialog.showLoading(msg: 'loading');
|
? theme.colorScheme.secondaryContainer
|
||||||
await onReload();
|
: null,
|
||||||
SmartDialog.dismiss();
|
textColor: isCurr
|
||||||
},
|
? theme.colorScheme.onSecondaryContainer
|
||||||
bgColor:
|
: null,
|
||||||
item['value'] == currentUserTypeFilterval.value
|
);
|
||||||
? theme.colorScheme.secondaryContainer
|
},
|
||||||
: null,
|
).toList(),
|
||||||
textColor:
|
|
||||||
item['value'] == currentUserTypeFilterval.value
|
|
||||||
? theme.colorScheme.onSecondaryContainer
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class _SearchUserPanelState
|
|||||||
children: [
|
children: [
|
||||||
Obx(
|
Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
'排序: ${controller.orderFiltersList[controller.currentOrderFilterval.value]['label']}',
|
'排序: ${controller.userOrderType!.value.label}',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(color: theme.colorScheme.outline),
|
style: TextStyle(color: theme.colorScheme.outline),
|
||||||
),
|
),
|
||||||
@@ -59,7 +59,7 @@ class _SearchUserPanelState
|
|||||||
const Spacer(),
|
const Spacer(),
|
||||||
Obx(
|
Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
'用户类型: ${controller.userTypeFiltersList[controller.currentUserTypeFilterval.value]['label']}',
|
'用户类型: ${controller.userType!.value.label}',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(color: theme.colorScheme.outline),
|
style: TextStyle(color: theme.colorScheme.outline),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/models/common/search/video_search_type.dart';
|
||||||
import 'package:PiliPlus/models/common/search_type.dart';
|
import 'package:PiliPlus/models/common/search_type.dart';
|
||||||
import 'package:PiliPlus/models/search/result.dart';
|
import 'package:PiliPlus/models/search/result.dart';
|
||||||
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
||||||
@@ -26,23 +27,11 @@ class SearchVideoController
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
videoDurationType = VideoDurationType.all;
|
||||||
|
videoZoneType = VideoZoneType.all;
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
pubBeginDate = DateTime(
|
pubBeginDate = DateTime(now.year, now.month, 1, 0, 0, 0);
|
||||||
now.year,
|
pubEndDate = DateTime(now.year, now.month, now.day, 23, 59, 59);
|
||||||
now.month,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
pubEndDate = DateTime(
|
|
||||||
now.year,
|
|
||||||
now.month,
|
|
||||||
now.day,
|
|
||||||
23,
|
|
||||||
59,
|
|
||||||
59,
|
|
||||||
);
|
|
||||||
|
|
||||||
jump2Video();
|
jump2Video();
|
||||||
}
|
}
|
||||||
@@ -86,61 +75,12 @@ class SearchVideoController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort
|
final Rx<ArchiveFilterType> selectedType = ArchiveFilterType.totalrank.obs;
|
||||||
late final List<Map> filterList = ArchiveFilterType.values
|
VideoPubTimeType? pubTimeType = VideoPubTimeType.all;
|
||||||
.map(
|
|
||||||
(type) => {
|
|
||||||
'label': type.desc,
|
|
||||||
'type': type,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
late final Rx<ArchiveFilterType> selectedType =
|
|
||||||
ArchiveFilterType.values.first.obs;
|
|
||||||
late final List pubTimeFiltersList = [
|
|
||||||
{'label': '不限', 'value': 0},
|
|
||||||
{'label': '最近一天', 'value': 1},
|
|
||||||
{'label': '最近一周', 'value': 2},
|
|
||||||
{'label': '最近半年', 'value': 3},
|
|
||||||
];
|
|
||||||
late final List timeFiltersList = [
|
|
||||||
{'label': '全部时长', 'value': 0},
|
|
||||||
{'label': '0-10分钟', 'value': 1},
|
|
||||||
{'label': '10-30分钟', 'value': 2},
|
|
||||||
{'label': '30-60分钟', 'value': 3},
|
|
||||||
{'label': '60分钟+', 'value': 4},
|
|
||||||
];
|
|
||||||
late final List zoneFiltersList = [
|
|
||||||
{'label': '全部', 'value': 0},
|
|
||||||
{'label': '动画', 'value': 1, 'tids': 1},
|
|
||||||
{'label': '番剧', 'value': 2, 'tids': 13},
|
|
||||||
{'label': '国创', 'value': 3, 'tids': 167},
|
|
||||||
{'label': '音乐', 'value': 4, 'tids': 3},
|
|
||||||
{'label': '舞蹈', 'value': 5, 'tids': 129},
|
|
||||||
{'label': '游戏', 'value': 6, 'tids': 4},
|
|
||||||
{'label': '知识', 'value': 7, 'tids': 36},
|
|
||||||
{'label': '科技', 'value': 8, 'tids': 188},
|
|
||||||
{'label': '运动', 'value': 9, 'tids': 234},
|
|
||||||
{'label': '汽车', 'value': 10, 'tids': 223},
|
|
||||||
{'label': '生活', 'value': 11, 'tids': 160},
|
|
||||||
{'label': '美食', 'value': 12, 'tids': 221},
|
|
||||||
{'label': '动物', 'value': 13, 'tids': 217},
|
|
||||||
{'label': '鬼畜', 'value': 14, 'tids': 119},
|
|
||||||
{'label': '时尚', 'value': 15, 'tids': 155},
|
|
||||||
{'label': '资讯', 'value': 16, 'tids': 202},
|
|
||||||
{'label': '娱乐', 'value': 17, 'tids': 5},
|
|
||||||
{'label': '影视', 'value': 18, 'tids': 181},
|
|
||||||
{'label': '记录', 'value': 19, 'tids': 177},
|
|
||||||
{'label': '电影', 'value': 20, 'tids': 23},
|
|
||||||
{'label': '电视', 'value': 21, 'tids': 11},
|
|
||||||
];
|
|
||||||
int currentPubTimeFilter = 0;
|
|
||||||
late DateTime pubBeginDate;
|
late DateTime pubBeginDate;
|
||||||
late DateTime pubEndDate;
|
late DateTime pubEndDate;
|
||||||
bool customPubBeginDate = false;
|
bool customPubBeginDate = false;
|
||||||
bool customPubEndDate = false;
|
bool customPubEndDate = false;
|
||||||
int currentTimeFilter = 0;
|
|
||||||
int currentZoneFilter = 0;
|
|
||||||
|
|
||||||
void onShowFilterDialog(BuildContext context) {
|
void onShowFilterDialog(BuildContext context) {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
@@ -154,6 +94,9 @@ class SearchVideoController
|
|||||||
builder: (context, setState) {
|
builder: (context, setState) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
Widget dateWidget([bool isFirst = true]) {
|
Widget dateWidget([bool isFirst = true]) {
|
||||||
|
final enable =
|
||||||
|
pubTimeType == null &&
|
||||||
|
(isFirst ? customPubBeginDate : customPubEndDate);
|
||||||
return SearchText(
|
return SearchText(
|
||||||
text: DateUtil.longFormat.format(
|
text: DateUtil.longFormat.format(
|
||||||
isFirst ? pubBeginDate : pubEndDate,
|
isFirst ? pubBeginDate : pubEndDate,
|
||||||
@@ -165,7 +108,7 @@ class SearchVideoController
|
|||||||
initialDate: isFirst ? pubBeginDate : pubEndDate,
|
initialDate: isFirst ? pubBeginDate : pubEndDate,
|
||||||
firstDate: isFirst ? DateTime(2009, 6, 26) : pubBeginDate,
|
firstDate: isFirst ? DateTime(2009, 6, 26) : pubBeginDate,
|
||||||
lastDate: isFirst ? pubEndDate : DateTime.now(),
|
lastDate: isFirst ? pubEndDate : DateTime.now(),
|
||||||
).then((selectedDate) async {
|
).then((selectedDate) {
|
||||||
if (selectedDate != null) {
|
if (selectedDate != null) {
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
customPubBeginDate = true;
|
customPubBeginDate = true;
|
||||||
@@ -174,7 +117,7 @@ class SearchVideoController
|
|||||||
customPubEndDate = true;
|
customPubEndDate = true;
|
||||||
pubEndDate = selectedDate;
|
pubEndDate = selectedDate;
|
||||||
}
|
}
|
||||||
currentPubTimeFilter = -1;
|
pubTimeType = null;
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
pubBegin =
|
pubBegin =
|
||||||
DateTime(
|
DateTime(
|
||||||
@@ -197,20 +140,14 @@ class SearchVideoController
|
|||||||
).millisecondsSinceEpoch ~/
|
).millisecondsSinceEpoch ~/
|
||||||
1000;
|
1000;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
SmartDialog.showLoading(msg: 'loading');
|
onSortSearch(getBack: false);
|
||||||
await onReload();
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
bgColor:
|
bgColor: enable
|
||||||
currentPubTimeFilter == -1 &&
|
|
||||||
(isFirst ? customPubBeginDate : customPubEndDate)
|
|
||||||
? theme.colorScheme.secondaryContainer
|
? theme.colorScheme.secondaryContainer
|
||||||
: theme.colorScheme.outline.withValues(alpha: 0.1),
|
: theme.colorScheme.outline.withValues(alpha: 0.1),
|
||||||
textColor:
|
textColor: enable
|
||||||
currentPubTimeFilter == -1 &&
|
|
||||||
(isFirst ? customPubBeginDate : customPubEndDate)
|
|
||||||
? theme.colorScheme.onSecondaryContainer
|
? theme.colorScheme.onSecondaryContainer
|
||||||
: theme.colorScheme.outline.withValues(alpha: 0.8),
|
: theme.colorScheme.outline.withValues(alpha: 0.8),
|
||||||
);
|
);
|
||||||
@@ -235,70 +172,62 @@ class SearchVideoController
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: pubTimeFiltersList
|
children: VideoPubTimeType.values.map(
|
||||||
.map(
|
(e) {
|
||||||
(item) => SearchText(
|
final isCurr = e == pubTimeType;
|
||||||
text: item['label'],
|
return SearchText(
|
||||||
onTap: (text) async {
|
text: e.label,
|
||||||
Get.back();
|
onTap: (text) {
|
||||||
currentPubTimeFilter = item['value'];
|
pubTimeType = e;
|
||||||
SmartDialog.dismiss();
|
DateTime now = DateTime.now();
|
||||||
SmartDialog.showToast("「${item['label']}」的筛选结果");
|
if (e == VideoPubTimeType.all) {
|
||||||
DateTime now = DateTime.now();
|
pubBegin = null;
|
||||||
if (item['value'] == 0) {
|
pubEnd = null;
|
||||||
pubBegin = null;
|
} else {
|
||||||
pubEnd = null;
|
pubBegin =
|
||||||
} else {
|
DateTime(
|
||||||
pubBegin =
|
now.year,
|
||||||
DateTime(
|
now.month,
|
||||||
now.year,
|
now.day -
|
||||||
now.month,
|
(e == VideoPubTimeType.day
|
||||||
now.day -
|
? 0
|
||||||
(item['value'] == 0
|
: e == VideoPubTimeType.week
|
||||||
? 0
|
? 6
|
||||||
: item['value'] == 1
|
: 179),
|
||||||
? 6
|
0,
|
||||||
: 179),
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
).millisecondsSinceEpoch ~/
|
||||||
0,
|
1000;
|
||||||
).millisecondsSinceEpoch ~/
|
pubEnd =
|
||||||
1000;
|
DateTime(
|
||||||
pubEnd =
|
now.year,
|
||||||
DateTime(
|
now.month,
|
||||||
now.year,
|
now.day,
|
||||||
now.month,
|
23,
|
||||||
now.day,
|
59,
|
||||||
23,
|
59,
|
||||||
59,
|
).millisecondsSinceEpoch ~/
|
||||||
59,
|
1000;
|
||||||
).millisecondsSinceEpoch ~/
|
}
|
||||||
1000;
|
onSortSearch();
|
||||||
}
|
},
|
||||||
SmartDialog.showLoading(msg: 'loading');
|
bgColor: isCurr
|
||||||
await onReload();
|
? theme.colorScheme.secondaryContainer
|
||||||
SmartDialog.dismiss();
|
: null,
|
||||||
},
|
textColor: isCurr
|
||||||
bgColor: item['value'] == currentPubTimeFilter
|
? theme.colorScheme.onSecondaryContainer
|
||||||
? theme.colorScheme.secondaryContainer
|
: null,
|
||||||
: null,
|
);
|
||||||
textColor: item['value'] == currentPubTimeFilter
|
},
|
||||||
? theme.colorScheme.onSecondaryContainer
|
).toList(),
|
||||||
: null,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: dateWidget()),
|
Expanded(child: dateWidget()),
|
||||||
const SizedBox(width: 8),
|
const Text('至', style: TextStyle(fontSize: 13)),
|
||||||
const Text(
|
|
||||||
'至',
|
|
||||||
style: TextStyle(fontSize: 13),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Expanded(child: dateWidget(false)),
|
Expanded(child: dateWidget(false)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -308,29 +237,24 @@ class SearchVideoController
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: timeFiltersList
|
children: VideoDurationType.values.map(
|
||||||
.map(
|
(e) {
|
||||||
(item) => SearchText(
|
final isCurr = e == videoDurationType;
|
||||||
text: item['label'],
|
return SearchText(
|
||||||
onTap: (text) async {
|
text: e.label,
|
||||||
Get.back();
|
onTap: (_) {
|
||||||
currentTimeFilter = item['value'];
|
videoDurationType = e;
|
||||||
SmartDialog.dismiss();
|
onSortSearch(label: e.label);
|
||||||
SmartDialog.showToast("「${item['label']}」的筛选结果");
|
},
|
||||||
duration.value = item['value'];
|
bgColor: isCurr
|
||||||
SmartDialog.showLoading(msg: 'loading');
|
? theme.colorScheme.secondaryContainer
|
||||||
await onReload();
|
: null,
|
||||||
SmartDialog.dismiss();
|
textColor: isCurr
|
||||||
},
|
? theme.colorScheme.onSecondaryContainer
|
||||||
bgColor: item['value'] == currentTimeFilter
|
: null,
|
||||||
? theme.colorScheme.secondaryContainer
|
);
|
||||||
: null,
|
},
|
||||||
textColor: item['value'] == currentTimeFilter
|
).toList(),
|
||||||
? theme.colorScheme.onSecondaryContainer
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Text('内容分区', style: TextStyle(fontSize: 16)),
|
const Text('内容分区', style: TextStyle(fontSize: 16)),
|
||||||
@@ -338,29 +262,24 @@ class SearchVideoController
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: zoneFiltersList
|
children: VideoZoneType.values.map(
|
||||||
.map(
|
(e) {
|
||||||
(item) => SearchText(
|
final isCurr = e == videoZoneType;
|
||||||
text: item['label'],
|
return SearchText(
|
||||||
onTap: (text) async {
|
text: e.label,
|
||||||
Get.back();
|
onTap: (_) {
|
||||||
currentZoneFilter = item['value'];
|
videoZoneType = e;
|
||||||
SmartDialog.dismiss();
|
onSortSearch(label: e.label);
|
||||||
SmartDialog.showToast("「${item['label']}」的筛选结果");
|
},
|
||||||
tids = item['tids'];
|
bgColor: isCurr
|
||||||
SmartDialog.showLoading(msg: 'loading');
|
? theme.colorScheme.secondaryContainer
|
||||||
await onReload();
|
: null,
|
||||||
SmartDialog.dismiss();
|
textColor: isCurr
|
||||||
},
|
? theme.colorScheme.onSecondaryContainer
|
||||||
bgColor: item['value'] == currentZoneFilter
|
: null,
|
||||||
? theme.colorScheme.secondaryContainer
|
);
|
||||||
: null,
|
},
|
||||||
textColor: item['value'] == currentZoneFilter
|
).toList(),
|
||||||
? theme.colorScheme.onSecondaryContainer
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import 'package:PiliPlus/common/widgets/custom_sliver_persistent_header_delegate.dart';
|
import 'package:PiliPlus/common/widgets/custom_sliver_persistent_header_delegate.dart';
|
||||||
import 'package:PiliPlus/common/widgets/video_card/video_card_h.dart';
|
import 'package:PiliPlus/common/widgets/video_card/video_card_h.dart';
|
||||||
|
import 'package:PiliPlus/models/common/search_type.dart';
|
||||||
import 'package:PiliPlus/models/search/result.dart';
|
import 'package:PiliPlus/models/search/result.dart';
|
||||||
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
||||||
import 'package:PiliPlus/pages/search_panel/video/controller.dart';
|
import 'package:PiliPlus/pages/search_panel/video/controller.dart';
|
||||||
import 'package:PiliPlus/pages/search_panel/view.dart';
|
import 'package:PiliPlus/pages/search_panel/view.dart';
|
||||||
import 'package:PiliPlus/utils/grid.dart';
|
import 'package:PiliPlus/utils/grid.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class SearchVideoPanel extends CommonSearchPanel {
|
class SearchVideoPanel extends CommonSearchPanel {
|
||||||
@@ -56,29 +56,21 @@ class _SearchVideoPanelState
|
|||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
children: [
|
children: [
|
||||||
for (var i in controller.filterList) ...[
|
for (var e in ArchiveFilterType.values)
|
||||||
Obx(
|
Obx(
|
||||||
() => SearchText(
|
() => SearchText(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
text: i['label'],
|
text: e.desc,
|
||||||
bgColor: Colors.transparent,
|
bgColor: Colors.transparent,
|
||||||
textColor:
|
textColor: controller.selectedType.value == e
|
||||||
controller.selectedType.value == i['type']
|
|
||||||
? theme.colorScheme.primary
|
? theme.colorScheme.primary
|
||||||
: theme.colorScheme.outline,
|
: theme.colorScheme.outline,
|
||||||
onTap: (value) async {
|
onTap: (_) => controller
|
||||||
controller.selectedType.value = i['type'];
|
..order = e.name
|
||||||
controller.order.value = i['type']
|
..selectedType.value = e
|
||||||
.toString()
|
..onSortSearch(getBack: false),
|
||||||
.split('.')
|
|
||||||
.last;
|
|
||||||
SmartDialog.showLoading(msg: 'loading');
|
|
||||||
await controller.onReload();
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||||
|
import 'package:PiliPlus/pages/search/controller.dart';
|
||||||
import 'package:PiliPlus/pages/setting/models/extra_settings.dart';
|
import 'package:PiliPlus/pages/setting/models/extra_settings.dart';
|
||||||
import 'package:PiliPlus/pages/setting/models/model.dart';
|
import 'package:PiliPlus/pages/setting/models/model.dart';
|
||||||
import 'package:PiliPlus/pages/setting/models/play_settings.dart';
|
import 'package:PiliPlus/pages/setting/models/play_settings.dart';
|
||||||
@@ -11,7 +10,6 @@ import 'package:PiliPlus/pages/setting/models/video_settings.dart';
|
|||||||
import 'package:PiliPlus/utils/grid.dart';
|
import 'package:PiliPlus/utils/grid.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:stream_transform/stream_transform.dart';
|
|
||||||
import 'package:waterfall_flow/waterfall_flow.dart';
|
import 'package:waterfall_flow/waterfall_flow.dart';
|
||||||
|
|
||||||
class SettingsSearchPage extends StatefulWidget {
|
class SettingsSearchPage extends StatefulWidget {
|
||||||
@@ -21,7 +19,8 @@ class SettingsSearchPage extends StatefulWidget {
|
|||||||
State<SettingsSearchPage> createState() => _SettingsSearchPageState();
|
State<SettingsSearchPage> createState() => _SettingsSearchPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SettingsSearchPageState extends State<SettingsSearchPage> {
|
class _SettingsSearchPageState extends State<SettingsSearchPage>
|
||||||
|
with SearchKeywordMixin {
|
||||||
final _textEditingController = TextEditingController();
|
final _textEditingController = TextEditingController();
|
||||||
final RxList<SettingsModel> _list = <SettingsModel>[].obs;
|
final RxList<SettingsModel> _list = <SettingsModel>[].obs;
|
||||||
late final _settings = [
|
late final _settings = [
|
||||||
@@ -32,37 +31,34 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
|
|||||||
...playSettings,
|
...playSettings,
|
||||||
...styleSettings,
|
...styleSettings,
|
||||||
];
|
];
|
||||||
late StreamController<String> _ctr;
|
|
||||||
late StreamSubscription<String> _sub;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_ctr = StreamController<String>();
|
subInit();
|
||||||
_sub = _ctr.stream
|
|
||||||
.debounce(const Duration(milliseconds: 200), trailing: true)
|
|
||||||
.listen((value) {
|
|
||||||
if (value.isEmpty) {
|
|
||||||
_list.clear();
|
|
||||||
} else {
|
|
||||||
value = value.toLowerCase();
|
|
||||||
_list.value = _settings
|
|
||||||
.where(
|
|
||||||
(item) =>
|
|
||||||
(item.title ?? item.getTitle?.call())
|
|
||||||
?.toLowerCase()
|
|
||||||
.contains(value) ||
|
|
||||||
item.subtitle?.toLowerCase().contains(value) == true,
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
ValueChanged<String> get onKeywordChanged => (value) {
|
||||||
|
if (value.isEmpty) {
|
||||||
|
_list.clear();
|
||||||
|
} else {
|
||||||
|
value = value.toLowerCase();
|
||||||
|
_list.value = _settings
|
||||||
|
.where(
|
||||||
|
(item) =>
|
||||||
|
(item.title ?? item.getTitle?.call())?.toLowerCase().contains(
|
||||||
|
value,
|
||||||
|
) ||
|
||||||
|
item.subtitle?.toLowerCase().contains(value) == true,
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_sub.cancel();
|
subDispose();
|
||||||
_ctr.close();
|
|
||||||
_textEditingController.dispose();
|
_textEditingController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
@@ -89,7 +85,7 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
|
|||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: _textEditingController,
|
controller: _textEditingController,
|
||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
onChanged: _ctr.add,
|
onChanged: ctr!.add,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
isDense: true,
|
isDense: true,
|
||||||
hintText: '搜索',
|
hintText: '搜索',
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:PiliPlus/grpc/bilibili/app/viewunite/pgcanymodel.pb.dart'
|
|||||||
show ViewPgcAny;
|
show ViewPgcAny;
|
||||||
import 'package:PiliPlus/grpc/view.dart';
|
import 'package:PiliPlus/grpc/view.dart';
|
||||||
import 'package:PiliPlus/http/constants.dart';
|
import 'package:PiliPlus/http/constants.dart';
|
||||||
|
import 'package:PiliPlus/http/fav.dart';
|
||||||
import 'package:PiliPlus/http/search.dart';
|
import 'package:PiliPlus/http/search.dart';
|
||||||
import 'package:PiliPlus/http/video.dart';
|
import 'package:PiliPlus/http/video.dart';
|
||||||
import 'package:PiliPlus/models/common/video/source_type.dart';
|
import 'package:PiliPlus/models/common/video/source_type.dart';
|
||||||
@@ -51,6 +52,7 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
|
|
||||||
late final RxBool isFollowed = false.obs;
|
late final RxBool isFollowed = false.obs;
|
||||||
late final RxInt followStatus = (-1).obs;
|
late final RxInt followStatus = (-1).obs;
|
||||||
|
late final RxBool isFav = (pgcItem.userStatus?.favored == 1).obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@@ -479,4 +481,16 @@ class PgcIntroController extends CommonIntroController {
|
|||||||
artist: pgcItem.title,
|
artist: pgcItem.title,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> onFavPugv(bool isFav) async {
|
||||||
|
final res = isFav
|
||||||
|
? await FavHttp.delFavPugv(seasonId)
|
||||||
|
: await FavHttp.addFavPugv(seasonId);
|
||||||
|
if (res['status']) {
|
||||||
|
this.isFav.value = !isFav;
|
||||||
|
SmartDialog.showToast('${isFav ? '取消' : ''}收藏成功');
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:math';
|
|||||||
|
|
||||||
import 'package:PiliPlus/common/constants.dart';
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
||||||
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
||||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||||
@@ -80,7 +81,7 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
spacing: 10,
|
spacing: 10,
|
||||||
children: [
|
children: [
|
||||||
_buildCover(isLandscape, item),
|
_buildCover(theme, isLandscape, item),
|
||||||
Expanded(child: _buildInfoPanel(isLandscape, theme, item)),
|
Expanded(child: _buildInfoPanel(isLandscape, theme, item)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -142,6 +143,7 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
|||||||
radius: 0,
|
radius: 0,
|
||||||
src: e.url,
|
src: e.url,
|
||||||
width: imgWidth,
|
width: imgWidth,
|
||||||
|
height: imgWidth * e.aspectRatio,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
@@ -153,7 +155,7 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCover(bool isLandscape, PgcInfoModel item) {
|
Widget _buildCover(ThemeData theme, bool isLandscape, PgcInfoModel item) {
|
||||||
return Stack(
|
return Stack(
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
@@ -183,6 +185,24 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
|||||||
bottom: 6,
|
bottom: 6,
|
||||||
left: null,
|
left: null,
|
||||||
),
|
),
|
||||||
|
if (!pgcIntroController.isPgc)
|
||||||
|
Positioned(
|
||||||
|
right: 6,
|
||||||
|
bottom: 6,
|
||||||
|
child: Obx(() {
|
||||||
|
final isFav = pgcIntroController.isFav.value;
|
||||||
|
return iconButton(
|
||||||
|
context: context,
|
||||||
|
size: 28,
|
||||||
|
iconSize: 26,
|
||||||
|
tooltip: '${isFav ? '取消' : ''}收藏',
|
||||||
|
onPressed: () => pgcIntroController.onFavPugv(isFav),
|
||||||
|
icon: isFav ? Icons.star_rounded : Icons.star_border_rounded,
|
||||||
|
bgColor: isFav ? null : theme.colorScheme.onInverseSurface,
|
||||||
|
iconColor: isFav ? null : theme.colorScheme.onSurfaceVariant,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -374,7 +394,7 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
|||||||
item.upInfo!.avatar!,
|
item.upInfo!.avatar!,
|
||||||
item.upInfo!.uname!,
|
item.upInfo!.uname!,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 6),
|
||||||
],
|
],
|
||||||
Text(
|
Text(
|
||||||
item.title!,
|
item.title!,
|
||||||
|
|||||||
Reference in New Issue
Block a user