mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
Merge branch 'main' into feature-danmaku
This commit is contained in:
@@ -74,12 +74,14 @@ Xcode 13.4 不支持**auto_orientation**,请注释相关代码
|
|||||||
- [ ] 弹幕
|
- [ ] 弹幕
|
||||||
- [ ] 字幕
|
- [ ] 字幕
|
||||||
- [x] 记忆播放
|
- [x] 记忆播放
|
||||||
|
- [x] 视频比例:高度/宽度适应、填充、包含等
|
||||||
|
|
||||||
- [x] 搜索相关
|
- [x] 搜索相关
|
||||||
- [x] 热搜
|
- [x] 热搜
|
||||||
- [x] 搜索历史
|
- [x] 搜索历史
|
||||||
- [x] 默认搜索词
|
- [x] 默认搜索词
|
||||||
- [x] 投稿、番剧、直播间、用户搜索
|
- [x] 投稿、番剧、直播间、用户搜索
|
||||||
|
- [x] 视频搜索排序、按时长筛选
|
||||||
|
|
||||||
- [x] 视频详情页相关
|
- [x] 视频详情页相关
|
||||||
- [x] 视频选集(分p)切换
|
- [x] 视频选集(分p)切换
|
||||||
|
|||||||
1
assets/images/error.svg
Normal file
1
assets/images/error.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 26 KiB |
19
change_log/1.0.2.0819.md
Normal file
19
change_log/1.0.2.0819.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
## 1.0.2
|
||||||
|
|
||||||
|
### 新功能
|
||||||
|
+ 自动检查更新
|
||||||
|
+ 封面图片保存
|
||||||
|
+ 动态跳转番剧
|
||||||
|
+ 历史记录番剧记忆播放
|
||||||
|
+ 一键清空稍后再看
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
+ 切换分P cid未切换
|
||||||
|
+ cookie存储问题
|
||||||
|
+ 登录/退出登录问题
|
||||||
|
|
||||||
|
### 优化
|
||||||
|
+ 页面空/异常状态样式
|
||||||
|
+ 退出登录提示
|
||||||
|
+ 请求节流
|
||||||
|
+ 全屏播放
|
||||||
19
change_log/1.0.3.0821.md
Normal file
19
change_log/1.0.3.0821.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
## 1.0.3
|
||||||
|
|
||||||
|
建议卸载1.0.2版本,重新安装
|
||||||
|
### 新功能
|
||||||
|
+ 底部播放进度条设置
|
||||||
|
+ 复制图片链接
|
||||||
|
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
+ 用户数据格式修改
|
||||||
|
+ video Fit
|
||||||
|
+ 没有audio 资源的视频异常
|
||||||
|
+ 评论区域图片无法点击
|
||||||
|
+ 视频进度条拖动问题
|
||||||
|
|
||||||
|
### 优化
|
||||||
|
+ 页面空/异常状态样式
|
||||||
|
+ 部分页面样式
|
||||||
|
+ 图片预览页面样式
|
||||||
@@ -1,31 +1,41 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
class HttpError extends StatelessWidget {
|
class HttpError extends StatelessWidget {
|
||||||
const HttpError({required this.errMsg, required this.fn, super.key});
|
const HttpError(
|
||||||
|
{required this.errMsg, required this.fn, this.btnText, super.key});
|
||||||
|
|
||||||
final String? errMsg;
|
final String? errMsg;
|
||||||
final Function()? fn;
|
final Function()? fn;
|
||||||
|
final String? btnText;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SliverToBoxAdapter(
|
return SliverToBoxAdapter(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 150,
|
height: 400,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
"assets/images/error.svg",
|
||||||
|
height: 200,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
errMsg ?? '请求异常',
|
errMsg ?? '请求异常',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 30),
|
||||||
ElevatedButton(
|
OutlinedButton.icon(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
fn!();
|
fn!();
|
||||||
},
|
},
|
||||||
child: const Text('点击重试'))
|
icon: const Icon(Icons.arrow_forward_outlined, size: 20),
|
||||||
|
label: Text(btnText ?? '点击重试'),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
31
lib/common/widgets/no_data.dart
Normal file
31
lib/common/widgets/no_data.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
|
class NoData extends StatelessWidget {
|
||||||
|
const NoData({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SliverToBoxAdapter(
|
||||||
|
child: SizedBox(
|
||||||
|
height: 400,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
"assets/images/error.svg",
|
||||||
|
height: 200,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Text(
|
||||||
|
'没有数据',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ class VideoCardH extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
StyleString.safeSpace, 7, StyleString.safeSpace, 7),
|
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, boxConstraints) {
|
builder: (context, boxConstraints) {
|
||||||
double width =
|
double width =
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class Request {
|
|||||||
|
|
||||||
/// 设置cookie
|
/// 设置cookie
|
||||||
static setCookie() async {
|
static setCookie() async {
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
var cookiePath = await Utils.getCookiePath();
|
var cookiePath = await Utils.getCookiePath();
|
||||||
var cookieJar = PersistCookieJar(
|
var cookieJar = PersistCookieJar(
|
||||||
ignoreExpires: true,
|
ignoreExpires: true,
|
||||||
@@ -30,7 +30,8 @@ class Request {
|
|||||||
dio.interceptors.add(cookieManager);
|
dio.interceptors.add(cookieManager);
|
||||||
var cookie = await cookieManager.cookieJar
|
var cookie = await cookieManager.cookieJar
|
||||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||||
if (user.get(UserBoxKey.userMid) != null) {
|
var userInfo = userInfoCache.get('userInfoCache');
|
||||||
|
if (userInfo != null && userInfo.mid != null) {
|
||||||
var cookie2 = await cookieManager.cookieJar
|
var cookie2 = await cookieManager.cookieJar
|
||||||
.loadForRequest(Uri.parse(HttpString.tUrl));
|
.loadForRequest(Uri.parse(HttpString.tUrl));
|
||||||
if (cookie2.isEmpty) {
|
if (cookie2.isEmpty) {
|
||||||
@@ -86,9 +87,10 @@ class Request {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
if (user.get(UserBoxKey.userMid) != null) {
|
var userInfo = userInfoCache.get('userInfoCache');
|
||||||
options.headers['x-bili-mid'] = user.get(UserBoxKey.userMid).toString();
|
if (userInfo != null && userInfo.mid != null) {
|
||||||
|
options.headers['x-bili-mid'] = userInfo.mid.toString();
|
||||||
options.headers['env'] = 'prod';
|
options.headers['env'] = 'prod';
|
||||||
options.headers['app-key'] = 'android64';
|
options.headers['app-key'] = 'android64';
|
||||||
options.headers['x-bili-aurora-eid'] = 'UlMFQVcABlAH';
|
options.headers['x-bili-aurora-eid'] = 'UlMFQVcABlAH';
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class ApiInterceptor extends Interceptor {
|
|||||||
handler.next(options);
|
handler.next(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
Box user = GStrorage.user;
|
Box localCache = GStrorage.localCache;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
||||||
@@ -29,7 +29,8 @@ class ApiInterceptor extends Interceptor {
|
|||||||
final uri = Uri.parse(locations.first);
|
final uri = Uri.parse(locations.first);
|
||||||
final accessKey = uri.queryParameters['access_key'];
|
final accessKey = uri.queryParameters['access_key'];
|
||||||
final mid = uri.queryParameters['mid'];
|
final mid = uri.queryParameters['mid'];
|
||||||
user.put(UserBoxKey.accessKey, {'mid': mid, 'value': accessKey});
|
localCache
|
||||||
|
.put(LocalCacheKey.accessKey, {'mid': mid, 'value': accessKey});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,14 +46,19 @@ class SearchHttp {
|
|||||||
required SearchType searchType,
|
required SearchType searchType,
|
||||||
required String keyword,
|
required String keyword,
|
||||||
required page,
|
required page,
|
||||||
|
String? order,
|
||||||
|
int? duration,
|
||||||
}) async {
|
}) async {
|
||||||
var res = await Request().get(Api.searchByType, data: {
|
var reqData = {
|
||||||
'search_type': searchType.type,
|
'search_type': searchType.type,
|
||||||
'keyword': keyword,
|
'keyword': keyword,
|
||||||
// 'order_sort': 0,
|
// 'order_sort': 0,
|
||||||
// 'user_type': 0,
|
// 'user_type': 0,
|
||||||
'page': page
|
'page': page,
|
||||||
});
|
if (order != null) 'order': order,
|
||||||
|
if (duration != null) 'duration': duration,
|
||||||
|
};
|
||||||
|
var res = await Request().get(Api.searchByType, data: reqData);
|
||||||
if (res.data['code'] == 0 && res.data['data']['numPages'] > 0) {
|
if (res.data['code'] == 0 && res.data['data']['numPages'] > 0) {
|
||||||
Object data;
|
Object data;
|
||||||
switch (searchType) {
|
switch (searchType) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/http/api.dart';
|
import 'package:pilipala/http/api.dart';
|
||||||
import 'package:pilipala/http/init.dart';
|
import 'package:pilipala/http/init.dart';
|
||||||
@@ -197,8 +198,12 @@ class UserHttp {
|
|||||||
'sign': Constants.thirdSign,
|
'sign': Constants.thirdSign,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0 && res.data['data']['has_login'] == 1) {
|
try {
|
||||||
Request().get(res.data['data']['confirm_uri']);
|
if (res.data['code'] == 0 && res.data['data']['has_login'] == 1) {
|
||||||
|
Request().get(res.data['data']['confirm_uri']);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
SmartDialog.showNotify(msg: '获取用户凭证: $err', notifyType: NotifyType.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import 'package:pilipala/utils/storage.dart';
|
|||||||
/// 返回{'status': bool, 'data': List}
|
/// 返回{'status': bool, 'data': List}
|
||||||
/// view层根据 status 判断渲染逻辑
|
/// view层根据 status 判断渲染逻辑
|
||||||
class VideoHttp {
|
class VideoHttp {
|
||||||
static Box user = GStrorage.user;
|
static Box localCache = GStrorage.localCache;
|
||||||
static Box setting = GStrorage.setting;
|
static Box setting = GStrorage.setting;
|
||||||
|
|
||||||
// 首页推荐视频
|
// 首页推荐视频
|
||||||
@@ -61,8 +61,9 @@ class VideoHttp {
|
|||||||
'device_name': 'vivo',
|
'device_name': 'vivo',
|
||||||
'pull': freshIdx == 0 ? 'true' : 'false',
|
'pull': freshIdx == 0 ? 'true' : 'false',
|
||||||
'appkey': Constants.appKey,
|
'appkey': Constants.appKey,
|
||||||
'access_key':
|
'access_key': localCache
|
||||||
user.get(UserBoxKey.accessKey, defaultValue: {})['value'] ?? ''
|
.get(LocalCacheKey.accessKey, defaultValue: {})['value'] ??
|
||||||
|
''
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
@@ -137,7 +138,12 @@ class VideoHttp {
|
|||||||
'data': PlayUrlModel.fromJson(res.data['data'])
|
'data': PlayUrlModel.fromJson(res.data['data'])
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'data': []};
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'code': res.data['code'],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return {'status': false, 'data': [], 'msg': err};
|
return {'status': false, 'data': [], 'msg': err};
|
||||||
@@ -154,13 +160,14 @@ class VideoHttp {
|
|||||||
Map errMap = {
|
Map errMap = {
|
||||||
-400: '请求错误',
|
-400: '请求错误',
|
||||||
-403: '权限不足',
|
-403: '权限不足',
|
||||||
-404: '无视频',
|
-404: '视频资源失效',
|
||||||
62002: '稿件不可见',
|
62002: '稿件不可见',
|
||||||
62004: '稿件审核中',
|
62004: '稿件审核中',
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': null,
|
'data': null,
|
||||||
|
'code': result.code,
|
||||||
'msg': errMap[result.code] ?? '请求异常',
|
'msg': errMap[result.code] ?? '请求异常',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,3 +27,20 @@ extension SearchTypeExtension on SearchType {
|
|||||||
['video', 'media_bangumi', 'live_room', 'bili_user'][index];
|
['video', 'media_bangumi', 'live_room', 'bili_user'][index];
|
||||||
String get label => ['视频', '番剧', '直播间', '用户'][index];
|
String get label => ['视频', '番剧', '直播间', '用户'][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 搜索类型为视频、专栏及相簿时
|
||||||
|
enum ArchiveFilterType {
|
||||||
|
totalrank,
|
||||||
|
click,
|
||||||
|
pubdate,
|
||||||
|
dm,
|
||||||
|
stow,
|
||||||
|
scores,
|
||||||
|
// 专栏
|
||||||
|
// attention,
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ArchiveFilterTypeExtension on ArchiveFilterType {
|
||||||
|
String get description =>
|
||||||
|
['默认排序', '播放多', '新发布', '弹幕多', '收藏多', '评论多', '最多喜欢'][index];
|
||||||
|
}
|
||||||
|
|||||||
@@ -408,6 +408,7 @@ class DynamicMajorModel {
|
|||||||
this.live,
|
this.live,
|
||||||
this.none,
|
this.none,
|
||||||
this.type,
|
this.type,
|
||||||
|
this.courses,
|
||||||
});
|
});
|
||||||
|
|
||||||
DynamicArchiveModel? archive;
|
DynamicArchiveModel? archive;
|
||||||
@@ -422,6 +423,7 @@ class DynamicMajorModel {
|
|||||||
// MAJOR_TYPE_ARCHIVE 视频
|
// MAJOR_TYPE_ARCHIVE 视频
|
||||||
// MAJOR_TYPE_OPUS 图文/文章
|
// MAJOR_TYPE_OPUS 图文/文章
|
||||||
String? type;
|
String? type;
|
||||||
|
Map? courses;
|
||||||
|
|
||||||
DynamicMajorModel.fromJson(Map<String, dynamic> json) {
|
DynamicMajorModel.fromJson(Map<String, dynamic> json) {
|
||||||
archive = json['archive'] != null
|
archive = json['archive'] != null
|
||||||
@@ -444,6 +446,7 @@ class DynamicMajorModel {
|
|||||||
none =
|
none =
|
||||||
json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null;
|
json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null;
|
||||||
type = json['type'];
|
type = json['type'];
|
||||||
|
courses = json['courses'] ?? {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ class FollowUpModel {
|
|||||||
List<UpItem>? upList;
|
List<UpItem>? upList;
|
||||||
|
|
||||||
FollowUpModel.fromJson(Map<String, dynamic> json) {
|
FollowUpModel.fromJson(Map<String, dynamic> json) {
|
||||||
liveUsers = LiveUsers.fromJson(json['live_users']);
|
liveUsers = json['live_users'] != null
|
||||||
|
? LiveUsers.fromJson(json['live_users'])
|
||||||
|
: null;
|
||||||
upList = json['up_list'] != null
|
upList = json['up_list'] != null
|
||||||
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
|
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
|
||||||
: [];
|
: [];
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ class LatestDataModel {
|
|||||||
this.tagName,
|
this.tagName,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.assets,
|
this.assets,
|
||||||
|
this.body,
|
||||||
});
|
});
|
||||||
|
|
||||||
String? url;
|
String? url;
|
||||||
String? tagName;
|
String? tagName;
|
||||||
String? createdAt;
|
String? createdAt;
|
||||||
List? assets;
|
List? assets;
|
||||||
|
String? body;
|
||||||
|
|
||||||
LatestDataModel.fromJson(Map<String, dynamic> json) {
|
LatestDataModel.fromJson(Map<String, dynamic> json) {
|
||||||
url = json['url'];
|
url = json['url'];
|
||||||
@@ -17,6 +19,7 @@ class LatestDataModel {
|
|||||||
createdAt = json['created_at'];
|
createdAt = json['created_at'];
|
||||||
assets =
|
assets =
|
||||||
json['assets'].map<AssetItem>((e) => AssetItem.fromJson(e)).toList();
|
json['assets'].map<AssetItem>((e) => AssetItem.fromJson(e)).toList();
|
||||||
|
body = json['body'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class SearchSuggestModel {
|
class SearchSuggestModel {
|
||||||
SearchSuggestModel({
|
SearchSuggestModel({
|
||||||
this.tag,
|
this.tag,
|
||||||
@@ -19,32 +22,74 @@ class SearchSuggestItem {
|
|||||||
SearchSuggestItem({
|
SearchSuggestItem({
|
||||||
this.value,
|
this.value,
|
||||||
this.term,
|
this.term,
|
||||||
this.name,
|
|
||||||
this.spid,
|
this.spid,
|
||||||
|
this.textRich,
|
||||||
});
|
});
|
||||||
|
|
||||||
String? value;
|
String? value;
|
||||||
String? term;
|
String? term;
|
||||||
List? name;
|
|
||||||
int? spid;
|
int? spid;
|
||||||
|
Widget? textRich;
|
||||||
|
|
||||||
SearchSuggestItem.fromJson(Map<String, dynamic> json, String inputTerm) {
|
SearchSuggestItem.fromJson(Map<String, dynamic> json, String inputTerm) {
|
||||||
value = json['value'];
|
value = json['value'];
|
||||||
term = json['term'];
|
term = json['term'];
|
||||||
String reg = '<em class="suggest_high_light">$inputTerm</em>';
|
textRich = highlightText(json['name']);
|
||||||
try {
|
|
||||||
if (json['name'].indexOf(inputTerm) != -1) {
|
|
||||||
String str = json['name'].replaceAll(reg, '^');
|
|
||||||
List arr = str.split('^');
|
|
||||||
arr.insert(arr.length - 1, inputTerm);
|
|
||||||
name = arr;
|
|
||||||
} else {
|
|
||||||
name = ['', '', json['term']];
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
name = ['', '', json['term']];
|
|
||||||
}
|
|
||||||
|
|
||||||
spid = json['spid'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget highlightText(String str) {
|
||||||
|
// 创建正则表达式,匹配 <em class="suggest_high_light">...</em> 格式的文本
|
||||||
|
RegExp regex = RegExp(r'<em class="suggest_high_light">(.*?)<\/em>');
|
||||||
|
|
||||||
|
// 用于存储每个匹配项的列表
|
||||||
|
List<InlineSpan> children = [];
|
||||||
|
|
||||||
|
// 获取所有匹配项
|
||||||
|
Iterable<Match> matches = regex.allMatches(str);
|
||||||
|
|
||||||
|
// 当前索引位置
|
||||||
|
int currentIndex = 0;
|
||||||
|
|
||||||
|
// 遍历每个匹配项
|
||||||
|
for (var match in matches) {
|
||||||
|
// 获取当前匹配项之前的普通文本部分
|
||||||
|
String normalText = str.substring(currentIndex, match.start);
|
||||||
|
|
||||||
|
// 获取需要高亮显示的文本部分
|
||||||
|
String highlightedText = match.group(1)!;
|
||||||
|
|
||||||
|
// 如果普通文本部分不为空,则将其添加到 children 列表中
|
||||||
|
if (normalText.isNotEmpty) {
|
||||||
|
children.add(TextSpan(
|
||||||
|
text: normalText,
|
||||||
|
style: DefaultTextStyle.of(Get.context!).style,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将需要高亮显示的文本部分添加到 children 列表中,并设置相应样式
|
||||||
|
children.add(TextSpan(
|
||||||
|
text: highlightedText,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(Get.context!).colorScheme.primary),
|
||||||
|
));
|
||||||
|
|
||||||
|
// 更新当前索引位置
|
||||||
|
currentIndex = match.end;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果当前索引位置小于文本长度,表示还有剩余的普通文本部分
|
||||||
|
if (currentIndex < str.length) {
|
||||||
|
String remainingText = str.substring(currentIndex);
|
||||||
|
|
||||||
|
// 将剩余的普通文本部分添加到 children 列表中
|
||||||
|
children.add(TextSpan(
|
||||||
|
text: remainingText,
|
||||||
|
style: DefaultTextStyle.of(Get.context!).style,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用 Text.rich 创建包含高亮显示的富文本小部件,并返回
|
||||||
|
return Text.rich(TextSpan(children: children));
|
||||||
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class HisListItem {
|
|||||||
viewAt = json['view_at'];
|
viewAt = json['view_at'];
|
||||||
progress = json['progress'];
|
progress = json['progress'];
|
||||||
badge = json['badge'];
|
badge = json['badge'];
|
||||||
showTitle = json['show_title'];
|
showTitle = json['show_title'] == '' ? null : json['show_title'];
|
||||||
duration = json['duration'];
|
duration = json['duration'];
|
||||||
current = json['current'];
|
current = json['current'];
|
||||||
total = json['total'];
|
total = json['total'];
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class UserInfoData {
|
|||||||
@HiveField(5)
|
@HiveField(5)
|
||||||
int? mobileVerified;
|
int? mobileVerified;
|
||||||
@HiveField(6)
|
@HiveField(6)
|
||||||
int? money;
|
double? money;
|
||||||
@HiveField(7)
|
@HiveField(7)
|
||||||
int? moral;
|
int? moral;
|
||||||
@HiveField(8)
|
@HiveField(8)
|
||||||
@@ -88,7 +88,7 @@ class UserInfoData {
|
|||||||
: LevelInfo();
|
: LevelInfo();
|
||||||
mid = json['mid'];
|
mid = json['mid'];
|
||||||
mobileVerified = json['mobile_verified'];
|
mobileVerified = json['mobile_verified'];
|
||||||
money = json['money'];
|
money = json['money'] is int ? json['money'].toDouble() : json['money'];
|
||||||
moral = json['moral'];
|
moral = json['moral'];
|
||||||
official = json['official'];
|
official = json['official'];
|
||||||
officialVerify = json['officialVerify'];
|
officialVerify = json['officialVerify'];
|
||||||
@@ -130,6 +130,7 @@ class LevelInfo {
|
|||||||
currentLevel = json['current_level'];
|
currentLevel = json['current_level'];
|
||||||
currentMin = json['current_min'];
|
currentMin = json['current_min'];
|
||||||
currentExp = json['current_exp'];
|
currentExp = json['current_exp'];
|
||||||
nextExp = json['next_exp'];
|
nextExp =
|
||||||
|
json['current_level'] == 6 ? json['current_exp'] : json['next_exp'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class UserInfoDataAdapter extends TypeAdapter<UserInfoData> {
|
|||||||
levelInfo: fields[3] as LevelInfo?,
|
levelInfo: fields[3] as LevelInfo?,
|
||||||
mid: fields[4] as int?,
|
mid: fields[4] as int?,
|
||||||
mobileVerified: fields[5] as int?,
|
mobileVerified: fields[5] as int?,
|
||||||
money: fields[6] as int?,
|
money: fields[6] as double?,
|
||||||
moral: fields[7] as int?,
|
moral: fields[7] as int?,
|
||||||
official: (fields[8] as Map?)?.cast<dynamic, dynamic>(),
|
official: (fields[8] as Map?)?.cast<dynamic, dynamic>(),
|
||||||
officialVerify: (fields[9] as Map?)?.cast<dynamic, dynamic>(),
|
officialVerify: (fields[9] as Map?)?.cast<dynamic, dynamic>(),
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
|
||||||
import 'package:pilipala/http/index.dart';
|
import 'package:pilipala/http/index.dart';
|
||||||
import 'package:pilipala/models/github/latest.dart';
|
import 'package:pilipala/models/github/latest.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
@@ -165,7 +164,7 @@ class AboutController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取啊当前版本
|
// 获取当前版本
|
||||||
Future getCurrentApp() async {
|
Future getCurrentApp() async {
|
||||||
var result = await PackageInfo.fromPlatform();
|
var result = await PackageInfo.fromPlatform();
|
||||||
currentVersion.value = result.version;
|
currentVersion.value = result.version;
|
||||||
|
|||||||
@@ -11,17 +11,19 @@ class BangumiController extends GetxController {
|
|||||||
RxList<BangumiListItemModel> bangumiFollowList = [BangumiListItemModel()].obs;
|
RxList<BangumiListItemModel> bangumiFollowList = [BangumiListItemModel()].obs;
|
||||||
int _currentPage = 1;
|
int _currentPage = 1;
|
||||||
bool isLoadingMore = true;
|
bool isLoadingMore = true;
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
RxBool userLogin = false.obs;
|
RxBool userLogin = false.obs;
|
||||||
late int mid;
|
late int mid;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
if (user.get(UserBoxKey.userMid) != null) {
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
mid = int.parse(user.get(UserBoxKey.userMid).toString());
|
if (userInfo != null) {
|
||||||
|
mid = userInfo.mid;
|
||||||
}
|
}
|
||||||
userLogin.value = user.get(UserBoxKey.userLogin) != null;
|
userLogin.value = userInfo != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future queryBangumiListFeed({type = 'init'}) async {
|
Future queryBangumiListFeed({type = 'init'}) async {
|
||||||
@@ -48,7 +50,11 @@ class BangumiController extends GetxController {
|
|||||||
|
|
||||||
// 我的订阅
|
// 我的订阅
|
||||||
Future queryBangumiFollow() async {
|
Future queryBangumiFollow() async {
|
||||||
var result = await BangumiHttp.bangumiFollow(mid: 17340771);
|
userInfo = userInfo ?? userInfoCache.get('userInfoCache');
|
||||||
|
if (userInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await BangumiHttp.bangumiFollow(mid: userInfo.mid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
bangumiFollowList.value = result['data'].list;
|
bangumiFollowList.value = result['data'].list;
|
||||||
} else {}
|
} else {}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class BangumiIntroController extends GetxController {
|
|||||||
RxBool hasCoin = false.obs;
|
RxBool hasCoin = false.obs;
|
||||||
// 是否收藏
|
// 是否收藏
|
||||||
RxBool hasFav = false.obs;
|
RxBool hasFav = false.obs;
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
bool userLogin = false;
|
bool userLogin = false;
|
||||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||||
List addMediaIdsNew = [];
|
List addMediaIdsNew = [];
|
||||||
@@ -57,6 +57,7 @@ class BangumiIntroController extends GetxController {
|
|||||||
// 关注状态 默认未关注
|
// 关注状态 默认未关注
|
||||||
RxMap followStatus = {}.obs;
|
RxMap followStatus = {}.obs;
|
||||||
int _tempThemeValue = -1;
|
int _tempThemeValue = -1;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@@ -82,7 +83,8 @@ class BangumiIntroController extends GetxController {
|
|||||||
// videoItem!['owner'] = args.owner;
|
// videoItem!['owner'] = args.owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userLogin = user.get(UserBoxKey.userLogin) != null;
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
|
userLogin = userInfo != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取番剧简介&选集
|
// 获取番剧简介&选集
|
||||||
@@ -142,7 +144,7 @@ class BangumiIntroController extends GetxController {
|
|||||||
|
|
||||||
// 投币
|
// 投币
|
||||||
Future actionCoinVideo() async {
|
Future actionCoinVideo() async {
|
||||||
if (user.get(UserBoxKey.userMid) == null) {
|
if (userInfo == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -283,7 +285,7 @@ class BangumiIntroController extends GetxController {
|
|||||||
|
|
||||||
Future queryVideoInFolder() async {
|
Future queryVideoInFolder() async {
|
||||||
var result = await VideoHttp.videoInFolder(
|
var result = await VideoHttp.videoInFolder(
|
||||||
mid: user.get(UserBoxKey.userMid), rid: IdUtils.bv2av(bvid));
|
mid: userInfo.mid, rid: IdUtils.bv2av(bvid));
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
favFolderData.value = result['data'];
|
favFolderData.value = result['data'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
|
|
||||||
// 收藏
|
// 收藏
|
||||||
showFavBottomSheet() {
|
showFavBottomSheet() {
|
||||||
if (bangumiIntroController.user.get(UserBoxKey.userMid) == null) {
|
if (bangumiIntroController.userInfo.mid == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -22,24 +23,28 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
final BangumiController _bangumidController = Get.put(BangumiController());
|
final BangumiController _bangumidController = Get.put(BangumiController());
|
||||||
late Future? _futureBuilderFuture;
|
late Future? _futureBuilderFuture;
|
||||||
|
late Future? _futureBuilderFutureFollow;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
ScrollController scrollController = _bangumidController.scrollController;
|
scrollController = _bangumidController.scrollController;
|
||||||
StreamController<bool> mainStream =
|
StreamController<bool> mainStream =
|
||||||
Get.find<MainController>().bottomBarStream;
|
Get.find<MainController>().bottomBarStream;
|
||||||
_futureBuilderFuture = _bangumidController.queryBangumiListFeed();
|
_futureBuilderFuture = _bangumidController.queryBangumiListFeed();
|
||||||
|
_futureBuilderFutureFollow = _bangumidController.queryBangumiFollow();
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
() async {
|
() async {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 200) {
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
if (!_bangumidController.isLoadingMore) {
|
EasyThrottle.throttle('my-throttler', const Duration(seconds: 1), () {
|
||||||
_bangumidController.isLoadingMore = true;
|
_bangumidController.isLoadingMore = true;
|
||||||
await _bangumidController.onLoad();
|
_bangumidController.onLoad();
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
final ScrollDirection direction =
|
final ScrollDirection direction =
|
||||||
@@ -53,6 +58,12 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
@@ -80,43 +91,61 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
'最近追番',
|
'最近追番',
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_futureBuilderFutureFollow =
|
||||||
|
_bangumidController.queryBangumiFollow();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.refresh,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 258,
|
height: 258,
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _bangumidController.queryBangumiFollow(),
|
future: _futureBuilderFutureFollow,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState ==
|
if (snapshot.connectionState ==
|
||||||
ConnectionState.done) {
|
ConnectionState.done) {
|
||||||
Map data = snapshot.data as Map;
|
Map data = snapshot.data as Map;
|
||||||
|
List list = _bangumidController.bangumiFollowList;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
return Obx(
|
return Obx(
|
||||||
() => ListView.builder(
|
() => list.isNotEmpty
|
||||||
scrollDirection: Axis.horizontal,
|
? ListView.builder(
|
||||||
itemCount: _bangumidController
|
scrollDirection: Axis.horizontal,
|
||||||
.bangumiFollowList.length,
|
itemCount: list.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return Container(
|
return Container(
|
||||||
width: Get.size.width / 3,
|
width: Get.size.width / 3,
|
||||||
height: 254,
|
height: 254,
|
||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
left: StyleString.safeSpace,
|
left: StyleString.safeSpace,
|
||||||
right: index ==
|
right: index ==
|
||||||
_bangumidController
|
_bangumidController
|
||||||
.bangumiFollowList
|
.bangumiFollowList
|
||||||
.length -
|
.length -
|
||||||
1
|
1
|
||||||
? StyleString.safeSpace
|
? StyleString.safeSpace
|
||||||
: 0),
|
: 0),
|
||||||
child: BangumiCardV(
|
child: BangumiCardV(
|
||||||
bangumiItem: _bangumidController
|
bangumiItem: _bangumidController
|
||||||
.bangumiFollowList[index],
|
.bangumiFollowList[index],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: const SizedBox(
|
||||||
|
child: Center(
|
||||||
|
child: Text('还没有追番'),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class _BlackListPageState extends State<BlackListPage> {
|
|||||||
List<int> blackMidsList =
|
List<int> blackMidsList =
|
||||||
_blackListController.blackList.map<int>((e) => e.mid!).toList();
|
_blackListController.blackList.map<int>((e) => e.mid!).toList();
|
||||||
setting.put(SettingBoxKey.blackMidsList, blackMidsList);
|
setting.put(SettingBoxKey.blackMidsList, blackMidsList);
|
||||||
|
scrollController.removeListener(() {});
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,29 +51,42 @@ class DynamicsController extends GetxController {
|
|||||||
];
|
];
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
RxInt initialValue = 1.obs;
|
RxInt initialValue = 1.obs;
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
RxBool userLogin = false.obs;
|
RxBool userLogin = false.obs;
|
||||||
|
var userInfo;
|
||||||
|
RxBool isLoadingDynamic = false.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
userLogin.value = user.get(UserBoxKey.userLogin, defaultValue: false);
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
|
userLogin.value = userInfo != null;
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future queryFollowDynamic({type = 'init'}) async {
|
Future queryFollowDynamic({type = 'init'}) async {
|
||||||
if (!userLogin.value) {
|
if (!userLogin.value) {
|
||||||
return {'status': false, 'msg': '未登录'};
|
return {'status': false, 'msg': '账号未登录'};
|
||||||
}
|
}
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
dynamicsList.clear();
|
dynamicsList.clear();
|
||||||
}
|
}
|
||||||
|
// 下拉刷新数据渲染时会触发onLoad
|
||||||
|
if (type == 'onLoad' && page == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isLoadingDynamic.value = true;
|
||||||
var res = await DynamicsHttp.followDynamic(
|
var res = await DynamicsHttp.followDynamic(
|
||||||
page: type == 'init' ? 1 : page,
|
page: type == 'init' ? 1 : page,
|
||||||
type: dynamicsType.value.values,
|
type: dynamicsType.value.values,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
mid: mid.value,
|
mid: mid.value,
|
||||||
);
|
);
|
||||||
|
isLoadingDynamic.value = false;
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
|
if (type == 'onLoad' && res['data'].items.isEmpty) {
|
||||||
|
SmartDialog.showToast('没有更多了');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
dynamicsList.value = res['data'].items;
|
dynamicsList.value = res['data'].items;
|
||||||
} else {
|
} else {
|
||||||
@@ -188,12 +201,19 @@ class DynamicsController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future queryFollowUp({type = 'init'}) async {
|
Future queryFollowUp({type = 'init'}) async {
|
||||||
|
if (!userLogin.value) {
|
||||||
|
return {'status': false, 'msg': '账号未登录'};
|
||||||
|
}
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
upData = FollowUpModel().obs;
|
upData.value.upList = [];
|
||||||
|
upData.value.liveUsers = LiveUsers();
|
||||||
}
|
}
|
||||||
var res = await DynamicsHttp.followUp();
|
var res = await DynamicsHttp.followUp();
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
upData.value = res['data'];
|
upData.value = res['data'];
|
||||||
|
if (upData.value.upList!.isEmpty) {
|
||||||
|
mid.value = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -207,7 +227,8 @@ class DynamicsController extends GetxController {
|
|||||||
|
|
||||||
onRefresh() async {
|
onRefresh() async {
|
||||||
page = 1;
|
page = 1;
|
||||||
queryFollowUp();
|
print('onRefresh');
|
||||||
|
await queryFollowUp();
|
||||||
await queryFollowDynamic();
|
await queryFollowDynamic();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +248,7 @@ class DynamicsController extends GetxController {
|
|||||||
mid.value = -1;
|
mid.value = -1;
|
||||||
dynamicsType.value = DynamicsType.values[0];
|
dynamicsType.value = DynamicsType.values[0];
|
||||||
initialValue.value = 1;
|
initialValue.value = 1;
|
||||||
SmartDialog.showToast('还原默认加载', alignment: Alignment.topCenter);
|
SmartDialog.showToast('还原默认加载');
|
||||||
dynamicsList.value = [DynamicItemModel()];
|
dynamicsList.value = [DynamicItemModel()];
|
||||||
queryFollowDynamic();
|
queryFollowDynamic();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/skeleton/video_reply.dart';
|
import 'package:pilipala/common/skeleton/video_reply.dart';
|
||||||
@@ -40,7 +41,9 @@ class _DynamicDetailPageState extends State<DynamicDetailPage> {
|
|||||||
} else {
|
} else {
|
||||||
oid = Get.arguments['item'].modules.moduleDynamic.major.draw.id;
|
oid = Get.arguments['item'].modules.moduleDynamic.major.draw.id;
|
||||||
}
|
}
|
||||||
type = Get.arguments['item'].basic!['comment_type'];
|
int commentType = Get.arguments['item'].basic!['comment_type'] ?? 11;
|
||||||
|
type = (commentType == 0) ? 11 : commentType;
|
||||||
|
|
||||||
action =
|
action =
|
||||||
Get.arguments.containsKey('action') ? Get.arguments['action'] : null;
|
Get.arguments.containsKey('action') ? Get.arguments['action'] : null;
|
||||||
_dynamicDetailController = Get.put(DynamicDetailController(oid, type));
|
_dynamicDetailController = Get.put(DynamicDetailController(oid, type));
|
||||||
@@ -56,10 +59,9 @@ class _DynamicDetailPageState extends State<DynamicDetailPage> {
|
|||||||
void _listen() async {
|
void _listen() async {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 300) {
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
if (!_dynamicDetailController!.isLoadingMore) {
|
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
||||||
_dynamicDetailController!.isLoadingMore = true;
|
_dynamicDetailController!.queryReplyList(reqType: 'onLoad');
|
||||||
await _dynamicDetailController!.queryReplyList(reqType: 'onLoad');
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollController.offset > 55 && !_visibleTitle) {
|
if (scrollController.offset > 55 && !_visibleTitle) {
|
||||||
@@ -95,6 +97,12 @@ class _DynamicDetailPageState extends State<DynamicDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -236,6 +244,11 @@ class _DynamicDetailPageState extends State<DynamicDetailPage> {
|
|||||||
replyReply: (replyItem) =>
|
replyReply: (replyItem) =>
|
||||||
replyReply(replyItem),
|
replyReply(replyItem),
|
||||||
replyType: ReplyType.values[type],
|
replyType: ReplyType.values[type],
|
||||||
|
addReply: (replyItem) {
|
||||||
|
_dynamicDetailController!
|
||||||
|
.replyList[index].replies!
|
||||||
|
.add(replyItem);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:custom_sliding_segmented_control/custom_sliding_segmented_control.dart';
|
import 'package:custom_sliding_segmented_control/custom_sliding_segmented_control.dart';
|
||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/skeleton/dynamic_card.dart';
|
import 'package:pilipala/common/skeleton/dynamic_card.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
|
import 'package:pilipala/common/widgets/no_data.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/pages/main/index.dart';
|
import 'package:pilipala/pages/main/index.dart';
|
||||||
import 'package:pilipala/utils/event_bus.dart';
|
import 'package:pilipala/utils/event_bus.dart';
|
||||||
@@ -29,9 +31,9 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
||||||
late Future _futureBuilderFuture;
|
late Future _futureBuilderFuture;
|
||||||
late Future _futureBuilderFutureUp;
|
late Future _futureBuilderFutureUp;
|
||||||
bool _isLoadingMore = false;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
Box user = GStrorage.user;
|
|
||||||
EventBus eventBus = EventBus();
|
EventBus eventBus = EventBus();
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
@@ -41,18 +43,17 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
super.initState();
|
super.initState();
|
||||||
_futureBuilderFuture = _dynamicsController.queryFollowDynamic();
|
_futureBuilderFuture = _dynamicsController.queryFollowDynamic();
|
||||||
_futureBuilderFutureUp = _dynamicsController.queryFollowUp();
|
_futureBuilderFutureUp = _dynamicsController.queryFollowUp();
|
||||||
ScrollController scrollController = _dynamicsController.scrollController;
|
scrollController = _dynamicsController.scrollController;
|
||||||
StreamController<bool> mainStream =
|
StreamController<bool> mainStream =
|
||||||
Get.find<MainController>().bottomBarStream;
|
Get.find<MainController>().bottomBarStream;
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
() async {
|
() async {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 200) {
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
if (!_isLoadingMore) {
|
EasyThrottle.throttle(
|
||||||
_isLoadingMore = true;
|
'queryFollowDynamic', const Duration(seconds: 1), () {
|
||||||
await _dynamicsController.queryFollowDynamic(type: 'onLoad');
|
_dynamicsController.queryFollowDynamic(type: 'onLoad');
|
||||||
_isLoadingMore = false;
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final ScrollDirection direction =
|
final ScrollDirection direction =
|
||||||
@@ -74,6 +75,12 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
@@ -145,14 +152,12 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
.textTheme
|
.textTheme
|
||||||
.labelMedium!
|
.labelMedium!
|
||||||
.fontSize)),
|
.fontSize)),
|
||||||
// 4: Text(
|
4: Text('专栏',
|
||||||
// '专栏',
|
style: TextStyle(
|
||||||
// style: TextStyle(
|
fontSize: Theme.of(context)
|
||||||
// fontSize: Theme.of(context)
|
.textTheme
|
||||||
// .textTheme
|
.labelMedium!
|
||||||
// .labelMedium!
|
.fontSize)),
|
||||||
// .fontSize),
|
|
||||||
// ),
|
|
||||||
},
|
},
|
||||||
padding: 13.0,
|
padding: 13.0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -179,22 +184,22 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Obx(
|
// Obx(
|
||||||
() => Visibility(
|
// () => Visibility(
|
||||||
visible: _dynamicsController.userLogin.value,
|
// visible: _dynamicsController.userLogin.value,
|
||||||
child: Positioned(
|
// child: Positioned(
|
||||||
right: 4,
|
// right: 4,
|
||||||
top: 0,
|
// top: 0,
|
||||||
bottom: 0,
|
// bottom: 0,
|
||||||
child: IconButton(
|
// child: IconButton(
|
||||||
padding: EdgeInsets.zero,
|
// padding: EdgeInsets.zero,
|
||||||
onPressed: () =>
|
// onPressed: () =>
|
||||||
{feedBack(), _dynamicsController.resetSearch()},
|
// {feedBack(), _dynamicsController.resetSearch()},
|
||||||
icon: const Icon(Icons.history, size: 21),
|
// icon: const Icon(Icons.history, size: 21),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -233,14 +238,24 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
List<DynamicItemModel> list =
|
List<DynamicItemModel> list =
|
||||||
_dynamicsController.dynamicsList;
|
_dynamicsController.dynamicsList;
|
||||||
return Obx(
|
return Obx(
|
||||||
() => list.isEmpty
|
() {
|
||||||
? skeleton()
|
if (list.isEmpty) {
|
||||||
: SliverList(
|
if (_dynamicsController.isLoadingDynamic.value) {
|
||||||
delegate:
|
return skeleton();
|
||||||
SliverChildBuilderDelegate((context, index) {
|
} else {
|
||||||
|
return const NoData();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return SliverList(
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) {
|
||||||
return DynamicPanel(item: list[index]);
|
return DynamicPanel(item: list[index]);
|
||||||
}, childCount: list.length),
|
},
|
||||||
|
childCount: list.length,
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return HttpError(
|
return HttpError(
|
||||||
@@ -261,6 +276,7 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
const SliverToBoxAdapter(child: SizedBox(height: 40))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class _ActionPanelState extends State<ActionPanel> {
|
|||||||
String dynamicId = item.idStr!;
|
String dynamicId = item.idStr!;
|
||||||
// 1 已点赞 2 不喜欢 0 未操作
|
// 1 已点赞 2 不喜欢 0 未操作
|
||||||
Like like = item.modules.moduleStat.like;
|
Like like = item.modules.moduleStat.like;
|
||||||
int count = int.parse(like.count!);
|
int count = like.count == '点赞' ? 0 : int.parse(like.count ?? '0');
|
||||||
bool status = like.status!;
|
bool status = like.status!;
|
||||||
int up = status ? 2 : 1;
|
int up = status ? 2 : 1;
|
||||||
var res = await DynamicsHttp.likeDynamic(dynamicId: dynamicId, up: up);
|
var res = await DynamicsHttp.likeDynamic(dynamicId: dynamicId, up: up);
|
||||||
@@ -47,7 +47,11 @@ class _ActionPanelState extends State<ActionPanel> {
|
|||||||
item.modules.moduleStat.like.count = (count + 1).toString();
|
item.modules.moduleStat.like.count = (count + 1).toString();
|
||||||
item.modules.moduleStat.like.status = true;
|
item.modules.moduleStat.like.status = true;
|
||||||
} else {
|
} else {
|
||||||
item.modules.moduleStat.like.count = (count - 1).toString();
|
if (count == 1) {
|
||||||
|
item.modules.moduleStat.like.count = '点赞';
|
||||||
|
} else {
|
||||||
|
item.modules.moduleStat.like.count = (count - 1).toString();
|
||||||
|
}
|
||||||
item.modules.moduleStat.like.status = false;
|
item.modules.moduleStat.like.status = false;
|
||||||
}
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@@ -63,54 +67,63 @@ class _ActionPanelState extends State<ActionPanel> {
|
|||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
TextButton.icon(
|
Expanded(
|
||||||
onPressed: () {},
|
flex: 1,
|
||||||
icon: const Icon(
|
child: TextButton.icon(
|
||||||
FontAwesomeIcons.shareFromSquare,
|
onPressed: () {},
|
||||||
size: 16,
|
icon: const Icon(
|
||||||
|
FontAwesomeIcons.shareFromSquare,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
||||||
|
foregroundColor: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
label: Text(stat.forward!.count ?? '转发'),
|
||||||
),
|
),
|
||||||
style: TextButton.styleFrom(
|
|
||||||
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
|
||||||
foregroundColor: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
label: Text(stat.forward!.count ?? '转发'),
|
|
||||||
),
|
),
|
||||||
TextButton.icon(
|
Expanded(
|
||||||
onPressed: () =>
|
flex: 1,
|
||||||
_dynamicsController.pushDetail(widget.item, 1, action: 'comment'),
|
child: TextButton.icon(
|
||||||
icon: const Icon(
|
onPressed: () => _dynamicsController.pushDetail(widget.item, 1,
|
||||||
FontAwesomeIcons.comment,
|
action: 'comment'),
|
||||||
size: 16,
|
icon: const Icon(
|
||||||
|
FontAwesomeIcons.comment,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
||||||
|
foregroundColor: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
label: Text(stat.comment!.count ?? '评论'),
|
||||||
),
|
),
|
||||||
style: TextButton.styleFrom(
|
|
||||||
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
|
||||||
foregroundColor: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
label: Text(stat.comment!.count ?? '评论'),
|
|
||||||
),
|
),
|
||||||
TextButton.icon(
|
Expanded(
|
||||||
onPressed: () => onLikeDynamic(),
|
flex: 1,
|
||||||
icon: Icon(
|
child: TextButton.icon(
|
||||||
stat.like!.status!
|
onPressed: () => onLikeDynamic(),
|
||||||
? FontAwesomeIcons.solidThumbsUp
|
icon: Icon(
|
||||||
: FontAwesomeIcons.thumbsUp,
|
stat.like!.status!
|
||||||
size: 16,
|
? FontAwesomeIcons.solidThumbsUp
|
||||||
color: stat.like!.status! ? primary : color,
|
: FontAwesomeIcons.thumbsUp,
|
||||||
),
|
size: 16,
|
||||||
style: TextButton.styleFrom(
|
color: stat.like!.status! ? primary : color,
|
||||||
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
),
|
||||||
foregroundColor: Theme.of(context).colorScheme.outline,
|
style: TextButton.styleFrom(
|
||||||
),
|
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
||||||
label: AnimatedSwitcher(
|
foregroundColor: Theme.of(context).colorScheme.outline,
|
||||||
duration: const Duration(milliseconds: 400),
|
),
|
||||||
transitionBuilder: (Widget child, Animation<double> animation) {
|
label: AnimatedSwitcher(
|
||||||
return ScaleTransition(scale: animation, child: child);
|
duration: const Duration(milliseconds: 400),
|
||||||
},
|
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||||
child: Text(
|
return ScaleTransition(scale: animation, child: child);
|
||||||
stat.like!.count ?? '点赞',
|
},
|
||||||
key: ValueKey<String>(stat.like!.count ?? '点赞'),
|
child: Text(
|
||||||
style: TextStyle(
|
stat.like!.count ?? '点赞',
|
||||||
color: stat.like!.status! ? primary : color,
|
key: ValueKey<String>(stat.like!.count ?? '点赞'),
|
||||||
|
style: TextStyle(
|
||||||
|
color: stat.like!.status! ? primary : color,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -60,43 +60,47 @@ Widget addWidget(item, context, type, {floor = 1}) {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
case 'ADDITIONAL_TYPE_RESERVE':
|
case 'ADDITIONAL_TYPE_RESERVE':
|
||||||
return Padding(
|
return dynamicProperty[type].state != -1
|
||||||
padding: const EdgeInsets.only(top: 8),
|
? Padding(
|
||||||
child: InkWell(
|
padding: const EdgeInsets.only(top: 8),
|
||||||
onTap: () {},
|
child: InkWell(
|
||||||
child: Container(
|
onTap: () {},
|
||||||
width: double.infinity,
|
child: Container(
|
||||||
padding:
|
width: double.infinity,
|
||||||
const EdgeInsets.only(left: 12, top: 10, right: 12, bottom: 10),
|
padding: const EdgeInsets.only(
|
||||||
color: bgColor,
|
left: 12, top: 10, right: 12, bottom: 10),
|
||||||
child: Column(
|
color: bgColor,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Text(
|
|
||||||
dynamicProperty[type].title,
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 1),
|
|
||||||
Text.rich(
|
|
||||||
TextSpan(
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
fontSize:
|
|
||||||
Theme.of(context).textTheme.labelMedium!.fontSize),
|
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: dynamicProperty[type].desc1['text']),
|
Text(
|
||||||
const TextSpan(text: ' '),
|
dynamicProperty[type].title,
|
||||||
TextSpan(text: dynamicProperty[type].desc2['text']),
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 1),
|
||||||
|
Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
fontSize: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.labelMedium!
|
||||||
|
.fontSize),
|
||||||
|
children: [
|
||||||
|
TextSpan(text: dynamicProperty[type].desc1['text']),
|
||||||
|
const TextSpan(text: ' '),
|
||||||
|
TextSpan(text: dynamicProperty[type].desc2['text']),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
// TextButton(onPressed: () {}, child: Text('123'))
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
// TextButton(onPressed: () {}, child: Text('123'))
|
)
|
||||||
),
|
: const SizedBox();
|
||||||
),
|
|
||||||
);
|
|
||||||
case 'ADDITIONAL_TYPE_GOODS':
|
case 'ADDITIONAL_TYPE_GOODS':
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(top: 6),
|
padding: const EdgeInsets.only(top: 6),
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
|
|||||||
// 直播
|
// 直播
|
||||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||||
return liveRcmdPanel(item, context, floor: floor);
|
return liveRcmdPanel(item, context, floor: floor);
|
||||||
|
// 直播
|
||||||
case 'DYNAMIC_TYPE_LIVE':
|
case 'DYNAMIC_TYPE_LIVE':
|
||||||
return livePanel(item, context, floor: floor);
|
return livePanel(item, context, floor: floor);
|
||||||
// 合集
|
// 合集
|
||||||
@@ -147,6 +148,7 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
|
|||||||
return videoSeasonWidget(item, context, 'pgc', floor: floor);
|
return videoSeasonWidget(item, context, 'pgc', floor: floor);
|
||||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||||
return videoSeasonWidget(item, context, 'pgc', floor: floor);
|
return videoSeasonWidget(item, context, 'pgc', floor: floor);
|
||||||
|
// 直播结束
|
||||||
case 'DYNAMIC_TYPE_NONE':
|
case 'DYNAMIC_TYPE_NONE':
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -158,7 +160,23 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
|
|||||||
Text(item.modules.moduleDynamic.major.none.tips)
|
Text(item.modules.moduleDynamic.major.none.tips)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
// 课堂
|
||||||
|
case 'DYNAMIC_TYPE_COURSES_SEASON':
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"课堂💪:${item.modules.moduleDynamic.major.courses['title']}",
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return const SizedBox(height: 0);
|
return const SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Text('🙏 暂未支持的类型,请联系开发者反馈 '),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,24 +24,28 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
List<UpItem> upList = [];
|
List<UpItem> upList = [];
|
||||||
List<LiveUserItem> liveList = [];
|
List<LiveUserItem> liveList = [];
|
||||||
static const itemPadding = EdgeInsets.symmetric(horizontal: 5, vertical: 0);
|
static const itemPadding = EdgeInsets.symmetric(horizontal: 5, vertical: 0);
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
upList = widget.upData!.upList!;
|
upList = widget.upData!.upList!;
|
||||||
liveList = widget.upData!.liveUsers!.items!;
|
if (widget.upData!.liveUsers != null) {
|
||||||
|
liveList = widget.upData!.liveUsers!.items!;
|
||||||
|
}
|
||||||
upList.insert(
|
upList.insert(
|
||||||
0,
|
0,
|
||||||
UpItem(
|
UpItem(
|
||||||
face: 'https://files.catbox.moe/8uc48f.png', uname: '全部动态', mid: -1),
|
face: 'https://files.catbox.moe/8uc48f.png', uname: '全部动态', mid: -1),
|
||||||
);
|
);
|
||||||
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
upList.insert(
|
upList.insert(
|
||||||
1,
|
1,
|
||||||
UpItem(
|
UpItem(
|
||||||
face: user.get(UserBoxKey.userFace),
|
face: userInfo.face,
|
||||||
uname: '我',
|
uname: '我',
|
||||||
mid: user.get(UserBoxKey.userMid),
|
mid: userInfo.mid,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -64,15 +68,20 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
for (int i = 0; i < liveList.length; i++) ...[
|
if (liveList.isNotEmpty) ...[
|
||||||
upItemBuild(liveList[i], i)
|
for (int i = 0; i < liveList.length; i++) ...[
|
||||||
|
upItemBuild(liveList[i], i)
|
||||||
|
],
|
||||||
|
VerticalDivider(
|
||||||
|
indent: 20,
|
||||||
|
endIndent: 40,
|
||||||
|
width: 26,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary
|
||||||
|
.withOpacity(0.5),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
VerticalDivider(
|
|
||||||
indent: 20,
|
|
||||||
endIndent: 40,
|
|
||||||
width: 26,
|
|
||||||
color: Theme.of(context).primaryColor.withOpacity(0.5),
|
|
||||||
),
|
|
||||||
for (int i = 0; i < upList.length; i++) ...[
|
for (int i = 0; i < upList.length; i++) ...[
|
||||||
upItemBuild(upList[i], i)
|
upItemBuild(upList[i], i)
|
||||||
],
|
],
|
||||||
@@ -123,7 +132,8 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
double itemWidth = contentWidth + itemPadding.horizontal;
|
double itemWidth = contentWidth + itemPadding.horizontal;
|
||||||
double screenWidth = MediaQuery.of(context).size.width;
|
double screenWidth = MediaQuery.of(context).size.width;
|
||||||
double moveDistance = 0.0;
|
double moveDistance = 0.0;
|
||||||
if ((upLen - i - 0.5) * itemWidth > screenWidth / 2) {
|
if (itemWidth * (upList.length + liveList.length) <= screenWidth) {
|
||||||
|
} else if ((upLen - i - 0.5) * itemWidth > screenWidth / 2) {
|
||||||
moveDistance =
|
moveDistance =
|
||||||
(i + liveLen + 0.5) * itemWidth + 46 - screenWidth / 2;
|
(i + liveLen + 0.5) * itemWidth + 46 - screenWidth / 2;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -5,19 +5,22 @@ import 'package:pilipala/models/fans/result.dart';
|
|||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class FansController extends GetxController {
|
class FansController extends GetxController {
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
int pn = 1;
|
int pn = 1;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
RxList<FansItemModel> fansList = [FansItemModel()].obs;
|
RxList<FansItemModel> fansList = [FansItemModel()].obs;
|
||||||
late int mid;
|
late int mid;
|
||||||
late String name;
|
late String name;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
mid = int.parse(
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
Get.parameters['mid'] ?? user.get(UserBoxKey.userMid).toString());
|
mid = Get.parameters['mid'] != null
|
||||||
name = Get.parameters['name'] ?? user.get(UserBoxKey.userName);
|
? int.parse(Get.parameters['mid']!)
|
||||||
|
: userInfo.mid;
|
||||||
|
name = Get.parameters['name'] ?? userInfo.uname;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future queryFans(type) async {
|
Future queryFans(type) async {
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ class _FansPageState extends State<FansPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@@ -1,16 +1,24 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/models/user/fav_folder.dart';
|
import 'package:pilipala/models/user/fav_folder.dart';
|
||||||
|
import 'package:pilipala/models/user/info.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class FavController extends GetxController {
|
class FavController extends GetxController {
|
||||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||||
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
UserInfoData? userInfo;
|
||||||
|
|
||||||
Future<dynamic> queryFavFolder() async {
|
Future<dynamic> queryFavFolder() async {
|
||||||
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
|
if (userInfo == null) {
|
||||||
|
return {'status': false, 'msg': '账号未登录'};
|
||||||
|
}
|
||||||
var res = await await UserHttp.userfavFolder(
|
var res = await await UserHttp.userfavFolder(
|
||||||
pn: 1,
|
pn: 1,
|
||||||
ps: 10,
|
ps: 10,
|
||||||
mid: GStrorage.user.get(UserBoxKey.userMid) ?? 0,
|
mid: userInfo!.mid!,
|
||||||
);
|
);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
favFolderData.value = res['data'];
|
favFolderData.value = res['data'];
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
|||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
expandedHeight: 260 - MediaQuery.of(context).padding.top,
|
expandedHeight: 260 - MediaQuery.of(context).padding.top,
|
||||||
pinned: true,
|
pinned: true,
|
||||||
|
titleSpacing: 0,
|
||||||
title: StreamBuilder(
|
title: StreamBuilder(
|
||||||
stream: titleStreamC.stream,
|
stream: titleStreamC.stream,
|
||||||
initialData: false,
|
initialData: false,
|
||||||
|
|||||||
@@ -5,19 +5,22 @@ import 'package:pilipala/models/follow/result.dart';
|
|||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class FollowController extends GetxController {
|
class FollowController extends GetxController {
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
int pn = 1;
|
int pn = 1;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
RxList<FollowItemModel> followList = [FollowItemModel()].obs;
|
RxList<FollowItemModel> followList = [FollowItemModel()].obs;
|
||||||
late int mid;
|
late int mid;
|
||||||
late String name;
|
late String name;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
mid = int.parse(
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
Get.parameters['mid'] ?? user.get(UserBoxKey.userMid).toString());
|
mid = Get.parameters['mid'] != null
|
||||||
name = Get.parameters['name'] ?? user.get(UserBoxKey.userName);
|
? int.parse(Get.parameters['mid']!)
|
||||||
|
: userInfo.mid;
|
||||||
|
name = Get.parameters['name'] ?? userInfo.uname;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future queryFollowings(type) async {
|
Future queryFollowings(type) async {
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ class _FollowPageState extends State<FollowPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ import 'package:pilipala/utils/storage.dart';
|
|||||||
class HistoryController extends GetxController {
|
class HistoryController extends GetxController {
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
RxList<HisListItem> historyList = [HisListItem()].obs;
|
RxList<HisListItem> historyList = [HisListItem()].obs;
|
||||||
bool isLoadingMore = false;
|
RxBool isLoadingMore = false.obs;
|
||||||
RxBool pauseStatus = false.obs;
|
RxBool pauseStatus = false.obs;
|
||||||
Box localCache = GStrorage.localCache;
|
Box localCache = GStrorage.localCache;
|
||||||
|
RxBool isLoading = false.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@@ -26,9 +27,9 @@ class HistoryController extends GetxController {
|
|||||||
max = historyList.last.history!.oid!;
|
max = historyList.last.history!.oid!;
|
||||||
viewAt = historyList.last.viewAt!;
|
viewAt = historyList.last.viewAt!;
|
||||||
}
|
}
|
||||||
isLoadingMore = true;
|
isLoadingMore.value = true;
|
||||||
var res = await UserHttp.historyList(max, viewAt);
|
var res = await UserHttp.historyList(max, viewAt);
|
||||||
isLoadingMore = false;
|
isLoadingMore.value = false;
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
if (type == 'onload') {
|
if (type == 'onload') {
|
||||||
historyList.addAll(res['data'].list);
|
historyList.addAll(res['data'].list);
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/skeleton/video_card_h.dart';
|
import 'package:pilipala/common/skeleton/video_card_h.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
|
import 'package:pilipala/common/widgets/no_data.dart';
|
||||||
import 'package:pilipala/pages/history/index.dart';
|
import 'package:pilipala/pages/history/index.dart';
|
||||||
|
|
||||||
import 'widgets/item.dart';
|
import 'widgets/item.dart';
|
||||||
@@ -16,25 +18,33 @@ class HistoryPage extends StatefulWidget {
|
|||||||
class _HistoryPageState extends State<HistoryPage> {
|
class _HistoryPageState extends State<HistoryPage> {
|
||||||
final HistoryController _historyController = Get.put(HistoryController());
|
final HistoryController _historyController = Get.put(HistoryController());
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_futureBuilderFuture = _historyController.queryHistoryList();
|
_futureBuilderFuture = _historyController.queryHistoryList();
|
||||||
super.initState();
|
super.initState();
|
||||||
|
scrollController = _historyController.scrollController;
|
||||||
_historyController.scrollController.addListener(
|
scrollController.addListener(
|
||||||
() {
|
() {
|
||||||
if (_historyController.scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
_historyController.scrollController.position.maxScrollExtent -
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
300) {
|
if (!_historyController.isLoadingMore.value) {
|
||||||
if (!_historyController.isLoadingMore) {
|
EasyThrottle.throttle('history', const Duration(seconds: 1), () {
|
||||||
_historyController.onLoad();
|
_historyController.onLoad();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -92,13 +102,8 @@ class _HistoryPageState extends State<HistoryPage> {
|
|||||||
Map data = snapshot.data;
|
Map data = snapshot.data;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
return Obx(
|
return Obx(
|
||||||
() => _historyController.historyList.isEmpty
|
() => _historyController.historyList.isNotEmpty
|
||||||
? const SliverToBoxAdapter(
|
? SliverList(
|
||||||
child: Center(
|
|
||||||
child: Text('没数据'),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: SliverList(
|
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(context, index) {
|
(context, index) {
|
||||||
return HistoryItem(
|
return HistoryItem(
|
||||||
@@ -108,7 +113,12 @@ class _HistoryPageState extends State<HistoryPage> {
|
|||||||
},
|
},
|
||||||
childCount:
|
childCount:
|
||||||
_historyController.historyList.length),
|
_historyController.historyList.length),
|
||||||
),
|
)
|
||||||
|
: _historyController.isLoadingMore.value
|
||||||
|
? const SliverToBoxAdapter(
|
||||||
|
child: Center(child: Text('加载中')),
|
||||||
|
)
|
||||||
|
: const NoData(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return HttpError(
|
return HttpError(
|
||||||
|
|||||||
@@ -37,20 +37,23 @@ class HistoryItem extends StatelessWidget {
|
|||||||
'pageTitle': videoItem.title
|
'pageTitle': videoItem.title
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else if (videoItem.history.business == 'live' &&
|
} else if (videoItem.history.business == 'live') {
|
||||||
videoItem.liveStatus == 1) {
|
if (videoItem.liveStatus == 1) {
|
||||||
LiveItemModel liveItem = LiveItemModel.fromJson({
|
LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||||
'face': videoItem.authorFace,
|
'face': videoItem.authorFace,
|
||||||
'roomid': videoItem.history.oid,
|
'roomid': videoItem.history.oid,
|
||||||
'pic': videoItem.cover,
|
'pic': videoItem.cover,
|
||||||
'title': videoItem.title,
|
'title': videoItem.title,
|
||||||
'uname': videoItem.authorName,
|
'uname': videoItem.authorName,
|
||||||
'cover': videoItem.cover,
|
'cover': videoItem.cover,
|
||||||
});
|
});
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/liveRoom?roomid=${videoItem.history.oid}',
|
'/liveRoom?roomid=${videoItem.history.oid}',
|
||||||
arguments: {'liveItem': liveItem},
|
arguments: {'liveItem': liveItem},
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast('直播未开播');
|
||||||
|
}
|
||||||
} else if (videoItem.badge == '番剧' ||
|
} else if (videoItem.badge == '番剧' ||
|
||||||
videoItem.tagName.contains('动画')) {
|
videoItem.tagName.contains('动画')) {
|
||||||
/// hack
|
/// hack
|
||||||
@@ -116,7 +119,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
StyleString.cardSpace, 5, StyleString.cardSpace, 5),
|
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, boxConstraints) {
|
builder: (context, boxConstraints) {
|
||||||
double width =
|
double width =
|
||||||
|
|||||||
@@ -11,16 +11,17 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
late TabController tabController;
|
late TabController tabController;
|
||||||
late List tabsCtrList;
|
late List tabsCtrList;
|
||||||
late List<Widget> tabsPageList;
|
late List<Widget> tabsPageList;
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
RxBool userLogin = false.obs;
|
RxBool userLogin = false.obs;
|
||||||
RxString userFace = ''.obs;
|
RxString userFace = ''.obs;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
userLogin.value = user.get(UserBoxKey.userLogin) ?? false;
|
userLogin.value = userInfo != null;
|
||||||
userFace.value = user.get(UserBoxKey.userFace) ?? '';
|
userFace.value = userInfo != null ? userInfo.face : '';
|
||||||
|
|
||||||
// 进行tabs配置
|
// 进行tabs配置
|
||||||
tabs = tabsConfig;
|
tabs = tabsConfig;
|
||||||
@@ -48,7 +49,8 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
|
|
||||||
// 更新登录状态
|
// 更新登录状态
|
||||||
void updateLoginStatus(val) {
|
void updateLoginStatus(val) {
|
||||||
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
userLogin.value = val ?? false;
|
userLogin.value = val ?? false;
|
||||||
userFace.value = user.get(UserBoxKey.userFace) ?? '';
|
userFace.value = userInfo != null ? userInfo.face : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ import 'package:pilipala/common/widgets/network_img_layer.dart';
|
|||||||
import 'package:pilipala/pages/mine/view.dart';
|
import 'package:pilipala/pages/mine/view.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
|
||||||
class HomeAppBar extends StatelessWidget {
|
class HomeAppBar extends StatelessWidget {
|
||||||
const HomeAppBar({super.key});
|
const HomeAppBar({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
var userInfo = userInfoCache.get('userInfoCache');
|
||||||
return SliverAppBar(
|
return SliverAppBar(
|
||||||
// forceElevated: true,
|
// forceElevated: true,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
@@ -55,7 +56,7 @@ class HomeAppBar extends StatelessWidget {
|
|||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
|
|
||||||
/// TODO
|
/// TODO
|
||||||
if (user.get(UserBoxKey.userLogin)) ...[
|
if (userInfo != null) ...[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => showModalBottomSheet(
|
onTap: () => showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -70,7 +71,7 @@ class HomeAppBar extends StatelessWidget {
|
|||||||
type: 'avatar',
|
type: 'avatar',
|
||||||
width: 32,
|
width: 32,
|
||||||
height: 32,
|
height: 32,
|
||||||
src: user.get(UserBoxKey.userMid),
|
src: userInfo.face,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
|||||||
final HotController _hotController = Get.put(HotController());
|
final HotController _hotController = Get.put(HotController());
|
||||||
List videoList = [];
|
List videoList = [];
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
@@ -31,7 +32,7 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_futureBuilderFuture = _hotController.queryHotFeed('init');
|
_futureBuilderFuture = _hotController.queryHotFeed('init');
|
||||||
ScrollController scrollController = _hotController.scrollController;
|
scrollController = _hotController.scrollController;
|
||||||
StreamController<bool> mainStream =
|
StreamController<bool> mainStream =
|
||||||
Get.find<MainController>().bottomBarStream;
|
Get.find<MainController>().bottomBarStream;
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
@@ -55,6 +56,12 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/skeleton/video_card_h.dart';
|
import 'package:pilipala/common/skeleton/video_card_h.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
|
import 'package:pilipala/common/widgets/no_data.dart';
|
||||||
import 'package:pilipala/common/widgets/video_card_h.dart';
|
import 'package:pilipala/common/widgets/video_card_h.dart';
|
||||||
import 'package:pilipala/pages/later/index.dart';
|
import 'package:pilipala/pages/later/index.dart';
|
||||||
|
|
||||||
@@ -85,13 +86,11 @@ class _LaterPageState extends State<LaterPage> {
|
|||||||
);
|
);
|
||||||
}, childCount: _laterController.laterList.length),
|
}, childCount: _laterController.laterList.length),
|
||||||
)
|
)
|
||||||
: SliverToBoxAdapter(
|
: _laterController.isLoading.value
|
||||||
child: Center(
|
? const SliverToBoxAdapter(
|
||||||
child: Text(_laterController.isLoading.value
|
child: Center(child: Text('加载中')),
|
||||||
? '加载中'
|
)
|
||||||
: '没有数据'),
|
: const NoData(),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return HttpError(
|
return HttpError(
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -23,22 +24,23 @@ class LivePage extends StatefulWidget {
|
|||||||
class _LivePageState extends State<LivePage> {
|
class _LivePageState extends State<LivePage> {
|
||||||
final LiveController _liveController = Get.put(LiveController());
|
final LiveController _liveController = Get.put(LiveController());
|
||||||
late Future _futureBuilderFuture;
|
late Future _futureBuilderFuture;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_futureBuilderFuture = _liveController.queryLiveList('init');
|
_futureBuilderFuture = _liveController.queryLiveList('init');
|
||||||
ScrollController scrollController = _liveController.scrollController;
|
scrollController = _liveController.scrollController;
|
||||||
StreamController<bool> mainStream =
|
StreamController<bool> mainStream =
|
||||||
Get.find<MainController>().bottomBarStream;
|
Get.find<MainController>().bottomBarStream;
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 200) {
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
if (!_liveController.isLoadingMore) {
|
EasyThrottle.throttle('my-throttler', const Duration(seconds: 1), () {
|
||||||
_liveController.isLoadingMore = true;
|
_liveController.isLoadingMore = true;
|
||||||
_liveController.onLoad();
|
_liveController.onLoad();
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
final ScrollDirection direction =
|
final ScrollDirection direction =
|
||||||
@@ -52,6 +54,12 @@ class _LivePageState extends State<LivePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/pages/dynamics/index.dart';
|
import 'package:pilipala/pages/dynamics/index.dart';
|
||||||
import 'package:pilipala/pages/home/view.dart';
|
import 'package:pilipala/pages/home/view.dart';
|
||||||
import 'package:pilipala/pages/media/index.dart';
|
import 'package:pilipala/pages/media/index.dart';
|
||||||
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class MainController extends GetxController {
|
class MainController extends GetxController {
|
||||||
List<Widget> pages = <Widget>[
|
List<Widget> pages = <Widget>[
|
||||||
@@ -49,4 +52,13 @@ class MainController extends GetxController {
|
|||||||
].obs;
|
].obs;
|
||||||
final StreamController<bool> bottomBarStream =
|
final StreamController<bool> bottomBarStream =
|
||||||
StreamController<bool>.broadcast();
|
StreamController<bool>.broadcast();
|
||||||
|
Box setting = GStrorage.setting;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
if (setting.get(SettingBoxKey.autoUpdate, defaultValue: false)) {
|
||||||
|
Utils.checkUpdata();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import 'package:pilipala/utils/storage.dart';
|
|||||||
|
|
||||||
class MediaController extends GetxController {
|
class MediaController extends GetxController {
|
||||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
RxBool userLogin = false.obs;
|
RxBool userLogin = false.obs;
|
||||||
List list = [
|
List list = [
|
||||||
{
|
{
|
||||||
@@ -34,21 +34,23 @@ class MediaController extends GetxController {
|
|||||||
'onTap': () => Get.toNamed('/later'),
|
'onTap': () => Get.toNamed('/later'),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
userLogin.value = user.get(UserBoxKey.userLogin) ?? false;
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
|
userLogin.value = userInfo != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> queryFavFolder() async {
|
Future<dynamic> queryFavFolder() async {
|
||||||
if (!userLogin.value || GStrorage.user.get(UserBoxKey.userMid) == null) {
|
if (!userLogin.value || GStrorage.userInfo.get('userInfoCache') == null) {
|
||||||
return {'status': false, 'data': [], 'msg': '未登录'};
|
return {'status': false, 'data': [], 'msg': '未登录'};
|
||||||
}
|
}
|
||||||
var res = await await UserHttp.userfavFolder(
|
var res = await await UserHttp.userfavFolder(
|
||||||
pn: 1,
|
pn: 1,
|
||||||
ps: 5,
|
ps: 5,
|
||||||
mid: GStrorage.user.get(UserBoxKey.userMid),
|
mid: GStrorage.userInfo.get('userInfoCache').mid,
|
||||||
);
|
);
|
||||||
favFolderData.value = res['data'];
|
favFolderData.value = res['data'];
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -161,11 +161,25 @@ class _MediaPageState extends State<MediaPage>
|
|||||||
right: 14, bottom: 35),
|
right: 14, bottom: 35),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: MaterialStateProperty.all(
|
||||||
|
EdgeInsets.zero),
|
||||||
|
backgroundColor:
|
||||||
|
MaterialStateProperty.resolveWith(
|
||||||
|
(states) {
|
||||||
|
return Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primaryContainer
|
||||||
|
.withOpacity(0.5);
|
||||||
|
}),
|
||||||
|
),
|
||||||
onPressed: () => Get.toNamed('/fav'),
|
onPressed: () => Get.toNamed('/fav'),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.arrow_forward_ios,
|
Icons.arrow_forward_ios,
|
||||||
size: 18,
|
size: 18,
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -14,16 +14,18 @@ class MemberController extends GetxController {
|
|||||||
Map? userStat;
|
Map? userStat;
|
||||||
String? face;
|
String? face;
|
||||||
String? heroTag;
|
String? heroTag;
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
late int ownerMid;
|
late int ownerMid;
|
||||||
// 投稿列表
|
// 投稿列表
|
||||||
RxList<VListItemModel>? archiveList = [VListItemModel()].obs;
|
RxList<VListItemModel>? archiveList = [VListItemModel()].obs;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
mid = int.parse(Get.parameters['mid']!);
|
mid = int.parse(Get.parameters['mid']!);
|
||||||
ownerMid = user.get(UserBoxKey.userMid) ?? -1;
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
|
ownerMid = userInfo != null ? userInfo.mid : -1;
|
||||||
face = Get.arguments['face'] ?? '';
|
face = Get.arguments['face'] ?? '';
|
||||||
heroTag = Get.arguments['heroTag'] ?? '';
|
heroTag = Get.arguments['heroTag'] ?? '';
|
||||||
}
|
}
|
||||||
@@ -57,7 +59,7 @@ class MemberController extends GetxController {
|
|||||||
|
|
||||||
// 关注/取关up
|
// 关注/取关up
|
||||||
Future actionRelationMod() async {
|
Future actionRelationMod() async {
|
||||||
if (user.get(UserBoxKey.userMid) == null) {
|
if (userInfo == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_extendNestCtr.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ class MineController extends GetxController {
|
|||||||
// 用户状态 动态、关注、粉丝
|
// 用户状态 动态、关注、粉丝
|
||||||
Rx<UserStat> userStat = UserStat().obs;
|
Rx<UserStat> userStat = UserStat().obs;
|
||||||
RxBool userLogin = false.obs;
|
RxBool userLogin = false.obs;
|
||||||
Box user = GStrorage.user;
|
|
||||||
Box setting = GStrorage.setting;
|
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
Box setting = GStrorage.setting;
|
||||||
Rx<ThemeType> themeType = ThemeType.system.obs;
|
Rx<ThemeType> themeType = ThemeType.system.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -24,6 +23,7 @@ class MineController extends GetxController {
|
|||||||
|
|
||||||
if (userInfoCache.get('userInfoCache') != null) {
|
if (userInfoCache.get('userInfoCache') != null) {
|
||||||
userInfo.value = userInfoCache.get('userInfoCache');
|
userInfo.value = userInfoCache.get('userInfoCache');
|
||||||
|
userLogin.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
themeType.value = ThemeType.values[setting.get(SettingBoxKey.themeMode,
|
themeType.value = ThemeType.values[setting.get(SettingBoxKey.themeMode,
|
||||||
@@ -41,8 +41,8 @@ class MineController extends GetxController {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
int mid = user.get(UserBoxKey.userMid);
|
int mid = userInfo.value.mid!;
|
||||||
String face = user.get(UserBoxKey.userFace);
|
String face = userInfo.value.face!;
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/member?mid=$mid',
|
'/member?mid=$mid',
|
||||||
arguments: {'face': face},
|
arguments: {'face': face},
|
||||||
@@ -51,7 +51,7 @@ class MineController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future queryUserInfo() async {
|
Future queryUserInfo() async {
|
||||||
if (user.get(UserBoxKey.userLogin) == null) {
|
if (!userLogin.value) {
|
||||||
return {'status': false};
|
return {'status': false};
|
||||||
}
|
}
|
||||||
var res = await UserHttp.userInfo();
|
var res = await UserHttp.userInfo();
|
||||||
@@ -59,18 +59,12 @@ class MineController extends GetxController {
|
|||||||
if (res['data'].isLogin) {
|
if (res['data'].isLogin) {
|
||||||
userInfo.value = res['data'];
|
userInfo.value = res['data'];
|
||||||
userInfoCache.put('userInfoCache', res['data']);
|
userInfoCache.put('userInfoCache', res['data']);
|
||||||
user.put(UserBoxKey.userName, res['data'].uname);
|
|
||||||
user.put(UserBoxKey.userFace, res['data'].face);
|
|
||||||
user.put(UserBoxKey.userMid, res['data'].mid);
|
|
||||||
user.put(UserBoxKey.userLogin, true);
|
|
||||||
userLogin.value = true;
|
userLogin.value = true;
|
||||||
// Get.find<MainController>().readuUserFace();
|
|
||||||
} else {
|
} else {
|
||||||
resetUserInfo();
|
resetUserInfo();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resetUserInfo();
|
resetUserInfo();
|
||||||
// SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
}
|
||||||
await queryUserStatOwner();
|
await queryUserStatOwner();
|
||||||
return res;
|
return res;
|
||||||
@@ -87,12 +81,8 @@ class MineController extends GetxController {
|
|||||||
Future resetUserInfo() async {
|
Future resetUserInfo() async {
|
||||||
userInfo.value = UserInfoData();
|
userInfo.value = UserInfoData();
|
||||||
userStat.value = UserStat();
|
userStat.value = UserStat();
|
||||||
await user.delete(UserBoxKey.userName);
|
userInfoCache.delete('userInfoCache');
|
||||||
await user.delete(UserBoxKey.userFace);
|
|
||||||
await user.delete(UserBoxKey.userMid);
|
|
||||||
await user.delete(UserBoxKey.userLogin);
|
|
||||||
userLogin.value = false;
|
userLogin.value = false;
|
||||||
// Get.find<MainController>().resetLast();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeTheme() {
|
onChangeTheme() {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/models/common/theme_type.dart';
|
import 'package:pilipala/models/common/theme_type.dart';
|
||||||
|
import 'package:pilipala/models/user/info.dart';
|
||||||
import 'package:pilipala/utils/event_bus.dart';
|
import 'package:pilipala/utils/event_bus.dart';
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
|
|
||||||
@@ -160,10 +161,11 @@ class _MinePageState extends State<MinePage> {
|
|||||||
]))
|
]))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 25),
|
||||||
if (_mineController.userInfo.value.levelInfo != null) ...[
|
if (_mineController.userInfo.value.levelInfo != null) ...[
|
||||||
LayoutBuilder(
|
LayoutBuilder(
|
||||||
builder: (context, BoxConstraints box) {
|
builder: (context, BoxConstraints box) {
|
||||||
|
LevelInfo levelInfo = _mineController.userInfo.value.levelInfo;
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: box.maxWidth,
|
width: box.maxWidth,
|
||||||
height: 24,
|
height: 24,
|
||||||
@@ -172,48 +174,27 @@ class _MinePageState extends State<MinePage> {
|
|||||||
Positioned(
|
Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: SizedBox(
|
bottom: 0,
|
||||||
height: 22,
|
child: Container(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
height: 24,
|
||||||
|
constraints:
|
||||||
|
const BoxConstraints(minWidth: 100), // 设置最小宽度为100
|
||||||
width: box.maxWidth *
|
width: box.maxWidth *
|
||||||
(1 -
|
(1 - (levelInfo.currentExp! / levelInfo.nextExp!)),
|
||||||
(_mineController
|
|
||||||
.userInfo.value.levelInfo!.currentExp! /
|
|
||||||
_mineController
|
|
||||||
.userInfo.value.levelInfo!.nextExp!)),
|
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
(_mineController
|
'${levelInfo.currentExp!}/${levelInfo.nextExp!}',
|
||||||
.userInfo.value.levelInfo!.nextExp! -
|
|
||||||
_mineController
|
|
||||||
.userInfo.value.levelInfo!.currentExp!)
|
|
||||||
.toString(),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.onPrimary,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
LayoutBuilder(
|
|
||||||
builder: (context, BoxConstraints box) {
|
|
||||||
return Container(
|
|
||||||
width: box.maxWidth,
|
|
||||||
height: 1,
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 0,
|
top: 23,
|
||||||
left: 0,
|
left: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -224,7 +205,6 @@ class _MinePageState extends State<MinePage> {
|
|||||||
.userInfo.value.levelInfo!.nextExp!),
|
.userInfo.value.levelInfo!.nextExp!),
|
||||||
height: 1,
|
height: 1,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -234,6 +214,36 @@ class _MinePageState extends State<MinePage> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
// LayoutBuilder(
|
||||||
|
// builder: (context, BoxConstraints box) {
|
||||||
|
// return Container(
|
||||||
|
// width: box.maxWidth,
|
||||||
|
// height: 1,
|
||||||
|
// color: Theme.of(context).colorScheme.onInverseSurface,
|
||||||
|
// child: Stack(
|
||||||
|
// children: [
|
||||||
|
// Positioned(
|
||||||
|
// top: 0,
|
||||||
|
// left: 0,
|
||||||
|
// bottom: 0,
|
||||||
|
// child: Container(
|
||||||
|
// width: box.maxWidth *
|
||||||
|
// (_mineController
|
||||||
|
// .userInfo.value.levelInfo!.currentExp! /
|
||||||
|
// _mineController
|
||||||
|
// .userInfo.value.levelInfo!.nextExp!),
|
||||||
|
// height: 1,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.circular(4),
|
||||||
|
// color: Theme.of(context).colorScheme.primary,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Padding(
|
Padding(
|
||||||
|
|||||||
@@ -2,11 +2,9 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'dart:typed_data';
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:image_gallery_saver/image_gallery_saver.dart';
|
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
class PreviewController extends GetxController {
|
class PreviewController extends GetxController {
|
||||||
@@ -17,7 +15,7 @@ class PreviewController extends GetxController {
|
|||||||
bool storage = true;
|
bool storage = true;
|
||||||
bool videos = true;
|
bool videos = true;
|
||||||
bool photos = true;
|
bool photos = true;
|
||||||
bool visiable = true;
|
String currentImgUrl = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@@ -26,6 +24,7 @@ class PreviewController extends GetxController {
|
|||||||
initialPage.value = Get.arguments['initialPage']!;
|
initialPage.value = Get.arguments['initialPage']!;
|
||||||
currentPage.value = Get.arguments['initialPage']! + 1;
|
currentPage.value = Get.arguments['initialPage']! + 1;
|
||||||
imgList.value = Get.arguments['imgList'];
|
imgList.value = Get.arguments['imgList'];
|
||||||
|
currentImgUrl = imgList[initialPage.value];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,22 +38,6 @@ class PreviewController extends GetxController {
|
|||||||
// final photosInfo = statuses[Permission.photos].toString();
|
// final photosInfo = statuses[Permission.photos].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 图片保存
|
|
||||||
void onSaveImg() async {
|
|
||||||
var response = await Dio().get(imgList[initialPage.value],
|
|
||||||
options: Options(responseType: ResponseType.bytes));
|
|
||||||
final result = await ImageGallerySaver.saveImage(
|
|
||||||
Uint8List.fromList(response.data),
|
|
||||||
quality: 100,
|
|
||||||
name: "pic_vvex${DateTime.now().toString().split('-').join()}");
|
|
||||||
if (result != null) {
|
|
||||||
if (result['isSuccess']) {
|
|
||||||
// ignore: avoid_print
|
|
||||||
print('已保存到相册');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 图片分享
|
// 图片分享
|
||||||
void onShareImg() async {
|
void onShareImg() async {
|
||||||
requestPermission();
|
requestPermission();
|
||||||
@@ -62,9 +45,15 @@ class PreviewController extends GetxController {
|
|||||||
options: Options(responseType: ResponseType.bytes));
|
options: Options(responseType: ResponseType.bytes));
|
||||||
final temp = await getTemporaryDirectory();
|
final temp = await getTemporaryDirectory();
|
||||||
String imgName =
|
String imgName =
|
||||||
"pic_plpl${DateTime.now().toString().split('-').join()}.jpg";
|
"plpl_pic_${DateTime.now().toString().split('-').join()}.jpg";
|
||||||
var path = '${temp.path}/$imgName';
|
var path = '${temp.path}/$imgName';
|
||||||
File(path).writeAsBytesSync(response.data);
|
File(path).writeAsBytesSync(response.data);
|
||||||
Share.shareXFiles([XFile(path)], subject: imgList[initialPage.value]);
|
Share.shareXFiles([XFile(path)], subject: imgList[initialPage.value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onChange(int index) {
|
||||||
|
initialPage.value = index;
|
||||||
|
currentPage.value = index + 1;
|
||||||
|
currentImgUrl = imgList[index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
import 'package:dismissible_page/dismissible_page.dart';
|
import 'package:dismissible_page/dismissible_page.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:extended_image/extended_image.dart';
|
import 'package:extended_image/extended_image.dart';
|
||||||
|
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||||
|
import 'package:pilipala/utils/download.dart';
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
|
|
||||||
typedef DoubleClickAnimationListener = void Function();
|
typedef DoubleClickAnimationListener = void Function();
|
||||||
@@ -35,6 +38,56 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
duration: const Duration(milliseconds: 250), vsync: this);
|
duration: const Duration(milliseconds: 250), vsync: this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onOpenMenu() {
|
||||||
|
SmartDialog.show(
|
||||||
|
useSystem: true,
|
||||||
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
_previewController.onShareImg();
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
},
|
||||||
|
dense: true,
|
||||||
|
title: const Text('分享', style: TextStyle(fontSize: 14)),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(text: _previewController.currentImgUrl))
|
||||||
|
.then((value) {
|
||||||
|
SmartDialog.showToast('已复制到粘贴板');
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
}).catchError((err) {
|
||||||
|
SmartDialog.showNotify(
|
||||||
|
msg: err.toString(),
|
||||||
|
notifyType: NotifyType.error,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
dense: true,
|
||||||
|
title: const Text('复制链接', style: TextStyle(fontSize: 14)),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
DownloadUtils.downloadImg(_previewController.currentImgUrl);
|
||||||
|
},
|
||||||
|
dense: true,
|
||||||
|
title: const Text('保存到手机', style: TextStyle(fontSize: 14)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// animationController.dispose();
|
// animationController.dispose();
|
||||||
@@ -51,7 +104,7 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
primary: false,
|
primary: false,
|
||||||
toolbarHeight: 0,
|
toolbarHeight: 0,
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
systemOverlayStyle: SystemUiOverlayStyle.light,
|
systemOverlayStyle: SystemUiOverlayStyle.dark,
|
||||||
),
|
),
|
||||||
body: Stack(
|
body: Stack(
|
||||||
children: [
|
children: [
|
||||||
@@ -69,19 +122,14 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
tag: _previewController
|
tag: _previewController
|
||||||
.imgList[_previewController.initialPage.value],
|
.imgList[_previewController.initialPage.value],
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onLongPress: () => onOpenMenu(),
|
||||||
_previewController.visiable = !_previewController.visiable;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
child: ExtendedImageGesturePageView.builder(
|
child: ExtendedImageGesturePageView.builder(
|
||||||
controller: ExtendedPageController(
|
controller: ExtendedPageController(
|
||||||
initialPage: _previewController.initialPage.value,
|
initialPage: _previewController.initialPage.value,
|
||||||
pageSpacing: 0,
|
pageSpacing: 0,
|
||||||
),
|
),
|
||||||
onPageChanged: (int index) {
|
onPageChanged: (int index) =>
|
||||||
_previewController.initialPage.value = index;
|
_previewController.onChange(index),
|
||||||
_previewController.currentPage.value = index + 1;
|
|
||||||
},
|
|
||||||
canScrollPage: (GestureDetails? gestureDetails) =>
|
canScrollPage: (GestureDetails? gestureDetails) =>
|
||||||
gestureDetails!.totalScale! <= 1.0,
|
gestureDetails!.totalScale! <= 1.0,
|
||||||
preloadPagesCount: 2,
|
preloadPagesCount: 2,
|
||||||
@@ -149,8 +197,10 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 150.0,
|
width: 150.0,
|
||||||
child:
|
child: LinearProgressIndicator(
|
||||||
LinearProgressIndicator(value: progress),
|
value: progress,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
Text('${((progress ?? 0.0) * 100).toInt()}%'),
|
Text('${((progress ?? 0.0) * 100).toInt()}%'),
|
||||||
@@ -179,7 +229,6 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
// height: 45,
|
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: MediaQuery.of(context).padding.bottom, top: 20),
|
bottom: MediaQuery.of(context).padding.bottom, top: 20),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
@@ -193,36 +242,18 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
tileMode: TileMode.mirror,
|
tileMode: TileMode.mirror,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Obx(
|
||||||
padding: const EdgeInsets.only(left: 20, right: 12),
|
() => Text.rich(
|
||||||
child: Row(
|
textAlign: TextAlign.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
TextSpan(
|
||||||
children: [
|
style: const TextStyle(color: Colors.white, fontSize: 15),
|
||||||
Obx(
|
children: [
|
||||||
() => Text.rich(
|
|
||||||
TextSpan(
|
TextSpan(
|
||||||
style: const TextStyle(
|
text: _previewController.currentPage.toString()),
|
||||||
color: Colors.white, fontSize: 18),
|
const TextSpan(text: ' / '),
|
||||||
children: [
|
TextSpan(
|
||||||
TextSpan(
|
text: _previewController.imgList.length.toString()),
|
||||||
text: _previewController.currentPage
|
]),
|
||||||
.toString()),
|
|
||||||
const TextSpan(text: ' / '),
|
|
||||||
TextSpan(
|
|
||||||
text: _previewController.imgList.length
|
|
||||||
.toString()),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () => _previewController.onShareImg(),
|
|
||||||
child: const Text('分享')),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () => _previewController.onSaveImg(),
|
|
||||||
child: const Text('保存'))
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -40,12 +41,11 @@ class _RcmdPageState extends State<RcmdPage>
|
|||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 200) {
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
if (!_rcmdController.isLoadingMore) {
|
EasyThrottle.throttle(
|
||||||
|
'my-throttler', const Duration(milliseconds: 500), () {
|
||||||
_rcmdController.isLoadingMore = true;
|
_rcmdController.isLoadingMore = true;
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
_rcmdController.onLoad();
|
||||||
_rcmdController.onLoad();
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final ScrollDirection direction =
|
final ScrollDirection direction =
|
||||||
@@ -59,6 +59,12 @@ class _RcmdPageState extends State<RcmdPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_rcmdController.scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ class SSearchController extends GetxController {
|
|||||||
final FocusNode searchFocusNode = FocusNode();
|
final FocusNode searchFocusNode = FocusNode();
|
||||||
RxString searchKeyWord = ''.obs;
|
RxString searchKeyWord = ''.obs;
|
||||||
Rx<TextEditingController> controller = TextEditingController().obs;
|
Rx<TextEditingController> controller = TextEditingController().obs;
|
||||||
List<HotSearchItem> hotSearchList = [];
|
RxList<HotSearchItem> hotSearchList = [HotSearchItem()].obs;
|
||||||
Box hotKeyword = GStrorage.hotKeyword;
|
|
||||||
Box histiryWord = GStrorage.historyword;
|
Box histiryWord = GStrorage.historyword;
|
||||||
List historyCacheList = [];
|
List historyCacheList = [];
|
||||||
RxList historyList = [].obs;
|
RxList historyList = [].obs;
|
||||||
@@ -27,14 +26,6 @@ class SSearchController extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
searchDefault();
|
searchDefault();
|
||||||
if (hotKeyword.get('cacheList') != null &&
|
|
||||||
hotKeyword.get('cacheList').isNotEmpty) {
|
|
||||||
List<HotSearchItem> list = [];
|
|
||||||
for (var i in hotKeyword.get('cacheList')) {
|
|
||||||
list.add(i);
|
|
||||||
}
|
|
||||||
hotSearchList = list;
|
|
||||||
}
|
|
||||||
// 其他页面跳转过来
|
// 其他页面跳转过来
|
||||||
if (Get.parameters.keys.isNotEmpty) {
|
if (Get.parameters.keys.isNotEmpty) {
|
||||||
if (Get.parameters['keyword'] != null) {
|
if (Get.parameters['keyword'] != null) {
|
||||||
@@ -89,8 +80,7 @@ class SSearchController extends GetxController {
|
|||||||
// 获取热搜关键词
|
// 获取热搜关键词
|
||||||
Future queryHotSearchList() async {
|
Future queryHotSearchList() async {
|
||||||
var result = await SearchHttp.hotSearchList();
|
var result = await SearchHttp.hotSearchList();
|
||||||
hotSearchList = result['data'].list;
|
hotSearchList.value = result['data'].list;
|
||||||
hotKeyword.put('cacheList', result['data'].list);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
|||||||
return OpenContainer(
|
return OpenContainer(
|
||||||
closedElevation: 0,
|
closedElevation: 0,
|
||||||
openElevation: 0,
|
openElevation: 0,
|
||||||
|
onClosed: (_) async {
|
||||||
|
// 在 openBuilder 关闭时触发的回调函数
|
||||||
|
await Future.delayed(const Duration(milliseconds: 500));
|
||||||
|
_searchController.onClear();
|
||||||
|
},
|
||||||
openColor: Theme.of(context).colorScheme.background,
|
openColor: Theme.of(context).colorScheme.background,
|
||||||
middleColor: Theme.of(context).colorScheme.background,
|
middleColor: Theme.of(context).colorScheme.background,
|
||||||
closedColor: Theme.of(context).colorScheme.background,
|
closedColor: Theme.of(context).colorScheme.background,
|
||||||
@@ -145,7 +150,7 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
|||||||
// 搜索建议
|
// 搜索建议
|
||||||
_searchSuggest(),
|
_searchSuggest(),
|
||||||
// 热搜
|
// 热搜
|
||||||
hotSearch(),
|
hotSearch(_searchController),
|
||||||
// 搜索历史
|
// 搜索历史
|
||||||
_history()
|
_history()
|
||||||
],
|
],
|
||||||
@@ -176,25 +181,7 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
|||||||
// child: Text(
|
// child: Text(
|
||||||
// _searchController.searchSuggestList[index].term!,
|
// _searchController.searchSuggestList[index].term!,
|
||||||
// ),
|
// ),
|
||||||
child: Text.rich(
|
child: _searchController.searchSuggestList[index].textRich,
|
||||||
TextSpan(
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: _searchController
|
|
||||||
.searchSuggestList[index].name![0]),
|
|
||||||
TextSpan(
|
|
||||||
text: _searchController
|
|
||||||
.searchSuggestList[index].name![1],
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: _searchController
|
|
||||||
.searchSuggestList[index].name![2]),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -203,20 +190,37 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget hotSearch() {
|
Widget hotSearch(ctr) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(10, 14, 4, 0),
|
padding: const EdgeInsets.fromLTRB(10, 14, 4, 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(6, 0, 0, 6),
|
padding: const EdgeInsets.fromLTRB(6, 0, 6, 6),
|
||||||
child: Text(
|
child: Row(
|
||||||
'大家都在搜',
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
style: Theme.of(context)
|
children: [
|
||||||
.textTheme
|
Text(
|
||||||
.titleMedium!
|
'大家都在搜',
|
||||||
.copyWith(fontWeight: FontWeight.bold),
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 34,
|
||||||
|
child: TextButton.icon(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: MaterialStateProperty.all(const EdgeInsets.only(
|
||||||
|
left: 10, top: 6, bottom: 6, right: 10)),
|
||||||
|
),
|
||||||
|
onPressed: () => ctr.queryHotSearchList(),
|
||||||
|
icon: const Icon(Icons.refresh_outlined, size: 18),
|
||||||
|
label: const Text('刷新'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
LayoutBuilder(
|
LayoutBuilder(
|
||||||
@@ -228,15 +232,17 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
|||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
Map data = snapshot.data as Map;
|
Map data = snapshot.data as Map;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
return HotKeyword(
|
return Obx(
|
||||||
width: width,
|
() => HotKeyword(
|
||||||
hotSearchList: _searchController.hotSearchList,
|
width: width,
|
||||||
onClick: (keyword) async {
|
hotSearchList: _searchController.hotSearchList.value,
|
||||||
_searchController.searchFocusNode.unfocus();
|
onClick: (keyword) async {
|
||||||
await Future.delayed(
|
_searchController.searchFocusNode.unfocus();
|
||||||
const Duration(milliseconds: 150));
|
await Future.delayed(
|
||||||
_searchController.onClickKeyword(keyword);
|
const Duration(milliseconds: 150));
|
||||||
},
|
_searchController.onClickKeyword(keyword);
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return HttpError(
|
return HttpError(
|
||||||
|
|||||||
@@ -12,17 +12,25 @@ class SearchPanelController extends GetxController {
|
|||||||
SearchType? searchType;
|
SearchType? searchType;
|
||||||
RxInt page = 1.obs;
|
RxInt page = 1.obs;
|
||||||
RxList resultList = [].obs;
|
RxList resultList = [].obs;
|
||||||
|
// 结果排序方式 搜索类型为视频、专栏及相簿时
|
||||||
|
RxString order = ''.obs;
|
||||||
|
// 视频时长筛选 仅用于搜索视频
|
||||||
|
RxInt duration = 0.obs;
|
||||||
|
|
||||||
Future onSearch({type = 'init'}) async {
|
Future onSearch({type = 'init'}) async {
|
||||||
var result = await SearchHttp.searchByType(
|
var result = await SearchHttp.searchByType(
|
||||||
searchType: searchType!, keyword: keyword!, page: page.value);
|
searchType: searchType!,
|
||||||
|
keyword: keyword!,
|
||||||
|
page: page.value,
|
||||||
|
order: searchType!.type != 'video' ? null : order.value,
|
||||||
|
duration: searchType!.type != 'video' ? null : duration.value);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
if (type == 'init' || type == 'onLoad') {
|
if (type == 'onRefresh') {
|
||||||
page.value++;
|
|
||||||
resultList.addAll(result['data'].list);
|
|
||||||
} else if (type == 'onRefresh') {
|
|
||||||
resultList.value = result['data'].list;
|
resultList.value = result['data'].list;
|
||||||
|
} else {
|
||||||
|
resultList.addAll(result['data'].list);
|
||||||
}
|
}
|
||||||
|
page.value++;
|
||||||
onPushDetail(keyword, resultList);
|
onPushDetail(keyword, resultList);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -30,7 +38,7 @@ class SearchPanelController extends GetxController {
|
|||||||
|
|
||||||
Future onRefresh() async {
|
Future onRefresh() async {
|
||||||
page.value = 1;
|
page.value = 1;
|
||||||
onSearch(type: 'onRefresh');
|
await onSearch(type: 'onRefresh');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回顶部并刷新
|
// 返回顶部并刷新
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/skeleton/media_bangumi.dart';
|
import 'package:pilipala/common/skeleton/media_bangumi.dart';
|
||||||
@@ -27,8 +28,8 @@ class _SearchPanelState extends State<SearchPanel>
|
|||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
late SearchPanelController _searchPanelController;
|
late SearchPanelController _searchPanelController;
|
||||||
|
|
||||||
bool _isLoadingMore = false;
|
|
||||||
late Future _futureBuilderFuture;
|
late Future _futureBuilderFuture;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
@@ -43,20 +44,24 @@ class _SearchPanelState extends State<SearchPanel>
|
|||||||
),
|
),
|
||||||
tag: widget.searchType!.type,
|
tag: widget.searchType!.type,
|
||||||
);
|
);
|
||||||
ScrollController scrollController = _searchPanelController.scrollController;
|
scrollController = _searchPanelController.scrollController;
|
||||||
scrollController.addListener(() async {
|
scrollController.addListener(() async {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 100) {
|
scrollController.position.maxScrollExtent - 100) {
|
||||||
if (!_isLoadingMore) {
|
EasyThrottle.throttle('history', const Duration(seconds: 1), () {
|
||||||
_isLoadingMore = true;
|
_searchPanelController.onSearch(type: 'onLoad');
|
||||||
await _searchPanelController.onSearch(type: 'onLoad');
|
});
|
||||||
_isLoadingMore = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_futureBuilderFuture = _searchPanelController.onSearch();
|
_futureBuilderFuture = _searchPanelController.onSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
@@ -70,12 +75,15 @@ class _SearchPanelState extends State<SearchPanel>
|
|||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
Map data = snapshot.data;
|
Map data = snapshot.data;
|
||||||
var ctr = _searchPanelController;
|
var ctr = _searchPanelController;
|
||||||
List list = ctr.resultList;
|
RxList list = ctr.resultList;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
switch (widget.searchType) {
|
switch (widget.searchType) {
|
||||||
case SearchType.video:
|
case SearchType.video:
|
||||||
return searchVideoPanel(context, ctr, list);
|
return SearchVideoPanel(
|
||||||
|
ctr: _searchPanelController,
|
||||||
|
list: list.value,
|
||||||
|
);
|
||||||
case SearchType.media_bangumi:
|
case SearchType.media_bangumi:
|
||||||
return searchMbangumiPanel(context, ctr, list);
|
return searchMbangumiPanel(context, ctr, list);
|
||||||
case SearchType.bili_user:
|
case SearchType.bili_user:
|
||||||
|
|||||||
@@ -1,15 +1,217 @@
|
|||||||
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:pilipala/common/widgets/video_card_h.dart';
|
import 'package:pilipala/common/widgets/video_card_h.dart';
|
||||||
|
import 'package:pilipala/models/common/search_type.dart';
|
||||||
|
import 'package:pilipala/pages/searchPanel/index.dart';
|
||||||
|
|
||||||
Widget searchVideoPanel(BuildContext context, ctr, list) {
|
class SearchVideoPanel extends StatelessWidget {
|
||||||
return ListView.builder(
|
SearchVideoPanel({
|
||||||
controller: ctr!.scrollController,
|
this.ctr,
|
||||||
addAutomaticKeepAlives: false,
|
this.list,
|
||||||
addRepaintBoundaries: false,
|
Key? key,
|
||||||
itemCount: list!.length,
|
}) : super(key: key);
|
||||||
itemBuilder: (context, index) {
|
|
||||||
var i = list![index];
|
final SearchPanelController? ctr;
|
||||||
return VideoCardH(videoItem: i);
|
final List? list;
|
||||||
},
|
|
||||||
);
|
final VideoPanelController controller = Get.put(VideoPanelController());
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Stack(
|
||||||
|
alignment: Alignment.topCenter,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 36),
|
||||||
|
child: ListView.builder(
|
||||||
|
controller: ctr!.scrollController,
|
||||||
|
addAutomaticKeepAlives: false,
|
||||||
|
addRepaintBoundaries: false,
|
||||||
|
itemCount: list!.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
var i = list![index];
|
||||||
|
return Padding(
|
||||||
|
padding: index == 0
|
||||||
|
? const EdgeInsets.only(top: 2)
|
||||||
|
: EdgeInsets.zero,
|
||||||
|
child: VideoCardH(videoItem: i),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// 分类筛选
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 36,
|
||||||
|
padding: const EdgeInsets.only(left: 8, top: 0, right: 12),
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// border: Border(
|
||||||
|
// bottom: BorderSide(
|
||||||
|
// color: Theme.of(context).colorScheme.primary.withOpacity(0.1),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: Obx(
|
||||||
|
() => Wrap(
|
||||||
|
// spacing: ,
|
||||||
|
children: [
|
||||||
|
for (var i in controller.filterList) ...[
|
||||||
|
CustomFilterChip(
|
||||||
|
label: i['label'],
|
||||||
|
type: i['type'],
|
||||||
|
selectedType: controller.selectedType.value,
|
||||||
|
callFn: (bool selected) async {
|
||||||
|
controller.selectedType.value = i['type'];
|
||||||
|
ctr!.order.value =
|
||||||
|
i['type'].toString().split('.').last;
|
||||||
|
SmartDialog.showLoading(msg: 'loooad');
|
||||||
|
await ctr!.onRefresh();
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const VerticalDivider(indent: 7, endIndent: 8),
|
||||||
|
const SizedBox(width: 3),
|
||||||
|
SizedBox(
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
child: IconButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
|
),
|
||||||
|
onPressed: () => controller.onShowFilterDialog(),
|
||||||
|
icon: Icon(
|
||||||
|
Icons.filter_list_outlined,
|
||||||
|
size: 18,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
), // 放置在ListView.builder()上方的组件
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CustomFilterChip extends StatelessWidget {
|
||||||
|
const CustomFilterChip({
|
||||||
|
this.label,
|
||||||
|
this.type,
|
||||||
|
this.selectedType,
|
||||||
|
this.callFn,
|
||||||
|
Key? key,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final String? label;
|
||||||
|
final ArchiveFilterType? type;
|
||||||
|
final ArchiveFilterType? selectedType;
|
||||||
|
final Function? callFn;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SizedBox(
|
||||||
|
height: 34,
|
||||||
|
child: FilterChip(
|
||||||
|
padding: const EdgeInsets.only(left: 11, right: 11),
|
||||||
|
labelPadding: EdgeInsets.zero,
|
||||||
|
label: Text(
|
||||||
|
label!,
|
||||||
|
style: const TextStyle(fontSize: 13),
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: type == selectedType
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Theme.of(context).colorScheme.outline),
|
||||||
|
selected: type == selectedType,
|
||||||
|
showCheckmark: false,
|
||||||
|
shape: ContinuousRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
selectedColor: Colors.transparent,
|
||||||
|
// backgroundColor:
|
||||||
|
// Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
side: BorderSide.none,
|
||||||
|
onSelected: (bool selected) => callFn!(selected),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VideoPanelController extends GetxController {
|
||||||
|
RxList<Map> filterList = [{}].obs;
|
||||||
|
Rx<ArchiveFilterType> selectedType = ArchiveFilterType.values.first.obs;
|
||||||
|
List<Map<String, dynamic>> timeFiltersList = [
|
||||||
|
{'label': '全部时长', 'value': 0},
|
||||||
|
{'label': '0-10分钟', 'value': 1},
|
||||||
|
{'label': '10-30分钟', 'value': 2},
|
||||||
|
{'label': '30-60分钟', 'value': 3},
|
||||||
|
{'label': '60分钟+', 'value': 4},
|
||||||
|
];
|
||||||
|
RxInt currentTimeFilterval = 0.obs;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
List<Map<String, dynamic>> list = ArchiveFilterType.values
|
||||||
|
.map((type) => {
|
||||||
|
'label': type.description,
|
||||||
|
'type': type,
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
filterList.value = list;
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
onShowFilterDialog() {
|
||||||
|
SmartDialog.show(
|
||||||
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
TextStyle textStyle = Theme.of(context).textTheme.titleMedium!;
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('时长筛选'),
|
||||||
|
contentPadding: const EdgeInsets.fromLTRB(0, 15, 0, 20),
|
||||||
|
content: StatefulBuilder(builder: (context, StateSetter setState) {
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
for (var i in timeFiltersList) ...[
|
||||||
|
RadioListTile(
|
||||||
|
value: i['value'],
|
||||||
|
autofocus: true,
|
||||||
|
title: Text(i['label'], style: textStyle),
|
||||||
|
groupValue: currentTimeFilterval.value,
|
||||||
|
onChanged: (value) async {
|
||||||
|
currentTimeFilterval.value = value!;
|
||||||
|
setState(() {});
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
SmartDialog.showToast("「${i['label']}」的筛选结果");
|
||||||
|
SearchPanelController ctr =
|
||||||
|
Get.find<SearchPanelController>(tag: 'video');
|
||||||
|
ctr.duration.value = i['value'];
|
||||||
|
SmartDialog.showLoading(msg: 'loooad');
|
||||||
|
await ctr.onRefresh();
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,19 +11,22 @@ import 'package:pilipala/utils/feed_back.dart';
|
|||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class SettingController extends GetxController {
|
class SettingController extends GetxController {
|
||||||
Box user = GStrorage.user;
|
|
||||||
Box setting = GStrorage.setting;
|
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
Box setting = GStrorage.setting;
|
||||||
|
// Box userInfoCache = GStrorage.userInfo;
|
||||||
|
Box localCache = GStrorage.localCache;
|
||||||
|
|
||||||
RxBool userLogin = false.obs;
|
RxBool userLogin = false.obs;
|
||||||
RxBool feedBackEnable = false.obs;
|
RxBool feedBackEnable = false.obs;
|
||||||
RxInt picQuality = 10.obs;
|
RxInt picQuality = 10.obs;
|
||||||
Rx<ThemeType> themeType = ThemeType.system.obs;
|
Rx<ThemeType> themeType = ThemeType.system.obs;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
userLogin.value = user.get(UserBoxKey.userLogin) ?? false;
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
|
userLogin.value = userInfo != null;
|
||||||
feedBackEnable.value =
|
feedBackEnable.value =
|
||||||
setting.get(SettingBoxKey.feedBackEnable, defaultValue: false);
|
setting.get(SettingBoxKey.feedBackEnable, defaultValue: false);
|
||||||
picQuality.value =
|
picQuality.value =
|
||||||
@@ -53,7 +56,8 @@ class SettingController extends GetxController {
|
|||||||
|
|
||||||
// 清空本地存储的用户标识
|
// 清空本地存储的用户标识
|
||||||
userInfoCache.put('userInfoCache', null);
|
userInfoCache.put('userInfoCache', null);
|
||||||
user.put(UserBoxKey.accessKey, {'mid': -1, 'value': ''});
|
localCache
|
||||||
|
.put(LocalCacheKey.accessKey, {'mid': -1, 'value': ''});
|
||||||
|
|
||||||
// 更改我的页面登录状态
|
// 更改我的页面登录状态
|
||||||
await Get.find<MineController>().resetUserInfo();
|
await Get.find<MineController>().resetUserInfo();
|
||||||
|
|||||||
37
lib/pages/setting/extra_setting.dart
Normal file
37
lib/pages/setting/extra_setting.dart
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
|
import 'widgets/switch_item.dart';
|
||||||
|
|
||||||
|
class ExtraSetting extends StatefulWidget {
|
||||||
|
const ExtraSetting({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ExtraSetting> createState() => _ExtraSettingState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ExtraSettingState extends State<ExtraSetting> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: false,
|
||||||
|
titleSpacing: 0,
|
||||||
|
title: Text(
|
||||||
|
'其他设置',
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: const [
|
||||||
|
SetSwitchItem(
|
||||||
|
title: '检查更新',
|
||||||
|
subTitle: '每次启动时检查是否需要更新',
|
||||||
|
setKey: SettingBoxKey.autoUpdate,
|
||||||
|
defaultVal: false,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/video/play/quality.dart';
|
import 'package:pilipala/models/video/play/quality.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/models/fullscreen_mode.dart';
|
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
import 'widgets/switch_item.dart';
|
import 'widgets/switch_item.dart';
|
||||||
@@ -19,6 +19,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
late dynamic defaultAudioQa;
|
late dynamic defaultAudioQa;
|
||||||
late dynamic defaultDecode;
|
late dynamic defaultDecode;
|
||||||
late int defaultFullScreenMode;
|
late int defaultFullScreenMode;
|
||||||
|
late int defaultBtmProgressBehavior;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -31,6 +32,8 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
defaultValue: VideoDecodeFormats.values.last.code);
|
defaultValue: VideoDecodeFormats.values.last.code);
|
||||||
defaultFullScreenMode = setting.get(SettingBoxKey.fullScreenMode,
|
defaultFullScreenMode = setting.get(SettingBoxKey.fullScreenMode,
|
||||||
defaultValue: FullScreenMode.values.first.code);
|
defaultValue: FullScreenMode.values.first.code);
|
||||||
|
defaultBtmProgressBehavior = setting.get(SettingBoxKey.btmProgressBehavior,
|
||||||
|
defaultValue: BtmProgresBehavior.values.first.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -163,6 +166,31 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
dense: false,
|
||||||
|
title: Text('底部进度条展示', style: titleStyle),
|
||||||
|
subtitle: Text(
|
||||||
|
'当前展示方式:${BtmProgresBehaviorCode.fromCode(defaultBtmProgressBehavior)!.description}',
|
||||||
|
style: subTitleStyle,
|
||||||
|
),
|
||||||
|
trailing: PopupMenuButton(
|
||||||
|
initialValue: defaultBtmProgressBehavior,
|
||||||
|
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
||||||
|
onSelected: (item) {
|
||||||
|
defaultBtmProgressBehavior = item;
|
||||||
|
setting.put(SettingBoxKey.btmProgressBehavior, item);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||||
|
for (var i in BtmProgresBehavior.values) ...[
|
||||||
|
PopupMenuItem(
|
||||||
|
value: i.code,
|
||||||
|
child: Text(i.description),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ class PrivacySetting extends StatefulWidget {
|
|||||||
|
|
||||||
class _PrivacySettingState extends State<PrivacySetting> {
|
class _PrivacySettingState extends State<PrivacySetting> {
|
||||||
bool userLogin = false;
|
bool userLogin = false;
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
userLogin = user.get(UserBoxKey.userLogin) ?? false;
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
|
userLogin = userInfo != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ class SettingPage extends StatelessWidget {
|
|||||||
dense: false,
|
dense: false,
|
||||||
title: const Text('外观设置'),
|
title: const Text('外观设置'),
|
||||||
),
|
),
|
||||||
// ListTile(
|
ListTile(
|
||||||
// onTap: () {},
|
onTap: () => Get.toNamed('/extraSetting'),
|
||||||
// dense: false,
|
dense: false,
|
||||||
// title: const Text('其他设置'),
|
title: const Text('其他设置'),
|
||||||
// ),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => Visibility(
|
() => Visibility(
|
||||||
visible: settingController.userLogin.value,
|
visible: settingController.userLogin.value,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class SetSwitchItem extends StatefulWidget {
|
class SetSwitchItem extends StatefulWidget {
|
||||||
final String? title;
|
final String? title;
|
||||||
@@ -61,6 +62,9 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
|
|||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
val = value;
|
val = value;
|
||||||
Setting.put(widget.setKey, value);
|
Setting.put(widget.setKey, value);
|
||||||
|
if (widget.setKey == SettingBoxKey.autoUpdate && value == true) {
|
||||||
|
Utils.checkUpdata();
|
||||||
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class VideoDetailController extends GetxController
|
|||||||
|
|
||||||
/// 播放器配置 画质 音质 解码格式
|
/// 播放器配置 画质 音质 解码格式
|
||||||
late VideoQuality currentVideoQa;
|
late VideoQuality currentVideoQa;
|
||||||
late AudioQuality currentAudioQa;
|
AudioQuality? currentAudioQa;
|
||||||
late VideoDecodeFormats currentDecodeFormats;
|
late VideoDecodeFormats currentDecodeFormats;
|
||||||
// PlPlayerController plPlayerController = PlPlayerController();
|
// PlPlayerController plPlayerController = PlPlayerController();
|
||||||
// 是否开始自动播放 存在多p的情况下,第二p需要为true
|
// 是否开始自动播放 存在多p的情况下,第二p需要为true
|
||||||
@@ -51,7 +51,7 @@ class VideoDetailController extends GetxController
|
|||||||
RxBool enableHA = true.obs;
|
RxBool enableHA = true.obs;
|
||||||
|
|
||||||
/// 本地存储
|
/// 本地存储
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
Box localCache = GStrorage.localCache;
|
Box localCache = GStrorage.localCache;
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
|
|
||||||
@@ -70,11 +70,13 @@ class VideoDetailController extends GetxController
|
|||||||
late Duration defaultST;
|
late Duration defaultST;
|
||||||
// 默认记录历史记录
|
// 默认记录历史记录
|
||||||
bool enableHeart = true;
|
bool enableHeart = true;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
Map argMap = Get.arguments;
|
Map argMap = Get.arguments;
|
||||||
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
var keys = argMap.keys.toList();
|
var keys = argMap.keys.toList();
|
||||||
if (keys.isNotEmpty) {
|
if (keys.isNotEmpty) {
|
||||||
if (keys.contains('videoItem')) {
|
if (keys.contains('videoItem')) {
|
||||||
@@ -92,7 +94,7 @@ class VideoDetailController extends GetxController
|
|||||||
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
|
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
|
||||||
enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: true);
|
enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: true);
|
||||||
|
|
||||||
if (user.get(UserBoxKey.userMid) == null ||
|
if (userInfo == null ||
|
||||||
localCache.get(LocalCacheKey.historyPause) == true) {
|
localCache.get(LocalCacheKey.historyPause) == true) {
|
||||||
enableHeart = false;
|
enableHeart = false;
|
||||||
}
|
}
|
||||||
@@ -140,9 +142,11 @@ class VideoDetailController extends GetxController
|
|||||||
videoUrl = firstVideo.baseUrl!;
|
videoUrl = firstVideo.baseUrl!;
|
||||||
|
|
||||||
/// 根据currentAudioQa 重新设置audioUrl
|
/// 根据currentAudioQa 重新设置audioUrl
|
||||||
AudioItem firstAudio =
|
if (currentAudioQa != null) {
|
||||||
data.dash!.audio!.firstWhere((i) => i.id == currentAudioQa.code);
|
AudioItem firstAudio =
|
||||||
audioUrl = firstAudio.baseUrl ?? '';
|
data.dash!.audio!.firstWhere((i) => i.id == currentAudioQa!.code);
|
||||||
|
audioUrl = firstAudio.baseUrl ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
playerInit();
|
playerInit();
|
||||||
}
|
}
|
||||||
@@ -224,11 +228,16 @@ class VideoDetailController extends GetxController
|
|||||||
// 根据画质选编码格式
|
// 根据画质选编码格式
|
||||||
List supportDecodeFormats =
|
List supportDecodeFormats =
|
||||||
supportFormats.firstWhere((e) => e.quality == resVideoQa).codecs!;
|
supportFormats.firstWhere((e) => e.quality == resVideoQa).codecs!;
|
||||||
|
// 默认从设置中取AVC
|
||||||
|
currentDecodeFormats = VideoDecodeFormatsCode.fromString(setting.get(
|
||||||
|
SettingBoxKey.defaultDecode,
|
||||||
|
defaultValue: VideoDecodeFormats.values.last.code))!;
|
||||||
try {
|
try {
|
||||||
currentDecodeFormats = VideoDecodeFormatsCode.fromString(setting.get(
|
// 当前视频没有对应格式返回第一个
|
||||||
SettingBoxKey.defaultDecode,
|
currentDecodeFormats =
|
||||||
defaultValue: supportDecodeFormats.first))!;
|
supportDecodeFormats.contains(supportDecodeFormats)
|
||||||
|
? supportDecodeFormats
|
||||||
|
: supportDecodeFormats.first;
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|
||||||
/// 取出符合当前解码格式的videoItem
|
/// 取出符合当前解码格式的videoItem
|
||||||
@@ -270,6 +279,9 @@ class VideoDetailController extends GetxController
|
|||||||
// duration: data.timeLength ?? 0,
|
// duration: data.timeLength ?? 0,
|
||||||
// );
|
// );
|
||||||
} else {
|
} else {
|
||||||
|
if (result['code'] == -404) {
|
||||||
|
isShowCover.value = false;
|
||||||
|
}
|
||||||
SmartDialog.showToast(result['msg'].toString());
|
SmartDialog.showToast(result['msg'].toString());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ class VideoIntroController extends GetxController {
|
|||||||
// 视频详情 请求返回
|
// 视频详情 请求返回
|
||||||
Rx<VideoDetailData> videoDetail = VideoDetailData().obs;
|
Rx<VideoDetailData> videoDetail = VideoDetailData().obs;
|
||||||
|
|
||||||
// 请求返回的信息
|
|
||||||
String responseMsg = '请求异常';
|
|
||||||
|
|
||||||
// up主粉丝数
|
// up主粉丝数
|
||||||
Map userStat = {'follower': '-'};
|
Map userStat = {'follower': '-'};
|
||||||
|
|
||||||
@@ -42,7 +39,7 @@ class VideoIntroController extends GetxController {
|
|||||||
RxBool hasCoin = false.obs;
|
RxBool hasCoin = false.obs;
|
||||||
// 是否收藏
|
// 是否收藏
|
||||||
RxBool hasFav = false.obs;
|
RxBool hasFav = false.obs;
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
bool userLogin = false;
|
bool userLogin = false;
|
||||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||||
List addMediaIdsNew = [];
|
List addMediaIdsNew = [];
|
||||||
@@ -52,10 +49,12 @@ class VideoIntroController extends GetxController {
|
|||||||
int _tempThemeValue = -1;
|
int _tempThemeValue = -1;
|
||||||
|
|
||||||
RxInt lastPlayCid = 0.obs;
|
RxInt lastPlayCid = 0.obs;
|
||||||
|
var userInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
if (Get.arguments.isNotEmpty) {
|
if (Get.arguments.isNotEmpty) {
|
||||||
if (Get.arguments.containsKey('videoItem')) {
|
if (Get.arguments.containsKey('videoItem')) {
|
||||||
preRender = true;
|
preRender = true;
|
||||||
@@ -77,7 +76,7 @@ class VideoIntroController extends GetxController {
|
|||||||
videoItem!['owner'] = args.owner;
|
videoItem!['owner'] = args.owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userLogin = user.get(UserBoxKey.userLogin) != null;
|
userLogin = userInfo != null;
|
||||||
lastPlayCid.value = int.parse(Get.parameters['cid']!);
|
lastPlayCid.value = int.parse(Get.parameters['cid']!);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,8 +93,6 @@ class VideoIntroController extends GetxController {
|
|||||||
.value = ['简介', '评论 ${result['data']!.stat!.reply}'];
|
.value = ['简介', '评论 ${result['data']!.stat!.reply}'];
|
||||||
// 获取到粉丝数再返回
|
// 获取到粉丝数再返回
|
||||||
await queryUserStat();
|
await queryUserStat();
|
||||||
} else {
|
|
||||||
responseMsg = result['msg'];
|
|
||||||
}
|
}
|
||||||
if (userLogin) {
|
if (userLogin) {
|
||||||
// 获取点赞状态
|
// 获取点赞状态
|
||||||
@@ -143,7 +140,7 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
// 一键三连
|
// 一键三连
|
||||||
Future actionOneThree() async {
|
Future actionOneThree() async {
|
||||||
if (user.get(UserBoxKey.userMid) == null) {
|
if (userInfo == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -206,7 +203,7 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
// 投币
|
// 投币
|
||||||
Future actionCoinVideo() async {
|
Future actionCoinVideo() async {
|
||||||
if (user.get(UserBoxKey.userMid) == null) {
|
if (userInfo == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -302,7 +299,7 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
Future queryVideoInFolder() async {
|
Future queryVideoInFolder() async {
|
||||||
var result = await VideoHttp.videoInFolder(
|
var result = await VideoHttp.videoInFolder(
|
||||||
mid: user.get(UserBoxKey.userMid), rid: IdUtils.bv2av(bvid));
|
mid: userInfo.mid, rid: IdUtils.bv2av(bvid));
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
favFolderData.value = result['data'];
|
favFolderData.value = result['data'];
|
||||||
}
|
}
|
||||||
@@ -327,6 +324,9 @@ class VideoIntroController extends GetxController {
|
|||||||
|
|
||||||
// 查询关注状态
|
// 查询关注状态
|
||||||
Future queryFollowStatus() async {
|
Future queryFollowStatus() async {
|
||||||
|
if (videoDetail.value.owner == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var result = await VideoHttp.hasFollow(mid: videoDetail.value.owner!.mid!);
|
var result = await VideoHttp.hasFollow(mid: videoDetail.value.owner!.mid!);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
followStatus.value = result['data'];
|
followStatus.value = result['data'];
|
||||||
@@ -337,7 +337,7 @@ class VideoIntroController extends GetxController {
|
|||||||
// 关注/取关up
|
// 关注/取关up
|
||||||
Future actionRelationMod() async {
|
Future actionRelationMod() async {
|
||||||
feedBack();
|
feedBack();
|
||||||
if (user.get(UserBoxKey.userMid) == null) {
|
if (userInfo == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
|||||||
// 请求错误
|
// 请求错误
|
||||||
return HttpError(
|
return HttpError(
|
||||||
errMsg: snapshot.data['msg'],
|
errMsg: snapshot.data['msg'],
|
||||||
|
btnText: snapshot.data['code'] == -404 ||
|
||||||
|
snapshot.data['code'] == 62002
|
||||||
|
? '返回上一页'
|
||||||
|
: null,
|
||||||
fn: () => Get.back(),
|
fn: () => Get.back(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -127,7 +131,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
// 收藏
|
// 收藏
|
||||||
showFavBottomSheet() {
|
showFavBottomSheet() {
|
||||||
if (videoIntroController.user.get(UserBoxKey.userMid) == null) {
|
if (videoIntroController.userInfo == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ class VideoReplyController extends GetxController {
|
|||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
}
|
}
|
||||||
|
if (noMore.value == '没有更多了') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var res = await ReplyHttp.replyList(
|
var res = await ReplyHttp.replyList(
|
||||||
oid: aid!,
|
oid: aid!,
|
||||||
pageNum: currentPage + 1,
|
pageNum: currentPage + 1,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -33,6 +34,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
|
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
|
||||||
late VideoReplyController _videoReplyController;
|
late VideoReplyController _videoReplyController;
|
||||||
late AnimationController fabAnimationCtr;
|
late AnimationController fabAnimationCtr;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
bool _isFabVisible = true;
|
bool _isFabVisible = true;
|
||||||
@@ -60,18 +62,18 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
vsync: this, duration: const Duration(milliseconds: 300));
|
vsync: this, duration: const Duration(milliseconds: 300));
|
||||||
|
|
||||||
_futureBuilderFuture = _videoReplyController.queryReplyList();
|
_futureBuilderFuture = _videoReplyController.queryReplyList();
|
||||||
_videoReplyController.scrollController.addListener(
|
scrollController = _videoReplyController.scrollController;
|
||||||
|
scrollController.addListener(
|
||||||
() {
|
() {
|
||||||
if (_videoReplyController.scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
_videoReplyController.scrollController.position.maxScrollExtent -
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
300) {
|
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
||||||
if (!_videoReplyController.isLoadingMore) {
|
|
||||||
_videoReplyController.onLoad();
|
_videoReplyController.onLoad();
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
final ScrollDirection direction =
|
final ScrollDirection direction =
|
||||||
_videoReplyController.scrollController.position.userScrollDirection;
|
scrollController.position.userScrollDirection;
|
||||||
if (direction == ScrollDirection.forward) {
|
if (direction == ScrollDirection.forward) {
|
||||||
_showFab();
|
_showFab();
|
||||||
} else if (direction == ScrollDirection.reverse) {
|
} else if (direction == ScrollDirection.reverse) {
|
||||||
@@ -112,7 +114,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
fabAnimationCtr.dispose();
|
fabAnimationCtr.dispose();
|
||||||
_videoReplyController.scrollController.dispose();
|
scrollController.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -657,11 +657,13 @@ InlineSpan buildContent(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (content.atNameToMid.isEmpty && content.jumpUrl.isEmpty) {
|
if (content.atNameToMid.isEmpty && content.jumpUrl.isEmpty) {
|
||||||
spanChilds.add(TextSpan(
|
if (str != '') {
|
||||||
text: str,
|
spanChilds.add(TextSpan(
|
||||||
recognizer: TapGestureRecognizer()
|
text: str,
|
||||||
..onTap = () =>
|
recognizer: TapGestureRecognizer()
|
||||||
replyReply(replyItem.root == 0 ? replyItem : fReplyItem)));
|
..onTap = () =>
|
||||||
|
replyReply(replyItem.root == 0 ? replyItem : fReplyItem)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
Box localCache = GStrorage.localCache;
|
Box localCache = GStrorage.localCache;
|
||||||
late double sheetHeight;
|
late double sheetHeight;
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -48,12 +49,11 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
// 上拉加载更多
|
// 上拉加载更多
|
||||||
_videoReplyReplyController.scrollController.addListener(
|
scrollController = _videoReplyReplyController.scrollController;
|
||||||
|
scrollController.addListener(
|
||||||
() {
|
() {
|
||||||
if (_videoReplyReplyController.scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
_videoReplyReplyController
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
.scrollController.position.maxScrollExtent -
|
|
||||||
300) {
|
|
||||||
if (!_videoReplyReplyController.isLoadingMore) {
|
if (!_videoReplyReplyController.isLoadingMore) {
|
||||||
_videoReplyReplyController.onLoad();
|
_videoReplyReplyController.onLoad();
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// _videoReplyReplyController.scrollController.dispose();
|
// scrollController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,15 +120,16 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
'当前画质 ${widget.videoDetailCtr!.currentVideoQa.description}',
|
'当前画质 ${widget.videoDetailCtr!.currentVideoQa.description}',
|
||||||
style: subTitleStyle),
|
style: subTitleStyle),
|
||||||
),
|
),
|
||||||
ListTile(
|
if (widget.videoDetailCtr!.currentAudioQa != null)
|
||||||
onTap: () => {Get.back(), showSetAudioQa()},
|
ListTile(
|
||||||
dense: true,
|
onTap: () => {Get.back(), showSetAudioQa()},
|
||||||
leading: const Icon(Icons.album_outlined, size: 20),
|
dense: true,
|
||||||
title: Text('选择音质', style: titleStyle),
|
leading: const Icon(Icons.album_outlined, size: 20),
|
||||||
subtitle: Text(
|
title: Text('选择音质', style: titleStyle),
|
||||||
'当前音质 ${widget.videoDetailCtr!.currentAudioQa.description}',
|
subtitle: Text(
|
||||||
style: subTitleStyle),
|
'当前音质 ${widget.videoDetailCtr!.currentAudioQa!.description}',
|
||||||
),
|
style: subTitleStyle),
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => {Get.back(), showSetDecodeFormats()},
|
onTap: () => {Get.back(), showSetDecodeFormats()},
|
||||||
dense: true,
|
dense: true,
|
||||||
@@ -319,7 +320,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
|
|
||||||
/// 选择音质
|
/// 选择音质
|
||||||
void showSetAudioQa() {
|
void showSetAudioQa() {
|
||||||
AudioQuality currentAudioQa = widget.videoDetailCtr!.currentAudioQa;
|
AudioQuality currentAudioQa = widget.videoDetailCtr!.currentAudioQa!;
|
||||||
|
|
||||||
List<AudioItem> audio = videoInfo.dash!.audio!;
|
List<AudioItem> audio = videoInfo.dash!.audio!;
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// ignore_for_file: avoid_print
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
@@ -14,7 +15,7 @@ import 'package:webview_flutter/webview_flutter.dart';
|
|||||||
|
|
||||||
class WebviewController extends GetxController {
|
class WebviewController extends GetxController {
|
||||||
String url = '';
|
String url = '';
|
||||||
String type = '';
|
RxString type = ''.obs;
|
||||||
String pageTitle = '';
|
String pageTitle = '';
|
||||||
final WebViewController controller = WebViewController();
|
final WebViewController controller = WebViewController();
|
||||||
RxInt loadProgress = 0.obs;
|
RxInt loadProgress = 0.obs;
|
||||||
@@ -25,10 +26,10 @@ class WebviewController extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
url = Get.parameters['url']!;
|
url = Get.parameters['url']!;
|
||||||
type = Get.parameters['type']!;
|
type.value = Get.parameters['type']!;
|
||||||
pageTitle = Get.parameters['pageTitle']!;
|
pageTitle = Get.parameters['pageTitle']!;
|
||||||
|
|
||||||
if (type == 'login') {
|
if (type.value == 'login') {
|
||||||
controller.clearCache();
|
controller.clearCache();
|
||||||
controller.clearLocalStorage();
|
controller.clearLocalStorage();
|
||||||
WebViewCookieManager().clearCookies();
|
WebViewCookieManager().clearCookies();
|
||||||
@@ -52,54 +53,11 @@ class WebviewController extends GetxController {
|
|||||||
onUrlChange: (UrlChange urlChange) async {
|
onUrlChange: (UrlChange urlChange) async {
|
||||||
loadShow.value = false;
|
loadShow.value = false;
|
||||||
String url = urlChange.url ?? '';
|
String url = urlChange.url ?? '';
|
||||||
if (type == 'login' &&
|
if (type.value == 'login' &&
|
||||||
(url.startsWith(
|
(url.startsWith(
|
||||||
'https://passport.bilibili.com/web/sso/exchange_cookie') ||
|
'https://passport.bilibili.com/web/sso/exchange_cookie') ||
|
||||||
url.startsWith('https://m.bilibili.com/'))) {
|
url.startsWith('https://m.bilibili.com/'))) {
|
||||||
try {
|
confirmLogin(url);
|
||||||
await SetCookie.onSet();
|
|
||||||
var result = await UserHttp.userInfo();
|
|
||||||
UserHttp.thirdLogin();
|
|
||||||
print('网页登录: $result');
|
|
||||||
if (result['status'] && result['data'].isLogin) {
|
|
||||||
SmartDialog.showToast('登录成功');
|
|
||||||
try {
|
|
||||||
Box user = GStrorage.user;
|
|
||||||
user.put(UserBoxKey.userLogin, true);
|
|
||||||
user.put(UserBoxKey.userName, result['data'].uname);
|
|
||||||
user.put(UserBoxKey.userFace, result['data'].face);
|
|
||||||
user.put(UserBoxKey.userMid, result['data'].mid);
|
|
||||||
|
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
|
||||||
userInfoCache.put('userInfoCache', result['data']);
|
|
||||||
|
|
||||||
// 通知更新
|
|
||||||
eventBus.emit(EventName.loginEvent, {'status': true});
|
|
||||||
|
|
||||||
HomeController homeCtr = Get.find<HomeController>();
|
|
||||||
homeCtr.updateLoginStatus(true);
|
|
||||||
} catch (err) {
|
|
||||||
SmartDialog.show(builder: (context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('登录遇到问题'),
|
|
||||||
content: Text(err.toString()),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => controller.reload(),
|
|
||||||
child: const Text('确认'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Get.back();
|
|
||||||
} else {
|
|
||||||
// 获取用户信息失败
|
|
||||||
SmartDialog.showToast(result.msg);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
print(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onWebResourceError: (WebResourceError error) {},
|
onWebResourceError: (WebResourceError error) {},
|
||||||
@@ -113,4 +71,51 @@ class WebviewController extends GetxController {
|
|||||||
)
|
)
|
||||||
..loadRequest(Uri.parse(url));
|
..loadRequest(Uri.parse(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
confirmLogin(url) async {
|
||||||
|
var content = '';
|
||||||
|
if (url != null) {
|
||||||
|
content = '${content + url}; \n';
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await SetCookie.onSet();
|
||||||
|
var result = await UserHttp.userInfo();
|
||||||
|
UserHttp.thirdLogin();
|
||||||
|
if (result['status'] && result['data'].isLogin) {
|
||||||
|
SmartDialog.showToast('登录成功');
|
||||||
|
try {
|
||||||
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
await userInfoCache.put('userInfoCache', result['data']);
|
||||||
|
|
||||||
|
// 通知更新
|
||||||
|
eventBus.emit(EventName.loginEvent, {'status': true});
|
||||||
|
|
||||||
|
HomeController homeCtr = Get.find<HomeController>();
|
||||||
|
homeCtr.updateLoginStatus(true);
|
||||||
|
} catch (err) {
|
||||||
|
SmartDialog.show(builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('登录遇到问题'),
|
||||||
|
content: Text(err.toString()),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => controller.reload(),
|
||||||
|
child: const Text('确认'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Get.back();
|
||||||
|
} else {
|
||||||
|
// 获取用户信息失败
|
||||||
|
SmartDialog.showToast(result.msg);
|
||||||
|
Clipboard.setData(ClipboardData(text: result.msg.toString()));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
SmartDialog.showNotify(msg: e.toString(), notifyType: NotifyType.warning);
|
||||||
|
content = content + e.toString();
|
||||||
|
}
|
||||||
|
Clipboard.setData(ClipboardData(text: content));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,19 +18,25 @@ class _WebviewPageState extends State<WebviewPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
|
titleSpacing: 0,
|
||||||
title: Text(
|
title: Text(
|
||||||
_webviewController.pageTitle,
|
_webviewController.pageTitle,
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_webviewController.controller.reload();
|
_webviewController.controller.reload();
|
||||||
},
|
},
|
||||||
icon: const Icon(
|
child: const Text('刷新'),
|
||||||
Icons.refresh,
|
),
|
||||||
size: 22,
|
Obx(
|
||||||
),
|
() => _webviewController.type.value == 'login'
|
||||||
|
? TextButton(
|
||||||
|
onPressed: () => _webviewController.confirmLogin(null),
|
||||||
|
child: const Text('刷新登录状态'),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10)
|
const SizedBox(width: 10)
|
||||||
],
|
],
|
||||||
@@ -48,6 +54,14 @@ class _WebviewPageState extends State<WebviewPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (_webviewController.type.value == 'login')
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 12, right: 12, top: 6, bottom: 6),
|
||||||
|
child: const Text('登录成功未自动跳转? 请点击右上角「刷新登录状态」'),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: WebViewWidget(controller: _webviewController.controller),
|
child: WebViewWidget(controller: _webviewController.controller),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class PlPlayerController {
|
|||||||
// 播放位置
|
// 播放位置
|
||||||
final Rx<Duration> _position = Rx(Duration.zero);
|
final Rx<Duration> _position = Rx(Duration.zero);
|
||||||
final Rx<Duration> _sliderPosition = Rx(Duration.zero);
|
final Rx<Duration> _sliderPosition = Rx(Duration.zero);
|
||||||
|
// 展示使用
|
||||||
final Rx<Duration> _sliderTempPosition = Rx(Duration.zero);
|
final Rx<Duration> _sliderTempPosition = Rx(Duration.zero);
|
||||||
final Rx<Duration> _duration = Rx(Duration.zero);
|
final Rx<Duration> _duration = Rx(Duration.zero);
|
||||||
final Rx<Duration> _buffered = Rx(Duration.zero);
|
final Rx<Duration> _buffered = Rx(Duration.zero);
|
||||||
@@ -450,7 +451,7 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 跳转至指定位置
|
/// 跳转至指定位置
|
||||||
Future<void> seekTo(Duration position) async {
|
Future<void> seekTo(Duration position, {type = 'seek'}) async {
|
||||||
// if (position >= duration.value) {
|
// if (position >= duration.value) {
|
||||||
// position = duration.value - const Duration(milliseconds: 100);
|
// position = duration.value - const Duration(milliseconds: 100);
|
||||||
// }
|
// }
|
||||||
@@ -459,7 +460,10 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
_position.value = position;
|
_position.value = position;
|
||||||
if (duration.value.inSeconds != 0) {
|
if (duration.value.inSeconds != 0) {
|
||||||
await _videoPlayerController!.stream.buffer.first;
|
if (type != 'slider') {
|
||||||
|
/// 拖动进度条调节时,不等待第一帧,防止抖动
|
||||||
|
await _videoPlayerController!.stream.buffer.first;
|
||||||
|
}
|
||||||
await _videoPlayerController?.seek(position);
|
await _videoPlayerController?.seek(position);
|
||||||
// if (playerStatus.stopped) {
|
// if (playerStatus.stopped) {
|
||||||
// play();
|
// play();
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ export './models/play_status.dart';
|
|||||||
export './models/data_status.dart';
|
export './models/data_status.dart';
|
||||||
export './widgets/common_btn.dart';
|
export './widgets/common_btn.dart';
|
||||||
export './models/play_speed.dart';
|
export './models/play_speed.dart';
|
||||||
|
export './models/fullscreen_mode.dart';
|
||||||
|
export './models/bottom_progress_behavior.dart';
|
||||||
export './widgets/app_bar_ani.dart';
|
export './widgets/app_bar_ani.dart';
|
||||||
export './utils/fullscreen.dart';
|
export './utils/fullscreen.dart';
|
||||||
export './utils.dart';
|
export './utils.dart';
|
||||||
|
|||||||
23
lib/plugin/pl_player/models/bottom_progress_behavior.dart
Normal file
23
lib/plugin/pl_player/models/bottom_progress_behavior.dart
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// ignore: camel_case_types
|
||||||
|
enum BtmProgresBehavior {
|
||||||
|
alwaysShow,
|
||||||
|
alwaysHide,
|
||||||
|
onlyShowFullScreen,
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BtmProgresBehaviorDesc on BtmProgresBehavior {
|
||||||
|
String get description => ['始终展示', '始终隐藏', '仅全屏时展示'][index];
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BtmProgresBehaviorCode on BtmProgresBehavior {
|
||||||
|
static final List<int> _codeList = [0, 1, 2];
|
||||||
|
int get code => _codeList[index];
|
||||||
|
|
||||||
|
static BtmProgresBehavior? fromCode(int code) {
|
||||||
|
final index = _codeList.indexOf(code);
|
||||||
|
if (index != -1) {
|
||||||
|
return BtmProgresBehavior.values[index];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ import 'package:pilipala/utils/feed_back.dart';
|
|||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:screen_brightness/screen_brightness.dart';
|
import 'package:screen_brightness/screen_brightness.dart';
|
||||||
|
|
||||||
|
import 'models/bottom_progress_behavior.dart';
|
||||||
import 'utils/fullscreen.dart';
|
import 'utils/fullscreen.dart';
|
||||||
import 'widgets/app_bar_ani.dart';
|
import 'widgets/app_bar_ani.dart';
|
||||||
import 'widgets/backward_seek.dart';
|
import 'widgets/backward_seek.dart';
|
||||||
@@ -67,6 +68,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
|
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
late FullScreenMode mode;
|
late FullScreenMode mode;
|
||||||
|
late int defaultBtmProgressBehavior;
|
||||||
|
|
||||||
void onDoubleTapSeekBackward() {
|
void onDoubleTapSeekBackward() {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -87,6 +89,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
vsync: this, duration: const Duration(milliseconds: 300));
|
vsync: this, duration: const Duration(milliseconds: 300));
|
||||||
videoController = widget.controller.videoController!;
|
videoController = widget.controller.videoController!;
|
||||||
widget.controller.headerControl = widget.headerControl;
|
widget.controller.headerControl = widget.headerControl;
|
||||||
|
defaultBtmProgressBehavior = setting.get(SettingBoxKey.btmProgressBehavior,
|
||||||
|
defaultValue: BtmProgresBehavior.values.first.code);
|
||||||
|
|
||||||
Future.microtask(() async {
|
Future.microtask(() async {
|
||||||
try {
|
try {
|
||||||
@@ -203,7 +207,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
systemOverlayStyle: SystemUiOverlayStyle.light,
|
systemOverlayStyle: SystemUiOverlayStyle.light,
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
bottom: true,
|
bottom: false,
|
||||||
child: PLVideoPlayer(
|
child: PLVideoPlayer(
|
||||||
controller: _,
|
controller: _,
|
||||||
headerControl: _.headerControl,
|
headerControl: _.headerControl,
|
||||||
@@ -229,6 +233,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
animationController.dispose();
|
animationController.dispose();
|
||||||
|
FlutterVolumeController.removeListener();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,13 +258,16 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
fit: StackFit.passthrough,
|
fit: StackFit.passthrough,
|
||||||
children: [
|
children: [
|
||||||
Video(
|
Obx(
|
||||||
controller: videoController,
|
() => Video(
|
||||||
controls: NoVideoControls,
|
controller: videoController,
|
||||||
subtitleViewConfiguration: SubtitleViewConfiguration(
|
controls: NoVideoControls,
|
||||||
style: subTitleStyle,
|
subtitleViewConfiguration: SubtitleViewConfiguration(
|
||||||
textAlign: TextAlign.center,
|
style: subTitleStyle,
|
||||||
padding: const EdgeInsets.all(24.0),
|
textAlign: TextAlign.center,
|
||||||
|
padding: const EdgeInsets.all(24.0),
|
||||||
|
),
|
||||||
|
fit: _.videoFit.value,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -312,38 +320,40 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
opacity: _.isSliderMoving.value ? 1.0 : 0.0,
|
opacity: _.isSliderMoving.value ? 1.0 : 0.0,
|
||||||
duration: const Duration(milliseconds: 150),
|
duration: const Duration(milliseconds: 150),
|
||||||
child: Container(
|
child: IntrinsicWidth(
|
||||||
alignment: Alignment.center,
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
alignment: Alignment.center,
|
||||||
color: const Color(0x88000000),
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(64.0),
|
color: const Color(0x88000000),
|
||||||
),
|
borderRadius: BorderRadius.circular(64.0),
|
||||||
height: 34.0,
|
),
|
||||||
width: 100.0,
|
height: 34.0,
|
||||||
child: Row(
|
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Row(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
Obx(() {
|
children: [
|
||||||
return Text(
|
Obx(() {
|
||||||
_.sliderTempPosition.value.inMinutes >= 60
|
return Text(
|
||||||
? printDurationWithHours(
|
_.sliderTempPosition.value.inMinutes >= 60
|
||||||
_.sliderTempPosition.value)
|
? printDurationWithHours(
|
||||||
: printDuration(_.sliderTempPosition.value),
|
_.sliderTempPosition.value)
|
||||||
style: textStyle,
|
: printDuration(_.sliderTempPosition.value),
|
||||||
);
|
style: textStyle,
|
||||||
}),
|
);
|
||||||
const SizedBox(width: 2),
|
}),
|
||||||
const Text('/', style: textStyle),
|
const SizedBox(width: 2),
|
||||||
const SizedBox(width: 2),
|
const Text('/', style: textStyle),
|
||||||
Obx(
|
const SizedBox(width: 2),
|
||||||
() => Text(
|
Obx(
|
||||||
_.duration.value.inMinutes >= 60
|
() => Text(
|
||||||
? printDurationWithHours(_.duration.value)
|
_.duration.value.inMinutes >= 60
|
||||||
: printDuration(_.duration.value),
|
? printDurationWithHours(_.duration.value)
|
||||||
style: textStyle,
|
: printDuration(_.duration.value),
|
||||||
|
style: textStyle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -539,7 +549,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_.onChangedSliderEnd();
|
_.onChangedSliderEnd();
|
||||||
_.seekTo(_.sliderPosition.value);
|
_.seekTo(_.sliderPosition.value, type: 'slider');
|
||||||
},
|
},
|
||||||
// 垂直方向 音量/亮度调节
|
// 垂直方向 音量/亮度调节
|
||||||
onVerticalDragUpdate: (DragUpdateDetails details) async {
|
onVerticalDragUpdate: (DragUpdateDetails details) async {
|
||||||
@@ -620,6 +630,15 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
final int value = _.sliderPosition.value.inSeconds;
|
final int value = _.sliderPosition.value.inSeconds;
|
||||||
final int max = _.duration.value.inSeconds;
|
final int max = _.duration.value.inSeconds;
|
||||||
final int buffer = _.buffered.value.inSeconds;
|
final int buffer = _.buffered.value.inSeconds;
|
||||||
|
if (defaultBtmProgressBehavior ==
|
||||||
|
BtmProgresBehavior.alwaysHide.code) {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
if (defaultBtmProgressBehavior ==
|
||||||
|
BtmProgresBehavior.onlyShowFullScreen.code &&
|
||||||
|
!_.isFullScreen.value) {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
if (value > max || max <= 0) {
|
if (value > max || max <= 0) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
@@ -695,9 +714,19 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
Obx(() {
|
Obx(() {
|
||||||
if (_.dataStatus.loading || _.isBuffering.value) {
|
if (_.dataStatus.loading || _.isBuffering.value) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Image.asset(
|
child: Container(
|
||||||
'assets/images/loading.gif',
|
padding: const EdgeInsets.all(30),
|
||||||
height: 25,
|
decoration: const BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
gradient: RadialGradient(
|
||||||
|
center: Alignment.center,
|
||||||
|
colors: [Colors.black26, Colors.transparent],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/loading.gif',
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -44,29 +44,33 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
if (value > max || max <= 0) {
|
if (value > max || max <= 0) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
return ProgressBar(
|
return Padding(
|
||||||
progress: Duration(seconds: value),
|
padding: const EdgeInsets.only(left: 5, right: 5, bottom: 5),
|
||||||
buffered: Duration(seconds: buffer),
|
child: ProgressBar(
|
||||||
total: Duration(seconds: max),
|
progress: Duration(seconds: value),
|
||||||
progressBarColor: colorTheme,
|
buffered: Duration(seconds: buffer),
|
||||||
baseBarColor: Colors.white.withOpacity(0.2),
|
total: Duration(seconds: max),
|
||||||
bufferedBarColor: colorTheme.withOpacity(0.4),
|
progressBarColor: colorTheme,
|
||||||
timeLabelLocation: TimeLabelLocation.none,
|
baseBarColor: Colors.white.withOpacity(0.2),
|
||||||
thumbColor: colorTheme,
|
bufferedBarColor: colorTheme.withOpacity(0.4),
|
||||||
barHeight: 3.0,
|
timeLabelLocation: TimeLabelLocation.none,
|
||||||
thumbRadius: 5.5,
|
thumbColor: colorTheme,
|
||||||
onDragStart: (duration) {
|
barHeight: 3.0,
|
||||||
feedBack();
|
thumbRadius: 5.5,
|
||||||
_.onChangedSliderStart();
|
onDragStart: (duration) {
|
||||||
},
|
feedBack();
|
||||||
onDragUpdate: (duration) {
|
_.onChangedSliderStart();
|
||||||
_.onUodatedSliderProgress(duration.timeStamp);
|
},
|
||||||
},
|
onDragUpdate: (duration) {
|
||||||
onSeek: (duration) {
|
_.onUodatedSliderProgress(duration.timeStamp);
|
||||||
_.onChangedSliderEnd();
|
},
|
||||||
_.onChangedSlider(duration.inSeconds.toDouble());
|
onSeek: (duration) {
|
||||||
_.seekTo(Duration(seconds: duration.inSeconds));
|
_.onChangedSliderEnd();
|
||||||
},
|
_.onChangedSlider(duration.inSeconds.toDouble());
|
||||||
|
_.seekTo(Duration(seconds: duration.inSeconds),
|
||||||
|
type: 'slider');
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import 'package:pilipala/pages/member/index.dart';
|
|||||||
import 'package:pilipala/pages/preview/index.dart';
|
import 'package:pilipala/pages/preview/index.dart';
|
||||||
import 'package:pilipala/pages/search/index.dart';
|
import 'package:pilipala/pages/search/index.dart';
|
||||||
import 'package:pilipala/pages/searchResult/index.dart';
|
import 'package:pilipala/pages/searchResult/index.dart';
|
||||||
|
import 'package:pilipala/pages/setting/extra_setting.dart';
|
||||||
import 'package:pilipala/pages/setting/play_setting.dart';
|
import 'package:pilipala/pages/setting/play_setting.dart';
|
||||||
import 'package:pilipala/pages/setting/privacy_setting.dart';
|
import 'package:pilipala/pages/setting/privacy_setting.dart';
|
||||||
import 'package:pilipala/pages/setting/style_setting.dart';
|
import 'package:pilipala/pages/setting/style_setting.dart';
|
||||||
@@ -80,7 +81,8 @@ class Routes {
|
|||||||
GetPage(name: '/styleSetting', page: () => const StyleSetting()),
|
GetPage(name: '/styleSetting', page: () => const StyleSetting()),
|
||||||
// 隐私设置
|
// 隐私设置
|
||||||
GetPage(name: '/privacySetting', page: () => const PrivacySetting()),
|
GetPage(name: '/privacySetting', page: () => const PrivacySetting()),
|
||||||
|
// 其他设置
|
||||||
|
GetPage(name: '/extraSetting', page: () => const ExtraSetting()),
|
||||||
//
|
//
|
||||||
GetPage(name: '/blackListPage', page: () => const BlackListPage()),
|
GetPage(name: '/blackListPage', page: () => const BlackListPage()),
|
||||||
// 关于
|
// 关于
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ class Data {
|
|||||||
|
|
||||||
static Future historyStatus() async {
|
static Future historyStatus() async {
|
||||||
Box localCache = GStrorage.localCache;
|
Box localCache = GStrorage.localCache;
|
||||||
Box user = GStrorage.user;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
if (user.get(UserBoxKey.userMid) == null) {
|
if (userInfoCache.get('userInfoCache') == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var res = await UserHttp.historyStatus();
|
var res = await UserHttp.historyStatus();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'package:image_gallery_saver/image_gallery_saver.dart';
|
|||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
class DownloadUtils {
|
class DownloadUtils {
|
||||||
// 获取存储全县
|
// 获取存储权限
|
||||||
static requestStoragePer() async {
|
static requestStoragePer() async {
|
||||||
Map<Permission, PermissionStatus> statuses = await [
|
Map<Permission, PermissionStatus> statuses = await [
|
||||||
Permission.storage,
|
Permission.storage,
|
||||||
|
|||||||
@@ -7,10 +7,8 @@ import 'package:pilipala/models/search/hot.dart';
|
|||||||
import 'package:pilipala/models/user/info.dart';
|
import 'package:pilipala/models/user/info.dart';
|
||||||
|
|
||||||
class GStrorage {
|
class GStrorage {
|
||||||
static late final Box user;
|
|
||||||
static late final Box recVideo;
|
static late final Box recVideo;
|
||||||
static late final Box userInfo;
|
static late final Box userInfo;
|
||||||
static late final Box hotKeyword;
|
|
||||||
static late final Box historyword;
|
static late final Box historyword;
|
||||||
static late final Box localCache;
|
static late final Box localCache;
|
||||||
static late final Box setting;
|
static late final Box setting;
|
||||||
@@ -21,28 +19,24 @@ class GStrorage {
|
|||||||
final path = dir.path;
|
final path = dir.path;
|
||||||
await Hive.initFlutter('$path/hive');
|
await Hive.initFlutter('$path/hive');
|
||||||
regAdapter();
|
regAdapter();
|
||||||
// 用户信息
|
|
||||||
user = await Hive.openBox('user');
|
|
||||||
// 首页推荐视频
|
// 首页推荐视频
|
||||||
recVideo = await Hive.openBox(
|
recVideo = await Hive.openBox(
|
||||||
'recVideo',
|
'recVideo',
|
||||||
compactionStrategy: (entries, deletedEntries) {
|
compactionStrategy: (entries, deletedEntries) {
|
||||||
return deletedEntries > 20;
|
return deletedEntries > 12;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
// 登录用户信息
|
// 登录用户信息
|
||||||
userInfo = await Hive.openBox('userInfo');
|
userInfo = await Hive.openBox(
|
||||||
|
'userInfo',
|
||||||
|
compactionStrategy: (entries, deletedEntries) {
|
||||||
|
return deletedEntries > 2;
|
||||||
|
},
|
||||||
|
);
|
||||||
// 本地缓存
|
// 本地缓存
|
||||||
localCache = await Hive.openBox('localCache');
|
localCache = await Hive.openBox('localCache');
|
||||||
// 设置
|
// 设置
|
||||||
setting = await Hive.openBox('setting');
|
setting = await Hive.openBox('setting');
|
||||||
// 热搜关键词
|
|
||||||
hotKeyword = await Hive.openBox(
|
|
||||||
'hotKeyword',
|
|
||||||
compactionStrategy: (entries, deletedEntries) {
|
|
||||||
return deletedEntries > 10;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
// 搜索历史
|
// 搜索历史
|
||||||
historyword = await Hive.openBox(
|
historyword = await Hive.openBox(
|
||||||
'historyWord',
|
'historyWord',
|
||||||
@@ -70,14 +64,12 @@ class GStrorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> close() async {
|
static Future<void> close() async {
|
||||||
user.compact();
|
// user.compact();
|
||||||
user.close();
|
// user.close();
|
||||||
recVideo.compact();
|
recVideo.compact();
|
||||||
recVideo.close();
|
recVideo.close();
|
||||||
userInfo.compact();
|
userInfo.compact();
|
||||||
userInfo.close();
|
userInfo.close();
|
||||||
hotKeyword.compact();
|
|
||||||
hotKeyword.close();
|
|
||||||
historyword.compact();
|
historyword.compact();
|
||||||
historyword.close();
|
historyword.close();
|
||||||
localCache.compact();
|
localCache.compact();
|
||||||
@@ -89,19 +81,6 @@ class GStrorage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 约定 key
|
|
||||||
class UserBoxKey {
|
|
||||||
static const String userName = 'userName';
|
|
||||||
// 头像
|
|
||||||
static const String userFace = 'userFace';
|
|
||||||
// mid
|
|
||||||
static const String userMid = 'userMid';
|
|
||||||
// 登录状态
|
|
||||||
static const String userLogin = 'userLogin';
|
|
||||||
// 凭证
|
|
||||||
static const String accessKey = 'accessKey';
|
|
||||||
}
|
|
||||||
|
|
||||||
class SettingBoxKey {
|
class SettingBoxKey {
|
||||||
static const String themeMode = 'themeMode';
|
static const String themeMode = 'themeMode';
|
||||||
static const String feedBackEnable = 'feedBackEnable';
|
static const String feedBackEnable = 'feedBackEnable';
|
||||||
@@ -119,11 +98,19 @@ class SettingBoxKey {
|
|||||||
static const String fullScreenMode = 'fullScreenMode';
|
static const String fullScreenMode = 'fullScreenMode';
|
||||||
|
|
||||||
static const String blackMidsList = 'blackMidsList';
|
static const String blackMidsList = 'blackMidsList';
|
||||||
|
static const String autoUpdate = 'autoUpdate';
|
||||||
|
static const String btmProgressBehavior = 'btmProgressBehavior';
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocalCacheKey {
|
class LocalCacheKey {
|
||||||
// 历史记录暂停状态 默认false 记录
|
// 历史记录暂停状态 默认false 记录
|
||||||
static const String historyPause = 'historyPause';
|
static const String historyPause = 'historyPause';
|
||||||
|
// access_key
|
||||||
|
static const String accessKey = 'accessKey';
|
||||||
|
|
||||||
|
//
|
||||||
|
static const String wbiKeys = 'wbiKeys';
|
||||||
|
static const String timeStamp = 'timeStamp';
|
||||||
}
|
}
|
||||||
|
|
||||||
class VideoBoxKey {
|
class VideoBoxKey {
|
||||||
|
|||||||
@@ -4,8 +4,14 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get_utils/get_utils.dart';
|
import 'package:get/get_utils/get_utils.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:pilipala/http/index.dart';
|
||||||
|
import 'package:pilipala/models/github/latest.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class Utils {
|
class Utils {
|
||||||
static Future<String> getCookiePath() async {
|
static Future<String> getCookiePath() async {
|
||||||
@@ -194,4 +200,55 @@ class Utils {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查更新
|
||||||
|
static Future<bool> checkUpdata() async {
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
var currentInfo = await PackageInfo.fromPlatform();
|
||||||
|
var result = await Request().get(Api.latestApp);
|
||||||
|
LatestDataModel data = LatestDataModel.fromJson(result.data);
|
||||||
|
bool isUpdate = Utils.needUpdate(currentInfo.version, data.tagName!);
|
||||||
|
if (isUpdate) {
|
||||||
|
SmartDialog.show(
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('🎉 发现新版本 '),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
data.tagName!,
|
||||||
|
style: const TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(data.body!),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
|
child: Text(
|
||||||
|
'稍后',
|
||||||
|
style:
|
||||||
|
TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
|
)),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await SmartDialog.dismiss();
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse(
|
||||||
|
'https://github.com/guozhigq/pilipala/releases'),
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: const Text('去下载')),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,8 +109,10 @@ class WbiSign {
|
|||||||
// 获取最新的 img_key 和 sub_key 可以从缓存中获取
|
// 获取最新的 img_key 和 sub_key 可以从缓存中获取
|
||||||
static Future<Map<String, dynamic>> getWbiKeys() async {
|
static Future<Map<String, dynamic>> getWbiKeys() async {
|
||||||
DateTime nowDate = DateTime.now();
|
DateTime nowDate = DateTime.now();
|
||||||
if (localCache.get('wbiKeys') != null &&
|
if (localCache.get(LocalCacheKey.wbiKeys) != null &&
|
||||||
DateTime.fromMillisecondsSinceEpoch(localCache.get('timeStamp')).day ==
|
DateTime.fromMillisecondsSinceEpoch(
|
||||||
|
localCache.get(LocalCacheKey.timeStamp))
|
||||||
|
.day ==
|
||||||
nowDate.day) {
|
nowDate.day) {
|
||||||
Map cacheWbiKeys = localCache.get('wbiKeys');
|
Map cacheWbiKeys = localCache.get('wbiKeys');
|
||||||
return Map<String, dynamic>.from(cacheWbiKeys);
|
return Map<String, dynamic>.from(cacheWbiKeys);
|
||||||
@@ -129,8 +131,8 @@ class WbiSign {
|
|||||||
.substring(subUrl.lastIndexOf('/') + 1, subUrl.length)
|
.substring(subUrl.lastIndexOf('/') + 1, subUrl.length)
|
||||||
.split('.')[0]
|
.split('.')[0]
|
||||||
};
|
};
|
||||||
localCache.put('wbiKeys', wbiKeys);
|
localCache.put(LocalCacheKey.wbiKeys, wbiKeys);
|
||||||
localCache.put('timeStamp', nowDate.millisecondsSinceEpoch);
|
localCache.put(LocalCacheKey.timeStamp, nowDate.millisecondsSinceEpoch);
|
||||||
return wbiKeys;
|
return wbiKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
48
pubspec.lock
48
pubspec.lock
@@ -337,6 +337,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.6"
|
version: "1.6.6"
|
||||||
|
easy_debounce:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: easy_debounce
|
||||||
|
sha256: f082609cfb8f37defb9e37fc28bc978c6712dedf08d4c5a26f820fa10165a236
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.3"
|
||||||
extended_image:
|
extended_image:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -467,6 +475,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.9.3+2"
|
version: "4.9.3+2"
|
||||||
|
flutter_svg:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_svg
|
||||||
|
sha256: "8c5d68a82add3ca76d792f058b186a0599414f279f00ece4830b9b231b570338"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.7"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -813,6 +829,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.3"
|
version: "1.8.3"
|
||||||
|
path_parsing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_parsing
|
||||||
|
sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.1"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -1282,6 +1306,30 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.7"
|
version: "3.0.7"
|
||||||
|
vector_graphics:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vector_graphics
|
||||||
|
sha256: "670f6e07aca990b4a2bcdc08a784193c4ccdd1932620244c3a86bb72a0eac67f"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.7"
|
||||||
|
vector_graphics_codec:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vector_graphics_codec
|
||||||
|
sha256: "7451721781d967db9933b63f5733b1c4533022c0ba373a01bdd79d1a5457f69f"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.7"
|
||||||
|
vector_graphics_compiler:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vector_graphics_compiler
|
||||||
|
sha256: "80a13c613c8bde758b1464a1755a7b3a8f2b6cec61fbf0f5a53c94c30f03ba2e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.7"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.0+1
|
version: 1.0.3
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.19.6 <3.0.0"
|
sdk: ">=2.19.6 <3.0.0"
|
||||||
@@ -114,6 +114,9 @@ dependencies:
|
|||||||
# 获取appx信息
|
# 获取appx信息
|
||||||
package_info_plus: ^4.1.0
|
package_info_plus: ^4.1.0
|
||||||
url_launcher: ^6.1.12
|
url_launcher: ^6.1.12
|
||||||
|
flutter_svg: ^2.0.7
|
||||||
|
# 防抖节流
|
||||||
|
easy_debounce: ^2.0.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user