Merge branch 'main' into fix
This commit is contained in:
@ -28,7 +28,7 @@ class BlackHttp {
|
|||||||
static Future removeBlack({required int fid}) async {
|
static Future removeBlack({required int fid}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.removeBlack,
|
Api.removeBlack,
|
||||||
queryParameters: {
|
data: {
|
||||||
'act': 6,
|
'act': 6,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
'fid': fid,
|
'fid': fid,
|
||||||
|
@ -67,9 +67,6 @@ class DanmakaHttp {
|
|||||||
var response = await Request().post(
|
var response = await Request().post(
|
||||||
Api.shootDanmaku,
|
Api.shootDanmaku,
|
||||||
data: params,
|
data: params,
|
||||||
options: Options(
|
|
||||||
contentType: Headers.formUrlEncodedContentType,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
return {
|
return {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
import '../models/dynamics/result.dart';
|
import '../models/dynamics/result.dart';
|
||||||
import '../models/dynamics/up.dart';
|
import '../models/dynamics/up.dart';
|
||||||
import 'index.dart';
|
import 'index.dart';
|
||||||
@ -69,7 +70,7 @@ class DynamicsHttp {
|
|||||||
}) async {
|
}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.likeDynamic,
|
Api.likeDynamic,
|
||||||
queryParameters: {
|
data: {
|
||||||
'dynamic_id': dynamicId,
|
'dynamic_id': dynamicId,
|
||||||
'up': up,
|
'up': up,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -175,27 +176,32 @@ class DynamicsHttp {
|
|||||||
'revs_id': {'dyn_type': 8, 'rid': oid}
|
'revs_id': {'dyn_type': 8, 'rid': oid}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var res = await Request().post(Api.dynamicCreate, queryParameters: {
|
var res = await Request().post(
|
||||||
'platform': 'web',
|
Api.dynamicCreate,
|
||||||
'csrf': await Request.getCsrf(),
|
queryParameters: {
|
||||||
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
'platform': 'web',
|
||||||
'x-bili-web-req-json': {'spm_id': '333.999'},
|
'csrf': await Request.getCsrf(),
|
||||||
}, data: {
|
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
||||||
'dyn_req': {
|
'x-bili-web-req-json': {'spm_id': '333.999'},
|
||||||
'content': {
|
|
||||||
'contents': [
|
|
||||||
{'raw_text': rawText ?? '', 'type': 1, 'biz_id': ''}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
'scene': scene,
|
|
||||||
'attach_card': null,
|
|
||||||
'upload_id': uploadId,
|
|
||||||
'meta': {
|
|
||||||
'app_meta': {'from': 'create.dynamic.web', 'mobi_app': 'web'}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'web_repost_src': webRepostSrc
|
data: {
|
||||||
});
|
'dyn_req': {
|
||||||
|
'content': {
|
||||||
|
'contents': [
|
||||||
|
{'raw_text': rawText ?? '', 'type': 1, 'biz_id': ''}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
'scene': scene,
|
||||||
|
'attach_card': null,
|
||||||
|
'upload_id': uploadId,
|
||||||
|
'meta': {
|
||||||
|
'app_meta': {'from': 'create.dynamic.web', 'mobi_app': 'web'}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'web_repost_src': webRepostSrc
|
||||||
|
},
|
||||||
|
options: Options(contentType: 'application/json'),
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
|
@ -11,7 +11,7 @@ class FavHttp {
|
|||||||
}) async {
|
}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.editFavFolder,
|
Api.editFavFolder,
|
||||||
queryParameters: {
|
data: {
|
||||||
'title': title,
|
'title': title,
|
||||||
'intro': intro,
|
'intro': intro,
|
||||||
'media_id': mediaId,
|
'media_id': mediaId,
|
||||||
@ -43,7 +43,7 @@ class FavHttp {
|
|||||||
}) async {
|
}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.addFavFolder,
|
Api.addFavFolder,
|
||||||
queryParameters: {
|
data: {
|
||||||
'title': title,
|
'title': title,
|
||||||
'intro': intro,
|
'intro': intro,
|
||||||
'cover': cover ?? '',
|
'cover': cover ?? '',
|
||||||
|
@ -260,7 +260,8 @@ class Request {
|
|||||||
url,
|
url,
|
||||||
data: data,
|
data: data,
|
||||||
queryParameters: queryParameters,
|
queryParameters: queryParameters,
|
||||||
options: options,
|
options:
|
||||||
|
options ?? Options(contentType: Headers.formUrlEncodedContentType),
|
||||||
cancelToken: cancelToken,
|
cancelToken: cancelToken,
|
||||||
);
|
);
|
||||||
// print('post success: ${response.data}');
|
// print('post success: ${response.data}');
|
||||||
|
@ -89,23 +89,26 @@ class LiveHttp {
|
|||||||
|
|
||||||
// 发送弹幕
|
// 发送弹幕
|
||||||
static Future sendDanmaku({roomId, msg}) async {
|
static Future sendDanmaku({roomId, msg}) async {
|
||||||
var res = await Request().post(Api.sendLiveMsg, queryParameters: {
|
var res = await Request().post(
|
||||||
'bubble': 0,
|
Api.sendLiveMsg,
|
||||||
'msg': msg,
|
data: {
|
||||||
'color': 16777215, // 颜色
|
'bubble': 0,
|
||||||
'mode': 1, // 模式
|
'msg': msg,
|
||||||
'room_type': 0,
|
'color': 16777215, // 颜色
|
||||||
'jumpfrom': 71001, // 直播间来源
|
'mode': 1, // 模式
|
||||||
'reply_mid': 0,
|
'room_type': 0,
|
||||||
'reply_attr': 0,
|
'jumpfrom': 71001, // 直播间来源
|
||||||
'replay_dmid': '',
|
'reply_mid': 0,
|
||||||
'statistics': {"appId": 100, "platform": 5},
|
'reply_attr': 0,
|
||||||
'fontsize': 25, // 字体大小
|
'replay_dmid': '',
|
||||||
'rnd': DateTime.now().millisecondsSinceEpoch ~/ 1000, // 时间戳
|
'statistics': {"appId": 100, "platform": 5},
|
||||||
'roomid': roomId,
|
'fontsize': 25, // 字体大小
|
||||||
'csrf': await Request.getCsrf(),
|
'rnd': DateTime.now().millisecondsSinceEpoch ~/ 1000, // 时间戳
|
||||||
'csrf_token': await Request.getCsrf(),
|
'roomid': roomId,
|
||||||
});
|
'csrf': await Request.getCsrf(),
|
||||||
|
'csrf_token': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
@ -145,12 +148,15 @@ class LiveHttp {
|
|||||||
|
|
||||||
// 直播历史记录
|
// 直播历史记录
|
||||||
static Future liveRoomEntry({required int roomId}) async {
|
static Future liveRoomEntry({required int roomId}) async {
|
||||||
await Request().post(Api.liveRoomEntry, queryParameters: {
|
await Request().post(
|
||||||
'room_id': roomId,
|
Api.liveRoomEntry,
|
||||||
'platform': 'pc',
|
data: {
|
||||||
'csrf_token': await Request.getCsrf(),
|
'room_id': roomId,
|
||||||
'csrf': await Request.getCsrf(),
|
'platform': 'pc',
|
||||||
'visit_id': '',
|
'csrf_token': await Request.getCsrf(),
|
||||||
});
|
'csrf': await Request.getCsrf(),
|
||||||
|
'visit_id': '',
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,9 +71,6 @@ class LoginHttp {
|
|||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.webSmsCode,
|
Api.webSmsCode,
|
||||||
data: formData,
|
data: formData,
|
||||||
options: Options(
|
|
||||||
contentType: Headers.formUrlEncodedContentType,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
@ -106,9 +103,6 @@ class LoginHttp {
|
|||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.webSmsLogin,
|
Api.webSmsLogin,
|
||||||
data: formData,
|
data: formData,
|
||||||
options: Options(
|
|
||||||
contentType: Headers.formUrlEncodedContentType,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
@ -155,9 +149,6 @@ class LoginHttp {
|
|||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.appSmsCode,
|
Api.appSmsCode,
|
||||||
data: data,
|
data: data,
|
||||||
options: Options(
|
|
||||||
contentType: Headers.formUrlEncodedContentType,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
print(res);
|
print(res);
|
||||||
}
|
}
|
||||||
@ -208,9 +199,6 @@ class LoginHttp {
|
|||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.loginInByPwdApi,
|
Api.loginInByPwdApi,
|
||||||
data: data,
|
data: data,
|
||||||
options: Options(
|
|
||||||
contentType: Headers.formUrlEncodedContentType,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
print(res);
|
print(res);
|
||||||
}
|
}
|
||||||
@ -239,9 +227,6 @@ class LoginHttp {
|
|||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.loginInByWebPwd,
|
Api.loginInByWebPwd,
|
||||||
data: formData,
|
data: formData,
|
||||||
options: Options(
|
|
||||||
contentType: Headers.formUrlEncodedContentType,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
if (res.data['data']['status'] == 0) {
|
if (res.data['data']['status'] == 0) {
|
||||||
|
@ -198,13 +198,15 @@ class MemberHttp {
|
|||||||
|
|
||||||
// 设置分组
|
// 设置分组
|
||||||
static Future addUsers(int? fids, String? tagids) async {
|
static Future addUsers(int? fids, String? tagids) async {
|
||||||
var res = await Request().post(Api.addUsers, queryParameters: {
|
var res = await Request().post(
|
||||||
'fids': fids,
|
Api.addUsers,
|
||||||
'tagids': tagids ?? '0',
|
data: {
|
||||||
'csrf': await Request.getCsrf(),
|
'fids': fids,
|
||||||
}, data: {
|
'tagids': tagids ?? '0',
|
||||||
'cross_domain': true
|
'csrf': await Request.getCsrf(),
|
||||||
});
|
},
|
||||||
|
queryParameters: {'cross_domain': true},
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': [], 'msg': '操作成功'};
|
return {'status': true, 'data': [], 'msg': '操作成功'};
|
||||||
} else {
|
} else {
|
||||||
@ -422,11 +424,14 @@ class MemberHttp {
|
|||||||
static Future cookieToKey() async {
|
static Future cookieToKey() async {
|
||||||
var authCodeRes = await getTVCode();
|
var authCodeRes = await getTVCode();
|
||||||
if (authCodeRes['status']) {
|
if (authCodeRes['status']) {
|
||||||
var res = await Request().post(Api.cookieToKey, queryParameters: {
|
var res = await Request().post(
|
||||||
'auth_code': authCodeRes['data'],
|
Api.cookieToKey,
|
||||||
'build': 708200,
|
data: {
|
||||||
'csrf': await Request.getCsrf(),
|
'auth_code': authCodeRes['data'],
|
||||||
});
|
'build': 708200,
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
await Future.delayed(const Duration(milliseconds: 300));
|
await Future.delayed(const Duration(milliseconds: 300));
|
||||||
await qrcodePoll(authCodeRes['data']);
|
await qrcodePoll(authCodeRes['data']);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:pilipala/models/msg/like.dart';
|
import 'package:pilipala/models/msg/like.dart';
|
||||||
import 'package:pilipala/models/msg/reply.dart';
|
import 'package:pilipala/models/msg/reply.dart';
|
||||||
import 'package:pilipala/models/msg/system.dart';
|
import 'package:pilipala/models/msg/system.dart';
|
||||||
@ -158,9 +157,6 @@ class MsgHttp {
|
|||||||
'csrf_token': csrf,
|
'csrf_token': csrf,
|
||||||
'csrf': csrf,
|
'csrf': csrf,
|
||||||
},
|
},
|
||||||
options: Options(
|
|
||||||
contentType: Headers.formUrlEncodedContentType,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
|
@ -78,7 +78,7 @@ class ReplyHttp {
|
|||||||
}) async {
|
}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.likeReply,
|
Api.likeReply,
|
||||||
queryParameters: {
|
data: {
|
||||||
'type': type,
|
'type': type,
|
||||||
'oid': oid,
|
'oid': oid,
|
||||||
'rpid': rpid,
|
'rpid': rpid,
|
||||||
|
@ -153,7 +153,7 @@ class UserHttp {
|
|||||||
// 暂停switchStatus传true 否则false
|
// 暂停switchStatus传true 否则false
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.pauseHistory,
|
Api.pauseHistory,
|
||||||
queryParameters: {
|
data: {
|
||||||
'switch': switchStatus,
|
'switch': switchStatus,
|
||||||
'jsonp': 'jsonp',
|
'jsonp': 'jsonp',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -172,7 +172,7 @@ class UserHttp {
|
|||||||
static Future clearHistory() async {
|
static Future clearHistory() async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.clearHistory,
|
Api.clearHistory,
|
||||||
queryParameters: {
|
data: {
|
||||||
'jsonp': 'jsonp',
|
'jsonp': 'jsonp',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
},
|
},
|
||||||
@ -190,7 +190,7 @@ class UserHttp {
|
|||||||
}
|
}
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.toViewLater,
|
Api.toViewLater,
|
||||||
queryParameters: data,
|
data: data,
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': 'yeah!稍后再看'};
|
return {'status': true, 'msg': 'yeah!稍后再看'};
|
||||||
@ -209,7 +209,7 @@ class UserHttp {
|
|||||||
params[aid != null ? 'aid' : 'viewed'] = aid ?? true;
|
params[aid != null ? 'aid' : 'viewed'] = aid ?? true;
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.toViewDel,
|
Api.toViewDel,
|
||||||
queryParameters: params,
|
data: params,
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': 'yeah!成功移除'};
|
return {'status': true, 'msg': 'yeah!成功移除'};
|
||||||
@ -241,7 +241,7 @@ class UserHttp {
|
|||||||
static Future toViewClear() async {
|
static Future toViewClear() async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.toViewClear,
|
Api.toViewClear,
|
||||||
queryParameters: {
|
data: {
|
||||||
'jsonp': 'jsonp',
|
'jsonp': 'jsonp',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
},
|
},
|
||||||
@ -257,7 +257,7 @@ class UserHttp {
|
|||||||
static Future delHistory(kid) async {
|
static Future delHistory(kid) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.delHistory,
|
Api.delHistory,
|
||||||
queryParameters: {
|
data: {
|
||||||
'kid': kid,
|
'kid': kid,
|
||||||
'jsonp': 'jsonp',
|
'jsonp': 'jsonp',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -406,7 +406,7 @@ class UserHttp {
|
|||||||
static Future cancelSub({required int seasonId}) async {
|
static Future cancelSub({required int seasonId}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.cancelSub,
|
Api.cancelSub,
|
||||||
queryParameters: {
|
data: {
|
||||||
'platform': 'web',
|
'platform': 'web',
|
||||||
'season_id': seasonId,
|
'season_id': seasonId,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -423,7 +423,7 @@ class UserHttp {
|
|||||||
static Future delFavFolder({required int mediaIds}) async {
|
static Future delFavFolder({required int mediaIds}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.delFavFolder,
|
Api.delFavFolder,
|
||||||
queryParameters: {
|
data: {
|
||||||
'media_ids': mediaIds,
|
'media_ids': mediaIds,
|
||||||
'platform': 'web',
|
'platform': 'web',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
|
@ -243,7 +243,7 @@ class VideoHttp {
|
|||||||
static Future coinVideo({required String bvid, required int multiply}) async {
|
static Future coinVideo({required String bvid, required int multiply}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.coinVideo,
|
Api.coinVideo,
|
||||||
queryParameters: {
|
data: {
|
||||||
'bvid': bvid,
|
'bvid': bvid,
|
||||||
'multiply': multiply,
|
'multiply': multiply,
|
||||||
'select_like': 0,
|
'select_like': 0,
|
||||||
@ -271,7 +271,7 @@ class VideoHttp {
|
|||||||
static Future oneThree({required String bvid}) async {
|
static Future oneThree({required String bvid}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.oneThree,
|
Api.oneThree,
|
||||||
queryParameters: {
|
data: {
|
||||||
'bvid': bvid,
|
'bvid': bvid,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
},
|
},
|
||||||
@ -287,7 +287,7 @@ class VideoHttp {
|
|||||||
static Future likeVideo({required String bvid, required bool type}) async {
|
static Future likeVideo({required String bvid, required bool type}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.likeVideo,
|
Api.likeVideo,
|
||||||
queryParameters: {
|
data: {
|
||||||
'bvid': bvid,
|
'bvid': bvid,
|
||||||
'like': type ? 1 : 2,
|
'like': type ? 1 : 2,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -303,13 +303,16 @@ class VideoHttp {
|
|||||||
// (取消)收藏
|
// (取消)收藏
|
||||||
static Future favVideo(
|
static Future favVideo(
|
||||||
{required int aid, String? addIds, String? delIds}) async {
|
{required int aid, String? addIds, String? delIds}) async {
|
||||||
var res = await Request().post(Api.favVideo, queryParameters: {
|
var res = await Request().post(
|
||||||
'rid': aid,
|
Api.favVideo,
|
||||||
'type': 2,
|
data: {
|
||||||
'add_media_ids': addIds ?? '',
|
'rid': aid,
|
||||||
'del_media_ids': delIds ?? '',
|
'type': 2,
|
||||||
'csrf': await Request.getCsrf(),
|
'add_media_ids': addIds ?? '',
|
||||||
});
|
'del_media_ids': delIds ?? '',
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
} else {
|
} else {
|
||||||
@ -347,14 +350,17 @@ class VideoHttp {
|
|||||||
if (message == '') {
|
if (message == '') {
|
||||||
return {'status': false, 'data': [], 'msg': '请输入评论内容'};
|
return {'status': false, 'data': [], 'msg': '请输入评论内容'};
|
||||||
}
|
}
|
||||||
var res = await Request().post(Api.replyAdd, queryParameters: {
|
var res = await Request().post(
|
||||||
'type': type.index,
|
Api.replyAdd,
|
||||||
'oid': oid,
|
data: {
|
||||||
'root': root == null || root == 0 ? '' : root,
|
'type': type.index,
|
||||||
'parent': parent == null || parent == 0 ? '' : parent,
|
'oid': oid,
|
||||||
'message': message,
|
'root': root == null || root == 0 ? '' : root,
|
||||||
'csrf': await Request.getCsrf(),
|
'parent': parent == null || parent == 0 ? '' : parent,
|
||||||
});
|
'message': message,
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
log(res.toString());
|
log(res.toString());
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
@ -376,12 +382,15 @@ class VideoHttp {
|
|||||||
// 操作用户关系
|
// 操作用户关系
|
||||||
static Future relationMod(
|
static Future relationMod(
|
||||||
{required int mid, required int act, required int reSrc}) async {
|
{required int mid, required int act, required int reSrc}) async {
|
||||||
var res = await Request().post(Api.relationMod, queryParameters: {
|
var res = await Request().post(
|
||||||
'fid': mid,
|
Api.relationMod,
|
||||||
'act': act,
|
data: {
|
||||||
're_src': reSrc,
|
'fid': mid,
|
||||||
'csrf': await Request.getCsrf(),
|
'act': act,
|
||||||
});
|
're_src': reSrc,
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
if (act == 5) {
|
if (act == 5) {
|
||||||
List<int> blackMidsList =
|
List<int> blackMidsList =
|
||||||
@ -397,27 +406,33 @@ class VideoHttp {
|
|||||||
|
|
||||||
// 视频播放进度
|
// 视频播放进度
|
||||||
static Future heartBeat({bvid, cid, progress, realtime}) async {
|
static Future heartBeat({bvid, cid, progress, realtime}) async {
|
||||||
await Request().post(Api.heartBeat, queryParameters: {
|
await Request().post(
|
||||||
// 'aid': aid,
|
Api.heartBeat,
|
||||||
'bvid': bvid,
|
data: {
|
||||||
'cid': cid,
|
// 'aid': aid,
|
||||||
// 'epid': '',
|
'bvid': bvid,
|
||||||
// 'sid': '',
|
'cid': cid,
|
||||||
// 'mid': '',
|
// 'epid': '',
|
||||||
'played_time': progress,
|
// 'sid': '',
|
||||||
// 'realtime': realtime,
|
// 'mid': '',
|
||||||
// 'type': '',
|
'played_time': progress,
|
||||||
// 'sub_type': '',
|
// 'realtime': realtime,
|
||||||
'csrf': await Request.getCsrf(),
|
// 'type': '',
|
||||||
});
|
// 'sub_type': '',
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加追番
|
// 添加追番
|
||||||
static Future bangumiAdd({int? seasonId}) async {
|
static Future bangumiAdd({int? seasonId}) async {
|
||||||
var res = await Request().post(Api.bangumiAdd, queryParameters: {
|
var res = await Request().post(
|
||||||
'season_id': seasonId,
|
Api.bangumiAdd,
|
||||||
'csrf': await Request.getCsrf(),
|
data: {
|
||||||
});
|
'season_id': seasonId,
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': res.data['result']['toast']};
|
return {'status': true, 'msg': res.data['result']['toast']};
|
||||||
} else {
|
} else {
|
||||||
@ -427,10 +442,13 @@ class VideoHttp {
|
|||||||
|
|
||||||
// 取消追番
|
// 取消追番
|
||||||
static Future bangumiDel({int? seasonId}) async {
|
static Future bangumiDel({int? seasonId}) async {
|
||||||
var res = await Request().post(Api.bangumiDel, queryParameters: {
|
var res = await Request().post(
|
||||||
'season_id': seasonId,
|
Api.bangumiDel,
|
||||||
'csrf': await Request.getCsrf(),
|
data: {
|
||||||
});
|
'season_id': seasonId,
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': res.data['result']['toast']};
|
return {'status': true, 'msg': res.data['result']['toast']};
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
// 内容
|
// 内容
|
||||||
import 'package:cached_network_image/cached_network_image.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/widgets/badge.dart';
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
@ -166,31 +165,6 @@ class _ContentState extends State<Content> {
|
|||||||
builder: (BuildContext context) => InteractiveviewerGallery(
|
builder: (BuildContext context) => InteractiveviewerGallery(
|
||||||
sources: picList,
|
sources: picList,
|
||||||
initIndex: initIndex,
|
initIndex: initIndex,
|
||||||
itemBuilder: (
|
|
||||||
BuildContext context,
|
|
||||||
int index,
|
|
||||||
bool isFocus,
|
|
||||||
bool enablePageView,
|
|
||||||
) {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onTap: () {
|
|
||||||
if (enablePageView) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Center(
|
|
||||||
child: Hero(
|
|
||||||
tag: picList[index],
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
fadeInDuration: const Duration(milliseconds: 0),
|
|
||||||
imageUrl: picList[index],
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onPageChanged: (int pageIndex) {},
|
onPageChanged: (int pageIndex) {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import 'package:cached_network_image/cached_network_image.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/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
@ -12,31 +11,6 @@ void onPreviewImg(currentUrl, picList, initIndex, context) {
|
|||||||
builder: (BuildContext context) => InteractiveviewerGallery(
|
builder: (BuildContext context) => InteractiveviewerGallery(
|
||||||
sources: picList,
|
sources: picList,
|
||||||
initIndex: initIndex,
|
initIndex: initIndex,
|
||||||
itemBuilder: (
|
|
||||||
BuildContext context,
|
|
||||||
int index,
|
|
||||||
bool isFocus,
|
|
||||||
bool enablePageView,
|
|
||||||
) {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onTap: () {
|
|
||||||
if (enablePageView) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Center(
|
|
||||||
child: Hero(
|
|
||||||
tag: picList[index],
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
fadeInDuration: const Duration(milliseconds: 0),
|
|
||||||
imageUrl: picList[index],
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onPageChanged: (int pageIndex) {},
|
onPageChanged: (int pageIndex) {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/http/read.dart';
|
import 'package:pilipala/http/read.dart';
|
||||||
import 'package:pilipala/models/read/opus.dart';
|
import 'package:pilipala/models/read/opus.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:pilipala/plugin/pl_gallery/hero_dialog_route.dart';
|
import 'package:pilipala/plugin/pl_gallery/hero_dialog_route.dart';
|
||||||
import 'package:pilipala/plugin/pl_gallery/interactiveviewer_gallery.dart';
|
import 'package:pilipala/plugin/pl_gallery/interactiveviewer_gallery.dart';
|
||||||
|
|
||||||
@ -39,6 +38,7 @@ class OpusController extends GetxController {
|
|||||||
'articleType': 'cv',
|
'articleType': 'cv',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
title.value = res['data'].detail!.basic!.title!;
|
||||||
opusData.value = res['data'];
|
opusData.value = res['data'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,37 +60,21 @@ class OpusController extends GetxController {
|
|||||||
builder: (BuildContext context) => InteractiveviewerGallery(
|
builder: (BuildContext context) => InteractiveviewerGallery(
|
||||||
sources: picList,
|
sources: picList,
|
||||||
initIndex: initIndex,
|
initIndex: initIndex,
|
||||||
itemBuilder: (
|
|
||||||
BuildContext context,
|
|
||||||
int index,
|
|
||||||
bool isFocus,
|
|
||||||
bool enablePageView,
|
|
||||||
) {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onTap: () {
|
|
||||||
if (enablePageView) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Center(
|
|
||||||
child: Hero(
|
|
||||||
tag: picList[index],
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
fadeInDuration: const Duration(milliseconds: 0),
|
|
||||||
imageUrl: picList[index],
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onPageChanged: (int pageIndex) {},
|
onPageChanged: (int pageIndex) {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 跳转webview
|
||||||
|
void onJumpWebview() {
|
||||||
|
Get.toNamed('/webview', parameters: {
|
||||||
|
'url': url,
|
||||||
|
'type': 'webview',
|
||||||
|
'pageTitle': title.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
scrollController.removeListener(_scrollListener);
|
scrollController.removeListener(_scrollListener);
|
||||||
|
@ -60,9 +60,14 @@ class _OpusPageState extends State<OpusPage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
PopupMenuButton(
|
||||||
icon: const Icon(Icons.more_vert_rounded),
|
icon: const Icon(Icons.more_vert_outlined),
|
||||||
onPressed: () {},
|
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: controller.onJumpWebview,
|
||||||
|
child: const Text('查看原网页'),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/http/read.dart';
|
import 'package:pilipala/http/read.dart';
|
||||||
@ -22,6 +21,7 @@ class ReadPageController extends GetxController {
|
|||||||
title.value = Get.parameters['title'] ?? '';
|
title.value = Get.parameters['title'] ?? '';
|
||||||
id = Get.parameters['id']!;
|
id = Get.parameters['id']!;
|
||||||
articleType = Get.parameters['articleType']!;
|
articleType = Get.parameters['articleType']!;
|
||||||
|
url = 'https://www.bilibili.com/read/cv$id';
|
||||||
scrollController.addListener(_scrollListener);
|
scrollController.addListener(_scrollListener);
|
||||||
fetchViewInfo();
|
fetchViewInfo();
|
||||||
}
|
}
|
||||||
@ -50,31 +50,6 @@ class ReadPageController extends GetxController {
|
|||||||
builder: (BuildContext context) => InteractiveviewerGallery(
|
builder: (BuildContext context) => InteractiveviewerGallery(
|
||||||
sources: picList,
|
sources: picList,
|
||||||
initIndex: initIndex,
|
initIndex: initIndex,
|
||||||
itemBuilder: (
|
|
||||||
BuildContext context,
|
|
||||||
int index,
|
|
||||||
bool isFocus,
|
|
||||||
bool enablePageView,
|
|
||||||
) {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onTap: () {
|
|
||||||
if (enablePageView) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Center(
|
|
||||||
child: Hero(
|
|
||||||
tag: picList[index],
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
fadeInDuration: const Duration(milliseconds: 0),
|
|
||||||
imageUrl: picList[index],
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onPageChanged: (int pageIndex) {},
|
onPageChanged: (int pageIndex) {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -85,6 +60,15 @@ class ReadPageController extends GetxController {
|
|||||||
ReadHttp.getViewInfo(id: id);
|
ReadHttp.getViewInfo(id: id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 跳转webview
|
||||||
|
void onJumpWebview() {
|
||||||
|
Get.toNamed('/webview', parameters: {
|
||||||
|
'url': url,
|
||||||
|
'type': 'webview',
|
||||||
|
'pageTitle': title.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
scrollController.removeListener(_scrollListener);
|
scrollController.removeListener(_scrollListener);
|
||||||
|
@ -72,9 +72,14 @@ class _ReadPageState extends State<ReadPage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
PopupMenuButton(
|
||||||
icon: const Icon(Icons.more_vert_rounded),
|
icon: const Icon(Icons.more_vert_outlined),
|
||||||
onPressed: () {},
|
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: controller.onJumpWebview,
|
||||||
|
child: const Text('查看原网页'),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
],
|
],
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:appscheme/appscheme.dart';
|
import 'package:appscheme/appscheme.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@ -583,34 +582,6 @@ InlineSpan buildContent(
|
|||||||
builder: (BuildContext context) => InteractiveviewerGallery(
|
builder: (BuildContext context) => InteractiveviewerGallery(
|
||||||
sources: picList,
|
sources: picList,
|
||||||
initIndex: initIndex,
|
initIndex: initIndex,
|
||||||
itemBuilder: (
|
|
||||||
BuildContext context,
|
|
||||||
int index,
|
|
||||||
bool isFocus,
|
|
||||||
bool enablePageView,
|
|
||||||
) {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onTap: () {
|
|
||||||
if (enablePageView) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
final MainController mainController =
|
|
||||||
Get.find<MainController>();
|
|
||||||
mainController.imgPreviewStatus = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Center(
|
|
||||||
child: Hero(
|
|
||||||
tag: picList[index] + randomInt,
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
fadeInDuration: const Duration(milliseconds: 0),
|
|
||||||
imageUrl: picList[index],
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onPageChanged: (int pageIndex) {},
|
onPageChanged: (int pageIndex) {},
|
||||||
onDismissed: (int value) {
|
onDismissed: (int value) {
|
||||||
print('onDismissed');
|
print('onDismissed');
|
||||||
|
@ -68,10 +68,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
late final AppLifecycleListener _lifecycleListener;
|
late final AppLifecycleListener _lifecycleListener;
|
||||||
late double statusHeight;
|
late double statusHeight;
|
||||||
|
|
||||||
// 稍后再看控制器
|
|
||||||
// late AnimationController _laterCtr;
|
|
||||||
// late Animation<Offset> _laterOffsetAni;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -108,7 +104,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
}
|
}
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
lifecycleListener();
|
lifecycleListener();
|
||||||
// watchLaterControllerInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取视频资源,初始化播放器
|
// 获取视频资源,初始化播放器
|
||||||
@ -242,8 +237,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
appbarStream.close();
|
appbarStream.close();
|
||||||
WidgetsBinding.instance.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
_lifecycleListener.dispose();
|
_lifecycleListener.dispose();
|
||||||
// _laterCtr.dispose();
|
|
||||||
// _laterOffsetAni.removeListener(() {});
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,21 +483,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 稍后再看控制器初始化
|
|
||||||
// void watchLaterControllerInit() {
|
|
||||||
// _laterCtr = AnimationController(
|
|
||||||
// duration: const Duration(milliseconds: 300),
|
|
||||||
// vsync: this,
|
|
||||||
// );
|
|
||||||
// _laterOffsetAni = Tween<Offset>(
|
|
||||||
// begin: const Offset(0.0, 1.0),
|
|
||||||
// end: Offset.zero,
|
|
||||||
// ).animate(CurvedAnimation(
|
|
||||||
// parent: _laterCtr,
|
|
||||||
// curve: Curves.easeInOut,
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final sizeContext = MediaQuery.sizeOf(context);
|
final sizeContext = MediaQuery.sizeOf(context);
|
||||||
|
@ -1,19 +1,8 @@
|
|||||||
// ignore_for_file: avoid_print
|
|
||||||
|
|
||||||
import 'package:flutter/material.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:hive/hive.dart';
|
|
||||||
import 'package:pilipala/http/init.dart';
|
import 'package:pilipala/http/init.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
|
||||||
import 'package:pilipala/pages/home/index.dart';
|
|
||||||
import 'package:pilipala/pages/media/index.dart';
|
|
||||||
import 'package:pilipala/utils/cookie.dart';
|
|
||||||
import 'package:pilipala/utils/event_bus.dart';
|
import 'package:pilipala/utils/event_bus.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'package:pilipala/utils/login.dart';
|
import 'package:pilipala/utils/login.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
|
||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
class WebviewController extends GetxController {
|
class WebviewController extends GetxController {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// ignore_for_file: constant_identifier_names
|
// ignore_for_file: constant_identifier_names
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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';
|
||||||
@ -170,31 +169,6 @@ class ChatItem extends StatelessWidget {
|
|||||||
builder: (BuildContext context) => InteractiveviewerGallery(
|
builder: (BuildContext context) => InteractiveviewerGallery(
|
||||||
sources: ctr.picList,
|
sources: ctr.picList,
|
||||||
initIndex: ctr.picList.indexOf(content['url']),
|
initIndex: ctr.picList.indexOf(content['url']),
|
||||||
itemBuilder: (
|
|
||||||
BuildContext context,
|
|
||||||
int index,
|
|
||||||
bool isFocus,
|
|
||||||
bool enablePageView,
|
|
||||||
) {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onTap: () {
|
|
||||||
if (enablePageView) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Center(
|
|
||||||
child: Hero(
|
|
||||||
tag: ctr.picList[index],
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
fadeInDuration: const Duration(milliseconds: 0),
|
|
||||||
imageUrl: ctr.picList[index],
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onPageChanged: (int pageIndex) {},
|
onPageChanged: (int pageIndex) {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -2,10 +2,12 @@ library interactiveviewer_gallery;
|
|||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.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:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:pilipala/utils/download.dart';
|
import 'package:pilipala/utils/download.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
@ -32,7 +34,7 @@ class InteractiveviewerGallery<T> extends StatefulWidget {
|
|||||||
const InteractiveviewerGallery({
|
const InteractiveviewerGallery({
|
||||||
required this.sources,
|
required this.sources,
|
||||||
required this.initIndex,
|
required this.initIndex,
|
||||||
required this.itemBuilder,
|
this.itemBuilder,
|
||||||
this.maxScale = 4.5,
|
this.maxScale = 4.5,
|
||||||
this.minScale = 1.0,
|
this.minScale = 1.0,
|
||||||
this.onPageChanged,
|
this.onPageChanged,
|
||||||
@ -47,7 +49,7 @@ class InteractiveviewerGallery<T> extends StatefulWidget {
|
|||||||
final int initIndex;
|
final int initIndex;
|
||||||
|
|
||||||
/// The item content
|
/// The item content
|
||||||
final IndexedFocusedWidgetBuilder itemBuilder;
|
final IndexedFocusedWidgetBuilder? itemBuilder;
|
||||||
|
|
||||||
final double maxScale;
|
final double maxScale;
|
||||||
|
|
||||||
@ -246,12 +248,15 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
_doubleTapLocalPosition = details.localPosition;
|
_doubleTapLocalPosition = details.localPosition;
|
||||||
},
|
},
|
||||||
onDoubleTap: onDoubleTap,
|
onDoubleTap: onDoubleTap,
|
||||||
child: widget.itemBuilder(
|
onLongPress: onLongPress,
|
||||||
context,
|
child: widget.itemBuilder != null
|
||||||
index,
|
? widget.itemBuilder!(
|
||||||
index == currentIndex,
|
context,
|
||||||
_enablePageView,
|
index,
|
||||||
),
|
index == currentIndex,
|
||||||
|
_enablePageView,
|
||||||
|
)
|
||||||
|
: _itemBuilder(widget.sources, index),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -302,17 +307,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: 1,
|
value: 1,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Clipboard.setData(ClipboardData(
|
onCopyImg(widget.sources[currentIndex!].toString());
|
||||||
text:
|
|
||||||
widget.sources[currentIndex!].toString()))
|
|
||||||
.then((value) {
|
|
||||||
SmartDialog.showToast('已复制到粘贴板');
|
|
||||||
}).catchError((err) {
|
|
||||||
SmartDialog.showNotify(
|
|
||||||
msg: err.toString(),
|
|
||||||
notifyType: NotifyType.error,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
child: const Text("复制图片"),
|
child: const Text("复制图片"),
|
||||||
),
|
),
|
||||||
@ -350,6 +345,41 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
Share.shareXFiles([XFile(path)], subject: imgUrl);
|
Share.shareXFiles([XFile(path)], subject: imgUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 复制图片
|
||||||
|
void onCopyImg(String imgUrl) {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(text: widget.sources[currentIndex!].toString()))
|
||||||
|
.then((value) {
|
||||||
|
SmartDialog.showToast('已复制到粘贴板');
|
||||||
|
}).catchError((err) {
|
||||||
|
SmartDialog.showNotify(
|
||||||
|
msg: err.toString(),
|
||||||
|
notifyType: NotifyType.error,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _itemBuilder(sources, index) {
|
||||||
|
return GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: () {
|
||||||
|
if (_enablePageView) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Center(
|
||||||
|
child: Hero(
|
||||||
|
tag: sources[index],
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
fadeInDuration: const Duration(milliseconds: 0),
|
||||||
|
imageUrl: sources[index],
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
onDoubleTap() {
|
onDoubleTap() {
|
||||||
Matrix4 matrix = _transformationController!.value.clone();
|
Matrix4 matrix = _transformationController!.value.clone();
|
||||||
double currentScale = matrix.row0.x;
|
double currentScale = matrix.row0.x;
|
||||||
@ -396,4 +426,61 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
.forward(from: 0)
|
.forward(from: 0)
|
||||||
.whenComplete(() => _onScaleChanged(targetScale));
|
.whenComplete(() => _onScaleChanged(targetScale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLongPress() {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (context) {
|
||||||
|
return Container(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () => Get.back(),
|
||||||
|
child: Container(
|
||||||
|
height: 35,
|
||||||
|
padding: const EdgeInsets.only(bottom: 2),
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 32,
|
||||||
|
height: 3,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
borderRadius:
|
||||||
|
const BorderRadius.all(Radius.circular(3))),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
onShareImg(widget.sources[currentIndex!]);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
title: const Text('分享图片'),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
onCopyImg(widget.sources[currentIndex!].toString());
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
title: const Text('复制图片'),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
DownloadUtils.downloadImg(widget.sources[currentIndex!]);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
title: const Text('保存图片'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ class PiliSchame {
|
|||||||
case 'opus':
|
case 'opus':
|
||||||
if (path.startsWith('/detail')) {
|
if (path.startsWith('/detail')) {
|
||||||
var opusId = path.split('/').last;
|
var opusId = path.split('/').last;
|
||||||
Get.toNamed('/opus', arguments: {
|
Get.toNamed('/opus', parameters: {
|
||||||
'title': '',
|
'title': '',
|
||||||
'id': opusId,
|
'id': opusId,
|
||||||
'articleType': 'opus',
|
'articleType': 'opus',
|
||||||
|
Reference in New Issue
Block a user