Merge branch 'main' into feature-media_kit
This commit is contained in:
24
change_log/1.0.8.0917.md
Normal file
24
change_log/1.0.8.0917.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
## 1.0.8
|
||||||
|
|
||||||
|
直播弹幕、循环播放等功能开发中
|
||||||
|
|
||||||
|
### 新功能
|
||||||
|
+ 用户拉黑功能
|
||||||
|
+ gif图片保存
|
||||||
|
+ 删除已看历史记录
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
+ 弹幕数量较少
|
||||||
|
+ 弹幕屏蔽设置自动记忆
|
||||||
|
+ 动态页面渲染
|
||||||
|
+ 用户主页数据错乱
|
||||||
|
+ 大家都在搜空白
|
||||||
|
+ 默认自动全屏,顶部操作栏丢失
|
||||||
|
|
||||||
|
|
||||||
|
### 优化
|
||||||
|
+ 全屏状态栏区域显示优化
|
||||||
|
+ 图片保存至PiliPala文件夹
|
||||||
|
|
||||||
|
更多更新日志可在Github上查看
|
||||||
|
问题反馈、功能建议请查看「关于」页面。
|
||||||
@ -1,6 +1,8 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- appscheme (1.0.4):
|
- appscheme (1.0.4):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- auto_orientation (0.0.1):
|
||||||
|
- Flutter
|
||||||
- connectivity_plus (0.0.1):
|
- connectivity_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- ReachabilitySwift
|
- ReachabilitySwift
|
||||||
@ -12,8 +14,6 @@ PODS:
|
|||||||
- FMDB (2.7.5):
|
- FMDB (2.7.5):
|
||||||
- FMDB/standard (= 2.7.5)
|
- FMDB/standard (= 2.7.5)
|
||||||
- FMDB/standard (2.7.5)
|
- FMDB/standard (2.7.5)
|
||||||
- image_gallery_saver (2.0.2):
|
|
||||||
- Flutter
|
|
||||||
- media_kit_libs_ios_video (1.0.4):
|
- media_kit_libs_ios_video (1.0.4):
|
||||||
- Flutter
|
- Flutter
|
||||||
- media_kit_native_event_loop (1.0.0):
|
- media_kit_native_event_loop (1.0.0):
|
||||||
@ -28,6 +28,8 @@ PODS:
|
|||||||
- permission_handler_apple (9.1.1):
|
- permission_handler_apple (9.1.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- ReachabilitySwift (5.0.0)
|
- ReachabilitySwift (5.0.0)
|
||||||
|
- saver_gallery (0.0.1):
|
||||||
|
- Flutter
|
||||||
- screen_brightness_ios (0.1.0):
|
- screen_brightness_ios (0.1.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- share_plus (0.0.1):
|
- share_plus (0.0.1):
|
||||||
@ -52,17 +54,18 @@ PODS:
|
|||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- appscheme (from `.symlinks/plugins/appscheme/ios`)
|
- appscheme (from `.symlinks/plugins/appscheme/ios`)
|
||||||
|
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
|
||||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_volume_controller (from `.symlinks/plugins/flutter_volume_controller/ios`)
|
- flutter_volume_controller (from `.symlinks/plugins/flutter_volume_controller/ios`)
|
||||||
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
|
|
||||||
- media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`)
|
- media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`)
|
||||||
- media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`)
|
- media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`)
|
||||||
- media_kit_video (from `.symlinks/plugins/media_kit_video/ios`)
|
- media_kit_video (from `.symlinks/plugins/media_kit_video/ios`)
|
||||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
|
- saver_gallery (from `.symlinks/plugins/saver_gallery/ios`)
|
||||||
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
|
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
|
||||||
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
||||||
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||||
@ -82,6 +85,8 @@ SPEC REPOS:
|
|||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
appscheme:
|
appscheme:
|
||||||
:path: ".symlinks/plugins/appscheme/ios"
|
:path: ".symlinks/plugins/appscheme/ios"
|
||||||
|
auto_orientation:
|
||||||
|
:path: ".symlinks/plugins/auto_orientation/ios"
|
||||||
connectivity_plus:
|
connectivity_plus:
|
||||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||||
device_info_plus:
|
device_info_plus:
|
||||||
@ -90,8 +95,6 @@ EXTERNAL SOURCES:
|
|||||||
:path: Flutter
|
:path: Flutter
|
||||||
flutter_volume_controller:
|
flutter_volume_controller:
|
||||||
:path: ".symlinks/plugins/flutter_volume_controller/ios"
|
:path: ".symlinks/plugins/flutter_volume_controller/ios"
|
||||||
image_gallery_saver:
|
|
||||||
:path: ".symlinks/plugins/image_gallery_saver/ios"
|
|
||||||
media_kit_libs_ios_video:
|
media_kit_libs_ios_video:
|
||||||
:path: ".symlinks/plugins/media_kit_libs_ios_video/ios"
|
:path: ".symlinks/plugins/media_kit_libs_ios_video/ios"
|
||||||
media_kit_native_event_loop:
|
media_kit_native_event_loop:
|
||||||
@ -104,6 +107,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||||
permission_handler_apple:
|
permission_handler_apple:
|
||||||
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||||
|
saver_gallery:
|
||||||
|
:path: ".symlinks/plugins/saver_gallery/ios"
|
||||||
screen_brightness_ios:
|
screen_brightness_ios:
|
||||||
:path: ".symlinks/plugins/screen_brightness_ios/ios"
|
:path: ".symlinks/plugins/screen_brightness_ios/ios"
|
||||||
share_plus:
|
share_plus:
|
||||||
@ -127,12 +132,12 @@ EXTERNAL SOURCES:
|
|||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
appscheme: b1c3f8862331cb20430cf9e0e4af85dbc1572ad8
|
appscheme: b1c3f8862331cb20430cf9e0e4af85dbc1572ad8
|
||||||
|
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||||
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
||||||
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
|
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
|
|
||||||
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
|
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
|
||||||
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
|
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
|
||||||
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
||||||
@ -140,6 +145,7 @@ SPEC CHECKSUMS:
|
|||||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||||
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
||||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||||
|
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
||||||
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
||||||
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
|
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
|
||||||
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_html/flutter_html.dart';
|
import 'package:flutter_html/flutter_html.dart';
|
||||||
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class HtmlRender extends StatelessWidget {
|
class HtmlRender extends StatelessWidget {
|
||||||
@ -20,35 +20,47 @@ class HtmlRender extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Html(
|
return Html(
|
||||||
data: htmlContent,
|
data: htmlContent,
|
||||||
// tagsList: Html.tags..addAll(["form", "label", "input"]),
|
|
||||||
onLinkTap: (url, buildContext, attributes) => {},
|
onLinkTap: (url, buildContext, attributes) => {},
|
||||||
extensions: [
|
extensions: [
|
||||||
TagExtension(
|
TagExtension(
|
||||||
tagsToExtend: {"img"},
|
tagsToExtend: {"img"},
|
||||||
builder: (extensionContext) {
|
builder: (extensionContext) {
|
||||||
String? imgUrl = extensionContext.attributes['src'];
|
try {
|
||||||
if (imgUrl!.startsWith('//')) {
|
Map attributes = extensionContext.attributes;
|
||||||
imgUrl = 'https:$imgUrl';
|
List key = attributes.keys.toList();
|
||||||
|
String? imgUrl = key.contains('src')
|
||||||
|
? attributes['src']
|
||||||
|
: attributes['data-src'];
|
||||||
|
if (imgUrl!.startsWith('//')) {
|
||||||
|
imgUrl = 'https:$imgUrl';
|
||||||
|
}
|
||||||
|
if (imgUrl.startsWith('http://')) {
|
||||||
|
imgUrl = imgUrl.replaceAll('http://', 'https://');
|
||||||
|
}
|
||||||
|
imgUrl = imgUrl.contains('@') ? imgUrl.split('@').first : imgUrl;
|
||||||
|
bool isEmote = imgUrl.contains('/emote/');
|
||||||
|
bool isMall = imgUrl.contains('/mall/');
|
||||||
|
if (isMall) {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
// bool inTable =
|
||||||
|
// extensionContext.element!.previousElementSibling == null ||
|
||||||
|
// extensionContext.element!.nextElementSibling == null;
|
||||||
|
// imgUrl = Utils().imageUrl(imgUrl!);
|
||||||
|
// return Image.network(
|
||||||
|
// imgUrl,
|
||||||
|
// width: isEmote ? 22 : null,
|
||||||
|
// height: isEmote ? 22 : null,
|
||||||
|
// );
|
||||||
|
return NetworkImgLayer(
|
||||||
|
width: isEmote ? 22 : Get.size.width - 24,
|
||||||
|
height: isEmote ? 22 : 200,
|
||||||
|
src: imgUrl,
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
print(err);
|
||||||
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
if (imgUrl.startsWith('http://')) {
|
|
||||||
imgUrl = imgUrl.replaceAll('http://', 'https://');
|
|
||||||
}
|
|
||||||
|
|
||||||
print(imgUrl);
|
|
||||||
bool isEmote = imgUrl.contains('/emote/');
|
|
||||||
bool isMall = imgUrl.contains('/mall/');
|
|
||||||
if (isMall) {
|
|
||||||
return SizedBox();
|
|
||||||
}
|
|
||||||
// bool inTable =
|
|
||||||
// extensionContext.element!.previousElementSibling == null ||
|
|
||||||
// extensionContext.element!.nextElementSibling == null;
|
|
||||||
// imgUrl = Utils().imageUrl(imgUrl!);
|
|
||||||
return Image.network(
|
|
||||||
imgUrl,
|
|
||||||
width: isEmote ? 22 : null,
|
|
||||||
height: isEmote ? 22 : null,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -63,11 +75,13 @@ class HtmlRender extends StatelessWidget {
|
|||||||
textDecoration: TextDecoration.none,
|
textDecoration: TextDecoration.none,
|
||||||
),
|
),
|
||||||
"p": Style(
|
"p": Style(
|
||||||
margin: Margins.only(bottom: 0),
|
margin: Margins.only(bottom: 10),
|
||||||
),
|
),
|
||||||
"span": Style(
|
"span": Style(
|
||||||
fontSize: FontSize.medium,
|
fontSize: FontSize.medium,
|
||||||
|
height: Height(1.65),
|
||||||
),
|
),
|
||||||
|
"div": Style(height: Height.auto()),
|
||||||
"li > p": Style(
|
"li > p": Style(
|
||||||
display: Display.inline,
|
display: Display.inline,
|
||||||
),
|
),
|
||||||
@ -75,61 +89,7 @@ class HtmlRender extends StatelessWidget {
|
|||||||
padding: HtmlPaddings.only(bottom: 4),
|
padding: HtmlPaddings.only(bottom: 4),
|
||||||
textAlign: TextAlign.justify,
|
textAlign: TextAlign.justify,
|
||||||
),
|
),
|
||||||
"image": Style(margin: Margins.only(top: 4, bottom: 4)),
|
"img": Style(margin: Margins.only(top: 4, bottom: 4)),
|
||||||
"p > img": Style(margin: Margins.only(top: 4, bottom: 4)),
|
|
||||||
"code": Style(
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.onInverseSurface),
|
|
||||||
"code > span": Style(textAlign: TextAlign.start),
|
|
||||||
"hr": Style(
|
|
||||||
margin: Margins.zero,
|
|
||||||
padding: HtmlPaddings.zero,
|
|
||||||
border: Border(
|
|
||||||
top: BorderSide(
|
|
||||||
width: 1.0,
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.onBackground.withOpacity(0.3),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'table': Style(
|
|
||||||
border: Border(
|
|
||||||
right: BorderSide(
|
|
||||||
width: 0.5,
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.onBackground.withOpacity(0.3),
|
|
||||||
),
|
|
||||||
bottom: BorderSide(
|
|
||||||
width: 0.5,
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.onBackground.withOpacity(0.3),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'tr': Style(
|
|
||||||
border: Border(
|
|
||||||
top: BorderSide(
|
|
||||||
width: 1.0,
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.onBackground.withOpacity(0.3),
|
|
||||||
),
|
|
||||||
left: BorderSide(
|
|
||||||
width: 1.0,
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.onBackground.withOpacity(0.3),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'thead': Style(
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.background,
|
|
||||||
),
|
|
||||||
'th': Style(
|
|
||||||
padding: HtmlPaddings.only(left: 3, right: 3),
|
|
||||||
),
|
|
||||||
'td': Style(
|
|
||||||
padding: HtmlPaddings.all(4.0),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,6 +62,15 @@ class VideoCardV extends StatelessWidget {
|
|||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
// 动态
|
||||||
|
case 'picture':
|
||||||
|
Get.toNamed('/htmlRender', parameters: {
|
||||||
|
'url': videoItem.uri,
|
||||||
|
'title': videoItem.title,
|
||||||
|
'id': videoItem.param.toString(),
|
||||||
|
'dynamicType': 'picture'
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
SmartDialog.showToast(videoItem.goto);
|
SmartDialog.showToast(videoItem.goto);
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
|
|||||||
@ -245,6 +245,9 @@ class Api {
|
|||||||
// wts=1689767832
|
// wts=1689767832
|
||||||
static const String memberArchive = '/x/space/wbi/arc/search';
|
static const String memberArchive = '/x/space/wbi/arc/search';
|
||||||
|
|
||||||
|
// 用户动态搜索
|
||||||
|
static const String memberDynamicSearch = '/x/space/dynamic/search';
|
||||||
|
|
||||||
// 用户动态
|
// 用户动态
|
||||||
static const String memberDynamic = '/x/polymer/web-dynamic/v1/feed/space';
|
static const String memberDynamic = '/x/polymer/web-dynamic/v1/feed/space';
|
||||||
|
|
||||||
|
|||||||
@ -17,17 +17,11 @@ class DanmakaHttp {
|
|||||||
'oid': cid,
|
'oid': cid,
|
||||||
'segment_index': segmentIndex,
|
'segment_index': segmentIndex,
|
||||||
};
|
};
|
||||||
|
var response = await Request().get(
|
||||||
// 计算函数
|
Api.webDanmaku,
|
||||||
Future<DmSegMobileReply> computeTask(Map<String, int> params) async {
|
data: params,
|
||||||
var response = await Request().get(
|
extra: {'resType': ResponseType.bytes},
|
||||||
Api.webDanmaku,
|
);
|
||||||
data: params,
|
return DmSegMobileReply.fromBuffer(response.data);
|
||||||
extra: {'resType': ResponseType.bytes},
|
|
||||||
);
|
|
||||||
return DmSegMobileReply.fromBuffer(response.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return await compute(computeTask, params);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,12 @@ import 'package:html/parser.dart';
|
|||||||
import 'package:pilipala/http/index.dart';
|
import 'package:pilipala/http/index.dart';
|
||||||
|
|
||||||
class HtmlHttp {
|
class HtmlHttp {
|
||||||
static Future reqHtml(id) async {
|
// article
|
||||||
var response = await Request().get("https://www.bilibili.com/opus/$id");
|
static Future reqHtml(id, dynamicType) async {
|
||||||
|
var response = await Request().get(
|
||||||
|
"https://www.bilibili.com/opus/$id",
|
||||||
|
extra: {'ua': 'pc'},
|
||||||
|
);
|
||||||
Document rootTree = parse(response.data);
|
Document rootTree = parse(response.data);
|
||||||
Element body = rootTree.body!;
|
Element body = rootTree.body!;
|
||||||
Element appDom = body.querySelector('#app')!;
|
Element appDom = body.querySelector('#app')!;
|
||||||
@ -34,7 +38,46 @@ class HtmlHttp {
|
|||||||
'uname': uname,
|
'uname': uname,
|
||||||
'updateTime': updateTime,
|
'updateTime': updateTime,
|
||||||
'content': opusContent,
|
'content': opusContent,
|
||||||
'commentId': commentId
|
'commentId': int.parse(commentId)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// read
|
||||||
|
static Future reqReadHtml(id, dynamicType) async {
|
||||||
|
var response = await Request().get(
|
||||||
|
"https://www.bilibili.com/$dynamicType/$id/",
|
||||||
|
extra: {'ua': 'pc'},
|
||||||
|
);
|
||||||
|
Document rootTree = parse(response.data);
|
||||||
|
Element body = rootTree.body!;
|
||||||
|
Element appDom = body.querySelector('#app')!;
|
||||||
|
Element authorHeader = appDom.querySelector('.up-left')!;
|
||||||
|
// 头像
|
||||||
|
// String avatar =
|
||||||
|
// authorHeader.querySelector('.bili-avatar-img')!.attributes['data-src']!;
|
||||||
|
// print(avatar);
|
||||||
|
// avatar = 'https:${avatar.split('@')[0]}';
|
||||||
|
String uname = authorHeader.querySelector('.up-name')!.text.trim();
|
||||||
|
// 动态详情
|
||||||
|
Element opusDetail = appDom.querySelector('.article-content')!;
|
||||||
|
// 发布时间
|
||||||
|
// String updateTime =
|
||||||
|
// opusDetail.querySelector('.opus-module-author__pub__text')!.text;
|
||||||
|
// print(updateTime);
|
||||||
|
|
||||||
|
//
|
||||||
|
String opusContent =
|
||||||
|
opusDetail.querySelector('#read-article-holder')!.innerHtml;
|
||||||
|
RegExp digitRegExp = RegExp(r'\d+');
|
||||||
|
Iterable<Match> matches = digitRegExp.allMatches(id);
|
||||||
|
String number = matches.first.group(0)!;
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'avatar': '',
|
||||||
|
'uname': uname,
|
||||||
|
'updateTime': '',
|
||||||
|
'content': opusContent,
|
||||||
|
'commentId': int.parse(number)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,11 +89,7 @@ class Request {
|
|||||||
//响应流上前后两次接受到数据的间隔,单位为毫秒。
|
//响应流上前后两次接受到数据的间隔,单位为毫秒。
|
||||||
receiveTimeout: const Duration(milliseconds: 12000),
|
receiveTimeout: const Duration(milliseconds: 12000),
|
||||||
//Http请求头.
|
//Http请求头.
|
||||||
headers: {
|
headers: {},
|
||||||
'keep-alive': 'true',
|
|
||||||
'user-agent': headerUa(),
|
|
||||||
},
|
|
||||||
persistentConnection: true,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
dio = Dio(options)
|
dio = Dio(options)
|
||||||
@ -128,13 +124,16 @@ class Request {
|
|||||||
*/
|
*/
|
||||||
get(url, {data, options, cancelToken, extra}) async {
|
get(url, {data, options, cancelToken, extra}) async {
|
||||||
Response response;
|
Response response;
|
||||||
Options options;
|
Options options = Options();
|
||||||
ResponseType resType = ResponseType.json;
|
ResponseType resType = ResponseType.json;
|
||||||
if (extra != null) {
|
if (extra != null) {
|
||||||
resType = extra!['resType'] ?? ResponseType.json;
|
resType = extra!['resType'] ?? ResponseType.json;
|
||||||
|
if (extra['ua'] != null) {
|
||||||
|
options.headers = {'user-agent': headerUa(type: extra['ua'])};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
options = Options();
|
|
||||||
options.responseType = resType;
|
options.responseType = resType;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
response = await dio.get(
|
response = await dio.get(
|
||||||
url,
|
url,
|
||||||
@ -201,14 +200,19 @@ class Request {
|
|||||||
token.cancel("cancelled");
|
token.cancel("cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
String headerUa() {
|
String headerUa({type = 'mob'}) {
|
||||||
String headerUa = '';
|
String headerUa = '';
|
||||||
if (Platform.isIOS) {
|
if (type == 'mob') {
|
||||||
headerUa =
|
if (Platform.isIOS) {
|
||||||
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1';
|
headerUa =
|
||||||
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1';
|
||||||
|
} else {
|
||||||
|
headerUa =
|
||||||
|
'Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Mobile Safari/537.36';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
headerUa =
|
headerUa =
|
||||||
'Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Mobile Safari/537.36';
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15';
|
||||||
}
|
}
|
||||||
return headerUa;
|
return headerUa;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,10 @@ class ApiInterceptor extends Interceptor {
|
|||||||
void onError(DioException err, ErrorInterceptorHandler handler) async {
|
void onError(DioException err, ErrorInterceptorHandler handler) async {
|
||||||
// 处理网络请求错误
|
// 处理网络请求错误
|
||||||
// handler.next(err);
|
// handler.next(err);
|
||||||
SmartDialog.showToast(await dioError(err));
|
SmartDialog.showToast(
|
||||||
|
await dioError(err),
|
||||||
|
displayType: SmartToastType.onlyRefresh,
|
||||||
|
);
|
||||||
super.onError(err, handler);
|
super.onError(err, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class MemberHttp {
|
|||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
Api.memberInfo,
|
Api.memberInfo,
|
||||||
data: params,
|
data: params,
|
||||||
|
extra: {'ua': 'pc'},
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
@ -65,7 +66,7 @@ class MemberHttp {
|
|||||||
int ps = 30,
|
int ps = 30,
|
||||||
int tid = 0,
|
int tid = 0,
|
||||||
int? pn,
|
int? pn,
|
||||||
String keyword = '',
|
String? keyword,
|
||||||
String order = 'pubdate',
|
String order = 'pubdate',
|
||||||
bool orderAvoided = true,
|
bool orderAvoided = true,
|
||||||
}) async {
|
}) async {
|
||||||
@ -74,7 +75,7 @@ class MemberHttp {
|
|||||||
'ps': ps,
|
'ps': ps,
|
||||||
'tid': tid,
|
'tid': tid,
|
||||||
'pn': pn,
|
'pn': pn,
|
||||||
'keyword': keyword,
|
'keyword': keyword ?? '',
|
||||||
'order': order,
|
'order': order,
|
||||||
'platform': 'web',
|
'platform': 'web',
|
||||||
'web_location': 1550101,
|
'web_location': 1550101,
|
||||||
@ -83,6 +84,7 @@ class MemberHttp {
|
|||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
Api.memberArchive,
|
Api.memberArchive,
|
||||||
data: params,
|
data: params,
|
||||||
|
extra: {'ua': 'pc'},
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
@ -119,4 +121,27 @@ class MemberHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 搜索用户动态
|
||||||
|
static Future memberDynamicSearch({int? pn, int? ps, int? mid}) async {
|
||||||
|
var res = await Request().get(Api.memberDynamic, data: {
|
||||||
|
'keyword': '海拔',
|
||||||
|
'mid': mid,
|
||||||
|
'pn': pn,
|
||||||
|
'ps': ps,
|
||||||
|
'platform': 'web'
|
||||||
|
});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': DynamicsDataModel.fromJson(res.data['data']),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class ReplyHttp {
|
|||||||
Map errMap = {
|
Map errMap = {
|
||||||
-400: '请求错误',
|
-400: '请求错误',
|
||||||
-404: '无此项',
|
-404: '无此项',
|
||||||
12002: '当前页面评论功能已关闭"',
|
12002: '当前页面评论功能已关闭',
|
||||||
12009: '评论主体的type不合法',
|
12009: '评论主体的type不合法',
|
||||||
12061: 'UP主已关闭评论区',
|
12061: 'UP主已关闭评论区',
|
||||||
};
|
};
|
||||||
|
|||||||
@ -238,7 +238,7 @@ class UserHttp {
|
|||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.delHistory,
|
Api.delHistory,
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'kid': 'archive_$kid',
|
'kid': kid,
|
||||||
'jsonp': 'jsonp',
|
'jsonp': 'jsonp',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.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';
|
||||||
@ -61,6 +64,23 @@ class MyApp extends StatelessWidget {
|
|||||||
double textScale =
|
double textScale =
|
||||||
setting.get(SettingBoxKey.defaultTextScale, defaultValue: 1.0);
|
setting.get(SettingBoxKey.defaultTextScale, defaultValue: 1.0);
|
||||||
|
|
||||||
|
// 强制设置高帧率
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
try {
|
||||||
|
late List modes;
|
||||||
|
FlutterDisplayMode.supported.then((value) {
|
||||||
|
modes = value;
|
||||||
|
var storageDisplay = setting.get(SettingBoxKey.displayMode);
|
||||||
|
DisplayMode f = DisplayMode.auto;
|
||||||
|
if (storageDisplay != null) {
|
||||||
|
f = modes.firstWhere((e) => e.toString() == storageDisplay);
|
||||||
|
}
|
||||||
|
DisplayMode preferred = modes.toList().firstWhere((el) => el == f);
|
||||||
|
FlutterDisplayMode.setPreferredMode(preferred);
|
||||||
|
});
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
|
|
||||||
return DynamicColorBuilder(
|
return DynamicColorBuilder(
|
||||||
builder: ((ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
|
builder: ((ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
|
||||||
ColorScheme? lightColorScheme;
|
ColorScheme? lightColorScheme;
|
||||||
|
|||||||
@ -397,6 +397,7 @@ class SearchArticleItemModel {
|
|||||||
this.pubTime,
|
this.pubTime,
|
||||||
this.like,
|
this.like,
|
||||||
this.title,
|
this.title,
|
||||||
|
this.subTitle,
|
||||||
this.rankOffset,
|
this.rankOffset,
|
||||||
this.mid,
|
this.mid,
|
||||||
this.imageUrls,
|
this.imageUrls,
|
||||||
@ -414,6 +415,7 @@ class SearchArticleItemModel {
|
|||||||
int? pubTime;
|
int? pubTime;
|
||||||
int? like;
|
int? like;
|
||||||
List? title;
|
List? title;
|
||||||
|
String? subTitle;
|
||||||
int? rankOffset;
|
int? rankOffset;
|
||||||
int? mid;
|
int? mid;
|
||||||
List? imageUrls;
|
List? imageUrls;
|
||||||
@ -431,6 +433,7 @@ class SearchArticleItemModel {
|
|||||||
pubTime = json['pub_time'];
|
pubTime = json['pub_time'];
|
||||||
like = json['like'];
|
like = json['like'];
|
||||||
title = Em.regTitle(json['title']);
|
title = Em.regTitle(json['title']);
|
||||||
|
subTitle = json['title'].replaceAll(RegExp(r'<[^>]*>'), '');
|
||||||
rankOffset = json['rank_offset'];
|
rankOffset = json['rank_offset'];
|
||||||
mid = json['mid'];
|
mid = json['mid'];
|
||||||
imageUrls = json['image_urls'];
|
imageUrls = json['image_urls'];
|
||||||
|
|||||||
@ -184,7 +184,7 @@ class AboutController extends GetxController {
|
|||||||
|
|
||||||
// 获取远程版本
|
// 获取远程版本
|
||||||
Future getRemoteApp() async {
|
Future getRemoteApp() async {
|
||||||
var result = await Request().get(Api.latestApp);
|
var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'});
|
||||||
data = LatestDataModel.fromJson(result.data);
|
data = LatestDataModel.fromJson(result.data);
|
||||||
remoteAppInfo = data;
|
remoteAppInfo = data;
|
||||||
remoteVersion.value = data.tagName!;
|
remoteVersion.value = data.tagName!;
|
||||||
|
|||||||
@ -10,22 +10,32 @@ class PlDanmakuController {
|
|||||||
// 按 6min 分段
|
// 按 6min 分段
|
||||||
int segCount = 0;
|
int segCount = 0;
|
||||||
List<DmSegMobileReply> dmSegList = [];
|
List<DmSegMobileReply> dmSegList = [];
|
||||||
int currentSegIndex = 0;
|
int currentSegIndex = 1;
|
||||||
int currentDmIndex = 0;
|
int currentDmIndex = 0;
|
||||||
|
|
||||||
void calcSegment() {
|
void calcSegment() {
|
||||||
|
dmSegList.clear();
|
||||||
|
// 视频分段数
|
||||||
segCount = (videoDuration.inSeconds / (60 * 6)).ceil();
|
segCount = (videoDuration.inSeconds / (60 * 6)).ceil();
|
||||||
|
dmSegList = List<DmSegMobileReply>.generate(
|
||||||
|
segCount < 1 ? 1 : segCount, (index) => DmSegMobileReply());
|
||||||
|
// 当前分段
|
||||||
|
try {
|
||||||
|
currentSegIndex =
|
||||||
|
(playerController.position.value.inSeconds / (60 * 6)).ceil();
|
||||||
|
currentSegIndex = currentSegIndex < 1 ? 1 : currentSegIndex;
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<DmSegMobileReply>> queryDanmaku() async {
|
Future<List<DmSegMobileReply>> queryDanmaku() async {
|
||||||
dmSegList.clear();
|
// dmSegList.clear();
|
||||||
for (int segIndex = 1; segIndex <= segCount; segIndex++) {
|
DmSegMobileReply result =
|
||||||
DmSegMobileReply result =
|
await DanmakaHttp.queryDanmaku(cid: cid, segmentIndex: currentSegIndex);
|
||||||
await DanmakaHttp.queryDanmaku(cid: cid, segmentIndex: segIndex);
|
if (result.elems.isNotEmpty) {
|
||||||
if (result.elems.isNotEmpty) {
|
result.elems.sort((a, b) => (a.progress).compareTo(b.progress));
|
||||||
result.elems.sort((a, b) => (a.progress).compareTo(b.progress));
|
// dmSegList.add(result);
|
||||||
dmSegList.add(result);
|
currentSegIndex = currentSegIndex < 1 ? 1 : currentSegIndex;
|
||||||
}
|
dmSegList[currentSegIndex - 1] = result;
|
||||||
}
|
}
|
||||||
if (dmSegList.isNotEmpty) {
|
if (dmSegList.isNotEmpty) {
|
||||||
findClosestPositionIndex(playerController.position.value.inMilliseconds);
|
findClosestPositionIndex(playerController.position.value.inMilliseconds);
|
||||||
|
|||||||
@ -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:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
@ -85,12 +86,20 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
_controller!.onResume();
|
_controller!.onResume();
|
||||||
danmuPlayStatus = true;
|
danmuPlayStatus = true;
|
||||||
}
|
}
|
||||||
|
if (!playerController.isOpenDanmu.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
PlDanmakuController ctr = _plDanmakuController;
|
PlDanmakuController ctr = _plDanmakuController;
|
||||||
int currentPosition = position.inMilliseconds;
|
int currentPosition = position.inMilliseconds;
|
||||||
blockTypes = playerController.blockTypes;
|
blockTypes = playerController.blockTypes;
|
||||||
|
// 根据position判断是否有已缓存弹幕。没有则请求对应段
|
||||||
if (!playerController.isOpenDanmu.value) {
|
int segIndex = (currentPosition / (6 * 60 * 1000)).ceil();
|
||||||
return;
|
segIndex = segIndex < 1 ? 1 : segIndex;
|
||||||
|
if (ctr.dmSegList[segIndex - 1].elems.isEmpty) {
|
||||||
|
ctr.currentSegIndex = segIndex;
|
||||||
|
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
|
||||||
|
ctr.queryDanmaku();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// 超出分段数返回
|
// 超出分段数返回
|
||||||
if (ctr.currentSegIndex >= ctr.dmSegList.length) {
|
if (ctr.currentSegIndex >= ctr.dmSegList.length) {
|
||||||
@ -140,23 +149,30 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(
|
return LayoutBuilder(builder: (context, box) {
|
||||||
() => AnimatedOpacity(
|
double initDuration = box.maxWidth / 12;
|
||||||
opacity: playerController.isOpenDanmu.value ? 1 : 0,
|
return Obx(
|
||||||
duration: const Duration(milliseconds: 100),
|
() => AnimatedOpacity(
|
||||||
child: DanmakuView(
|
opacity: playerController.isOpenDanmu.value ? 1 : 0,
|
||||||
createdController: (DanmakuController e) async {
|
duration: const Duration(milliseconds: 100),
|
||||||
widget.playerController.danmakuController = _controller = e;
|
child: DanmakuView(
|
||||||
},
|
createdController: (DanmakuController e) async {
|
||||||
option: DanmakuOption(
|
widget.playerController.danmakuController = _controller = e;
|
||||||
fontSize: 15 * fontSizeVal,
|
},
|
||||||
area: showArea,
|
option: DanmakuOption(
|
||||||
opacity: opacityVal,
|
fontSize: 15 * fontSizeVal,
|
||||||
duration: danmakuSpeedVal * widget.playerController.playbackSpeed,
|
area: showArea,
|
||||||
|
opacity: opacityVal,
|
||||||
|
hideTop: blockTypes.contains(5),
|
||||||
|
hideScroll: blockTypes.contains(2),
|
||||||
|
hideBottom: blockTypes.contains(4),
|
||||||
|
duration: initDuration /
|
||||||
|
(danmakuSpeedVal * widget.playerController.playbackSpeed),
|
||||||
|
),
|
||||||
|
statusChanged: (isPlaying) {},
|
||||||
),
|
),
|
||||||
statusChanged: (isPlaying) {},
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,10 +149,30 @@ class DynamicsController extends GetxController {
|
|||||||
case 'DYNAMIC_TYPE_ARTICLE':
|
case 'DYNAMIC_TYPE_ARTICLE':
|
||||||
String title = item.modules.moduleDynamic.major.opus.title;
|
String title = item.modules.moduleDynamic.major.opus.title;
|
||||||
String url = item.modules.moduleDynamic.major.opus.jumpUrl;
|
String url = item.modules.moduleDynamic.major.opus.jumpUrl;
|
||||||
Get.toNamed(
|
if (url.contains('opus') || url.contains('read')) {
|
||||||
'/webview',
|
RegExp digitRegExp = RegExp(r'\d+');
|
||||||
parameters: {'url': 'https:$url', 'type': 'note', 'pageTitle': title},
|
Iterable<Match> matches = digitRegExp.allMatches(url);
|
||||||
);
|
String number = matches.first.group(0)!;
|
||||||
|
if (url.contains('read')) {
|
||||||
|
number = 'cv$number';
|
||||||
|
}
|
||||||
|
Get.toNamed('/htmlRender', parameters: {
|
||||||
|
'url': url.startsWith('//') ? url.split('//').last : url,
|
||||||
|
'title': title,
|
||||||
|
'id': number,
|
||||||
|
'dynamicType': url.split('//').last.split('/')[1]
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Get.toNamed(
|
||||||
|
'/webview',
|
||||||
|
parameters: {
|
||||||
|
'url': 'https:$url',
|
||||||
|
'type': 'note',
|
||||||
|
'pageTitle': title
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'DYNAMIC_TYPE_PGC':
|
case 'DYNAMIC_TYPE_PGC':
|
||||||
print('番剧');
|
print('番剧');
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
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/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:pilipala/http/search.dart';
|
||||||
|
|
||||||
/// TODO 点击跳转
|
/// TODO 点击跳转
|
||||||
Widget addWidget(item, context, type, {floor = 1}) {
|
Widget addWidget(item, context, type, {floor = 1}) {
|
||||||
@ -19,8 +22,27 @@ Widget addWidget(item, context, type, {floor = 1}) {
|
|||||||
: Theme.of(context).colorScheme.background;
|
: Theme.of(context).colorScheme.background;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'ADDITIONAL_TYPE_UGC':
|
case 'ADDITIONAL_TYPE_UGC':
|
||||||
|
// 转发的投稿
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {},
|
onTap: () async {
|
||||||
|
String text = dynamicProperty[type].jumpUrl;
|
||||||
|
RegExp bvRegex = RegExp(r'BV[0-9A-Za-z]{10}', caseSensitive: false);
|
||||||
|
Iterable<Match> matches = bvRegex.allMatches(text);
|
||||||
|
if (matches.isNotEmpty) {
|
||||||
|
Match match = matches.first;
|
||||||
|
String bvid = match.group(0)!;
|
||||||
|
String cover = dynamicProperty[type].cover;
|
||||||
|
try {
|
||||||
|
int cid = await SearchHttp.ab2c(bvid: bvid);
|
||||||
|
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
||||||
|
arguments: {'pic': cover, 'heroTag': bvid});
|
||||||
|
} catch (err) {
|
||||||
|
SmartDialog.showToast(err.toString());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("No match found.");
|
||||||
|
}
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.only(left: 12, top: 8, right: 12, bottom: 8),
|
const EdgeInsets.only(left: 12, top: 8, right: 12, bottom: 8),
|
||||||
|
|||||||
@ -225,8 +225,10 @@ InlineSpan richNode(item, context) {
|
|||||||
width: box.maxWidth / 2,
|
width: box.maxWidth / 2,
|
||||||
height: box.maxWidth *
|
height: box.maxWidth *
|
||||||
0.5 *
|
0.5 *
|
||||||
pictureItem.height! /
|
(pictureItem.height != null &&
|
||||||
pictureItem.width!,
|
pictureItem.width != null
|
||||||
|
? pictureItem.height! / pictureItem.width!
|
||||||
|
: 1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -91,7 +91,10 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
),
|
),
|
||||||
Material(
|
Material(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => {feedBack(), Get.toNamed('/follow')},
|
onTap: () => {
|
||||||
|
feedBack(),
|
||||||
|
Get.toNamed('/follow?mid=${userInfo.mid}')
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 100,
|
height: 100,
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||||
|
|||||||
@ -16,13 +16,16 @@ class FansPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _FansPageState extends State<FansPage> {
|
class _FansPageState extends State<FansPage> {
|
||||||
final FansController _fansController = Get.put(FansController());
|
late String mid;
|
||||||
|
late FansController _fansController;
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
mid = Get.parameters['mid']!;
|
||||||
|
_fansController = Get.put(FansController(), tag: mid);
|
||||||
_futureBuilderFuture = _fansController.queryFans('init');
|
_futureBuilderFuture = _fansController.queryFans('init');
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
() async {
|
() async {
|
||||||
|
|||||||
@ -16,13 +16,16 @@ class FollowPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _FollowPageState extends State<FollowPage> {
|
class _FollowPageState extends State<FollowPage> {
|
||||||
final FollowController _followController = Get.put(FollowController());
|
late String mid;
|
||||||
|
late FollowController _followController;
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
mid = Get.parameters['mid']!;
|
||||||
|
_followController = Get.put(FollowController(), tag: mid);
|
||||||
_futureBuilderFuture = _followController.queryFollowings('init');
|
_futureBuilderFuture = _followController.queryFollowings('init');
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
() async {
|
() async {
|
||||||
|
|||||||
@ -123,8 +123,15 @@ class HistoryController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除某条历史记录
|
// 删除某条历史记录
|
||||||
Future delHistory(kid) async {
|
Future delHistory(kid, business) async {
|
||||||
var res = await UserHttp.delHistory(kid);
|
String resKid = 'archive_$kid';
|
||||||
|
if (business == 'live') {
|
||||||
|
resKid = 'live_$kid';
|
||||||
|
} else if (business.contains('article')) {
|
||||||
|
resKid = 'article_$kid';
|
||||||
|
}
|
||||||
|
|
||||||
|
var res = await UserHttp.delHistory(resKid);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
historyList.removeWhere((e) => e.kid == kid);
|
historyList.removeWhere((e) => e.kid == kid);
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
@ -136,7 +143,8 @@ class HistoryController extends GetxController {
|
|||||||
List<HisListItem> result =
|
List<HisListItem> result =
|
||||||
historyList.where((e) => e.progress == -1).toList();
|
historyList.where((e) => e.progress == -1).toList();
|
||||||
for (HisListItem i in result) {
|
for (HisListItem i in result) {
|
||||||
await UserHttp.delHistory(i.kid);
|
String resKid = 'archive_${i.kid}';
|
||||||
|
await UserHttp.delHistory(resKid);
|
||||||
historyList.removeWhere((e) => e.kid == i.kid);
|
historyList.removeWhere((e) => e.kid == i.kid);
|
||||||
}
|
}
|
||||||
SmartDialog.showToast('操作完成');
|
SmartDialog.showToast('操作完成');
|
||||||
|
|||||||
@ -247,26 +247,26 @@ class VideoContent extends StatelessWidget {
|
|||||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
color: Theme.of(context).colorScheme.outline),
|
color: Theme.of(context).colorScheme.outline),
|
||||||
),
|
),
|
||||||
if (videoItem.badge != '番剧' &&
|
SizedBox(
|
||||||
!videoItem.tagName.contains('动画') &&
|
width: 24,
|
||||||
videoItem.history.business != 'live' &&
|
height: 24,
|
||||||
!videoItem.history.business.contains('article'))
|
child: PopupMenuButton<String>(
|
||||||
SizedBox(
|
padding: EdgeInsets.zero,
|
||||||
width: 24,
|
tooltip: '功能菜单',
|
||||||
height: 24,
|
icon: Icon(
|
||||||
child: PopupMenuButton<String>(
|
Icons.more_vert_outlined,
|
||||||
padding: EdgeInsets.zero,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
tooltip: '功能菜单',
|
size: 14,
|
||||||
icon: Icon(
|
),
|
||||||
Icons.more_vert_outlined,
|
position: PopupMenuPosition.under,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
// constraints: const BoxConstraints(maxHeight: 35),
|
||||||
size: 14,
|
onSelected: (String type) {},
|
||||||
),
|
itemBuilder: (BuildContext context) =>
|
||||||
position: PopupMenuPosition.under,
|
<PopupMenuEntry<String>>[
|
||||||
// constraints: const BoxConstraints(maxHeight: 35),
|
if (videoItem.badge != '番剧' &&
|
||||||
onSelected: (String type) {},
|
!videoItem.tagName.contains('动画') &&
|
||||||
itemBuilder: (BuildContext context) =>
|
videoItem.history.business != 'live' &&
|
||||||
<PopupMenuEntry<String>>[
|
!videoItem.history.business.contains('article'))
|
||||||
PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var res = await UserHttp.toViewLater(
|
var res = await UserHttp.toViewLater(
|
||||||
@ -283,21 +283,22 @@ class VideoContent extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
onTap: () => ctr!.delHistory(videoItem.kid),
|
onTap: () => ctr!.delHistory(
|
||||||
value: 'pause',
|
videoItem.kid, videoItem.history.business),
|
||||||
height: 35,
|
value: 'pause',
|
||||||
child: const Row(
|
height: 35,
|
||||||
children: [
|
child: const Row(
|
||||||
Icon(Icons.close_outlined, size: 16),
|
children: [
|
||||||
SizedBox(width: 6),
|
Icon(Icons.close_outlined, size: 16),
|
||||||
Text('删除记录', style: TextStyle(fontSize: 13))
|
SizedBox(width: 6),
|
||||||
],
|
Text('删除记录', style: TextStyle(fontSize: 13))
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,19 +1,112 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/html.dart';
|
import 'package:pilipala/http/html.dart';
|
||||||
|
import 'package:pilipala/http/reply.dart';
|
||||||
|
import 'package:pilipala/models/common/reply_sort_type.dart';
|
||||||
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class HtmlRenderController extends GetxController {
|
class HtmlRenderController extends GetxController {
|
||||||
late String id;
|
late String id;
|
||||||
|
late String dynamicType;
|
||||||
|
late int type;
|
||||||
|
RxInt oid = (-1).obs;
|
||||||
late Map response;
|
late Map response;
|
||||||
|
int? floor;
|
||||||
|
int currentPage = 0;
|
||||||
|
bool isLoadingMore = false;
|
||||||
|
RxString noMore = ''.obs;
|
||||||
|
RxList<ReplyItemModel> replyList = <ReplyItemModel>[].obs;
|
||||||
|
RxInt acount = 0.obs;
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
|
|
||||||
|
ReplySortType _sortType = ReplySortType.time;
|
||||||
|
RxString sortTypeTitle = ReplySortType.time.titles.obs;
|
||||||
|
RxString sortTypeLabel = ReplySortType.time.labels.obs;
|
||||||
|
Box setting = GStrorage.setting;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
id = Get.parameters['id']!;
|
id = Get.parameters['id']!;
|
||||||
|
dynamicType = Get.parameters['dynamicType']!;
|
||||||
|
type = dynamicType == 'picture' ? 11 : 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future reqHtml() async {
|
// 请求动态内容
|
||||||
var res = await HtmlHttp.reqHtml(id);
|
Future reqHtml(id) async {
|
||||||
|
late dynamic res;
|
||||||
|
if (dynamicType == 'opus' || dynamicType == 'picture') {
|
||||||
|
res = await HtmlHttp.reqHtml(id, dynamicType);
|
||||||
|
} else {
|
||||||
|
res = await HtmlHttp.reqReadHtml(id, dynamicType);
|
||||||
|
}
|
||||||
response = res;
|
response = res;
|
||||||
|
oid.value = res['commentId'];
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 请求评论
|
||||||
|
Future queryReplyList({reqType = 'init'}) async {
|
||||||
|
var res = await ReplyHttp.replyList(
|
||||||
|
oid: oid.value,
|
||||||
|
pageNum: currentPage + 1,
|
||||||
|
type: type,
|
||||||
|
sort: _sortType.index,
|
||||||
|
);
|
||||||
|
if (res['status']) {
|
||||||
|
List<ReplyItemModel> replies = res['data'].replies;
|
||||||
|
acount.value = res['data'].page.acount;
|
||||||
|
if (replies.isNotEmpty) {
|
||||||
|
currentPage++;
|
||||||
|
noMore.value = '加载中...';
|
||||||
|
if (replies.length < 20) {
|
||||||
|
noMore.value = '没有更多了';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了';
|
||||||
|
}
|
||||||
|
if (reqType == 'init') {
|
||||||
|
// 添加置顶回复
|
||||||
|
if (res['data'].upper.top != null) {
|
||||||
|
bool flag = res['data']
|
||||||
|
.topReplies
|
||||||
|
.any((reply) => reply.rpid == res['data'].upper.top.rpid);
|
||||||
|
if (!flag) {
|
||||||
|
replies.insert(0, res['data'].upper.top);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
replies.insertAll(0, res['data'].topReplies);
|
||||||
|
replyList.value = replies;
|
||||||
|
} else {
|
||||||
|
replyList.addAll(replies);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isLoadingMore = false;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序搜索评论
|
||||||
|
queryBySort() {
|
||||||
|
feedBack();
|
||||||
|
switch (_sortType) {
|
||||||
|
case ReplySortType.time:
|
||||||
|
_sortType = ReplySortType.like;
|
||||||
|
break;
|
||||||
|
case ReplySortType.like:
|
||||||
|
_sortType = ReplySortType.reply;
|
||||||
|
break;
|
||||||
|
case ReplySortType.reply:
|
||||||
|
_sortType = ReplySortType.time;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
sortTypeTitle.value = _sortType.titles;
|
||||||
|
sortTypeLabel.value = _sortType.labels;
|
||||||
|
currentPage = 0;
|
||||||
|
replyList.clear();
|
||||||
|
queryReplyList(reqType: 'init');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,19 @@
|
|||||||
|
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/services.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/skeleton/video_reply.dart';
|
||||||
import 'package:pilipala/common/widgets/html_render.dart';
|
import 'package:pilipala/common/widgets/html_render.dart';
|
||||||
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
|
import 'package:pilipala/pages/mine/index.dart';
|
||||||
|
import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.dart';
|
||||||
|
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
||||||
|
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
|
|
||||||
@ -12,16 +24,104 @@ class HtmlRenderPage extends StatefulWidget {
|
|||||||
State<HtmlRenderPage> createState() => _HtmlRenderPageState();
|
State<HtmlRenderPage> createState() => _HtmlRenderPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HtmlRenderPageState extends State<HtmlRenderPage> {
|
class _HtmlRenderPageState extends State<HtmlRenderPage>
|
||||||
HtmlRenderController htmlRenderCtr = Get.put(HtmlRenderController());
|
with TickerProviderStateMixin {
|
||||||
|
final HtmlRenderController _htmlRenderCtr = Get.put(HtmlRenderController());
|
||||||
late String title;
|
late String title;
|
||||||
late String id;
|
late String id;
|
||||||
|
late String url;
|
||||||
|
late String dynamicType;
|
||||||
|
late int type;
|
||||||
|
bool _isFabVisible = true;
|
||||||
|
late Future _futureBuilderFuture;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
late AnimationController fabAnimationCtr;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
title = Get.parameters['title']!;
|
title = Get.parameters['title']!;
|
||||||
id = Get.parameters['id']!;
|
id = Get.parameters['id']!;
|
||||||
|
url = Get.parameters['url']!;
|
||||||
|
dynamicType = Get.parameters['dynamicType']!;
|
||||||
|
type = dynamicType == 'picture' ? 11 : 12;
|
||||||
|
_futureBuilderFuture = _htmlRenderCtr.reqHtml(id);
|
||||||
|
fabAnimationCtr = AnimationController(
|
||||||
|
vsync: this,
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
);
|
||||||
|
scrollListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
void scrollListener() {
|
||||||
|
scrollController = _htmlRenderCtr.scrollController;
|
||||||
|
scrollController.addListener(
|
||||||
|
() {
|
||||||
|
// 分页加载
|
||||||
|
if (scrollController.position.pixels >=
|
||||||
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
|
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
||||||
|
_htmlRenderCtr.queryReplyList(reqType: 'onLoad');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
// if (scrollController.offset > 55 && !_visibleTitle) {
|
||||||
|
// _visibleTitle = true;
|
||||||
|
// titleStreamC.add(true);
|
||||||
|
// } else if (scrollController.offset <= 55 && _visibleTitle) {
|
||||||
|
// _visibleTitle = false;
|
||||||
|
// titleStreamC.add(false);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// fab按钮
|
||||||
|
final ScrollDirection direction =
|
||||||
|
scrollController.position.userScrollDirection;
|
||||||
|
if (direction == ScrollDirection.forward) {
|
||||||
|
_showFab();
|
||||||
|
} else if (direction == ScrollDirection.reverse) {
|
||||||
|
_hideFab();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showFab() {
|
||||||
|
if (!_isFabVisible) {
|
||||||
|
_isFabVisible = true;
|
||||||
|
fabAnimationCtr.forward();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _hideFab() {
|
||||||
|
if (_isFabVisible) {
|
||||||
|
_isFabVisible = false;
|
||||||
|
fabAnimationCtr.reverse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void replyReply(replyItem) {
|
||||||
|
int oid = replyItem.oid;
|
||||||
|
int rpid = replyItem.rpid!;
|
||||||
|
Get.to(
|
||||||
|
() => Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: 0,
|
||||||
|
centerTitle: false,
|
||||||
|
title: Text(
|
||||||
|
'评论详情',
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: VideoReplyReplyPanel(
|
||||||
|
oid: oid,
|
||||||
|
rpid: rpid,
|
||||||
|
source: 'dynamic',
|
||||||
|
replyType: ReplyType.values[type],
|
||||||
|
firstFloor: replyItem,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -29,88 +129,328 @@ class _HtmlRenderPageState extends State<HtmlRenderPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
title: Text(title),
|
titleSpacing: 0,
|
||||||
|
title: Text(
|
||||||
|
title,
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.toNamed('/webview', parameters: {
|
||||||
|
'url': 'https:$url',
|
||||||
|
'type': 'url',
|
||||||
|
'pageTitle': title,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.open_in_browser_outlined, size: 19),
|
||||||
|
),
|
||||||
|
PopupMenuButton(
|
||||||
|
icon: const Icon(Icons.more_vert),
|
||||||
|
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: () => {
|
||||||
|
Clipboard.setData(ClipboardData(text: url)),
|
||||||
|
SmartDialog.showToast('已复制'),
|
||||||
|
},
|
||||||
|
child: const Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.copy_rounded, size: 19),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Text('复制链接'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: () => {},
|
||||||
|
child: const Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.share_outlined, size: 19),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Text('分享'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: Stack(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
SingleChildScrollView(
|
||||||
FutureBuilder(
|
controller: scrollController,
|
||||||
future: htmlRenderCtr.reqHtml(),
|
child: Column(
|
||||||
builder: (context, snapshot) {
|
children: [
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
FutureBuilder(
|
||||||
var data = snapshot.data;
|
future: _futureBuilderFuture,
|
||||||
if (data['status']) {
|
builder: (context, snapshot) {
|
||||||
return Column(
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
children: [
|
var data = snapshot.data;
|
||||||
Padding(
|
fabAnimationCtr.forward();
|
||||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
if (data['status']) {
|
||||||
child: Row(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
Padding(
|
||||||
width: 40,
|
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
||||||
height: 40,
|
child: Row(
|
||||||
type: 'avatar',
|
|
||||||
src: htmlRenderCtr.response['avatar']!,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
Text(htmlRenderCtr.response['uname'],
|
NetworkImgLayer(
|
||||||
style: TextStyle(
|
width: 40,
|
||||||
fontSize: Theme.of(context)
|
height: 40,
|
||||||
.textTheme
|
type: 'avatar',
|
||||||
.titleSmall!
|
src: _htmlRenderCtr.response['avatar']!,
|
||||||
.fontSize,
|
|
||||||
)),
|
|
||||||
Text(
|
|
||||||
htmlRenderCtr.response['updateTime'],
|
|
||||||
style: TextStyle(
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.outline,
|
|
||||||
fontSize: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.labelSmall!
|
|
||||||
.fontSize,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(_htmlRenderCtr.response['uname'],
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleSmall!
|
||||||
|
.fontSize,
|
||||||
|
)),
|
||||||
|
Text(
|
||||||
|
_htmlRenderCtr.response['updateTime'],
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.outline,
|
||||||
|
fontSize: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.labelSmall!
|
||||||
|
.fontSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const Spacer(),
|
),
|
||||||
],
|
Padding(
|
||||||
),
|
padding: const EdgeInsets.fromLTRB(12, 8, 12, 8),
|
||||||
),
|
child: HtmlRender(
|
||||||
Padding(
|
htmlContent: _htmlRenderCtr.response['content'],
|
||||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
),
|
||||||
child: HtmlRender(
|
),
|
||||||
htmlContent: htmlRenderCtr.response['content'],
|
Container(
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
),
|
border: Border(
|
||||||
Container(
|
bottom: BorderSide(
|
||||||
|
width: 8,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.dividerColor
|
||||||
|
.withOpacity(0.05),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const Text('error');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 骨架屏
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Obx(
|
||||||
|
() => _htmlRenderCtr.oid.value != -1
|
||||||
|
? Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surface,
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(
|
top: BorderSide(
|
||||||
width: 8,
|
width: 0.6,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.dividerColor
|
.dividerColor
|
||||||
.withOpacity(0.05),
|
.withOpacity(0.05),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
height: 45,
|
||||||
],
|
padding: const EdgeInsets.only(left: 12, right: 6),
|
||||||
);
|
child: Row(
|
||||||
} else {
|
children: [
|
||||||
return Text('error');
|
const Text('回复'),
|
||||||
}
|
const Spacer(),
|
||||||
} else {
|
SizedBox(
|
||||||
// 骨架屏
|
height: 35,
|
||||||
return const SizedBox();
|
child: TextButton.icon(
|
||||||
}
|
onPressed: () => _htmlRenderCtr.queryBySort(),
|
||||||
},
|
icon: const Icon(Icons.sort, size: 16),
|
||||||
|
label: Obx(
|
||||||
|
() => Text(
|
||||||
|
_htmlRenderCtr.sortTypeLabel.value,
|
||||||
|
style: const TextStyle(fontSize: 13),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
),
|
||||||
|
Obx(
|
||||||
|
() => _htmlRenderCtr.oid.value != -1
|
||||||
|
? FutureBuilder(
|
||||||
|
future: _htmlRenderCtr.queryReplyList(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState ==
|
||||||
|
ConnectionState.done) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
if (snapshot.data['status']) {
|
||||||
|
// 请求成功
|
||||||
|
return Obx(
|
||||||
|
() => _htmlRenderCtr.replyList.isEmpty &&
|
||||||
|
_htmlRenderCtr.isLoadingMore
|
||||||
|
? ListView.builder(
|
||||||
|
itemCount: 5,
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics:
|
||||||
|
const NeverScrollableScrollPhysics(),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return const VideoReplySkeleton();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics:
|
||||||
|
const NeverScrollableScrollPhysics(),
|
||||||
|
itemCount:
|
||||||
|
_htmlRenderCtr.replyList.length +
|
||||||
|
1,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (index ==
|
||||||
|
_htmlRenderCtr
|
||||||
|
.replyList.length) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom:
|
||||||
|
MediaQuery.of(context)
|
||||||
|
.padding
|
||||||
|
.bottom),
|
||||||
|
height: MediaQuery.of(context)
|
||||||
|
.padding
|
||||||
|
.bottom +
|
||||||
|
100,
|
||||||
|
child: Center(
|
||||||
|
child: Obx(
|
||||||
|
() => Text(
|
||||||
|
_htmlRenderCtr
|
||||||
|
.noMore.value,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return ReplyItem(
|
||||||
|
replyItem: _htmlRenderCtr
|
||||||
|
.replyList[index],
|
||||||
|
showReplyRow: true,
|
||||||
|
replyLevel: '1',
|
||||||
|
replyReply: (replyItem) =>
|
||||||
|
replyReply(replyItem),
|
||||||
|
replyType:
|
||||||
|
ReplyType.values[type],
|
||||||
|
addReply: (replyItem) {
|
||||||
|
_htmlRenderCtr
|
||||||
|
.replyList[index].replies!
|
||||||
|
.add(replyItem);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// 请求错误
|
||||||
|
return CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
HttpError(
|
||||||
|
errMsg: data['msg'],
|
||||||
|
fn: () => setState(() {}),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 骨架屏
|
||||||
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemCount: 5,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return const VideoReplySkeleton();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
Positioned(
|
||||||
|
bottom: MediaQuery.of(context).padding.bottom + 14,
|
||||||
|
right: 14,
|
||||||
|
child: SlideTransition(
|
||||||
|
position: Tween<Offset>(
|
||||||
|
begin: const Offset(0, 2),
|
||||||
|
end: const Offset(0, 0),
|
||||||
|
).animate(CurvedAnimation(
|
||||||
|
parent: fabAnimationCtr,
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
)),
|
||||||
|
child: FloatingActionButton(
|
||||||
|
heroTag: null,
|
||||||
|
onPressed: () {
|
||||||
|
feedBack();
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return VideoReplyNewDialog(
|
||||||
|
oid: _htmlRenderCtr.oid.value,
|
||||||
|
root: 0,
|
||||||
|
parent: 0,
|
||||||
|
replyType: ReplyType.values[type],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
).then(
|
||||||
|
(value) => {
|
||||||
|
// 完成评论,数据添加
|
||||||
|
if (value != null && value['data'] != null)
|
||||||
|
{
|
||||||
|
_htmlRenderCtr.replyList.add(value['data']),
|
||||||
|
_htmlRenderCtr.acount.value++
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
tooltip: '评论动态',
|
||||||
|
child: const Icon(Icons.reply),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,9 +25,9 @@ class LiveController extends GetxController {
|
|||||||
|
|
||||||
// 获取推荐
|
// 获取推荐
|
||||||
Future queryLiveList(type) async {
|
Future queryLiveList(type) async {
|
||||||
if (type == 'init') {
|
// if (type == 'init') {
|
||||||
_currentPage = 1;
|
// _currentPage = 1;
|
||||||
}
|
// }
|
||||||
var res = await LiveHttp.liveList(
|
var res = await LiveHttp.liveList(
|
||||||
pn: _currentPage,
|
pn: _currentPage,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -21,11 +21,15 @@ class LivePage extends StatefulWidget {
|
|||||||
State<LivePage> createState() => _LivePageState();
|
State<LivePage> createState() => _LivePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LivePageState extends State<LivePage> {
|
class _LivePageState extends State<LivePage>
|
||||||
|
with AutomaticKeepAliveClientMixin {
|
||||||
final LiveController _liveController = Get.put(LiveController());
|
final LiveController _liveController = Get.put(LiveController());
|
||||||
late Future _futureBuilderFuture;
|
late Future _futureBuilderFuture;
|
||||||
late ScrollController scrollController;
|
late ScrollController scrollController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -37,7 +41,7 @@ class _LivePageState extends State<LivePage> {
|
|||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 200) {
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
EasyThrottle.throttle('my-throttler', const Duration(seconds: 1), () {
|
EasyThrottle.throttle('liveList', const Duration(seconds: 1), () {
|
||||||
_liveController.isLoadingMore = true;
|
_liveController.isLoadingMore = true;
|
||||||
_liveController.onLoad();
|
_liveController.onLoad();
|
||||||
});
|
});
|
||||||
@ -144,9 +148,9 @@ class _LivePageState extends State<LivePage> {
|
|||||||
return SliverGrid(
|
return SliverGrid(
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
// 行间距
|
// 行间距
|
||||||
mainAxisSpacing: StyleString.cardSpace + 4,
|
mainAxisSpacing: StyleString.safeSpace,
|
||||||
// 列间距
|
// 列间距
|
||||||
crossAxisSpacing: StyleString.cardSpace + 4,
|
crossAxisSpacing: StyleString.safeSpace,
|
||||||
// 列数
|
// 列数
|
||||||
crossAxisCount: crossAxisCount,
|
crossAxisCount: crossAxisCount,
|
||||||
mainAxisExtent:
|
mainAxisExtent:
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class LiveCardV extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String heroTag = Utils.makeHeroTag(liveItem.roomId);
|
String heroTag = Utils.makeHeroTag(liveItem.roomId);
|
||||||
return Card(
|
return Card(
|
||||||
elevation: crossAxisCount == 1 ? 0 : 1,
|
elevation: 0,
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@ -102,7 +102,7 @@ class LiveContent extends StatelessWidget {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: crossAxisCount == 1
|
padding: crossAxisCount == 1
|
||||||
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
||||||
: const EdgeInsets.fromLTRB(9, 8, 9, 8),
|
: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
|||||||
@ -5,20 +5,38 @@ class ArchiveController extends GetxController {
|
|||||||
int? mid;
|
int? mid;
|
||||||
int pn = 1;
|
int pn = 1;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
RxMap<String, String> currentOrder = <String, String>{}.obs;
|
||||||
|
List<Map<String, String>> orderList = [
|
||||||
|
{'type': 'pubdate', 'label': '最新发布'},
|
||||||
|
{'type': 'click', 'label': '最多播放'},
|
||||||
|
{'type': 'stow', 'label': '最多收藏'},
|
||||||
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
mid = int.parse(Get.parameters['mid']!);
|
mid = int.parse(Get.parameters['mid']!);
|
||||||
|
currentOrder.value = orderList.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户投稿
|
// 获取用户投稿
|
||||||
Future getMemberArchive() async {
|
Future getMemberArchive() async {
|
||||||
var res = await MemberHttp.memberArchive(mid: mid, pn: pn);
|
var res = await MemberHttp.memberArchive(
|
||||||
|
mid: mid, pn: pn, order: currentOrder['type']!);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
count = res['data'].page['count'];
|
count = res['data'].page['count'];
|
||||||
pn += 1;
|
pn += 1;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleSort() async {
|
||||||
|
pn = 1;
|
||||||
|
int index = orderList.indexOf(currentOrder.value);
|
||||||
|
if (index == orderList.length - 1) {
|
||||||
|
currentOrder.value = orderList.first;
|
||||||
|
} else {
|
||||||
|
currentOrder.value = orderList[index + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,8 @@ class _ArchivePanelState extends State<ArchivePanel>
|
|||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
DateTime lastRefreshTime = DateTime.now();
|
DateTime lastRefreshTime = DateTime.now();
|
||||||
late final LoadMoreListSource source = LoadMoreListSource();
|
late final LoadMoreListSource source = LoadMoreListSource();
|
||||||
|
final ArchiveController _archiveController =
|
||||||
|
Get.put(ArchiveController(), tag: Get.arguments['heroTag']);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
@ -40,14 +42,63 @@ class _ArchivePanelState extends State<ArchivePanel>
|
|||||||
// return PullToRefreshHeader(info, lastRefreshTime);
|
// return PullToRefreshHeader(info, lastRefreshTime);
|
||||||
// },
|
// },
|
||||||
// ),
|
// ),
|
||||||
const SizedBox(height: 4),
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 14, top: 8, bottom: 8, right: 8),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text('排序方式'),
|
||||||
|
SizedBox(
|
||||||
|
height: 35,
|
||||||
|
width: 85,
|
||||||
|
child: TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
// _archiveController.order = 'click';
|
||||||
|
// _archiveController.pn = 1;
|
||||||
|
_archiveController.toggleSort();
|
||||||
|
source.refresh(true);
|
||||||
|
// LoadMoreListSource().loadData();
|
||||||
|
},
|
||||||
|
child: Obx(
|
||||||
|
() => AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 400),
|
||||||
|
transitionBuilder:
|
||||||
|
(Widget child, Animation<double> animation) {
|
||||||
|
return ScaleTransition(
|
||||||
|
scale: animation, child: child);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
_archiveController.currentOrder['label']!,
|
||||||
|
key: ValueKey<String>(
|
||||||
|
_archiveController.currentOrder['label']!),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: LoadingMoreList<VListItemModel>(
|
child: LoadingMoreList<VListItemModel>(
|
||||||
ListConfig<VListItemModel>(
|
ListConfig<VListItemModel>(
|
||||||
sourceList: source,
|
sourceList: source,
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
(BuildContext c, VListItemModel item, int index) {
|
(BuildContext c, VListItemModel item, int index) {
|
||||||
return VideoCardH(videoItem: item);
|
if (index == 0) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
VideoCardH(videoItem: item)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return VideoCardH(videoItem: item);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
indicatorBuilder: _buildIndicator,
|
indicatorBuilder: _buildIndicator,
|
||||||
),
|
),
|
||||||
@ -144,12 +195,16 @@ class _ArchivePanelState extends State<ArchivePanel>
|
|||||||
class LoadMoreListSource extends LoadingMoreBase<VListItemModel> {
|
class LoadMoreListSource extends LoadingMoreBase<VListItemModel> {
|
||||||
final ArchiveController _archiveController =
|
final ArchiveController _archiveController =
|
||||||
Get.put(ArchiveController(), tag: Get.arguments['heroTag']);
|
Get.put(ArchiveController(), tag: Get.arguments['heroTag']);
|
||||||
|
bool forceRefresh = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> loadData([bool isloadMoreAction = false]) async {
|
Future<bool> loadData([bool isloadMoreAction = false]) async {
|
||||||
bool isSuccess = false;
|
bool isSuccess = false;
|
||||||
var res = await _archiveController.getMemberArchive();
|
var res = await _archiveController.getMemberArchive();
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
|
if (_archiveController.pn == 2) {
|
||||||
|
clear();
|
||||||
|
}
|
||||||
addAll(res['data'].list.vlist);
|
addAll(res['data'].list.vlist);
|
||||||
}
|
}
|
||||||
if (length < res['data'].page['count']) {
|
if (length < res['data'].page['count']) {
|
||||||
@ -159,4 +214,17 @@ class LoadMoreListSource extends LoadingMoreBase<VListItemModel> {
|
|||||||
}
|
}
|
||||||
return isSuccess;
|
return isSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<bool> refresh([bool clearBeforeRequest = false]) async {
|
||||||
|
// _hasMore = true;
|
||||||
|
// pageindex = 1;
|
||||||
|
// //force to refresh list when you don't want clear list before request
|
||||||
|
// //for the case, if your list already has 20 items.
|
||||||
|
forceRefresh = !clearBeforeRequest;
|
||||||
|
var result = await super.refresh(clearBeforeRequest);
|
||||||
|
|
||||||
|
forceRefresh = false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class MemberController extends GetxController {
|
|||||||
late int mid;
|
late int mid;
|
||||||
Rx<MemberInfoModel> memberInfo = MemberInfoModel().obs;
|
Rx<MemberInfoModel> memberInfo = MemberInfoModel().obs;
|
||||||
Map? userStat;
|
Map? userStat;
|
||||||
String? face;
|
RxString face = ''.obs;
|
||||||
String? heroTag;
|
String? heroTag;
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
late int ownerMid;
|
late int ownerMid;
|
||||||
@ -30,7 +30,7 @@ class MemberController extends GetxController {
|
|||||||
mid = int.parse(Get.parameters['mid']!);
|
mid = int.parse(Get.parameters['mid']!);
|
||||||
userInfo = userInfoCache.get('userInfoCache');
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
ownerMid = userInfo != null ? userInfo.mid : -1;
|
ownerMid = userInfo != null ? userInfo.mid : -1;
|
||||||
face = Get.arguments['face'] ?? '';
|
face.value = Get.arguments['face'] ?? '';
|
||||||
heroTag = Get.arguments['heroTag'] ?? '';
|
heroTag = Get.arguments['heroTag'] ?? '';
|
||||||
relationSearch();
|
relationSearch();
|
||||||
}
|
}
|
||||||
@ -41,6 +41,7 @@ class MemberController extends GetxController {
|
|||||||
var res = await MemberHttp.memberInfo(mid: mid);
|
var res = await MemberHttp.memberInfo(mid: mid);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
memberInfo.value = res['data'];
|
memberInfo.value = res['data'];
|
||||||
|
face.value = res['data'].face;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -110,6 +111,7 @@ class MemberController extends GetxController {
|
|||||||
// 关系查询
|
// 关系查询
|
||||||
Future relationSearch() async {
|
Future relationSearch() async {
|
||||||
if (userInfo == null) return;
|
if (userInfo == null) return;
|
||||||
|
if (mid == ownerMid) return;
|
||||||
var res = await UserHttp.relationSearch(mid);
|
var res = await UserHttp.relationSearch(mid);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
attribute.value = res['data']['relation']['attribute'];
|
attribute.value = res['data']['relation']['attribute'];
|
||||||
@ -117,7 +119,7 @@ class MemberController extends GetxController {
|
|||||||
? '关注'
|
? '关注'
|
||||||
: attribute.value == 2
|
: attribute.value == 2
|
||||||
? '已关注'
|
? '已关注'
|
||||||
: attribute.value == 2
|
: attribute.value == 6
|
||||||
? '已互粉'
|
? '已互粉'
|
||||||
: '已拉黑';
|
: '已拉黑';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:pilipala/common/widgets/network_img_layer.dart';
|
|||||||
import 'package:pilipala/pages/member/archive/view.dart';
|
import 'package:pilipala/pages/member/archive/view.dart';
|
||||||
import 'package:pilipala/pages/member/dynamic/index.dart';
|
import 'package:pilipala/pages/member/dynamic/index.dart';
|
||||||
import 'package:pilipala/pages/member/index.dart';
|
import 'package:pilipala/pages/member/index.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
import 'widgets/profile.dart';
|
import 'widgets/profile.dart';
|
||||||
|
|
||||||
@ -20,7 +21,8 @@ class MemberPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _MemberPageState extends State<MemberPage>
|
class _MemberPageState extends State<MemberPage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
final MemberController _memberController = Get.put(MemberController());
|
late String heroTag;
|
||||||
|
late MemberController _memberController;
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
final ScrollController _extendNestCtr = ScrollController();
|
final ScrollController _extendNestCtr = ScrollController();
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
@ -29,6 +31,9 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
heroTag =
|
||||||
|
Get.arguments['heroTag'] ?? Utils.makeHeroTag(Get.parameters['mid']);
|
||||||
|
_memberController = Get.put(MemberController(), tag: heroTag);
|
||||||
_tabController = TabController(length: 3, vsync: this, initialIndex: 2);
|
_tabController = TabController(length: 3, vsync: this, initialIndex: 2);
|
||||||
_futureBuilderFuture = _memberController.getInfo();
|
_futureBuilderFuture = _memberController.getInfo();
|
||||||
_extendNestCtr.addListener(
|
_extendNestCtr.addListener(
|
||||||
@ -77,11 +82,13 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
Obx(
|
||||||
width: 35,
|
() => NetworkImgLayer(
|
||||||
height: 35,
|
width: 35,
|
||||||
type: 'avatar',
|
height: 35,
|
||||||
src: _memberController.face ?? '',
|
type: 'avatar',
|
||||||
|
src: _memberController.face.value,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Obx(
|
Obx(
|
||||||
@ -102,30 +109,41 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Get.toNamed(
|
||||||
|
'/memberSearch?mid=${Get.parameters['mid']}&uname=${_memberController.memberInfo.value.name!}'),
|
||||||
|
icon: const Icon(Icons.search_outlined),
|
||||||
|
),
|
||||||
PopupMenuButton(
|
PopupMenuButton(
|
||||||
icon: const Icon(Icons.more_vert),
|
icon: const Icon(Icons.more_vert),
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||||
|
if (_memberController.ownerMid !=
|
||||||
|
_memberController.mid) ...[
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: () => _memberController.blockUser(),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.block, size: 19),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Text(_memberController.attribute.value != 128
|
||||||
|
? '加入黑名单'
|
||||||
|
: '移除黑名单'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
onTap: () => _memberController.blockUser(),
|
onTap: () => _memberController.shareUser(),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.block, size: 19),
|
const Icon(Icons.share_outlined, size: 19),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(_memberController.attribute.value != 128
|
Text(_memberController.ownerMid !=
|
||||||
? '加入黑名单'
|
_memberController.mid
|
||||||
: '移除黑名单'),
|
? '分享UP主'
|
||||||
],
|
: '分享我的主页'),
|
||||||
),
|
|
||||||
),
|
|
||||||
PopupMenuItem(
|
|
||||||
onTap: () => _memberController.shareUser(),
|
|
||||||
child: const Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Icon(Icons.share_outlined, size: 19),
|
|
||||||
SizedBox(width: 10),
|
|
||||||
Text('分享UP主'),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -136,34 +154,38 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
background: Stack(
|
background: Stack(
|
||||||
children: [
|
children: [
|
||||||
if (_memberController.face != null)
|
Obx(
|
||||||
Positioned.fill(
|
() => _memberController.face.value != ''
|
||||||
bottom: 10,
|
? Positioned.fill(
|
||||||
child: Container(
|
bottom: 10,
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
image: DecorationImage(
|
decoration: BoxDecoration(
|
||||||
fit: BoxFit.fitWidth,
|
image: DecorationImage(
|
||||||
image: NetworkImage(_memberController.face!),
|
fit: BoxFit.fitWidth,
|
||||||
alignment: Alignment.topCenter,
|
image: NetworkImage(
|
||||||
isAntiAlias: true,
|
_memberController.face.value),
|
||||||
),
|
alignment: Alignment.topCenter,
|
||||||
),
|
isAntiAlias: true,
|
||||||
foregroundDecoration: BoxDecoration(
|
),
|
||||||
gradient: LinearGradient(
|
),
|
||||||
colors: [
|
foregroundDecoration: BoxDecoration(
|
||||||
Theme.of(context)
|
gradient: LinearGradient(
|
||||||
.colorScheme
|
colors: [
|
||||||
.background
|
Theme.of(context)
|
||||||
.withOpacity(0.44),
|
.colorScheme
|
||||||
Theme.of(context).colorScheme.background,
|
.background
|
||||||
],
|
.withOpacity(0.44),
|
||||||
begin: Alignment.topCenter,
|
Theme.of(context).colorScheme.background,
|
||||||
end: Alignment.bottomCenter,
|
],
|
||||||
stops: const [0.0, 0.46],
|
begin: Alignment.topCenter,
|
||||||
),
|
end: Alignment.bottomCenter,
|
||||||
),
|
stops: const [0.0, 0.46],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
|
|||||||
@ -22,7 +22,7 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
width: 90,
|
width: 90,
|
||||||
height: 90,
|
height: 90,
|
||||||
type: 'avatar',
|
type: 'avatar',
|
||||||
src: !loadingStatus ? memberInfo.face : ctr.face,
|
src: !loadingStatus ? memberInfo.face : ctr.face.value,
|
||||||
),
|
),
|
||||||
if (!loadingStatus &&
|
if (!loadingStatus &&
|
||||||
memberInfo.liveRoom != null &&
|
memberInfo.liveRoom != null &&
|
||||||
@ -123,12 +123,14 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
: '-',
|
: '-',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold)),
|
fontWeight: FontWeight.bold)),
|
||||||
Text('粉丝',
|
Text(
|
||||||
style: TextStyle(
|
'粉丝',
|
||||||
fontSize: Theme.of(context)
|
style: TextStyle(
|
||||||
.textTheme
|
fontSize: Theme.of(context)
|
||||||
.labelMedium!
|
.textTheme
|
||||||
.fontSize))
|
.labelMedium!
|
||||||
|
.fontSize),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
90
lib/pages/member_search/controller.dart
Normal file
90
lib/pages/member_search/controller.dart
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/http/member.dart';
|
||||||
|
import 'package:pilipala/models/member/archive.dart';
|
||||||
|
|
||||||
|
class MemberSearchController extends GetxController {
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
|
Rx<TextEditingController> controller = TextEditingController().obs;
|
||||||
|
final FocusNode searchFocusNode = FocusNode();
|
||||||
|
RxString searchKeyWord = ''.obs;
|
||||||
|
String hintText = '搜索';
|
||||||
|
RxString loadingStatus = 'init'.obs;
|
||||||
|
RxString loadingText = '加载中...'.obs;
|
||||||
|
bool hasRequest = false;
|
||||||
|
late int mid;
|
||||||
|
RxString uname = ''.obs;
|
||||||
|
int archivePn = 1;
|
||||||
|
int archiveCount = 0;
|
||||||
|
RxList<VListItemModel> archiveList = <VListItemModel>[].obs;
|
||||||
|
int dynamic_pn = 1;
|
||||||
|
RxList<VListItemModel> dynamicList = <VListItemModel>[].obs;
|
||||||
|
|
||||||
|
int ps = 30;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
mid = int.parse(Get.parameters['mid']!);
|
||||||
|
uname.value = Get.parameters['uname']!;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清空搜索
|
||||||
|
void onClear() {
|
||||||
|
if (searchKeyWord.value.isNotEmpty && controller.value.text != '') {
|
||||||
|
controller.value.clear();
|
||||||
|
searchKeyWord.value = '';
|
||||||
|
} else {
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChange(value) {
|
||||||
|
searchKeyWord.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交搜索内容
|
||||||
|
void submit() {
|
||||||
|
loadingStatus.value = 'loading';
|
||||||
|
if (hasRequest) {
|
||||||
|
archivePn = 1;
|
||||||
|
searchArchives();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索视频
|
||||||
|
Future searchArchives({type = 'init'}) async {
|
||||||
|
if (type == 'onLoad' && loadingText.value == '没有更多了') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var res = await MemberHttp.memberArchive(
|
||||||
|
mid: mid,
|
||||||
|
pn: archivePn,
|
||||||
|
keyword: controller.value.text,
|
||||||
|
order: 'pubdate',
|
||||||
|
);
|
||||||
|
if (res['status']) {
|
||||||
|
if (type == 'init' || archivePn == 1) {
|
||||||
|
archiveList.value = res['data'].list.vlist;
|
||||||
|
} else {
|
||||||
|
archiveList.addAll(res['data'].list.vlist);
|
||||||
|
}
|
||||||
|
archiveCount = res['data'].page['count'];
|
||||||
|
if (archiveList.length == archiveCount) {
|
||||||
|
loadingText.value = '没有更多了';
|
||||||
|
}
|
||||||
|
archivePn += 1;
|
||||||
|
hasRequest = true;
|
||||||
|
}
|
||||||
|
// loadingStatus.value = 'finish';
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索动态
|
||||||
|
Future searchDynamic() async {}
|
||||||
|
|
||||||
|
//
|
||||||
|
onLoad() {
|
||||||
|
searchArchives(type: 'onLoad');
|
||||||
|
}
|
||||||
|
}
|
||||||
4
lib/pages/member_search/index.dart
Normal file
4
lib/pages/member_search/index.dart
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
library member_search;
|
||||||
|
|
||||||
|
export './controller.dart';
|
||||||
|
export './view.dart';
|
||||||
195
lib/pages/member_search/view.dart
Normal file
195
lib/pages/member_search/view.dart
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/skeleton/video_card_h.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 'controller.dart';
|
||||||
|
|
||||||
|
class MemberSearchPage extends StatefulWidget {
|
||||||
|
const MemberSearchPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MemberSearchPage> createState() => _MemberSearchPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MemberSearchPageState extends State<MemberSearchPage>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
final MemberSearchController _memberSearchCtr =
|
||||||
|
Get.put(MemberSearchController());
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
scrollController = _memberSearchCtr.scrollController;
|
||||||
|
scrollController.addListener(
|
||||||
|
() {
|
||||||
|
if (scrollController.position.pixels >=
|
||||||
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
|
EasyThrottle.throttle('history', const Duration(seconds: 1), () {
|
||||||
|
_memberSearchCtr.onLoad();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
// _tabController = TabController(length: 2, vsync: this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
// _tabController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: 0,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => _memberSearchCtr.submit(),
|
||||||
|
icon: const Icon(CupertinoIcons.search, size: 22)),
|
||||||
|
const SizedBox(width: 10)
|
||||||
|
],
|
||||||
|
title: Obx(
|
||||||
|
() => TextField(
|
||||||
|
autofocus: true,
|
||||||
|
focusNode: _memberSearchCtr.searchFocusNode,
|
||||||
|
controller: _memberSearchCtr.controller.value,
|
||||||
|
textInputAction: TextInputAction.search,
|
||||||
|
onChanged: (value) => _memberSearchCtr.onChange(value),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: _memberSearchCtr.hintText,
|
||||||
|
border: InputBorder.none,
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.clear,
|
||||||
|
size: 22,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
onPressed: () => _memberSearchCtr.onClear(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onSubmitted: (String value) => _memberSearchCtr.submit(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Obx(
|
||||||
|
() => Column(
|
||||||
|
children: _memberSearchCtr.loadingStatus.value == 'init'
|
||||||
|
? [
|
||||||
|
Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Text('搜索「${_memberSearchCtr.uname.value}」的动态、视频'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
// TabBar(
|
||||||
|
// controller: _tabController,
|
||||||
|
// tabs: const [
|
||||||
|
// Tab(text: "视频"),
|
||||||
|
// Tab(text: "动态"),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
Expanded(
|
||||||
|
child:
|
||||||
|
// TabBarView(
|
||||||
|
// controller: _tabController,
|
||||||
|
// children: [
|
||||||
|
FutureBuilder(
|
||||||
|
future: _memberSearchCtr.searchArchives(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
if (data['status']) {
|
||||||
|
return Obx(
|
||||||
|
() => _memberSearchCtr.archiveList.isNotEmpty
|
||||||
|
? ListView.builder(
|
||||||
|
controller: scrollController,
|
||||||
|
itemCount:
|
||||||
|
_memberSearchCtr.archiveList.length +
|
||||||
|
1,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (index ==
|
||||||
|
_memberSearchCtr
|
||||||
|
.archiveList.length) {
|
||||||
|
return Container(
|
||||||
|
height: MediaQuery.of(context)
|
||||||
|
.padding
|
||||||
|
.bottom +
|
||||||
|
60,
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: MediaQuery.of(context)
|
||||||
|
.padding
|
||||||
|
.bottom),
|
||||||
|
child: Center(
|
||||||
|
child: Obx(
|
||||||
|
() => Text(
|
||||||
|
_memberSearchCtr
|
||||||
|
.loadingText.value,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.outline,
|
||||||
|
fontSize: 13),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return VideoCardH(
|
||||||
|
videoItem: _memberSearchCtr
|
||||||
|
.archiveList[index]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: _memberSearchCtr.loadingStatus.value ==
|
||||||
|
'loading'
|
||||||
|
? ListView.builder(
|
||||||
|
itemCount: 10,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return const VideoCardHSkeleton();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: const CustomScrollView(
|
||||||
|
slivers: <Widget>[
|
||||||
|
NoData(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return CustomScrollView(
|
||||||
|
slivers: <Widget>[
|
||||||
|
HttpError(
|
||||||
|
errMsg: data['msg'],
|
||||||
|
fn: () => setState(() {}),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 骨架屏
|
||||||
|
return ListView.builder(
|
||||||
|
itemCount: 10,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return const VideoCardHSkeleton();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
@ -111,4 +112,20 @@ class MineController extends GetxController {
|
|||||||
}
|
}
|
||||||
Get.forceAppUpdate();
|
Get.forceAppUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pushFollow() {
|
||||||
|
if (!userLogin.value) {
|
||||||
|
SmartDialog.showToast('账号未登录');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Get.toNamed('/follow?mid=${userInfo.value.mid}');
|
||||||
|
}
|
||||||
|
|
||||||
|
pushFans() {
|
||||||
|
if (!userLogin.value) {
|
||||||
|
SmartDialog.showToast('账号未登录');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Get.toNamed('/fan?mid=${userInfo.value.mid}');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -264,7 +264,7 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => Get.toNamed('/follow'),
|
onTap: () => _mineController.pushFollow(),
|
||||||
borderRadius: StyleString.mdRadius,
|
borderRadius: StyleString.mdRadius,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -294,7 +294,7 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => Get.toNamed('/fan'),
|
onTap: () => _mineController.pushFans(),
|
||||||
borderRadius: StyleString.mdRadius,
|
borderRadius: StyleString.mdRadius,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class RcmdController extends GetxController {
|
|||||||
Box recVideo = GStrorage.recVideo;
|
Box recVideo = GStrorage.recVideo;
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
RxInt crossAxisCount = 2.obs;
|
RxInt crossAxisCount = 2.obs;
|
||||||
|
late bool enableSaveLastData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -28,6 +29,8 @@ class RcmdController extends GetxController {
|
|||||||
}
|
}
|
||||||
videoList.value = list;
|
videoList.value = list;
|
||||||
}
|
}
|
||||||
|
enableSaveLastData =
|
||||||
|
setting.get(SettingBoxKey.enableSaveLastData, defaultValue: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取推荐
|
// 获取推荐
|
||||||
@ -49,7 +52,11 @@ class RcmdController extends GetxController {
|
|||||||
videoList.value = res['data'];
|
videoList.value = res['data'];
|
||||||
}
|
}
|
||||||
} else if (type == 'onRefresh') {
|
} else if (type == 'onRefresh') {
|
||||||
videoList.value = res['data'];
|
if (enableSaveLastData) {
|
||||||
|
videoList.insertAll(0, res['data']);
|
||||||
|
} else {
|
||||||
|
videoList.value = res['data'];
|
||||||
|
}
|
||||||
} else if (type == 'onLoad') {
|
} else if (type == 'onLoad') {
|
||||||
videoList.addAll(res['data']);
|
videoList.addAll(res['data']);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class SSearchController extends GetxController {
|
|||||||
Future querySearchSuggest(String value) async {
|
Future querySearchSuggest(String value) async {
|
||||||
var result = await SearchHttp.searchSuggest(term: value);
|
var result = await SearchHttp.searchSuggest(term: value);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
if (result['data'].isNotEmpty) {
|
if (result['data'] is SearchSuggestModel) {
|
||||||
searchSuggestList.value = result['data'].tag;
|
searchSuggestList.value = result['data'].tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
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/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
@ -12,7 +13,14 @@ Widget searchArticlePanel(BuildContext context, ctr, list) {
|
|||||||
itemCount: list.length,
|
itemCount: list.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
Get.toNamed('/htmlRender', parameters: {
|
||||||
|
'url': 'www.bilibili.com/read/cv${list[index].id}',
|
||||||
|
'title': list[index].subTitle,
|
||||||
|
'id': 'cv${list[index].id}',
|
||||||
|
'dynamicType': 'read'
|
||||||
|
});
|
||||||
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
||||||
|
|||||||
@ -79,6 +79,12 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
setKey: SettingBoxKey.enableWordRe,
|
setKey: SettingBoxKey.enableWordRe,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
|
const SetSwitchItem(
|
||||||
|
title: '首页推荐刷新',
|
||||||
|
subTitle: '下拉刷新时保留上次内容',
|
||||||
|
setKey: SettingBoxKey.enableSaveLastData,
|
||||||
|
defaultVal: false,
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text('评论展示', style: titleStyle),
|
title: Text('评论展示', style: titleStyle),
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class SetDiaplayMode extends StatefulWidget {
|
class SetDiaplayMode extends StatefulWidget {
|
||||||
const SetDiaplayMode({super.key});
|
const SetDiaplayMode({super.key});
|
||||||
@ -14,6 +16,7 @@ class _SetDiaplayModeState extends State<SetDiaplayMode> {
|
|||||||
List<DisplayMode> modes = <DisplayMode>[];
|
List<DisplayMode> modes = <DisplayMode>[];
|
||||||
DisplayMode? active;
|
DisplayMode? active;
|
||||||
DisplayMode? preferred;
|
DisplayMode? preferred;
|
||||||
|
Box setting = GStrorage.setting;
|
||||||
|
|
||||||
final ValueNotifier<int> page = ValueNotifier<int>(0);
|
final ValueNotifier<int> page = ValueNotifier<int>(0);
|
||||||
late final PageController controller = PageController()
|
late final PageController controller = PageController()
|
||||||
@ -29,24 +32,36 @@ class _SetDiaplayModeState extends State<SetDiaplayMode> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取所有的mode
|
||||||
Future<void> fetchAll() async {
|
Future<void> fetchAll() async {
|
||||||
preferred = await FlutterDisplayMode.preferred;
|
preferred = await FlutterDisplayMode.preferred;
|
||||||
active = await FlutterDisplayMode.active;
|
active = await FlutterDisplayMode.active;
|
||||||
// GStorage().setDisplayModeType(preferred!);
|
await setting.put(SettingBoxKey.displayMode, preferred.toString());
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 初始化mode/手动设置
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
try {
|
try {
|
||||||
modes = await FlutterDisplayMode.supported;
|
modes = await FlutterDisplayMode.supported;
|
||||||
} on PlatformException catch (e) {
|
} on PlatformException catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
}
|
}
|
||||||
// var res = await GStorage().getDisplayModeType();
|
var res = await getDisplayModeType(modes);
|
||||||
// preferred = modes.toList().firstWhere((el) => el == res);
|
|
||||||
|
preferred = modes.toList().firstWhere((el) => el == res);
|
||||||
FlutterDisplayMode.setPreferredMode(preferred!);
|
FlutterDisplayMode.setPreferredMode(preferred!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<DisplayMode> getDisplayModeType(modes) async {
|
||||||
|
var value = setting.get(SettingBoxKey.displayMode);
|
||||||
|
DisplayMode f = DisplayMode.auto;
|
||||||
|
if (value != null) {
|
||||||
|
f = modes.firstWhere((e) => e.toString() == value);
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@ -199,6 +199,9 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
// 视频介绍
|
// 视频介绍
|
||||||
showIntroDetail() {
|
showIntroDetail() {
|
||||||
|
if (loadingStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
feedBack();
|
feedBack();
|
||||||
showBottomSheet(
|
showBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@ -254,22 +257,25 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 20),
|
const SizedBox(width: 20),
|
||||||
SizedBox(
|
Opacity(
|
||||||
width: 34,
|
opacity: loadingStatus ? 0 : 1,
|
||||||
height: 34,
|
child: SizedBox(
|
||||||
child: IconButton(
|
width: 34,
|
||||||
style: ButtonStyle(
|
height: 34,
|
||||||
padding:
|
child: IconButton(
|
||||||
MaterialStateProperty.all(EdgeInsets.zero),
|
style: ButtonStyle(
|
||||||
backgroundColor:
|
padding:
|
||||||
MaterialStateProperty.resolveWith((states) {
|
MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
return t.highlightColor.withOpacity(0.2);
|
backgroundColor:
|
||||||
}),
|
MaterialStateProperty.resolveWith((states) {
|
||||||
),
|
return t.highlightColor.withOpacity(0.2);
|
||||||
onPressed: showIntroDetail,
|
}),
|
||||||
icon: Icon(
|
),
|
||||||
Icons.more_horiz,
|
onPressed: showIntroDetail,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
icon: Icon(
|
||||||
|
Icons.more_horiz,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||||
@ -129,7 +130,50 @@ class IntroDetail extends StatelessWidget {
|
|||||||
final currentDesc = descV2[index];
|
final currentDesc = descV2[index];
|
||||||
switch (currentDesc.type) {
|
switch (currentDesc.type) {
|
||||||
case 1:
|
case 1:
|
||||||
return TextSpan(text: currentDesc.rawText);
|
List<InlineSpan> spanChildren = [];
|
||||||
|
RegExp urlRegExp = RegExp(r'https?://\S+\b');
|
||||||
|
Iterable<Match> matches = urlRegExp.allMatches(currentDesc.rawText);
|
||||||
|
|
||||||
|
int previousEndIndex = 0;
|
||||||
|
for (Match match in matches) {
|
||||||
|
if (match.start > previousEndIndex) {
|
||||||
|
spanChildren.add(TextSpan(
|
||||||
|
text: currentDesc.rawText
|
||||||
|
.substring(previousEndIndex, match.start)));
|
||||||
|
}
|
||||||
|
spanChildren.add(
|
||||||
|
TextSpan(
|
||||||
|
text: match.group(0),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.primary), // 设置颜色为蓝色
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
// 处理点击事件
|
||||||
|
try {
|
||||||
|
Get.toNamed(
|
||||||
|
'/webview',
|
||||||
|
parameters: {
|
||||||
|
'url': match.group(0)!,
|
||||||
|
'type': 'url',
|
||||||
|
'pageTitle': match.group(0)!,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
SmartDialog.showToast(err.toString());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
previousEndIndex = match.end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previousEndIndex < currentDesc.rawText.length) {
|
||||||
|
spanChildren.add(TextSpan(
|
||||||
|
text: currentDesc.rawText.substring(previousEndIndex)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TextSpan result = TextSpan(children: spanChildren);
|
||||||
|
return result;
|
||||||
case 2:
|
case 2:
|
||||||
final colorSchemePrimary = Theme.of(context).colorScheme.primary;
|
final colorSchemePrimary = Theme.of(context).colorScheme.primary;
|
||||||
final heroTag = Utils.makeHeroTag(currentDesc.bizId);
|
final heroTag = Utils.makeHeroTag(currentDesc.bizId);
|
||||||
|
|||||||
@ -96,8 +96,8 @@ class VideoReplyController extends GetxController {
|
|||||||
} else {
|
} else {
|
||||||
replyList.addAll(replies);
|
replyList.addAll(replies);
|
||||||
}
|
}
|
||||||
|
count.value = res['data'].page.count;
|
||||||
}
|
}
|
||||||
count.value = res['data'].page.count;
|
|
||||||
isLoadingMore = false;
|
isLoadingMore = false;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
bool _isFabVisible = true;
|
bool _isFabVisible = true;
|
||||||
String replyLevel = '1';
|
String replyLevel = '1';
|
||||||
|
late String heroTag;
|
||||||
|
|
||||||
// 添加页面缓存
|
// 添加页面缓存
|
||||||
@override
|
@override
|
||||||
@ -46,16 +47,17 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
int oid = widget.bvid != null ? IdUtils.bv2av(widget.bvid!) : 0;
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
int oid = widget.bvid != null ? IdUtils.bv2av(widget.bvid!) : 0;
|
||||||
|
heroTag = Get.arguments['heroTag'];
|
||||||
replyLevel = widget.replyLevel ?? '1';
|
replyLevel = widget.replyLevel ?? '1';
|
||||||
if (replyLevel == '2') {
|
if (replyLevel == '2') {
|
||||||
_videoReplyController = Get.put(
|
_videoReplyController = Get.put(
|
||||||
VideoReplyController(oid, widget.rpid.toString(), replyLevel),
|
VideoReplyController(oid, widget.rpid.toString(), replyLevel),
|
||||||
tag: widget.rpid.toString());
|
tag: widget.rpid.toString());
|
||||||
} else {
|
} else {
|
||||||
_videoReplyController = Get.put(VideoReplyController(oid, '', replyLevel),
|
_videoReplyController =
|
||||||
tag: Get.arguments['heroTag']);
|
Get.put(VideoReplyController(oid, '', replyLevel), tag: heroTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
fabAnimationCtr = AnimationController(
|
fabAnimationCtr = AnimationController(
|
||||||
@ -106,7 +108,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
// 展示二级回复
|
// 展示二级回复
|
||||||
void replyReply(replyItem) {
|
void replyReply(replyItem) {
|
||||||
VideoDetailController videoDetailCtr =
|
VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
Get.find<VideoDetailController>(tag: heroTag);
|
||||||
if (replyItem != null) {
|
if (replyItem != null) {
|
||||||
videoDetailCtr.oid = replyItem.oid;
|
videoDetailCtr.oid = replyItem.oid;
|
||||||
videoDetailCtr.fRpid = replyItem.rpid!;
|
videoDetailCtr.fRpid = replyItem.rpid!;
|
||||||
@ -193,7 +195,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
Map data = snapshot.data as Map;
|
var data = snapshot.data;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
// 请求成功
|
// 请求成功
|
||||||
return Obx(
|
return Obx(
|
||||||
|
|||||||
@ -26,11 +26,6 @@ class VideoReplyReplyController extends GetxController {
|
|||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上拉加载
|
|
||||||
Future onLoad() async {
|
|
||||||
queryReplyList(type: 'onLoad');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future queryReplyList({type = 'init'}) async {
|
Future queryReplyList({type = 'init'}) async {
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
@ -49,11 +44,11 @@ class VideoReplyReplyController extends GetxController {
|
|||||||
if (replyList.length == res['data'].page.count) {
|
if (replyList.length == res['data'].page.count) {
|
||||||
noMore.value = '没有更多了';
|
noMore.value = '没有更多了';
|
||||||
}
|
}
|
||||||
|
currentPage++;
|
||||||
} else {
|
} else {
|
||||||
// 未登录状态replies可能返回null
|
// 未登录状态replies可能返回null
|
||||||
noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了';
|
noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了';
|
||||||
}
|
}
|
||||||
currentPage++;
|
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
// List<ReplyItemModel> replies = res['data'].replies;
|
// List<ReplyItemModel> replies = res['data'].replies;
|
||||||
// 添加置顶回复
|
// 添加置顶回复
|
||||||
@ -72,6 +67,10 @@ class VideoReplyReplyController extends GetxController {
|
|||||||
// res['data'].replies = replies;
|
// res['data'].replies = replies;
|
||||||
replyList.value = replies;
|
replyList.value = replies;
|
||||||
} else {
|
} else {
|
||||||
|
// 每次回复之后,翻页请求有且只有相同的一条回复数据
|
||||||
|
if (replies.length == 1 && replies.last.rpid == replyList.last.rpid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
replyList.addAll(replies);
|
replyList.addAll(replies);
|
||||||
// res['data'].replies.addAll(replyList);
|
// res['data'].replies.addAll(replyList);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
@ -54,9 +55,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 300) {
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
if (!_videoReplyReplyController.isLoadingMore) {
|
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
||||||
_videoReplyReplyController.onLoad();
|
_videoReplyReplyController.queryReplyList(type: 'onLoad');
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -99,10 +99,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
plPlayerController!.triggerFullScreen(status: false);
|
plPlayerController!.triggerFullScreen(status: false);
|
||||||
}
|
}
|
||||||
// 播放完展示控制栏
|
// 播放完展示控制栏
|
||||||
PiPStatus currentStatus = await videoDetailController.floating!.pipStatus;
|
try {
|
||||||
if (currentStatus == PiPStatus.disabled) {
|
PiPStatus currentStatus =
|
||||||
plPlayerController!.onLockControl(false);
|
await videoDetailController.floating!.pipStatus;
|
||||||
}
|
if (currentStatus == PiPStatus.disabled) {
|
||||||
|
plPlayerController!.onLockControl(false);
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,10 +143,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
if (setting.get(SettingBoxKey.enableAutoBrightness, defaultValue: false)) {
|
if (setting.get(SettingBoxKey.enableAutoBrightness, defaultValue: false)) {
|
||||||
videoDetailController.brightness = plPlayerController!.brightness.value;
|
videoDetailController.brightness = plPlayerController!.brightness.value;
|
||||||
}
|
}
|
||||||
videoDetailController.defaultST = plPlayerController!.position.value;
|
if (plPlayerController != null) {
|
||||||
videoIntroController.isPaused = true;
|
videoDetailController.defaultST = plPlayerController!.position.value;
|
||||||
plPlayerController!.removeStatusLister(playerListener);
|
videoIntroController.isPaused = true;
|
||||||
plPlayerController!.pause();
|
plPlayerController!.removeStatusLister(playerListener);
|
||||||
|
plPlayerController!.pause();
|
||||||
|
}
|
||||||
super.didPushNext();
|
super.didPushNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
@ -24,11 +25,20 @@ class _WebviewPageState extends State<WebviewPage> {
|
|||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
const SizedBox(width: 4),
|
||||||
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_webviewController.controller.reload();
|
_webviewController.controller.reload();
|
||||||
},
|
},
|
||||||
child: const Text('刷新'),
|
icon: Icon(Icons.refresh_outlined,
|
||||||
|
color: Theme.of(context).colorScheme.primary),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
launchUrl(Uri.parse(_webviewController.url));
|
||||||
|
},
|
||||||
|
icon: Icon(Icons.open_in_browser_outlined,
|
||||||
|
color: Theme.of(context).colorScheme.primary),
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => _webviewController.type.value == 'login'
|
() => _webviewController.type.value == 'login'
|
||||||
@ -38,7 +48,7 @@ class _WebviewPageState extends State<WebviewPage> {
|
|||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10)
|
const SizedBox(width: 12)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
|
|||||||
@ -449,7 +449,9 @@ class PlPlayerController {
|
|||||||
for (var element in _statusListeners) {
|
for (var element in _statusListeners) {
|
||||||
element(event ? PlayerStatus.playing : PlayerStatus.paused);
|
element(event ? PlayerStatus.playing : PlayerStatus.paused);
|
||||||
}
|
}
|
||||||
makeHeartBeat(_position.value.inSeconds, type: 'status');
|
if (videoPlayerController!.state.position.inSeconds != 0) {
|
||||||
|
makeHeartBeat(_position.value.inSeconds, type: 'status');
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
videoPlayerController!.stream.completed.listen((event) {
|
videoPlayerController!.stream.completed.listen((event) {
|
||||||
if (event) {
|
if (event) {
|
||||||
@ -510,6 +512,7 @@ class PlPlayerController {
|
|||||||
position = Duration.zero;
|
position = Duration.zero;
|
||||||
}
|
}
|
||||||
_position.value = position;
|
_position.value = position;
|
||||||
|
_heartDuration = position.inSeconds;
|
||||||
if (duration.value.inSeconds != 0) {
|
if (duration.value.inSeconds != 0) {
|
||||||
if (type != 'slider') {
|
if (type != 'slider') {
|
||||||
/// 拖动进度条调节时,不等待第一帧,防止抖动
|
/// 拖动进度条调节时,不等待第一帧,防止抖动
|
||||||
@ -814,6 +817,10 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleFullScreen(true);
|
toggleFullScreen(true);
|
||||||
|
bool isValid =
|
||||||
|
direction.value == 'vertical' || mode == FullScreenMode.vertical
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
var result = await showDialog(
|
var result = await showDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
useSafeArea: false,
|
useSafeArea: false,
|
||||||
@ -821,12 +828,10 @@ class PlPlayerController {
|
|||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
// 忽略手机安全区域
|
// 忽略手机安全区域
|
||||||
|
top: isValid,
|
||||||
left: false,
|
left: false,
|
||||||
right: false,
|
right: false,
|
||||||
bottom:
|
bottom: isValid,
|
||||||
direction.value == 'vertical' || mode == FullScreenMode.vertical
|
|
||||||
? true
|
|
||||||
: false,
|
|
||||||
child: PLVideoPlayer(
|
child: PLVideoPlayer(
|
||||||
controller: this,
|
controller: this,
|
||||||
headerControl: headerControl,
|
headerControl: headerControl,
|
||||||
@ -878,7 +883,7 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 记录播放记录
|
// 记录播放记录
|
||||||
Future makeHeartBeat(progress, {type = 'playing'}) async {
|
Future makeHeartBeat(int progress, {type = 'playing'}) async {
|
||||||
if (!_enableHeart) {
|
if (!_enableHeart) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -547,34 +547,38 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
),
|
),
|
||||||
|
|
||||||
// 头部、底部控制条
|
// 头部、底部控制条
|
||||||
Obx(
|
SafeArea(
|
||||||
() => Column(
|
top: false,
|
||||||
children: [
|
bottom: false,
|
||||||
if (widget.headerControl != null || _.headerControl != null)
|
child: Obx(
|
||||||
|
() => Column(
|
||||||
|
children: [
|
||||||
|
if (widget.headerControl != null || _.headerControl != null)
|
||||||
|
ClipRect(
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
child: AppBarAni(
|
||||||
|
controller: animationController,
|
||||||
|
visible: !_.controlsLock.value && _.showControls.value,
|
||||||
|
position: 'top',
|
||||||
|
child: widget.headerControl ?? _.headerControl!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
ClipRect(
|
ClipRect(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: AppBarAni(
|
child: AppBarAni(
|
||||||
controller: animationController,
|
controller: animationController,
|
||||||
visible: !_.controlsLock.value && _.showControls.value,
|
visible: !_.controlsLock.value && _.showControls.value,
|
||||||
position: 'top',
|
position: 'bottom',
|
||||||
child: widget.headerControl ?? _.headerControl!,
|
child: widget.bottomControl ??
|
||||||
|
BottomControl(
|
||||||
|
controller: widget.controller,
|
||||||
|
triggerFullScreen:
|
||||||
|
widget.controller.triggerFullScreen),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
],
|
||||||
ClipRect(
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
child: AppBarAni(
|
|
||||||
controller: animationController,
|
|
||||||
visible: !_.controlsLock.value && _.showControls.value,
|
|
||||||
position: 'bottom',
|
|
||||||
child: widget.bottomControl ??
|
|
||||||
BottomControl(
|
|
||||||
controller: widget.controller,
|
|
||||||
triggerFullScreen:
|
|
||||||
widget.controller.triggerFullScreen),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import 'package:pilipala/pages/html/index.dart';
|
|||||||
import 'package:pilipala/pages/later/index.dart';
|
import 'package:pilipala/pages/later/index.dart';
|
||||||
import 'package:pilipala/pages/liveRoom/view.dart';
|
import 'package:pilipala/pages/liveRoom/view.dart';
|
||||||
import 'package:pilipala/pages/member/index.dart';
|
import 'package:pilipala/pages/member/index.dart';
|
||||||
|
import 'package:pilipala/pages/member_search/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';
|
||||||
@ -86,6 +87,7 @@ class Routes {
|
|||||||
CustomGetPage(name: '/liveRoom', page: () => const LiveRoomPage()),
|
CustomGetPage(name: '/liveRoom', page: () => const LiveRoomPage()),
|
||||||
// 用户中心
|
// 用户中心
|
||||||
CustomGetPage(name: '/member', page: () => const MemberPage()),
|
CustomGetPage(name: '/member', page: () => const MemberPage()),
|
||||||
|
CustomGetPage(name: '/memberSearch', page: () => const MemberSearchPage()),
|
||||||
// 二级回复
|
// 二级回复
|
||||||
CustomGetPage(
|
CustomGetPage(
|
||||||
name: '/replyReply', page: () => const VideoReplyReplyPanel()),
|
name: '/replyReply', page: () => const VideoReplyReplyPanel()),
|
||||||
|
|||||||
@ -121,6 +121,7 @@ class SettingBoxKey {
|
|||||||
static const String enableWordRe = 'enableWordRe';
|
static const String enableWordRe = 'enableWordRe';
|
||||||
static const String enableSearchWord = 'enableSearchWord';
|
static const String enableSearchWord = 'enableSearchWord';
|
||||||
static const String enableRcmdDynamic = 'enableRcmdDynamic';
|
static const String enableRcmdDynamic = 'enableRcmdDynamic';
|
||||||
|
static const String enableSaveLastData = 'enableSaveLastData';
|
||||||
|
|
||||||
/// 外观
|
/// 外观
|
||||||
static const String themeMode = 'themeMode';
|
static const String themeMode = 'themeMode';
|
||||||
@ -129,6 +130,7 @@ class SettingBoxKey {
|
|||||||
static const String customColor = 'customColor'; // 自定义主题色
|
static const String customColor = 'customColor'; // 自定义主题色
|
||||||
static const String iosTransition = 'iosTransition'; // ios路由
|
static const String iosTransition = 'iosTransition'; // ios路由
|
||||||
static const String enableSingleRow = 'enableSingleRow'; // 首页单列
|
static const String enableSingleRow = 'enableSingleRow'; // 首页单列
|
||||||
|
static const String displayMode = 'displayMode';
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocalCacheKey {
|
class LocalCacheKey {
|
||||||
|
|||||||
@ -721,18 +721,18 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: loading_more_list
|
name: loading_more_list
|
||||||
sha256: aa680edc81cf024c394dccfa7ba1db701a5efb23ec1b8c657308428ce9da11d1
|
sha256: "6b49eb935345d6cf291e0367d3c238ef0a525a08b671ee41e09ee67d41888a7a"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.3"
|
version: "6.0.0"
|
||||||
loading_more_list_library:
|
loading_more_list_library:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: loading_more_list_library
|
name: loading_more_list_library
|
||||||
sha256: "31348925a98748ffe04f661e4b47df37103fabad39442064fcf59148a5fee2dd"
|
sha256: de6b57edbab83022180f053ec3f598dd5e1192cfd6a285882b8155e3cb5dc581
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "3.0.0"
|
||||||
logging:
|
logging:
|
||||||
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.7
|
version: 1.0.8
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.19.6 <3.0.0"
|
sdk: ">=2.19.6 <3.0.0"
|
||||||
@ -70,7 +70,7 @@ dependencies:
|
|||||||
# 解决sliver滑动不同步
|
# 解决sliver滑动不同步
|
||||||
extended_nested_scroll_view: ^6.1.2
|
extended_nested_scroll_view: ^6.1.2
|
||||||
# 上拉加载
|
# 上拉加载
|
||||||
loading_more_list: ^5.0.3
|
loading_more_list: ^6.0.0
|
||||||
# 下拉刷新
|
# 下拉刷新
|
||||||
pull_to_refresh_notification: ^3.0.1
|
pull_to_refresh_notification: ^3.0.1
|
||||||
# 图标
|
# 图标
|
||||||
|
|||||||
Reference in New Issue
Block a user