Compare commits
29 Commits
v1.0.10.10
...
feature-bu
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ece96df21 | |||
| c11c5695a2 | |||
| 93581c2932 | |||
| fd43a8cb31 | |||
| 6f34bacb64 | |||
| 90314f89ed | |||
| 45c53de2c2 | |||
| 5c07cb4545 | |||
| 844053b138 | |||
| 6af8b91f63 | |||
| 8aa02f7450 | |||
| 38a1f2e1f7 | |||
| b2e1d98f51 | |||
| e19cf92992 | |||
| 80e10aeaad | |||
| b1a9152a49 | |||
| 935b7577b3 | |||
| fd5c4463d2 | |||
| 7fcbe4dd9d | |||
| 9a0c9f4021 | |||
| 6b3773a074 | |||
| 7be8ebaa7e | |||
| 092b1cee3d | |||
| 252f39e8c7 | |||
| e631ca04a0 | |||
| 3665d6a0f6 | |||
| e3c9e8c13b | |||
| 39995bae23 | |||
| f42d0d01ea |
@ -1,4 +0,0 @@
|
|||||||
## 1.0.9
|
|
||||||
|
|
||||||
### 修复
|
|
||||||
+ 长按倍速抬起后未恢复默认倍速
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
## 1.0.8
|
|
||||||
|
|
||||||
直播弹幕、循环播放等功能开发中
|
|
||||||
|
|
||||||
### 新功能
|
|
||||||
+ 用户拉黑功能
|
|
||||||
+ gif图片保存
|
|
||||||
+ 删除已看历史记录
|
|
||||||
|
|
||||||
### 修复
|
|
||||||
+ 弹幕数量较少
|
|
||||||
+ 弹幕屏蔽设置自动记忆
|
|
||||||
+ 动态页面渲染
|
|
||||||
+ 用户主页数据错乱
|
|
||||||
+ 大家都在搜空白
|
|
||||||
+ 默认自动全屏,顶部操作栏丢失
|
|
||||||
|
|
||||||
|
|
||||||
### 优化
|
|
||||||
+ 全屏状态栏区域显示优化
|
|
||||||
+ 图片保存至PiliPala文件夹
|
|
||||||
|
|
||||||
更多更新日志可在Github上查看
|
|
||||||
问题反馈、功能建议请查看「关于」页面。
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
## 1.0.9
|
|
||||||
|
|
||||||
|
|
||||||
### 新功能
|
|
||||||
+ 自定义倍速、默认倍速
|
|
||||||
+ 历史记录搜索
|
|
||||||
+ 收藏夹搜索
|
|
||||||
+ 历史记录多选删除
|
|
||||||
+ 视频循环播放
|
|
||||||
+ 免登录看1080P
|
|
||||||
+ 评论区视频链接跳转
|
|
||||||
+ up主分组
|
|
||||||
+ up主投稿搜索
|
|
||||||
|
|
||||||
### 修复
|
|
||||||
+ 搜索视频标题乱码
|
|
||||||
+ 屏幕帧率
|
|
||||||
+ 动态页面渲染
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 优化
|
|
||||||
+ 快进手势
|
|
||||||
+ 视频简介链接匹配
|
|
||||||
+ 视频全屏时安全区域
|
|
||||||
|
|
||||||
更多更新日志可在Github上查看
|
|
||||||
问题反馈、功能建议请查看「关于」页面。
|
|
||||||
@ -1,8 +1,6 @@
|
|||||||
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
|
||||||
@ -14,6 +12,8 @@ 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,8 +28,6 @@ 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):
|
||||||
@ -54,18 +52,17 @@ 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`)
|
||||||
@ -85,8 +82,6 @@ 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:
|
||||||
@ -95,6 +90,8 @@ 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:
|
||||||
@ -107,8 +104,6 @@ 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:
|
||||||
@ -132,12 +127,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
|
||||||
@ -145,7 +140,6 @@ 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,47 +20,35 @@ 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) {
|
||||||
try {
|
String? imgUrl = extensionContext.attributes['src'];
|
||||||
Map attributes = extensionContext.attributes;
|
if (imgUrl!.startsWith('//')) {
|
||||||
List key = attributes.keys.toList();
|
imgUrl = 'https:$imgUrl';
|
||||||
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,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -75,13 +63,11 @@ class HtmlRender extends StatelessWidget {
|
|||||||
textDecoration: TextDecoration.none,
|
textDecoration: TextDecoration.none,
|
||||||
),
|
),
|
||||||
"p": Style(
|
"p": Style(
|
||||||
margin: Margins.only(bottom: 10),
|
margin: Margins.only(bottom: 0),
|
||||||
),
|
),
|
||||||
"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,
|
||||||
),
|
),
|
||||||
@ -89,7 +75,61 @@ class HtmlRender extends StatelessWidget {
|
|||||||
padding: HtmlPaddings.only(bottom: 4),
|
padding: HtmlPaddings.only(bottom: 4),
|
||||||
textAlign: TextAlign.justify,
|
textAlign: TextAlign.justify,
|
||||||
),
|
),
|
||||||
"img": Style(margin: Margins.only(top: 4, bottom: 4)),
|
"image": 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,
|
||||||
|
),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:pilipala/common/widgets/stat/danmu.dart';
|
|||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
import 'package:pilipala/http/search.dart';
|
import 'package:pilipala/http/search.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
|
import 'package:pilipala/pages/member/index.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
|
||||||
@ -33,9 +34,10 @@ class VideoCardH extends StatelessWidget {
|
|||||||
String heroTag = Utils.makeHeroTag(aid);
|
String heroTag = Utils.makeHeroTag(aid);
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
if (longPress != null) {
|
// if (longPress != null) {
|
||||||
longPress!();
|
// longPress!();
|
||||||
}
|
// }
|
||||||
|
MemberController().blockUser(videoItem.mid);
|
||||||
},
|
},
|
||||||
// onLongPressEnd: (details) {
|
// onLongPressEnd: (details) {
|
||||||
// if (longPressEnd != null) {
|
// if (longPressEnd != null) {
|
||||||
@ -188,46 +190,7 @@ class VideoContent extends StatelessWidget {
|
|||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
StatView(
|
|
||||||
theme: 'gray',
|
|
||||||
view: videoItem.stat.view,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
StatDanMu(
|
|
||||||
theme: 'gray',
|
|
||||||
danmu: videoItem.stat.danmaku,
|
|
||||||
),
|
|
||||||
// Text(
|
|
||||||
// Utils.dateFormat(videoItem.pubdate!),
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 11,
|
|
||||||
// color: Theme.of(context).colorScheme.outline),
|
|
||||||
// )
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
// SizedBox(
|
|
||||||
// width: 20,
|
|
||||||
// height: 20,
|
|
||||||
// child: IconButton(
|
|
||||||
// tooltip: '稍后再看',
|
|
||||||
// style: ButtonStyle(
|
|
||||||
// padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
||||||
// ),
|
|
||||||
// onPressed: () async {
|
|
||||||
// var res =
|
|
||||||
// await UserHttp.toViewLater(bvid: videoItem.bvid);
|
|
||||||
// SmartDialog.showToast(res['msg']);
|
|
||||||
// },
|
|
||||||
// icon: Icon(
|
|
||||||
// Icons.more_vert_outlined,
|
|
||||||
// color: Theme.of(context).colorScheme.outline,
|
|
||||||
// size: 14,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
if (source == 'normal')
|
if (source == 'normal')
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 24,
|
width: 24,
|
||||||
@ -261,6 +224,20 @@ class VideoContent extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// PopupMenuItem<String>(
|
||||||
|
// onTap: () async {
|
||||||
|
// MemberController().blockUser(videoItem.mid);
|
||||||
|
// },
|
||||||
|
// value: 'block',
|
||||||
|
// height: 35,
|
||||||
|
// child: const Row(
|
||||||
|
// children: [
|
||||||
|
// Icon(Icons.block, size: 16),
|
||||||
|
// SizedBox(width: 6),
|
||||||
|
// Text('拉黑up', style: TextStyle(fontSize: 13))
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import 'package:pilipala/common/constants.dart';
|
|||||||
import 'package:pilipala/common/widgets/badge.dart';
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
import 'package:pilipala/http/dynamics.dart';
|
|
||||||
import 'package:pilipala/http/search.dart';
|
import 'package:pilipala/http/search.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/models/common/search_type.dart';
|
import 'package:pilipala/models/common/search_type.dart';
|
||||||
@ -28,11 +27,6 @@ class VideoCardV extends StatelessWidget {
|
|||||||
this.longPressEnd,
|
this.longPressEnd,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
bool isStringNumeric(String str) {
|
|
||||||
RegExp numericRegex = RegExp(r'^\d+$');
|
|
||||||
return numericRegex.hasMatch(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void onPushDetail(heroTag) async {
|
void onPushDetail(heroTag) async {
|
||||||
String goto = videoItem.goto;
|
String goto = videoItem.goto;
|
||||||
switch (goto) {
|
switch (goto) {
|
||||||
@ -54,7 +48,7 @@ class VideoCardV extends StatelessWidget {
|
|||||||
arguments: {
|
arguments: {
|
||||||
'pic': videoItem.pic,
|
'pic': videoItem.pic,
|
||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
'videoType': SearchType.media_bangumi,
|
// 'videoType': SearchType.media_bangumi,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -68,39 +62,6 @@ class VideoCardV extends StatelessWidget {
|
|||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
// 动态
|
|
||||||
case 'picture':
|
|
||||||
String dynamicType = 'picture';
|
|
||||||
String uri = videoItem.uri;
|
|
||||||
if (videoItem.uri.contains('bilibili://article/')) {
|
|
||||||
dynamicType = 'article';
|
|
||||||
RegExp regex = RegExp(r'\d+');
|
|
||||||
Match match = regex.firstMatch(videoItem.uri)!;
|
|
||||||
String matchedNumber = match.group(0)!;
|
|
||||||
videoItem.param = 'cv' + matchedNumber;
|
|
||||||
}
|
|
||||||
if (uri.startsWith('http')) {
|
|
||||||
String path = Uri.parse(uri).path;
|
|
||||||
if (isStringNumeric(path.split('/')[1])) {
|
|
||||||
// 请求接口
|
|
||||||
var res = await DynamicsHttp.dynamicDetail(id: path.split('/')[1]);
|
|
||||||
if (res['status']) {
|
|
||||||
Get.toNamed('/dynamicDetail', arguments: {
|
|
||||||
'item': res['data'],
|
|
||||||
'floor': 1,
|
|
||||||
'action': 'detail'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Get.toNamed('/htmlRender', parameters: {
|
|
||||||
'url': uri,
|
|
||||||
'title': videoItem.title,
|
|
||||||
'id': videoItem.param.toString(),
|
|
||||||
'dynamicType': dynamicType
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
SmartDialog.showToast(videoItem.goto);
|
SmartDialog.showToast(videoItem.goto);
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
@ -317,18 +278,23 @@ class VideoStat extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return RichText(
|
return Row(
|
||||||
maxLines: 1,
|
children: [
|
||||||
text: TextSpan(
|
Text(
|
||||||
style: TextStyle(
|
'${videoItem.stat.view}观看',
|
||||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.outline,
|
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
children: [
|
Text(
|
||||||
TextSpan(text: '${videoItem.stat.view}观看'),
|
' • ${videoItem.stat.danmu}弹幕',
|
||||||
TextSpan(text: ' • ${videoItem.stat.danmu}弹幕'),
|
style: TextStyle(
|
||||||
],
|
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||||
),
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,9 +97,6 @@ class Api {
|
|||||||
// 操作用户关系
|
// 操作用户关系
|
||||||
static const String relationMod = '/x/relation/modify';
|
static const String relationMod = '/x/relation/modify';
|
||||||
|
|
||||||
// 相互关系查询
|
|
||||||
static const String relationSearch = '/x/space/wbi/acc/relation';
|
|
||||||
|
|
||||||
// 评论列表
|
// 评论列表
|
||||||
// https://api.bilibili.com/x/v2/reply/main?csrf=6e22efc1a47225ea25f901f922b5cfdd&mode=3&oid=254175381&pagination_str=%7B%22offset%22:%22%22%7D&plat=1&seek_rpid=0&type=11
|
// https://api.bilibili.com/x/v2/reply/main?csrf=6e22efc1a47225ea25f901f922b5cfdd&mode=3&oid=254175381&pagination_str=%7B%22offset%22:%22%22%7D&plat=1&seek_rpid=0&type=11
|
||||||
static const String replyList = '/x/v2/reply';
|
static const String replyList = '/x/v2/reply';
|
||||||
@ -129,14 +126,12 @@ class Api {
|
|||||||
static const String userFavFolder = '/x/v3/fav/folder/created/list';
|
static const String userFavFolder = '/x/v3/fav/folder/created/list';
|
||||||
|
|
||||||
/// 收藏夹 详情
|
/// 收藏夹 详情
|
||||||
/// media_id 当前收藏夹id 搜索全部时为默认收藏夹id
|
/// media_id int 收藏夹id
|
||||||
/// pn int 当前页
|
/// pn int 当前页
|
||||||
/// ps int pageSize
|
/// ps int pageSize
|
||||||
/// keyword String 搜索词
|
/// keyword String 搜索词
|
||||||
/// order String 排序方式 view 最多播放 mtime 最近收藏 pubtime 最近投稿
|
/// order String 排序方式 view 最多播放 mtime 最近收藏 pubtime 最近投稿
|
||||||
/// tid int 分区id
|
/// tid int 分区id
|
||||||
/// platform web
|
|
||||||
/// type 0 当前收藏夹 1 全部收藏夹
|
|
||||||
// https://api.bilibili.com/x/v3/fav/resource/list?media_id=76614671&pn=1&ps=20&keyword=&order=mtime&type=0&tid=0
|
// https://api.bilibili.com/x/v3/fav/resource/list?media_id=76614671&pn=1&ps=20&keyword=&order=mtime&type=0&tid=0
|
||||||
static const String userFavFolderDetail = '/x/v3/fav/resource/list';
|
static const String userFavFolderDetail = '/x/v3/fav/resource/list';
|
||||||
|
|
||||||
@ -172,9 +167,6 @@ class Api {
|
|||||||
// 删除某条历史记录
|
// 删除某条历史记录
|
||||||
static const String delHistory = '/x/v2/history/delete';
|
static const String delHistory = '/x/v2/history/delete';
|
||||||
|
|
||||||
// 搜索历史记录
|
|
||||||
static const String searchHistory = '/x/web-goblin/history/search';
|
|
||||||
|
|
||||||
// 热搜
|
// 热搜
|
||||||
static const String hotSearchList =
|
static const String hotSearchList =
|
||||||
'https://s.search.bilibili.com/main/hotword';
|
'https://s.search.bilibili.com/main/hotword';
|
||||||
@ -312,19 +304,6 @@ class Api {
|
|||||||
|
|
||||||
static const String webDanmaku = '/x/v2/dm/web/seg.so';
|
static const String webDanmaku = '/x/v2/dm/web/seg.so';
|
||||||
|
|
||||||
// up主分组
|
// 搜索历史记录
|
||||||
static const String followUpTag = '/x/relation/tags';
|
static const String searchHistory = '/x/web-goblin/history/search';
|
||||||
|
|
||||||
// 设置Up主分组
|
|
||||||
// 0 添加至默认分组 否则使用,分割tagid
|
|
||||||
static const String addUsers = '/x/relation/tags/addUsers';
|
|
||||||
|
|
||||||
// 获取指定分组下的up
|
|
||||||
static const String followUpGroup = '/x/relation/tag';
|
|
||||||
|
|
||||||
// 获取某个动态详情
|
|
||||||
// timezone_offset=-480
|
|
||||||
// id=849312409672744983
|
|
||||||
// features=itemOpusStyle
|
|
||||||
static const String dynamicDetail = '/x/polymer/web-dynamic/v1/detail';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,37 +2,4 @@ class HttpString {
|
|||||||
static const String baseUrl = 'https://www.bilibili.com';
|
static const String baseUrl = 'https://www.bilibili.com';
|
||||||
static const String baseApiUrl = 'https://api.bilibili.com';
|
static const String baseApiUrl = 'https://api.bilibili.com';
|
||||||
static const String tUrl = 'https://api.vc.bilibili.com';
|
static const String tUrl = 'https://api.vc.bilibili.com';
|
||||||
static const List<int> validateStatusCodes = [
|
|
||||||
302,
|
|
||||||
304,
|
|
||||||
307,
|
|
||||||
400,
|
|
||||||
401,
|
|
||||||
403,
|
|
||||||
404,
|
|
||||||
405,
|
|
||||||
409,
|
|
||||||
412,
|
|
||||||
500,
|
|
||||||
503,
|
|
||||||
504,
|
|
||||||
509,
|
|
||||||
616,
|
|
||||||
617,
|
|
||||||
625,
|
|
||||||
626,
|
|
||||||
628,
|
|
||||||
629,
|
|
||||||
632,
|
|
||||||
643,
|
|
||||||
650,
|
|
||||||
652,
|
|
||||||
658,
|
|
||||||
662,
|
|
||||||
688,
|
|
||||||
689,
|
|
||||||
701,
|
|
||||||
799,
|
|
||||||
8888
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,11 +17,17 @@ class DanmakaHttp {
|
|||||||
'oid': cid,
|
'oid': cid,
|
||||||
'segment_index': segmentIndex,
|
'segment_index': segmentIndex,
|
||||||
};
|
};
|
||||||
var response = await Request().get(
|
|
||||||
Api.webDanmaku,
|
// 计算函数
|
||||||
data: params,
|
Future<DmSegMobileReply> computeTask(Map<String, int> params) async {
|
||||||
extra: {'resType': ResponseType.bytes},
|
var response = await Request().get(
|
||||||
);
|
Api.webDanmaku,
|
||||||
return DmSegMobileReply.fromBuffer(response.data);
|
data: params,
|
||||||
|
extra: {'resType': ResponseType.bytes},
|
||||||
|
);
|
||||||
|
return DmSegMobileReply.fromBuffer(response.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await compute(computeTask, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,6 @@ class DynamicsHttp {
|
|||||||
'data': DynamicsDataModel.fromJson(res.data['data']),
|
'data': DynamicsDataModel.fromJson(res.data['data']),
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
print(err);
|
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': [],
|
'data': [],
|
||||||
@ -86,35 +85,4 @@ class DynamicsHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
static Future dynamicDetail({
|
|
||||||
String? id,
|
|
||||||
}) async {
|
|
||||||
var res = await Request().get(Api.dynamicDetail, data: {
|
|
||||||
'timezone_offset': -480,
|
|
||||||
'id': id,
|
|
||||||
'features': 'itemOpusStyle',
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
try {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': DynamicItemModel.fromJson(res.data['data']['item']),
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': err.toString(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,101 +3,38 @@ import 'package:html/parser.dart';
|
|||||||
import 'package:pilipala/http/index.dart';
|
import 'package:pilipala/http/index.dart';
|
||||||
|
|
||||||
class HtmlHttp {
|
class HtmlHttp {
|
||||||
// article
|
static Future reqHtml(id) async {
|
||||||
static Future reqHtml(id, dynamicType) async {
|
var response = await Request().get("https://www.bilibili.com/opus/$id");
|
||||||
var response = await Request().get(
|
|
||||||
"https://www.bilibili.com/opus/$id",
|
|
||||||
extra: {'ua': 'pc'},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.data.contains('Redirecting to')) {
|
|
||||||
RegExp regex = RegExp(r'//([\w\.]+)/(\w+)/(\w+)');
|
|
||||||
Match match = regex.firstMatch(response.data)!;
|
|
||||||
String matchedString = match.group(0)!;
|
|
||||||
response = await Request().get(
|
|
||||||
'https:$matchedString' + '/',
|
|
||||||
extra: {'ua': 'pc'},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Document rootTree = parse(response.data);
|
|
||||||
// log(response.data.body.toString());
|
|
||||||
Element body = rootTree.body!;
|
|
||||||
Element appDom = body.querySelector('#app')!;
|
|
||||||
Element authorHeader = appDom.querySelector('.fixed-author-header')!;
|
|
||||||
// 头像
|
|
||||||
String avatar = authorHeader.querySelector('img')!.attributes['src']!;
|
|
||||||
avatar = 'https:${avatar.split('@')[0]}';
|
|
||||||
String uname = authorHeader
|
|
||||||
.querySelector('.fixed-author-header__author__name')!
|
|
||||||
.text;
|
|
||||||
|
|
||||||
// 动态详情
|
|
||||||
Element opusDetail = appDom.querySelector('.opus-detail')!;
|
|
||||||
// 发布时间
|
|
||||||
String updateTime =
|
|
||||||
opusDetail.querySelector('.opus-module-author__pub__text')!.text;
|
|
||||||
//
|
|
||||||
String opusContent =
|
|
||||||
opusDetail.querySelector('.opus-module-content')!.innerHtml;
|
|
||||||
String test = opusDetail
|
|
||||||
.querySelector('.horizontal-scroll-album__pic__img')!
|
|
||||||
.innerHtml;
|
|
||||||
String commentId = opusDetail
|
|
||||||
.querySelector('.bili-comment-container')!
|
|
||||||
.className
|
|
||||||
.split(' ')[1]
|
|
||||||
.split('-')[2];
|
|
||||||
// List imgList = opusDetail.querySelectorAll('bili-album__preview__picture__img');
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'avatar': avatar,
|
|
||||||
'uname': uname,
|
|
||||||
'updateTime': updateTime,
|
|
||||||
'content': test + opusContent,
|
|
||||||
'commentId': int.parse(commentId)
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
print('err: $err');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
Document rootTree = parse(response.data);
|
||||||
Element body = rootTree.body!;
|
Element body = rootTree.body!;
|
||||||
Element appDom = body.querySelector('#app')!;
|
Element appDom = body.querySelector('#app')!;
|
||||||
Element authorHeader = appDom.querySelector('.up-left')!;
|
Element authorHeader = appDom.querySelector('.fixed-author-header')!;
|
||||||
// 头像
|
// 头像
|
||||||
// String avatar =
|
String avatar = authorHeader.querySelector('img')!.attributes['src']!;
|
||||||
// authorHeader.querySelector('.bili-avatar-img')!.attributes['data-src']!;
|
avatar = 'https:${avatar.split('@')[0]}';
|
||||||
// print(avatar);
|
String uname =
|
||||||
// avatar = 'https:${avatar.split('@')[0]}';
|
authorHeader.querySelector('.fixed-author-header__author__name')!.text;
|
||||||
String uname = authorHeader.querySelector('.up-name')!.text.trim();
|
|
||||||
// 动态详情
|
// 动态详情
|
||||||
Element opusDetail = appDom.querySelector('.article-content')!;
|
Element opusDetail = appDom.querySelector('.opus-detail')!;
|
||||||
// 发布时间
|
// 发布时间
|
||||||
// String updateTime =
|
String updateTime =
|
||||||
// opusDetail.querySelector('.opus-module-author__pub__text')!.text;
|
opusDetail.querySelector('.opus-module-author__pub__text')!.text;
|
||||||
// print(updateTime);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
String opusContent =
|
String opusContent =
|
||||||
opusDetail.querySelector('#read-article-holder')!.innerHtml;
|
opusDetail.querySelector('.opus-module-content')!.innerHtml;
|
||||||
RegExp digitRegExp = RegExp(r'\d+');
|
String commentId = opusDetail
|
||||||
Iterable<Match> matches = digitRegExp.allMatches(id);
|
.querySelector('.bili-comment-container')!
|
||||||
String number = matches.first.group(0)!;
|
.className
|
||||||
|
.split(' ')[1]
|
||||||
|
.split('-')[2];
|
||||||
|
// List imgList = opusDetail.querySelectorAll('bili-album__preview__picture__img');
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
'avatar': '',
|
'avatar': avatar,
|
||||||
'uname': uname,
|
'uname': uname,
|
||||||
'updateTime': '',
|
'updateTime': updateTime,
|
||||||
'content': opusContent,
|
'content': opusContent,
|
||||||
'commentId': int.parse(number)
|
'commentId': commentId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import 'dart:io';
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:cookie_jar/cookie_jar.dart';
|
import 'package:cookie_jar/cookie_jar.dart';
|
||||||
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
@ -60,6 +59,9 @@ class Request {
|
|||||||
static Future<String> getCsrf() async {
|
static Future<String> getCsrf() async {
|
||||||
var cookies = await cookieManager.cookieJar
|
var cookies = await cookieManager.cookieJar
|
||||||
.loadForRequest(Uri.parse(HttpString.baseApiUrl));
|
.loadForRequest(Uri.parse(HttpString.baseApiUrl));
|
||||||
|
// for (var i in cookies) {
|
||||||
|
// print(i);
|
||||||
|
// }
|
||||||
String token = '';
|
String token = '';
|
||||||
if (cookies.where((e) => e.name == 'bili_jct').isNotEmpty) {
|
if (cookies.where((e) => e.name == 'bili_jct').isNotEmpty) {
|
||||||
token = cookies.firstWhere((e) => e.name == 'bili_jct').value;
|
token = cookies.firstWhere((e) => e.name == 'bili_jct').value;
|
||||||
@ -89,18 +91,15 @@ class Request {
|
|||||||
//响应流上前后两次接受到数据的间隔,单位为毫秒。
|
//响应流上前后两次接受到数据的间隔,单位为毫秒。
|
||||||
receiveTimeout: const Duration(milliseconds: 12000),
|
receiveTimeout: const Duration(milliseconds: 12000),
|
||||||
//Http请求头.
|
//Http请求头.
|
||||||
headers: {},
|
headers: {
|
||||||
|
'keep-alive': true,
|
||||||
|
'user-agent': headerUa('pc'),
|
||||||
|
'Accept-Encoding': 'gzip'
|
||||||
|
},
|
||||||
|
persistentConnection: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
dio = Dio(options)
|
dio = Dio(options);
|
||||||
|
|
||||||
/// fix 第三方登录 302重定向 跟iOS代理问题冲突
|
|
||||||
..httpClientAdapter = Http2Adapter(
|
|
||||||
ConnectionManager(
|
|
||||||
idleTimeout: const Duration(milliseconds: 10000),
|
|
||||||
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
//添加拦截器
|
//添加拦截器
|
||||||
dio.interceptors.add(ApiInterceptor());
|
dio.interceptors.add(ApiInterceptor());
|
||||||
@ -114,26 +113,30 @@ class Request {
|
|||||||
|
|
||||||
dio.transformer = BackgroundTransformer();
|
dio.transformer = BackgroundTransformer();
|
||||||
dio.options.validateStatus = (status) {
|
dio.options.validateStatus = (status) {
|
||||||
return status! >= 200 && status < 300 ||
|
return status! >= 200 && status < 300 || status == 304 || status == 302;
|
||||||
HttpString.validateStatusCodes.contains(status);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get请求
|
* get请求
|
||||||
*/
|
*/
|
||||||
get(url, {data, options, cancelToken, extra}) async {
|
get(url, {data, cacheOptions, options, cancelToken, extra}) async {
|
||||||
Response response;
|
Response response;
|
||||||
Options options = Options();
|
Options options;
|
||||||
|
String ua = 'pc';
|
||||||
ResponseType resType = ResponseType.json;
|
ResponseType resType = ResponseType.json;
|
||||||
if (extra != null) {
|
if (extra != null) {
|
||||||
|
ua = extra!['ua'] ?? 'pc';
|
||||||
resType = extra!['resType'] ?? ResponseType.json;
|
resType = extra!['resType'] ?? ResponseType.json;
|
||||||
if (extra['ua'] != null) {
|
|
||||||
options.headers = {'user-agent': headerUa(type: extra['ua'])};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
options.responseType = resType;
|
if (cacheOptions != null) {
|
||||||
|
cacheOptions.headers = {'user-agent': headerUa(ua)};
|
||||||
|
options = cacheOptions;
|
||||||
|
} else {
|
||||||
|
options = Options();
|
||||||
|
options.headers = {'user-agent': headerUa(ua)};
|
||||||
|
options.responseType = resType;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
response = await dio.get(
|
response = await dio.get(
|
||||||
url,
|
url,
|
||||||
@ -200,19 +203,15 @@ class Request {
|
|||||||
token.cancel("cancelled");
|
token.cancel("cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
String headerUa({type = 'mob'}) {
|
String headerUa(ua) {
|
||||||
String headerUa = '';
|
String headerUa = '';
|
||||||
if (type == 'mob') {
|
if (ua == 'mob') {
|
||||||
if (Platform.isIOS) {
|
headerUa = Platform.isIOS
|
||||||
headerUa =
|
? 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'
|
||||||
'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';
|
: 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36';
|
||||||
} 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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15';
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_3_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15';
|
||||||
}
|
}
|
||||||
return headerUa;
|
return headerUa;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,10 +46,7 @@ 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(
|
SmartDialog.showToast(await dioError(err));
|
||||||
await dioError(err),
|
|
||||||
displayType: SmartToastType.onlyRefresh,
|
|
||||||
);
|
|
||||||
super.onError(err, handler);
|
super.onError(err, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import 'package:pilipala/http/index.dart';
|
import 'package:pilipala/http/index.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/models/follow/result.dart';
|
|
||||||
import 'package:pilipala/models/member/archive.dart';
|
import 'package:pilipala/models/member/archive.dart';
|
||||||
import 'package:pilipala/models/member/info.dart';
|
import 'package:pilipala/models/member/info.dart';
|
||||||
import 'package:pilipala/models/member/tags.dart';
|
|
||||||
import 'package:pilipala/utils/wbi_sign.dart';
|
import 'package:pilipala/utils/wbi_sign.dart';
|
||||||
|
|
||||||
class MemberHttp {
|
class MemberHttp {
|
||||||
@ -20,7 +18,6 @@ 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 {
|
||||||
@ -86,7 +83,6 @@ 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 {
|
||||||
@ -146,73 +142,4 @@ class MemberHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询分组
|
|
||||||
static Future followUpTags() async {
|
|
||||||
var res = await Request().get(Api.followUpTag);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data']
|
|
||||||
.map<MemberTagItemModel>((e) => MemberTagItemModel.fromJson(e))
|
|
||||||
.toList()
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置分组
|
|
||||||
static Future addUsers(int? fids, String? tagids) async {
|
|
||||||
var res = await Request().post(Api.addUsers, queryParameters: {
|
|
||||||
'fids': fids,
|
|
||||||
'tagids': tagids ?? '0',
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
}, data: {
|
|
||||||
'cross_domain': true
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {'status': true, 'data': [], 'msg': '操作成功'};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取某分组下的up
|
|
||||||
static Future followUpGroup(
|
|
||||||
int? mid,
|
|
||||||
int? tagid,
|
|
||||||
int? pn,
|
|
||||||
int? ps,
|
|
||||||
) async {
|
|
||||||
var res = await Request().get(Api.followUpGroup, data: {
|
|
||||||
'mid': mid,
|
|
||||||
'tagid': tagid,
|
|
||||||
'pn': pn,
|
|
||||||
'ps': ps,
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
// FollowItemModel
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data']
|
|
||||||
.map<FollowItemModel>((e) => FollowItemModel.fromJson(e))
|
|
||||||
.toList()
|
|
||||||
};
|
|
||||||
} 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主已关闭评论区',
|
||||||
};
|
};
|
||||||
|
|||||||
@ -39,16 +39,25 @@ class SearchHttp {
|
|||||||
static Future searchSuggest({required term}) async {
|
static Future searchSuggest({required term}) async {
|
||||||
var res = await Request().get(Api.serachSuggest,
|
var res = await Request().get(Api.serachSuggest,
|
||||||
data: {'term': term, 'main_ver': 'v1', 'highlight': term});
|
data: {'term': term, 'main_ver': 'v1', 'highlight': term});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data is String) {
|
||||||
if (res.data['result'] is Map) {
|
Map<String, dynamic> resultMap = json.decode(res.data);
|
||||||
res.data['result']['term'] = term;
|
if (resultMap['code'] == 0) {
|
||||||
|
if (resultMap['result'] is Map) {
|
||||||
|
resultMap['result']['term'] = term;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': resultMap['result'] is Map
|
||||||
|
? SearchSuggestModel.fromJson(resultMap['result'])
|
||||||
|
: [],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': '请求错误 🙅',
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['result'] is Map
|
|
||||||
? SearchSuggestModel.fromJson(res.data['result'])
|
|
||||||
: [],
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import 'package:pilipala/models/user/fav_folder.dart';
|
|||||||
import 'package:pilipala/models/user/history.dart';
|
import 'package:pilipala/models/user/history.dart';
|
||||||
import 'package:pilipala/models/user/info.dart';
|
import 'package:pilipala/models/user/info.dart';
|
||||||
import 'package:pilipala/models/user/stat.dart';
|
import 'package:pilipala/models/user/stat.dart';
|
||||||
import 'package:pilipala/utils/wbi_sign.dart';
|
|
||||||
|
|
||||||
class UserHttp {
|
class UserHttp {
|
||||||
static Future<dynamic> userStat({required int mid}) async {
|
static Future<dynamic> userStat({required int mid}) async {
|
||||||
@ -71,15 +70,14 @@ class UserHttp {
|
|||||||
required int pn,
|
required int pn,
|
||||||
required int ps,
|
required int ps,
|
||||||
String keyword = '',
|
String keyword = '',
|
||||||
String order = 'mtime',
|
String order = 'mtime'}) async {
|
||||||
int type = 0}) async {
|
|
||||||
var res = await Request().get(Api.userFavFolderDetail, data: {
|
var res = await Request().get(Api.userFavFolderDetail, data: {
|
||||||
'media_id': mediaId,
|
'media_id': mediaId,
|
||||||
'pn': pn,
|
'pn': pn,
|
||||||
'ps': ps,
|
'ps': ps,
|
||||||
'keyword': keyword,
|
'keyword': keyword,
|
||||||
'order': order,
|
'order': order,
|
||||||
'type': type,
|
'type': 0,
|
||||||
'tid': 0,
|
'tid': 0,
|
||||||
'platform': 'web'
|
'platform': 'web'
|
||||||
});
|
});
|
||||||
@ -251,31 +249,6 @@ class UserHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 相互关系查询
|
|
||||||
static Future relationSearch(int mid) async {
|
|
||||||
Map params = await WbiSign().makSign({
|
|
||||||
'mid': mid,
|
|
||||||
'token': '',
|
|
||||||
'platform': 'web',
|
|
||||||
'web_location': 1550101,
|
|
||||||
});
|
|
||||||
var res = await Request().get(
|
|
||||||
Api.relationSearch,
|
|
||||||
data: {
|
|
||||||
'mid': mid,
|
|
||||||
'w_rid': params['w_rid'],
|
|
||||||
'wts': params['wts'],
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
// relation 主动状态
|
|
||||||
// 被动状态
|
|
||||||
return {'status': true, 'data': res.data['data']};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 搜索历史记录
|
// 搜索历史记录
|
||||||
static Future searchHistory(
|
static Future searchHistory(
|
||||||
{required int pn, required String keyword}) async {
|
{required int pn, required String keyword}) async {
|
||||||
|
|||||||
@ -22,7 +22,6 @@ class VideoHttp {
|
|||||||
static Box setting = GStrorage.setting;
|
static Box setting = GStrorage.setting;
|
||||||
static bool enableRcmdDynamic =
|
static bool enableRcmdDynamic =
|
||||||
setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
|
setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
|
||||||
static Box userInfoCache = GStrorage.userInfo;
|
|
||||||
|
|
||||||
// 首页推荐视频
|
// 首页推荐视频
|
||||||
static Future rcmdVideoList({required int ps, required int freshIdx}) async {
|
static Future rcmdVideoList({required int ps, required int freshIdx}) async {
|
||||||
@ -134,11 +133,6 @@ class VideoHttp {
|
|||||||
// 'platform': '',
|
// 'platform': '',
|
||||||
// 'high_quality': ''
|
// 'high_quality': ''
|
||||||
};
|
};
|
||||||
// 免登录查看1080p
|
|
||||||
if (userInfoCache.get('userInfoCache') == null &&
|
|
||||||
setting.get(SettingBoxKey.p1080, defaultValue: true)) {
|
|
||||||
data['try_look'] = 1;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
var res = await Request().get(Api.videoUrl, data: data);
|
var res = await Request().get(Api.videoUrl, data: data);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
|
|||||||
@ -1,7 +1,4 @@
|
|||||||
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';
|
||||||
@ -64,23 +61,6 @@ 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;
|
||||||
|
|||||||
@ -244,9 +244,7 @@ class Vote {
|
|||||||
choiceCnt = json['choice_cnt'];
|
choiceCnt = json['choice_cnt'];
|
||||||
share = json['share'];
|
share = json['share'];
|
||||||
defaultShare = json['default_share'];
|
defaultShare = json['default_share'];
|
||||||
endTime = json['end_time'] is int
|
endTime = json['end_time'];
|
||||||
? json['end_time']
|
|
||||||
: int.parse(json['end_time']);
|
|
||||||
joinNum = json['join_num'];
|
joinNum = json['join_num'];
|
||||||
status = json['status'];
|
status = json['status'];
|
||||||
type = json['type'];
|
type = json['type'];
|
||||||
|
|||||||
@ -8,7 +8,7 @@ class FollowDataModel {
|
|||||||
List<FollowItemModel>? list;
|
List<FollowItemModel>? list;
|
||||||
|
|
||||||
FollowDataModel.fromJson(Map<String, dynamic> json) {
|
FollowDataModel.fromJson(Map<String, dynamic> json) {
|
||||||
total = json['total'] ?? 0;
|
total = json['total'];
|
||||||
list = json['list']
|
list = json['list']
|
||||||
.map<FollowItemModel>((e) => FollowItemModel.fromJson(e))
|
.map<FollowItemModel>((e) => FollowItemModel.fromJson(e))
|
||||||
.toList();
|
.toList();
|
||||||
@ -19,7 +19,7 @@ class FollowItemModel {
|
|||||||
FollowItemModel({
|
FollowItemModel({
|
||||||
this.mid,
|
this.mid,
|
||||||
this.attribute,
|
this.attribute,
|
||||||
// this.mtime,
|
this.mtime,
|
||||||
this.tag,
|
this.tag,
|
||||||
this.special,
|
this.special,
|
||||||
this.uname,
|
this.uname,
|
||||||
@ -30,7 +30,7 @@ class FollowItemModel {
|
|||||||
|
|
||||||
int? mid;
|
int? mid;
|
||||||
int? attribute;
|
int? attribute;
|
||||||
// int? mtime;
|
int? mtime;
|
||||||
List? tag;
|
List? tag;
|
||||||
int? special;
|
int? special;
|
||||||
String? uname;
|
String? uname;
|
||||||
@ -41,7 +41,7 @@ class FollowItemModel {
|
|||||||
FollowItemModel.fromJson(Map<String, dynamic> json) {
|
FollowItemModel.fromJson(Map<String, dynamic> json) {
|
||||||
mid = json['mid'];
|
mid = json['mid'];
|
||||||
attribute = json['attribute'];
|
attribute = json['attribute'];
|
||||||
// mtime = json['mtime'];
|
mtime = json['mtime'];
|
||||||
tag = json['tag'];
|
tag = json['tag'];
|
||||||
special = json['special'];
|
special = json['special'];
|
||||||
uname = json['uname'];
|
uname = json['uname'];
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
class MemberTagItemModel {
|
|
||||||
MemberTagItemModel({
|
|
||||||
this.count,
|
|
||||||
this.name,
|
|
||||||
this.tagid,
|
|
||||||
this.tip,
|
|
||||||
this.checked,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? count;
|
|
||||||
String? name;
|
|
||||||
int? tagid;
|
|
||||||
String? tip;
|
|
||||||
bool? checked;
|
|
||||||
|
|
||||||
MemberTagItemModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
count = json['count'];
|
|
||||||
name = json['name'];
|
|
||||||
tagid = json['tagid'];
|
|
||||||
tip = json['tip'];
|
|
||||||
checked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -184,7 +184,7 @@ class AboutController extends GetxController {
|
|||||||
|
|
||||||
// 获取远程版本
|
// 获取远程版本
|
||||||
Future getRemoteApp() async {
|
Future getRemoteApp() async {
|
||||||
var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'});
|
var result = await Request().get(Api.latestApp);
|
||||||
data = LatestDataModel.fromJson(result.data);
|
data = LatestDataModel.fromJson(result.data);
|
||||||
remoteAppInfo = data;
|
remoteAppInfo = data;
|
||||||
remoteVersion.value = data.tagName!;
|
remoteVersion.value = data.tagName!;
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class BangumiIntroController extends GetxController {
|
|||||||
? int.parse(Get.parameters['seasonId']!)
|
? int.parse(Get.parameters['seasonId']!)
|
||||||
: null;
|
: null;
|
||||||
var epId = Get.parameters['epId'] != null
|
var epId = Get.parameters['epId'] != null
|
||||||
? int.tryParse(Get.parameters['epId']!)
|
? int.parse(Get.parameters['epId']!)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
// 是否预渲染 骨架屏
|
// 是否预渲染 骨架屏
|
||||||
@ -258,7 +258,7 @@ class BangumiIntroController extends GetxController {
|
|||||||
VideoDetailController videoDetailCtr =
|
VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
||||||
videoDetailCtr.bvid = bvid;
|
videoDetailCtr.bvid = bvid;
|
||||||
videoDetailCtr.cid.value = cid;
|
videoDetailCtr.cid = cid;
|
||||||
videoDetailCtr.danmakuCid.value = cid;
|
videoDetailCtr.danmakuCid.value = cid;
|
||||||
videoDetailCtr.queryVideoUrl();
|
videoDetailCtr.queryVideoUrl();
|
||||||
// 重新请求评论
|
// 重新请求评论
|
||||||
|
|||||||
@ -34,12 +34,10 @@ class BangumiIntroPanel extends StatefulWidget {
|
|||||||
|
|
||||||
class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
late BangumiIntroController bangumiIntroController;
|
final BangumiIntroController bangumiIntroController =
|
||||||
late VideoDetailController videoDetailCtr;
|
Get.put(BangumiIntroController(), tag: Get.arguments['heroTag']);
|
||||||
BangumiInfoModel? bangumiDetail;
|
BangumiInfoModel? bangumiDetail;
|
||||||
late Future _futureBuilderFuture;
|
late Future _futureBuilderFuture;
|
||||||
late int cid;
|
|
||||||
late String heroTag;
|
|
||||||
|
|
||||||
// 添加页面缓存
|
// 添加页面缓存
|
||||||
@override
|
@override
|
||||||
@ -48,19 +46,10 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
heroTag = Get.arguments['heroTag'];
|
|
||||||
cid = widget.cid!;
|
|
||||||
bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag);
|
|
||||||
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
|
||||||
bangumiIntroController.bangumiDetail.listen((value) {
|
bangumiIntroController.bangumiDetail.listen((value) {
|
||||||
bangumiDetail = value;
|
bangumiDetail = value;
|
||||||
});
|
});
|
||||||
_futureBuilderFuture = bangumiIntroController.queryBangumiIntro();
|
_futureBuilderFuture = bangumiIntroController.queryBangumiIntro();
|
||||||
videoDetailCtr.cid.listen((p0) {
|
|
||||||
print('🐶🐶$p0');
|
|
||||||
cid = p0;
|
|
||||||
setState(() {});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -72,25 +61,22 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
|||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
if (snapshot.data['status']) {
|
if (snapshot.data['status']) {
|
||||||
// 请求成功
|
// 请求成功
|
||||||
|
|
||||||
return BangumiInfo(
|
return BangumiInfo(
|
||||||
loadingStatus: false,
|
loadingStatus: false,
|
||||||
bangumiDetail: bangumiDetail,
|
bangumiDetail: bangumiDetail,
|
||||||
cid: cid,
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 请求错误
|
// 请求错误
|
||||||
// return HttpError(
|
return HttpError(
|
||||||
// errMsg: snapshot.data['msg'],
|
errMsg: snapshot.data['msg'],
|
||||||
// fn: () => Get.back(),
|
fn: () => Get.back(),
|
||||||
// );
|
);
|
||||||
return SizedBox();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return BangumiInfo(
|
return BangumiInfo(
|
||||||
loadingStatus: true,
|
loadingStatus: true,
|
||||||
bangumiDetail: bangumiDetail,
|
bangumiDetail: bangumiDetail,
|
||||||
cid: cid,
|
cid: widget.cid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -131,12 +117,6 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
bangumiItem = bangumiIntroController.bangumiItem;
|
bangumiItem = bangumiIntroController.bangumiItem;
|
||||||
sheetHeight = localCache.get('sheetHeight');
|
sheetHeight = localCache.get('sheetHeight');
|
||||||
cid = widget.cid!;
|
cid = widget.cid!;
|
||||||
print('cid: $cid');
|
|
||||||
videoDetailCtr.cid.listen((p0) {
|
|
||||||
cid = p0;
|
|
||||||
print('cid: $cid');
|
|
||||||
setState(() {});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏
|
// 收藏
|
||||||
@ -280,15 +260,9 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
!widget.loadingStatus
|
!widget.loadingStatus
|
||||||
? (widget.bangumiDetail!.areas!
|
? widget.bangumiDetail!.areas!
|
||||||
.isNotEmpty
|
.first['name']
|
||||||
? widget.bangumiDetail!.areas!
|
: bangumiItem!.areas!.first['name'],
|
||||||
.first['name']
|
|
||||||
: '')
|
|
||||||
: (bangumiItem!.areas!.isNotEmpty
|
|
||||||
? bangumiItem!
|
|
||||||
.areas!.first['name']
|
|
||||||
: ''),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: t.colorScheme.outline,
|
color: t.colorScheme.outline,
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/bangumi/info.dart';
|
import 'package:pilipala/models/bangumi/info.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class BangumiPanel extends StatefulWidget {
|
class BangumiPanel extends StatefulWidget {
|
||||||
@ -32,28 +30,16 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
dynamic userInfo;
|
dynamic userInfo;
|
||||||
// 默认未开通
|
// 默认未开通
|
||||||
int vipStatus = 0;
|
int vipStatus = 0;
|
||||||
late int cid;
|
|
||||||
String heroTag = Get.arguments['heroTag'];
|
|
||||||
late final VideoDetailController videoDetailCtr;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
cid = widget.cid!;
|
currentIndex = widget.pages.indexWhere((e) => e.cid == widget.cid!);
|
||||||
currentIndex = widget.pages.indexWhere((e) => e.cid == cid);
|
|
||||||
scrollToIndex();
|
scrollToIndex();
|
||||||
userInfo = userInfoCache.get('userInfoCache');
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
if (userInfo != null) {
|
if (userInfo != null) {
|
||||||
vipStatus = userInfo.vipStatus;
|
vipStatus = userInfo.vipStatus;
|
||||||
}
|
}
|
||||||
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
|
||||||
|
|
||||||
videoDetailCtr.cid.listen((p0) {
|
|
||||||
cid = p0;
|
|
||||||
setState(() {});
|
|
||||||
currentIndex = widget.pages.indexWhere((e) => e.cid == cid);
|
|
||||||
scrollToIndex();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class BangumiCardV extends StatelessWidget {
|
|||||||
arguments: {
|
arguments: {
|
||||||
'pic': pic,
|
'pic': pic,
|
||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
'videoType': SearchType.media_bangumi,
|
// 'videoType': SearchType.media_bangumi,
|
||||||
'bangumiItem': res['data'],
|
'bangumiItem': res['data'],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,32 +10,22 @@ class PlDanmakuController {
|
|||||||
// 按 6min 分段
|
// 按 6min 分段
|
||||||
int segCount = 0;
|
int segCount = 0;
|
||||||
List<DmSegMobileReply> dmSegList = [];
|
List<DmSegMobileReply> dmSegList = [];
|
||||||
int currentSegIndex = 1;
|
int currentSegIndex = 0;
|
||||||
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();
|
||||||
DmSegMobileReply result =
|
for (int segIndex = 1; segIndex <= segCount; segIndex++) {
|
||||||
await DanmakaHttp.queryDanmaku(cid: cid, segmentIndex: currentSegIndex);
|
DmSegMobileReply result =
|
||||||
if (result.elems.isNotEmpty) {
|
await DanmakaHttp.queryDanmaku(cid: cid, segmentIndex: segIndex);
|
||||||
result.elems.sort((a, b) => (a.progress).compareTo(b.progress));
|
if (result.elems.isNotEmpty) {
|
||||||
// dmSegList.add(result);
|
result.elems.sort((a, b) => (a.progress).compareTo(b.progress));
|
||||||
currentSegIndex = currentSegIndex < 1 ? 1 : currentSegIndex;
|
dmSegList.add(result);
|
||||||
dmSegList[currentSegIndex - 1] = result;
|
}
|
||||||
}
|
}
|
||||||
if (dmSegList.isNotEmpty) {
|
if (dmSegList.isNotEmpty) {
|
||||||
findClosestPositionIndex(playerController.position.value.inMilliseconds);
|
findClosestPositionIndex(playerController.position.value.inMilliseconds);
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
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';
|
||||||
@ -86,20 +85,12 @@ 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判断是否有已缓存弹幕。没有则请求对应段
|
|
||||||
int segIndex = (currentPosition / (6 * 60 * 1000)).ceil();
|
if (!playerController.isOpenDanmu.value) {
|
||||||
segIndex = segIndex < 1 ? 1 : segIndex;
|
return;
|
||||||
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) {
|
||||||
@ -149,30 +140,23 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return LayoutBuilder(builder: (context, box) {
|
return Obx(
|
||||||
double initDuration = box.maxWidth / 12;
|
() => AnimatedOpacity(
|
||||||
return Obx(
|
opacity: playerController.isOpenDanmu.value ? 1 : 0,
|
||||||
() => AnimatedOpacity(
|
duration: const Duration(milliseconds: 100),
|
||||||
opacity: playerController.isOpenDanmu.value ? 1 : 0,
|
child: DanmakuView(
|
||||||
duration: const Duration(milliseconds: 100),
|
createdController: (DanmakuController e) async {
|
||||||
child: DanmakuView(
|
widget.playerController.danmakuController = _controller = e;
|
||||||
createdController: (DanmakuController e) async {
|
},
|
||||||
widget.playerController.danmakuController = _controller = e;
|
option: DanmakuOption(
|
||||||
},
|
fontSize: 15 * fontSizeVal,
|
||||||
option: DanmakuOption(
|
area: showArea,
|
||||||
fontSize: 15 * fontSizeVal,
|
opacity: opacityVal,
|
||||||
area: showArea,
|
duration: danmakuSpeedVal * widget.playerController.playbackSpeed,
|
||||||
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,30 +149,10 @@ 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;
|
||||||
if (url.contains('opus') || url.contains('read')) {
|
Get.toNamed(
|
||||||
RegExp digitRegExp = RegExp(r'\d+');
|
'/webview',
|
||||||
Iterable<Match> matches = digitRegExp.allMatches(url);
|
parameters: {'url': 'https:$url', 'type': 'note', 'pageTitle': title},
|
||||||
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('番剧');
|
||||||
@ -234,7 +214,7 @@ class DynamicsController extends GetxController {
|
|||||||
arguments: {
|
arguments: {
|
||||||
'pic': pic,
|
'pic': pic,
|
||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
'videoType': SearchType.media_bangumi,
|
// 'videoType': SearchType.media_bangumi,
|
||||||
'bangumiItem': res['data'],
|
'bangumiItem': res['data'],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
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';
|
||||||
import 'package:pilipala/http/reply.dart';
|
import 'package:pilipala/http/reply.dart';
|
||||||
@ -18,7 +17,6 @@ class DynamicDetailController extends GetxController {
|
|||||||
RxString noMore = ''.obs;
|
RxString noMore = ''.obs;
|
||||||
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs;
|
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs;
|
||||||
RxInt acount = 0.obs;
|
RxInt acount = 0.obs;
|
||||||
final ScrollController scrollController = ScrollController();
|
|
||||||
|
|
||||||
ReplySortType _sortType = ReplySortType.time;
|
ReplySortType _sortType = ReplySortType.time;
|
||||||
RxString sortTypeTitle = ReplySortType.time.titles.obs;
|
RxString sortTypeTitle = ReplySortType.time.titles.obs;
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:easy_debounce/easy_throttle.dart';
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/skeleton/video_reply.dart';
|
import 'package:pilipala/common/skeleton/video_reply.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
@ -10,10 +9,7 @@ import 'package:pilipala/models/common/reply_type.dart';
|
|||||||
import 'package:pilipala/pages/dynamics/deatil/index.dart';
|
import 'package:pilipala/pages/dynamics/deatil/index.dart';
|
||||||
import 'package:pilipala/pages/dynamics/widgets/author_panel.dart';
|
import 'package:pilipala/pages/dynamics/widgets/author_panel.dart';
|
||||||
import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.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/pages/video/detail/replyReply/index.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
|
||||||
|
|
||||||
import '../widgets/dynamic_panel.dart';
|
import '../widgets/dynamic_panel.dart';
|
||||||
|
|
||||||
@ -25,18 +21,15 @@ class DynamicDetailPage extends StatefulWidget {
|
|||||||
State<DynamicDetailPage> createState() => _DynamicDetailPageState();
|
State<DynamicDetailPage> createState() => _DynamicDetailPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DynamicDetailPageState extends State<DynamicDetailPage>
|
class _DynamicDetailPageState extends State<DynamicDetailPage> {
|
||||||
with TickerProviderStateMixin {
|
late DynamicDetailController? _dynamicDetailController;
|
||||||
late DynamicDetailController _dynamicDetailController;
|
|
||||||
late AnimationController fabAnimationCtr;
|
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
late StreamController<bool> titleStreamC; // appBar title
|
late StreamController<bool> titleStreamC; // appBar title
|
||||||
late ScrollController scrollController;
|
final ScrollController scrollController = ScrollController();
|
||||||
bool _visibleTitle = false;
|
bool _visibleTitle = false;
|
||||||
String? action;
|
String? action;
|
||||||
// 回复类型
|
// 回复类型
|
||||||
late int type;
|
late int type;
|
||||||
bool _isFabVisible = true;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -57,30 +50,37 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
int commentType = 11;
|
int commentType = Get.arguments['item'].basic!['comment_type'] ?? 11;
|
||||||
try {
|
|
||||||
commentType = Get.arguments['item'].basic!['comment_type'];
|
|
||||||
} catch (_) {}
|
|
||||||
type = (commentType == 0) ? 11 : commentType;
|
type = (commentType == 0) ? 11 : commentType;
|
||||||
|
|
||||||
action =
|
action =
|
||||||
Get.arguments.containsKey('action') ? Get.arguments['action'] : null;
|
Get.arguments.containsKey('action') ? Get.arguments['action'] : null;
|
||||||
_dynamicDetailController =
|
_dynamicDetailController =
|
||||||
Get.put(DynamicDetailController(oid, type), tag: oid.toString());
|
Get.put(DynamicDetailController(oid, type), tag: oid.toString());
|
||||||
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
_futureBuilderFuture = _dynamicDetailController!.queryReplyList();
|
||||||
titleStreamC = StreamController<bool>();
|
titleStreamC = StreamController<bool>();
|
||||||
|
scrollController.addListener(_listen);
|
||||||
if (action == 'comment') {
|
if (action == 'comment') {
|
||||||
_visibleTitle = true;
|
_visibleTitle = true;
|
||||||
titleStreamC.add(true);
|
titleStreamC.add(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fabAnimationCtr = AnimationController(
|
void _listen() async {
|
||||||
vsync: this,
|
if (scrollController.position.pixels >=
|
||||||
duration: const Duration(milliseconds: 300),
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
);
|
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
||||||
fabAnimationCtr.forward();
|
_dynamicDetailController!.queryReplyList(reqType: 'onLoad');
|
||||||
// 滚动事件监听
|
});
|
||||||
scrollListener();
|
}
|
||||||
|
|
||||||
|
if (scrollController.offset > 55 && !_visibleTitle) {
|
||||||
|
_visibleTitle = true;
|
||||||
|
titleStreamC.add(true);
|
||||||
|
} else if (scrollController.offset <= 55 && _visibleTitle) {
|
||||||
|
_visibleTitle = false;
|
||||||
|
titleStreamC.add(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void replyReply(replyItem) {
|
void replyReply(replyItem) {
|
||||||
@ -107,58 +107,9 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollListener() {
|
|
||||||
scrollController = _dynamicDetailController.scrollController;
|
|
||||||
scrollController.addListener(
|
|
||||||
() {
|
|
||||||
// 分页加载
|
|
||||||
if (scrollController.position.pixels >=
|
|
||||||
scrollController.position.maxScrollExtent - 300) {
|
|
||||||
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
|
||||||
_dynamicDetailController.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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
scrollController.removeListener(() {});
|
scrollController.removeListener(() {});
|
||||||
fabAnimationCtr.dispose();
|
|
||||||
scrollController.dispose();
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +128,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
return AnimatedOpacity(
|
return AnimatedOpacity(
|
||||||
opacity: snapshot.data ? 1 : 0,
|
opacity: snapshot.data ? 1 : 0,
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
child: AuthorPanel(item: _dynamicDetailController.item),
|
child: author(_dynamicDetailController!.item, context),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -185,206 +136,155 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
),
|
),
|
||||||
body: RefreshIndicator(
|
body: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
await _dynamicDetailController.queryReplyList();
|
await _dynamicDetailController!.queryReplyList();
|
||||||
},
|
},
|
||||||
child: Stack(
|
child: CustomScrollView(
|
||||||
children: [
|
controller: scrollController,
|
||||||
CustomScrollView(
|
slivers: [
|
||||||
controller: scrollController,
|
if (action != 'comment')
|
||||||
slivers: [
|
SliverToBoxAdapter(
|
||||||
if (action != 'comment')
|
child: DynamicPanel(
|
||||||
SliverToBoxAdapter(
|
item: _dynamicDetailController!.item,
|
||||||
child: DynamicPanel(
|
source: 'detail',
|
||||||
item: _dynamicDetailController.item,
|
),
|
||||||
source: 'detail',
|
),
|
||||||
|
SliverPersistentHeader(
|
||||||
|
delegate: _MySliverPersistentHeaderDelegate(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surface,
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(
|
||||||
|
width: 0.6,
|
||||||
|
color: Theme.of(context).dividerColor.withOpacity(0.05),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverPersistentHeader(
|
height: 45,
|
||||||
delegate: _MySliverPersistentHeaderDelegate(
|
padding: const EdgeInsets.only(left: 12, right: 6),
|
||||||
child: Container(
|
child: Row(
|
||||||
decoration: BoxDecoration(
|
children: [
|
||||||
color: Theme.of(context).colorScheme.surface,
|
Obx(
|
||||||
border: Border(
|
() => AnimatedSwitcher(
|
||||||
top: BorderSide(
|
duration: const Duration(milliseconds: 400),
|
||||||
width: 0.6,
|
transitionBuilder:
|
||||||
color: Theme.of(context)
|
(Widget child, Animation<double> animation) {
|
||||||
.dividerColor
|
return ScaleTransition(
|
||||||
.withOpacity(0.05),
|
scale: animation, child: child);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'${_dynamicDetailController!.acount.value}',
|
||||||
|
key: ValueKey<int>(
|
||||||
|
_dynamicDetailController!.acount.value),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
height: 45,
|
const Text('条回复'),
|
||||||
padding: const EdgeInsets.only(left: 12, right: 6),
|
const Spacer(),
|
||||||
child: Row(
|
SizedBox(
|
||||||
children: [
|
height: 35,
|
||||||
Obx(
|
child: TextButton.icon(
|
||||||
() => AnimatedSwitcher(
|
onPressed: () =>
|
||||||
duration: const Duration(milliseconds: 400),
|
_dynamicDetailController!.queryBySort(),
|
||||||
transitionBuilder:
|
icon: const Icon(Icons.sort, size: 16),
|
||||||
(Widget child, Animation<double> animation) {
|
label: Obx(() => Text(
|
||||||
return ScaleTransition(
|
_dynamicDetailController!.sortTypeLabel.value,
|
||||||
scale: animation, child: child);
|
style: const TextStyle(fontSize: 13),
|
||||||
},
|
)),
|
||||||
child: Text(
|
),
|
||||||
'${_dynamicDetailController.acount.value}',
|
)
|
||||||
key: ValueKey<int>(
|
],
|
||||||
_dynamicDetailController.acount.value),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Text('条回复'),
|
|
||||||
const Spacer(),
|
|
||||||
SizedBox(
|
|
||||||
height: 35,
|
|
||||||
child: TextButton.icon(
|
|
||||||
onPressed: () =>
|
|
||||||
_dynamicDetailController.queryBySort(),
|
|
||||||
icon: const Icon(Icons.sort, size: 16),
|
|
||||||
label: Obx(() => Text(
|
|
||||||
_dynamicDetailController
|
|
||||||
.sortTypeLabel.value,
|
|
||||||
style: const TextStyle(fontSize: 13),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
pinned: true,
|
|
||||||
),
|
|
||||||
FutureBuilder(
|
|
||||||
future: _futureBuilderFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
Map data = snapshot.data as Map;
|
|
||||||
if (snapshot.data['status']) {
|
|
||||||
// 请求成功
|
|
||||||
return Obx(
|
|
||||||
() => _dynamicDetailController.replyList.isEmpty &&
|
|
||||||
_dynamicDetailController.isLoadingMore
|
|
||||||
? SliverList(
|
|
||||||
delegate: SliverChildBuilderDelegate(
|
|
||||||
(context, index) {
|
|
||||||
return const VideoReplySkeleton();
|
|
||||||
}, childCount: 8),
|
|
||||||
)
|
|
||||||
: SliverList(
|
|
||||||
delegate: SliverChildBuilderDelegate(
|
|
||||||
(context, index) {
|
|
||||||
if (index ==
|
|
||||||
_dynamicDetailController
|
|
||||||
.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(
|
|
||||||
_dynamicDetailController
|
|
||||||
.noMore.value,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return ReplyItem(
|
|
||||||
replyItem: _dynamicDetailController
|
|
||||||
.replyList[index],
|
|
||||||
showReplyRow: true,
|
|
||||||
replyLevel: '1',
|
|
||||||
replyReply: (replyItem) =>
|
|
||||||
replyReply(replyItem),
|
|
||||||
replyType: ReplyType.values[type],
|
|
||||||
addReply: (replyItem) {
|
|
||||||
_dynamicDetailController
|
|
||||||
.replyList[index].replies!
|
|
||||||
.add(replyItem);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
childCount: _dynamicDetailController
|
|
||||||
.replyList.length +
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// 请求错误
|
|
||||||
return HttpError(
|
|
||||||
errMsg: data['msg'],
|
|
||||||
fn: () => setState(() {}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 骨架屏
|
|
||||||
return SliverList(
|
|
||||||
delegate: SliverChildBuilderDelegate((context, index) {
|
|
||||||
return const VideoReplySkeleton();
|
|
||||||
}, childCount: 8),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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: _dynamicDetailController.oid ??
|
|
||||||
IdUtils.bv2av(Get.parameters['bvid']!),
|
|
||||||
root: 0,
|
|
||||||
parent: 0,
|
|
||||||
replyType: ReplyType.values[type],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
).then(
|
|
||||||
(value) => {
|
|
||||||
// 完成评论,数据添加
|
|
||||||
if (value != null && value['data'] != null)
|
|
||||||
{
|
|
||||||
_dynamicDetailController.replyList
|
|
||||||
.add(value['data']),
|
|
||||||
_dynamicDetailController.acount.value++
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
tooltip: '评论动态',
|
|
||||||
child: const Icon(Icons.reply),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
pinned: true,
|
||||||
),
|
),
|
||||||
|
FutureBuilder(
|
||||||
|
future: _futureBuilderFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
if (snapshot.data['status']) {
|
||||||
|
// 请求成功
|
||||||
|
return Obx(
|
||||||
|
() => _dynamicDetailController!.replyList.isEmpty &&
|
||||||
|
_dynamicDetailController!.isLoadingMore
|
||||||
|
? SliverList(
|
||||||
|
delegate:
|
||||||
|
SliverChildBuilderDelegate((context, index) {
|
||||||
|
return const VideoReplySkeleton();
|
||||||
|
}, childCount: 8),
|
||||||
|
)
|
||||||
|
: SliverList(
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) {
|
||||||
|
if (index ==
|
||||||
|
_dynamicDetailController!
|
||||||
|
.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(
|
||||||
|
_dynamicDetailController!
|
||||||
|
.noMore.value,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return ReplyItem(
|
||||||
|
replyItem: _dynamicDetailController!
|
||||||
|
.replyList[index],
|
||||||
|
showReplyRow: true,
|
||||||
|
replyLevel: '1',
|
||||||
|
replyReply: (replyItem) =>
|
||||||
|
replyReply(replyItem),
|
||||||
|
replyType: ReplyType.values[type],
|
||||||
|
addReply: (replyItem) {
|
||||||
|
_dynamicDetailController!
|
||||||
|
.replyList[index].replies!
|
||||||
|
.add(replyItem);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
childCount:
|
||||||
|
_dynamicDetailController!.replyList.length +
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// 请求错误
|
||||||
|
return HttpError(
|
||||||
|
errMsg: data['msg'],
|
||||||
|
fn: () => setState(() {}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 骨架屏
|
||||||
|
return SliverList(
|
||||||
|
delegate: SliverChildBuilderDelegate((context, index) {
|
||||||
|
return const VideoReplySkeleton();
|
||||||
|
}, childCount: 8),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,8 +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: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}) {
|
||||||
@ -22,27 +19,8 @@ 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: () async {
|
onTap: () {},
|
||||||
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),
|
||||||
@ -83,111 +61,101 @@ Widget addWidget(item, context, type, {floor = 1}) {
|
|||||||
);
|
);
|
||||||
case 'ADDITIONAL_TYPE_RESERVE':
|
case 'ADDITIONAL_TYPE_RESERVE':
|
||||||
return dynamicProperty[type].state != -1
|
return dynamicProperty[type].state != -1
|
||||||
? dynamicProperty[type].title != null
|
? Padding(
|
||||||
? Padding(
|
padding: const EdgeInsets.only(top: 8),
|
||||||
padding: const EdgeInsets.only(top: 8),
|
child: InkWell(
|
||||||
child: InkWell(
|
onTap: () {},
|
||||||
onTap: () {},
|
child: Container(
|
||||||
child: Container(
|
width: double.infinity,
|
||||||
width: double.infinity,
|
padding: const EdgeInsets.only(
|
||||||
padding: const EdgeInsets.only(
|
left: 12, top: 10, right: 12, bottom: 10),
|
||||||
left: 12, top: 10, right: 12, bottom: 10),
|
color: bgColor,
|
||||||
color: bgColor,
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
children: [
|
Text(
|
||||||
Text(
|
dynamicProperty[type].title,
|
||||||
dynamicProperty[type].title,
|
maxLines: 1,
|
||||||
maxLines: 1,
|
overflow: TextOverflow.ellipsis,
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 1),
|
|
||||||
Text.rich(
|
|
||||||
TextSpan(
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
fontSize: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.labelMedium!
|
|
||||||
.fontSize),
|
|
||||||
children: [
|
|
||||||
if (dynamicProperty[type].desc1 != null)
|
|
||||||
TextSpan(
|
|
||||||
text:
|
|
||||||
dynamicProperty[type].desc1['text']),
|
|
||||||
const TextSpan(text: ' '),
|
|
||||||
if (dynamicProperty[type].desc2 != null)
|
|
||||||
TextSpan(
|
|
||||||
text:
|
|
||||||
dynamicProperty[type].desc2['text']),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
// TextButton(onPressed: () {}, child: Text('123'))
|
const SizedBox(height: 1),
|
||||||
),
|
Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
fontSize: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.labelMedium!
|
||||||
|
.fontSize),
|
||||||
|
children: [
|
||||||
|
TextSpan(text: dynamicProperty[type].desc1['text']),
|
||||||
|
const TextSpan(text: ' '),
|
||||||
|
TextSpan(text: dynamicProperty[type].desc2['text']),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
)
|
// TextButton(onPressed: () {}, child: Text('123'))
|
||||||
: const SizedBox()
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
: const SizedBox();
|
: const SizedBox();
|
||||||
case 'ADDITIONAL_TYPE_GOODS':
|
case 'ADDITIONAL_TYPE_GOODS':
|
||||||
// 商品
|
return Padding(
|
||||||
return const SizedBox();
|
padding: const EdgeInsets.only(top: 6),
|
||||||
// return Padding(
|
child: InkWell(
|
||||||
// padding: const EdgeInsets.only(top: 6),
|
onTap: () {},
|
||||||
// child: InkWell(
|
child: Container(
|
||||||
// onTap: () {},
|
padding:
|
||||||
// child: Container(
|
const EdgeInsets.only(left: 12, top: 8, right: 12, bottom: 8),
|
||||||
// padding:
|
decoration: BoxDecoration(
|
||||||
// const EdgeInsets.only(left: 12, top: 8, right: 12, bottom: 8),
|
color: bgColor,
|
||||||
// decoration: BoxDecoration(
|
borderRadius: const BorderRadius.all(Radius.circular(6)),
|
||||||
// color: bgColor,
|
),
|
||||||
// borderRadius: const BorderRadius.all(Radius.circular(6)),
|
child: Row(
|
||||||
// ),
|
children: [
|
||||||
// child: Row(
|
NetworkImgLayer(
|
||||||
// children: [
|
width: 75,
|
||||||
// NetworkImgLayer(
|
height: 75,
|
||||||
// width: 75,
|
src: dynamicProperty[type].items.first.cover,
|
||||||
// height: 75,
|
),
|
||||||
// src: dynamicProperty[type].items.first.cover,
|
const SizedBox(width: 10),
|
||||||
// ),
|
Expanded(
|
||||||
// const SizedBox(width: 10),
|
child: Column(
|
||||||
// Expanded(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// child: Column(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
// mainAxisAlignment: MainAxisAlignment.start,
|
Text(
|
||||||
// children: [
|
dynamicProperty[type].items.first.name,
|
||||||
// Text(
|
maxLines: 1,
|
||||||
// dynamicProperty[type].items.first.name,
|
overflow: TextOverflow.ellipsis,
|
||||||
// maxLines: 1,
|
),
|
||||||
// overflow: TextOverflow.ellipsis,
|
Text(
|
||||||
// ),
|
dynamicProperty[type].items.first.brief,
|
||||||
// Text(
|
maxLines: 1,
|
||||||
// dynamicProperty[type].items.first.brief,
|
style: TextStyle(
|
||||||
// maxLines: 1,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
// style: TextStyle(
|
fontSize: Theme.of(context)
|
||||||
// color: Theme.of(context).colorScheme.outline,
|
.textTheme
|
||||||
// fontSize: Theme.of(context)
|
.labelMedium!
|
||||||
// .textTheme
|
.fontSize,
|
||||||
// .labelMedium!
|
),
|
||||||
// .fontSize,
|
),
|
||||||
// ),
|
const SizedBox(height: 2),
|
||||||
// ),
|
Text(
|
||||||
// const SizedBox(height: 2),
|
dynamicProperty[type].items.first.price,
|
||||||
// Text(
|
style: TextStyle(
|
||||||
// dynamicProperty[type].items.first.price,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
// style: TextStyle(
|
),
|
||||||
// color: Theme.of(context).colorScheme.primary,
|
),
|
||||||
// ),
|
],
|
||||||
// ),
|
),
|
||||||
// ],
|
),
|
||||||
// ),
|
],
|
||||||
// ),
|
),
|
||||||
// ],
|
),
|
||||||
// ),
|
));
|
||||||
// ),
|
|
||||||
// ),);
|
|
||||||
case 'ADDITIONAL_TYPE_MATCH':
|
case 'ADDITIONAL_TYPE_MATCH':
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
case 'ADDITIONAL_TYPE_COMMON':
|
case 'ADDITIONAL_TYPE_COMMON':
|
||||||
|
|||||||
@ -1,159 +1,65 @@
|
|||||||
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:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class AuthorPanel extends StatelessWidget {
|
Widget author(item, context) {
|
||||||
final dynamic item;
|
String heroTag = Utils.makeHeroTag(item.modules.moduleAuthor.mid);
|
||||||
const AuthorPanel({super.key, required this.item});
|
return Row(
|
||||||
|
children: [
|
||||||
@override
|
GestureDetector(
|
||||||
Widget build(BuildContext context) {
|
onTap: () {
|
||||||
String heroTag = Utils.makeHeroTag(item.modules.moduleAuthor.mid);
|
feedBack();
|
||||||
return Row(
|
Get.toNamed(
|
||||||
children: [
|
'/member?mid=${item.modules.moduleAuthor.mid}',
|
||||||
GestureDetector(
|
arguments: {
|
||||||
onTap: () {
|
'face': item.modules.moduleAuthor.face,
|
||||||
feedBack();
|
'heroTag': heroTag
|
||||||
Get.toNamed(
|
|
||||||
'/member?mid=${item.modules.moduleAuthor.mid}',
|
|
||||||
arguments: {
|
|
||||||
'face': item.modules.moduleAuthor.face,
|
|
||||||
'heroTag': heroTag
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Hero(
|
|
||||||
tag: heroTag,
|
|
||||||
child: NetworkImgLayer(
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
type: 'avatar',
|
|
||||||
src: item.modules.moduleAuthor.face,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.modules.moduleAuthor.name,
|
|
||||||
style: TextStyle(
|
|
||||||
color: item.modules.moduleAuthor!.vip != null &&
|
|
||||||
item.modules.moduleAuthor!.vip['status'] > 0
|
|
||||||
? const Color.fromARGB(255, 251, 100, 163)
|
|
||||||
: Theme.of(context).colorScheme.onBackground,
|
|
||||||
fontSize: Theme.of(context).textTheme.titleSmall!.fontSize,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
DefaultTextStyle.merge(
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(item.modules.moduleAuthor.pubTime),
|
|
||||||
if (item.modules.moduleAuthor.pubTime != '' &&
|
|
||||||
item.modules.moduleAuthor.pubAction != '')
|
|
||||||
const Text(' '),
|
|
||||||
Text(item.modules.moduleAuthor.pubAction),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
if (item.type == 'DYNAMIC_TYPE_AV')
|
|
||||||
SizedBox(
|
|
||||||
width: 32,
|
|
||||||
height: 32,
|
|
||||||
child: IconButton(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
useRootNavigator: true,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (context) {
|
|
||||||
return MorePanel(item: item);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.more_vert_outlined, size: 18),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MorePanel extends StatelessWidget {
|
|
||||||
final dynamic item;
|
|
||||||
const MorePanel({super.key, required this.item});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
|
||||||
// clipBehavior: Clip.hardEdge,
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
InkWell(
|
|
||||||
onTap: () => Get.back(),
|
|
||||||
child: Container(
|
|
||||||
height: 35,
|
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
width: 32,
|
|
||||||
height: 3,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () async {
|
|
||||||
try {
|
|
||||||
String bvid = item.modules.moduleDynamic.major.archive.bvid;
|
|
||||||
var res = await UserHttp.toViewLater(bvid: bvid);
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
Get.back();
|
|
||||||
} catch (err) {
|
|
||||||
SmartDialog.showToast('出错了:${err.toString()}');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
minLeadingWidth: 0,
|
);
|
||||||
// dense: true,
|
},
|
||||||
leading: const Icon(Icons.watch_later_outlined, size: 19),
|
child: Hero(
|
||||||
title: Text(
|
tag: heroTag,
|
||||||
'稍后再看',
|
child: NetworkImgLayer(
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
type: 'avatar',
|
||||||
|
src: item.modules.moduleAuthor.face,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
item.modules.moduleAuthor.name,
|
||||||
|
style: TextStyle(
|
||||||
|
color: item.modules.moduleAuthor!.vip != null &&
|
||||||
|
item.modules.moduleAuthor!.vip['status'] > 0
|
||||||
|
? const Color.fromARGB(255, 251, 100, 163)
|
||||||
|
: Theme.of(context).colorScheme.onBackground,
|
||||||
|
fontSize: Theme.of(context).textTheme.titleSmall!.fontSize,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Divider(thickness: 0.1, height: 1),
|
DefaultTextStyle.merge(
|
||||||
ListTile(
|
style: TextStyle(
|
||||||
onTap: () => Get.back(),
|
color: Theme.of(context).colorScheme.outline,
|
||||||
minLeadingWidth: 0,
|
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||||
dense: true,
|
|
||||||
title: Text(
|
|
||||||
'取消',
|
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
),
|
||||||
),
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(item.modules.moduleAuthor.pubTime),
|
||||||
|
if (item.modules.moduleAuthor.pubTime != '' &&
|
||||||
|
item.modules.moduleAuthor.pubAction != '')
|
||||||
|
const Text(' '),
|
||||||
|
Text(item.modules.moduleAuthor.pubAction),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
],
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,183 +1,42 @@
|
|||||||
// 内容
|
// 内容
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
|
||||||
import 'package:pilipala/pages/preview/index.dart';
|
|
||||||
|
|
||||||
import 'rich_node_panel.dart';
|
import 'rich_node_panel.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
Widget content(item, context, source) {
|
||||||
class Content extends StatefulWidget {
|
TextStyle authorStyle =
|
||||||
dynamic item;
|
TextStyle(color: Theme.of(context).colorScheme.primary);
|
||||||
String? source;
|
return Container(
|
||||||
Content({
|
width: double.infinity,
|
||||||
super.key,
|
padding: const EdgeInsets.fromLTRB(12, 0, 12, 6),
|
||||||
this.item,
|
child: Column(
|
||||||
this.source,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
});
|
children: [
|
||||||
|
if (item.modules.moduleDynamic.topic != null) ...[
|
||||||
@override
|
GestureDetector(
|
||||||
State<Content> createState() => _ContentState();
|
child: Text(
|
||||||
}
|
'#${item.modules.moduleDynamic.topic.name}',
|
||||||
|
style: authorStyle,
|
||||||
class _ContentState extends State<Content> {
|
|
||||||
late bool hasPics;
|
|
||||||
List<OpusPicsModel> pics = [];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
hasPics = widget.item.modules.moduleDynamic.major != null &&
|
|
||||||
widget.item.modules.moduleDynamic.major.opus != null &&
|
|
||||||
widget.item.modules.moduleDynamic.major.opus.pics.isNotEmpty;
|
|
||||||
if (hasPics) {
|
|
||||||
pics = widget.item.modules.moduleDynamic.major.opus.pics;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InlineSpan picsNodes() {
|
|
||||||
List<InlineSpan> spanChilds = [];
|
|
||||||
int len = pics.length;
|
|
||||||
List<String> picList = [];
|
|
||||||
|
|
||||||
if (len == 1) {
|
|
||||||
OpusPicsModel pictureItem = pics.first;
|
|
||||||
picList.add(pictureItem.url!);
|
|
||||||
spanChilds.add(const TextSpan(text: '\n'));
|
|
||||||
spanChilds.add(
|
|
||||||
WidgetSpan(
|
|
||||||
child: LayoutBuilder(
|
|
||||||
builder: (context, BoxConstraints box) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
useSafeArea: false,
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return ImagePreview(initialPage: 0, imgList: picList);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(top: 4),
|
|
||||||
child: NetworkImgLayer(
|
|
||||||
src: pictureItem.url,
|
|
||||||
width: box.maxWidth / 2,
|
|
||||||
height: box.maxWidth *
|
|
||||||
0.5 *
|
|
||||||
(pictureItem.height != null && pictureItem.width != null
|
|
||||||
? pictureItem.height! / pictureItem.width!
|
|
||||||
: 1),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (len > 1) {
|
|
||||||
List<Widget> list = [];
|
|
||||||
for (var i = 0; i < len; i++) {
|
|
||||||
picList.add(pics[i].url!);
|
|
||||||
list.add(
|
|
||||||
LayoutBuilder(
|
|
||||||
builder: (context, BoxConstraints box) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
useSafeArea: false,
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return ImagePreview(initialPage: i, imgList: picList);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: NetworkImgLayer(
|
|
||||||
src: pics[i].url,
|
|
||||||
width: box.maxWidth,
|
|
||||||
height: box.maxWidth,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
spanChilds.add(
|
|
||||||
WidgetSpan(
|
|
||||||
child: LayoutBuilder(
|
|
||||||
builder: (context, BoxConstraints box) {
|
|
||||||
double maxWidth = box.maxWidth;
|
|
||||||
double crossCount = len < 3 ? 2 : 3;
|
|
||||||
double height = maxWidth /
|
|
||||||
crossCount *
|
|
||||||
(len % crossCount == 0
|
|
||||||
? len ~/ crossCount
|
|
||||||
: len ~/ crossCount + 1) +
|
|
||||||
6;
|
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.only(top: 6),
|
|
||||||
height: height,
|
|
||||||
child: GridView.count(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
crossAxisCount: crossCount.toInt(),
|
|
||||||
mainAxisSpacing: 4.0,
|
|
||||||
crossAxisSpacing: 4.0,
|
|
||||||
childAspectRatio: 1,
|
|
||||||
children: list,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return TextSpan(
|
|
||||||
children: spanChilds,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
TextStyle authorStyle =
|
|
||||||
TextStyle(color: Theme.of(context).colorScheme.primary);
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
width: double.infinity,
|
|
||||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 6),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (widget.item.modules.moduleDynamic.topic != null) ...[
|
|
||||||
GestureDetector(
|
|
||||||
child: Text(
|
|
||||||
'#${widget.item.modules.moduleDynamic.topic.name}',
|
|
||||||
style: authorStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
IgnorePointer(
|
|
||||||
// 禁用SelectableRegion的触摸交互功能
|
|
||||||
ignoring: widget.source == 'detail' ? false : true,
|
|
||||||
child: SelectableRegion(
|
|
||||||
magnifierConfiguration: const TextMagnifierConfiguration(),
|
|
||||||
focusNode: FocusNode(),
|
|
||||||
selectionControls: MaterialTextSelectionControls(),
|
|
||||||
child: Text.rich(
|
|
||||||
/// fix 默认20px高度
|
|
||||||
style: const TextStyle(height: 0),
|
|
||||||
richNode(widget.item, context),
|
|
||||||
maxLines: widget.source == 'detail' ? 999 : 3,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (hasPics) ...[
|
|
||||||
Text.rich(picsNodes()),
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
),
|
IgnorePointer(
|
||||||
);
|
// 禁用SelectableRegion的触摸交互功能
|
||||||
}
|
ignoring: source == 'detail' ? false : true,
|
||||||
|
child: SelectableRegion(
|
||||||
|
magnifierConfiguration: const TextMagnifierConfiguration(),
|
||||||
|
focusNode: FocusNode(),
|
||||||
|
selectionControls: MaterialTextSelectionControls(),
|
||||||
|
child: Text.rich(
|
||||||
|
/// fix 默认20px高度
|
||||||
|
style: const TextStyle(height: 0),
|
||||||
|
richNode(item, context),
|
||||||
|
maxLines: source == 'detail' ? 999 : 3,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,11 +39,11 @@ class DynamicPanel extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
||||||
child: AuthorPanel(item: item),
|
child: author(item, context),
|
||||||
),
|
),
|
||||||
if (item!.modules!.moduleDynamic!.desc != null ||
|
if (item!.modules!.moduleDynamic!.desc != null ||
|
||||||
item!.modules!.moduleDynamic!.major != null)
|
item!.modules!.moduleDynamic!.major != null)
|
||||||
Content(item: item, source: source),
|
content(item, context, source),
|
||||||
forWard(item, context, _dynamicsController, source),
|
forWard(item, context, _dynamicsController, source),
|
||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
if (source == null) ActionPanel(item: item),
|
if (source == null) ActionPanel(item: item),
|
||||||
|
|||||||
@ -27,9 +27,8 @@ InlineSpan richNode(item, context) {
|
|||||||
} else {
|
} else {
|
||||||
for (var i in richTextNodes) {
|
for (var i in richTextNodes) {
|
||||||
/// fix 渲染专栏时内容会重复
|
/// fix 渲染专栏时内容会重复
|
||||||
// if (item.modules.moduleDynamic.major.opus.title == null &&
|
if (item.modules.moduleDynamic.major.opus.title == null &&
|
||||||
// i.type == 'RICH_TEXT_NODE_TYPE_TEXT') {
|
i.type == 'RICH_TEXT_NODE_TYPE_TEXT') {
|
||||||
if (i.type == 'RICH_TEXT_NODE_TYPE_TEXT') {
|
|
||||||
spanChilds.add(
|
spanChilds.add(
|
||||||
TextSpan(text: i.origText, style: const TextStyle(height: 1.65)));
|
TextSpan(text: i.origText, style: const TextStyle(height: 1.65)));
|
||||||
}
|
}
|
||||||
@ -110,18 +109,16 @@ InlineSpan richNode(item, context) {
|
|||||||
alignment: PlaceholderAlignment.middle,
|
alignment: PlaceholderAlignment.middle,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
try {
|
String dynamicId = item.basic['comment_id_str'];
|
||||||
String dynamicId = item.basic['comment_id_str'];
|
Get.toNamed(
|
||||||
Get.toNamed(
|
'/webview',
|
||||||
'/webview',
|
parameters: {
|
||||||
parameters: {
|
'url':
|
||||||
'url':
|
'https://t.bilibili.com/vote/h5/index/#/result?vote_id=${i.rid}&dynamic_id=$dynamicId&isWeb=1',
|
||||||
'https://t.bilibili.com/vote/h5/index/#/result?vote_id=${i.rid}&dynamic_id=$dynamicId&isWeb=1',
|
'type': 'vote',
|
||||||
'type': 'vote',
|
'pageTitle': '投票'
|
||||||
'pageTitle': '投票'
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
} catch (_) {}
|
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'投票:${i.text}',
|
'投票:${i.text}',
|
||||||
@ -196,118 +193,116 @@ InlineSpan richNode(item, context) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (contentType == 'major' &&
|
if (contentType == 'major' &&
|
||||||
// item.modules.moduleDynamic.major.opus.pics.isNotEmpty) {
|
item.modules.moduleDynamic.major.opus.pics.isNotEmpty) {
|
||||||
// // 图片可能跟其他widget重复渲染
|
// 图片可能跟其他widget重复渲染
|
||||||
// List<OpusPicsModel> pics = item.modules.moduleDynamic.major.opus.pics;
|
List<OpusPicsModel> pics = item.modules.moduleDynamic.major.opus.pics;
|
||||||
// int len = pics.length;
|
int len = pics.length;
|
||||||
// List<String> picList = [];
|
List<String> picList = [];
|
||||||
|
|
||||||
// if (len == 1) {
|
if (len == 1) {
|
||||||
// OpusPicsModel pictureItem = pics.first;
|
OpusPicsModel pictureItem = pics.first;
|
||||||
// picList.add(pictureItem.url!);
|
picList.add(pictureItem.url!);
|
||||||
// spanChilds.add(const TextSpan(text: '\n'));
|
spanChilds.add(const TextSpan(text: '\n'));
|
||||||
// spanChilds.add(
|
spanChilds.add(
|
||||||
// WidgetSpan(
|
WidgetSpan(
|
||||||
// child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
// builder: (context, BoxConstraints box) {
|
builder: (context, BoxConstraints box) {
|
||||||
// return GestureDetector(
|
return GestureDetector(
|
||||||
// onTap: () {
|
onTap: () {
|
||||||
// showDialog(
|
showDialog(
|
||||||
// useSafeArea: false,
|
useSafeArea: false,
|
||||||
// context: context,
|
context: context,
|
||||||
// builder: (context) {
|
builder: (context) {
|
||||||
// return ImagePreview(initialPage: 0, imgList: picList);
|
return ImagePreview(initialPage: 0, imgList: picList);
|
||||||
// },
|
},
|
||||||
// );
|
);
|
||||||
// },
|
},
|
||||||
// child: Padding(
|
child: Padding(
|
||||||
// padding: const EdgeInsets.only(top: 4),
|
padding: const EdgeInsets.only(top: 4),
|
||||||
// child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
// src: pictureItem.url,
|
src: pictureItem.url,
|
||||||
// width: box.maxWidth / 2,
|
width: box.maxWidth / 2,
|
||||||
// height: box.maxWidth *
|
height: box.maxWidth *
|
||||||
// 0.5 *
|
0.5 *
|
||||||
// (pictureItem.height != null &&
|
pictureItem.height! /
|
||||||
// pictureItem.width != null
|
pictureItem.width!,
|
||||||
// ? pictureItem.height! / pictureItem.width!
|
),
|
||||||
// : 1),
|
),
|
||||||
// ),
|
);
|
||||||
// ),
|
},
|
||||||
// );
|
),
|
||||||
// },
|
),
|
||||||
// ),
|
);
|
||||||
// ),
|
}
|
||||||
// );
|
if (len > 1) {
|
||||||
// }
|
List<Widget> list = [];
|
||||||
// if (len > 1) {
|
for (var i = 0; i < len; i++) {
|
||||||
// List<Widget> list = [];
|
picList.add(pics[i].url!);
|
||||||
// for (var i = 0; i < len; i++) {
|
list.add(
|
||||||
// picList.add(pics[i].url!);
|
LayoutBuilder(
|
||||||
// list.add(
|
builder: (context, BoxConstraints box) {
|
||||||
// LayoutBuilder(
|
return GestureDetector(
|
||||||
// builder: (context, BoxConstraints box) {
|
onTap: () {
|
||||||
// return GestureDetector(
|
showDialog(
|
||||||
// onTap: () {
|
useSafeArea: false,
|
||||||
// showDialog(
|
context: context,
|
||||||
// useSafeArea: false,
|
builder: (context) {
|
||||||
// context: context,
|
return ImagePreview(initialPage: i, imgList: picList);
|
||||||
// builder: (context) {
|
},
|
||||||
// return ImagePreview(initialPage: i, imgList: picList);
|
);
|
||||||
// },
|
},
|
||||||
// );
|
child: NetworkImgLayer(
|
||||||
// },
|
src: pics[i].url,
|
||||||
// child: NetworkImgLayer(
|
width: box.maxWidth,
|
||||||
// src: pics[i].url,
|
height: box.maxWidth,
|
||||||
// width: box.maxWidth,
|
),
|
||||||
// height: box.maxWidth,
|
);
|
||||||
// ),
|
},
|
||||||
// );
|
),
|
||||||
// },
|
);
|
||||||
// ),
|
}
|
||||||
// );
|
spanChilds.add(
|
||||||
// }
|
WidgetSpan(
|
||||||
// spanChilds.add(
|
child: LayoutBuilder(
|
||||||
// WidgetSpan(
|
builder: (context, BoxConstraints box) {
|
||||||
// child: LayoutBuilder(
|
double maxWidth = box.maxWidth;
|
||||||
// builder: (context, BoxConstraints box) {
|
double crossCount = len < 3 ? 2 : 3;
|
||||||
// double maxWidth = box.maxWidth;
|
double height = maxWidth /
|
||||||
// double crossCount = len < 3 ? 2 : 3;
|
crossCount *
|
||||||
// double height = maxWidth /
|
(len % crossCount == 0
|
||||||
// crossCount *
|
? len ~/ crossCount
|
||||||
// (len % crossCount == 0
|
: len ~/ crossCount + 1) +
|
||||||
// ? len ~/ crossCount
|
6;
|
||||||
// : len ~/ crossCount + 1) +
|
return Container(
|
||||||
// 6;
|
padding: const EdgeInsets.only(top: 6),
|
||||||
// return Container(
|
height: height,
|
||||||
// padding: const EdgeInsets.only(top: 6),
|
child: GridView.count(
|
||||||
// height: height,
|
padding: EdgeInsets.zero,
|
||||||
// child: GridView.count(
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
// padding: EdgeInsets.zero,
|
crossAxisCount: crossCount.toInt(),
|
||||||
// physics: const NeverScrollableScrollPhysics(),
|
mainAxisSpacing: 4.0,
|
||||||
// crossAxisCount: crossCount.toInt(),
|
crossAxisSpacing: 4.0,
|
||||||
// mainAxisSpacing: 4.0,
|
childAspectRatio: 1,
|
||||||
// crossAxisSpacing: 4.0,
|
children: list,
|
||||||
// childAspectRatio: 1,
|
),
|
||||||
// children: list,
|
);
|
||||||
// ),
|
},
|
||||||
// );
|
),
|
||||||
// },
|
),
|
||||||
// ),
|
);
|
||||||
// ),
|
}
|
||||||
// );
|
// spanChilds.add(
|
||||||
// }
|
// WidgetSpan(
|
||||||
// spanChilds.add(
|
// child: NetworkImgLayer(
|
||||||
// WidgetSpan(
|
// src: pics.first.url,
|
||||||
// child: NetworkImgLayer(
|
// type: 'emote',
|
||||||
// src: pics.first.url,
|
// width: 100,
|
||||||
// type: 'emote',
|
// height: 200,
|
||||||
// width: 100,
|
// ),
|
||||||
// height: 200,
|
// ),
|
||||||
// ),
|
// );
|
||||||
// ),
|
}
|
||||||
// );
|
|
||||||
// }
|
|
||||||
return TextSpan(
|
return TextSpan(
|
||||||
children: spanChilds,
|
children: spanChilds,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -91,10 +91,7 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
),
|
),
|
||||||
Material(
|
Material(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => {
|
onTap: () => {feedBack(), Get.toNamed('/follow')},
|
||||||
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,16 +16,13 @@ class FansPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _FansPageState extends State<FansPage> {
|
class _FansPageState extends State<FansPage> {
|
||||||
late String mid;
|
final FansController _fansController = Get.put(FansController());
|
||||||
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 {
|
||||||
|
|||||||
@ -44,14 +44,6 @@ class _FavPageState extends State<FavPage> {
|
|||||||
'我的收藏',
|
'我的收藏',
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: () => Get.toNamed(
|
|
||||||
'/favSearch?searchType=1&mediaId=${_favController.favFolderData.value.list!.first.id}'),
|
|
||||||
icon: const Icon(Icons.search_outlined),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
body: FutureBuilder(
|
body: FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
|
|||||||
@ -92,18 +92,13 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
// actions: [
|
||||||
IconButton(
|
// IconButton(
|
||||||
onPressed: () => Get.toNamed(
|
// onPressed: () {},
|
||||||
'/favSearch?searchType=0&mediaId=${Get.parameters['mediaId']!}'),
|
// icon: const Icon(Icons.more_vert),
|
||||||
icon: const Icon(Icons.search_outlined),
|
// ),
|
||||||
),
|
// const SizedBox(width: 4)
|
||||||
// IconButton(
|
// ],
|
||||||
// onPressed: () {},
|
|
||||||
// icon: const Icon(Icons.more_vert),
|
|
||||||
// ),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
],
|
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
background: Container(
|
background: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|||||||
@ -49,8 +49,8 @@ class FavVideoCardH extends StatelessWidget {
|
|||||||
Get.toNamed('/video', parameters: parameters, arguments: {
|
Get.toNamed('/video', parameters: parameters, arguments: {
|
||||||
'videoItem': videoItem,
|
'videoItem': videoItem,
|
||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
'videoType':
|
// 'videoType':
|
||||||
epId != null ? SearchType.media_bangumi : SearchType.video,
|
// epId != null ? SearchType.media_bangumi : SearchType.video,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -142,21 +142,15 @@ class VideoContent extends StatelessWidget {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Text(
|
|
||||||
videoItem.owner.name,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
StatView(
|
Text(
|
||||||
theme: 'gray',
|
videoItem.owner.name,
|
||||||
view: videoItem.cntInfo['play'],
|
style: TextStyle(
|
||||||
|
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
|
||||||
StatDanMu(theme: 'gray', danmu: videoItem.cntInfo['danmaku']),
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 26,
|
width: 26,
|
||||||
|
|||||||
@ -1,75 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:pilipala/http/user.dart';
|
|
||||||
import 'package:pilipala/models/user/fav_detail.dart';
|
|
||||||
|
|
||||||
class FavSearchController extends GetxController {
|
|
||||||
final ScrollController scrollController = ScrollController();
|
|
||||||
Rx<TextEditingController> controller = TextEditingController().obs;
|
|
||||||
final FocusNode searchFocusNode = FocusNode();
|
|
||||||
RxString searchKeyWord = ''.obs; // 搜索词
|
|
||||||
String hintText = '请输入已收藏视频名称'; // 默认
|
|
||||||
RxBool loadingStatus = false.obs; // 加载状态
|
|
||||||
RxString loadingText = '加载中...'.obs; // 加载提示
|
|
||||||
bool hasMore = false;
|
|
||||||
late int searchType;
|
|
||||||
late int mediaId;
|
|
||||||
|
|
||||||
int currentPage = 1; // 当前页
|
|
||||||
int count = 0; // 总数
|
|
||||||
RxList<FavDetailItemData> favList = <FavDetailItemData>[].obs;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
searchType = int.parse(Get.parameters['searchType']!);
|
|
||||||
mediaId = int.parse(Get.parameters['mediaId']!);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 清空搜索
|
|
||||||
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 = true;
|
|
||||||
currentPage = 1;
|
|
||||||
searchFav();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 搜索收藏夹视频
|
|
||||||
Future searchFav({type = 'init'}) async {
|
|
||||||
var res = await await UserHttp.userFavFolderDetail(
|
|
||||||
pn: currentPage,
|
|
||||||
ps: 20,
|
|
||||||
mediaId: mediaId,
|
|
||||||
keyword: searchKeyWord.value,
|
|
||||||
type: searchType,
|
|
||||||
);
|
|
||||||
if (res['status']) {
|
|
||||||
if (currentPage == 1 && type == 'init') {
|
|
||||||
favList.value = res['data'].medias;
|
|
||||||
} else if (type == 'onLoad') {
|
|
||||||
favList.addAll(res['data'].medias);
|
|
||||||
}
|
|
||||||
hasMore = res['data'].hasMore;
|
|
||||||
}
|
|
||||||
currentPage += 1;
|
|
||||||
loadingStatus.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoad() {
|
|
||||||
if (!hasMore) return;
|
|
||||||
searchFav(type: 'onLoad');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
library fav_search;
|
|
||||||
|
|
||||||
export './controller.dart';
|
|
||||||
export './view.dart';
|
|
||||||
@ -1,116 +0,0 @@
|
|||||||
import 'package:easy_debounce/easy_throttle.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/no_data.dart';
|
|
||||||
import 'package:pilipala/pages/favDetail/widget/fav_video_card.dart';
|
|
||||||
|
|
||||||
import 'controller.dart';
|
|
||||||
|
|
||||||
class FavSearchPage extends StatefulWidget {
|
|
||||||
final int? sourceType;
|
|
||||||
final int? mediaId;
|
|
||||||
const FavSearchPage({super.key, this.sourceType, this.mediaId});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<FavSearchPage> createState() => _FavSearchPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FavSearchPageState extends State<FavSearchPage> {
|
|
||||||
final FavSearchController _favSearchCtr = Get.put(FavSearchController());
|
|
||||||
late ScrollController scrollController;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
scrollController = _favSearchCtr.scrollController;
|
|
||||||
scrollController.addListener(
|
|
||||||
() {
|
|
||||||
if (scrollController.position.pixels >=
|
|
||||||
scrollController.position.maxScrollExtent - 300) {
|
|
||||||
EasyThrottle.throttle('fav', const Duration(seconds: 1), () {
|
|
||||||
_favSearchCtr.onLoad();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
scrollController.removeListener(() {});
|
|
||||||
scrollController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
titleSpacing: 0,
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: () => _favSearchCtr.submit(),
|
|
||||||
icon: const Icon(Icons.search_outlined, size: 22)),
|
|
||||||
const SizedBox(width: 10)
|
|
||||||
],
|
|
||||||
title: Obx(
|
|
||||||
() => TextField(
|
|
||||||
autofocus: true,
|
|
||||||
focusNode: _favSearchCtr.searchFocusNode,
|
|
||||||
controller: _favSearchCtr.controller.value,
|
|
||||||
textInputAction: TextInputAction.search,
|
|
||||||
onChanged: (value) => _favSearchCtr.onChange(value),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: _favSearchCtr.hintText,
|
|
||||||
border: InputBorder.none,
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
Icons.clear,
|
|
||||||
size: 22,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
onPressed: () => _favSearchCtr.onClear(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSubmitted: (String value) => _favSearchCtr.submit(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: Obx(
|
|
||||||
() => _favSearchCtr.loadingStatus.value && _favSearchCtr.favList.isEmpty
|
|
||||||
? ListView.builder(
|
|
||||||
itemCount: 10,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return const VideoCardHSkeleton();
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: _favSearchCtr.favList.isNotEmpty
|
|
||||||
? ListView.builder(
|
|
||||||
controller: scrollController,
|
|
||||||
itemCount: _favSearchCtr.favList.length + 1,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == _favSearchCtr.favList.length) {
|
|
||||||
return Container(
|
|
||||||
height: MediaQuery.of(context).padding.bottom + 60,
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
bottom: MediaQuery.of(context).padding.bottom),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return FavVideoCardH(
|
|
||||||
videoItem: _favSearchCtr.favList[index],
|
|
||||||
callFn: () => null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: const CustomScrollView(
|
|
||||||
slivers: <Widget>[
|
|
||||||
NoData(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,28 +1,20 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/follow.dart';
|
import 'package:pilipala/http/follow.dart';
|
||||||
import 'package:pilipala/http/member.dart';
|
|
||||||
import 'package:pilipala/models/follow/result.dart';
|
import 'package:pilipala/models/follow/result.dart';
|
||||||
import 'package:pilipala/models/member/tags.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
/// 查看自己的关注时,可以查看分类
|
class FollowController extends GetxController {
|
||||||
/// 查看其他人的关注时,只可以看全部
|
|
||||||
class FollowController extends GetxController with GetTickerProviderStateMixin {
|
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
int pn = 1;
|
int pn = 1;
|
||||||
int ps = 20;
|
int ps = 20;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
RxList<FollowItemModel> followList = <FollowItemModel>[].obs;
|
RxList<FollowItemModel> followList = [FollowItemModel()].obs;
|
||||||
late int mid;
|
late int mid;
|
||||||
late String name;
|
late String name;
|
||||||
var userInfo;
|
var userInfo;
|
||||||
RxString loadingText = '加载中...'.obs;
|
RxString loadingText = '加载中...'.obs;
|
||||||
RxBool isOwner = false.obs;
|
|
||||||
late List<MemberTagItemModel> followTags;
|
|
||||||
late TabController tabController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -31,7 +23,6 @@ class FollowController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
mid = Get.parameters['mid'] != null
|
mid = Get.parameters['mid'] != null
|
||||||
? int.parse(Get.parameters['mid']!)
|
? int.parse(Get.parameters['mid']!)
|
||||||
: userInfo.mid;
|
: userInfo.mid;
|
||||||
isOwner.value = mid == userInfo.mid;
|
|
||||||
name = Get.parameters['name'] ?? userInfo.uname;
|
name = Get.parameters['name'] ?? userInfo.uname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,20 +56,4 @@ class FollowController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当查看当前用户的关注时,请求关注分组
|
|
||||||
Future followUpTags() async {
|
|
||||||
if (userInfo != null && mid == userInfo.mid) {
|
|
||||||
var res = await MemberHttp.followUpTags();
|
|
||||||
if (res['status']) {
|
|
||||||
followTags = res['data'];
|
|
||||||
tabController = TabController(
|
|
||||||
initialIndex: 0,
|
|
||||||
length: res['data'].length,
|
|
||||||
vsync: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
|
import 'package:pilipala/common/widgets/no_data.dart';
|
||||||
|
import 'package:pilipala/models/follow/result.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'widgets/follow_list.dart';
|
import 'widgets/follow_item.dart';
|
||||||
import 'widgets/owner_follow_list.dart';
|
|
||||||
|
|
||||||
class FollowPage extends StatefulWidget {
|
class FollowPage extends StatefulWidget {
|
||||||
const FollowPage({super.key});
|
const FollowPage({super.key});
|
||||||
@ -12,15 +16,30 @@ class FollowPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _FollowPageState extends State<FollowPage> {
|
class _FollowPageState extends State<FollowPage> {
|
||||||
late String mid;
|
final FollowController _followController = Get.put(FollowController());
|
||||||
late FollowController _followController;
|
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
|
Future? _futureBuilderFuture;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
mid = Get.parameters['mid']!;
|
_futureBuilderFuture = _followController.queryFollowings('init');
|
||||||
_followController = Get.put(FollowController(), tag: mid);
|
scrollController.addListener(
|
||||||
|
() async {
|
||||||
|
if (scrollController.position.pixels >=
|
||||||
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
|
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
|
||||||
|
_followController.queryFollowings('onLoad');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -32,57 +51,73 @@ class _FollowPageState extends State<FollowPage> {
|
|||||||
titleSpacing: 0,
|
titleSpacing: 0,
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
title: Text(
|
title: Text(
|
||||||
_followController.isOwner.value
|
'${_followController.name}的关注',
|
||||||
? '我的关注'
|
|
||||||
: '${_followController.name}的关注',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Obx(
|
body: RefreshIndicator(
|
||||||
() => !_followController.isOwner.value
|
onRefresh: () async =>
|
||||||
? FollowList(ctr: _followController)
|
await _followController.queryFollowings('init'),
|
||||||
: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _followController.followUpTags(),
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
var data = snapshot.data;
|
var data = snapshot.data;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
return Column(
|
List<FollowItemModel> list = _followController.followList;
|
||||||
children: [
|
return Obx(
|
||||||
TabBar(
|
() => list.isNotEmpty
|
||||||
controller: _followController.tabController,
|
? ListView.builder(
|
||||||
isScrollable: true,
|
controller: scrollController,
|
||||||
tabs: [
|
itemCount: list.length + 1,
|
||||||
for (var i in data['data']) ...[
|
itemBuilder: (BuildContext context, int index) {
|
||||||
Tab(text: i.name),
|
if (index == list.length) {
|
||||||
]
|
return Container(
|
||||||
]),
|
height:
|
||||||
Expanded(
|
MediaQuery.of(context).padding.bottom +
|
||||||
child: TabBarView(
|
60,
|
||||||
controller: _followController.tabController,
|
padding: EdgeInsets.only(
|
||||||
children: [
|
bottom: MediaQuery.of(context)
|
||||||
for (var i = 0;
|
.padding
|
||||||
i < _followController.tabController.length;
|
.bottom),
|
||||||
i++) ...[
|
child: Center(
|
||||||
OwnerFollowList(
|
child: Obx(
|
||||||
ctr: _followController,
|
() => Text(
|
||||||
tagItem: _followController.followTags[i],
|
_followController.loadingText.value,
|
||||||
)
|
style: TextStyle(
|
||||||
]
|
color: Theme.of(context)
|
||||||
],
|
.colorScheme
|
||||||
),
|
.outline,
|
||||||
|
fontSize: 13),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return followItem(item: list[index]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: const CustomScrollView(
|
||||||
|
slivers: [NoData()],
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
);
|
} else {
|
||||||
} else {
|
return CustomScrollView(
|
||||||
return const SizedBox();
|
slivers: [
|
||||||
}
|
HttpError(
|
||||||
} else {
|
errMsg: data['msg'],
|
||||||
return const SizedBox();
|
fn: () => _followController.queryFollowings('init'),
|
||||||
}
|
)
|
||||||
},
|
],
|
||||||
),
|
);
|
||||||
),
|
}
|
||||||
|
} else {
|
||||||
|
// 骨架屏
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,45 +1,32 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/models/follow/result.dart';
|
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class FollowItem extends StatelessWidget {
|
Widget followItem({item}) {
|
||||||
final FollowItemModel item;
|
String heroTag = Utils.makeHeroTag(item!.mid);
|
||||||
const FollowItem({super.key, required this.item});
|
return ListTile(
|
||||||
|
onTap: () {
|
||||||
@override
|
feedBack();
|
||||||
Widget build(BuildContext context) {
|
Get.toNamed('/member?mid=${item.mid}',
|
||||||
String heroTag = Utils.makeHeroTag(item!.mid);
|
arguments: {'face': item.face, 'heroTag': heroTag});
|
||||||
return ListTile(
|
},
|
||||||
onTap: () {
|
leading: Hero(
|
||||||
feedBack();
|
tag: heroTag,
|
||||||
Get.toNamed('/member?mid=${item.mid}',
|
child: NetworkImgLayer(
|
||||||
arguments: {'face': item.face, 'heroTag': heroTag});
|
width: 45,
|
||||||
},
|
height: 45,
|
||||||
leading: Hero(
|
type: 'avatar',
|
||||||
tag: heroTag,
|
src: item.face,
|
||||||
child: NetworkImgLayer(
|
|
||||||
width: 45,
|
|
||||||
height: 45,
|
|
||||||
type: 'avatar',
|
|
||||||
src: item.face,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
title: Text(
|
),
|
||||||
item.uname!,
|
title: Text(
|
||||||
maxLines: 1,
|
item.uname,
|
||||||
overflow: TextOverflow.ellipsis,
|
maxLines: 1,
|
||||||
style: const TextStyle(fontSize: 14),
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
style: const TextStyle(fontSize: 14),
|
||||||
subtitle: Text(
|
),
|
||||||
item.sign!,
|
trailing: const SizedBox(width: 6),
|
||||||
maxLines: 1,
|
);
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
dense: true,
|
|
||||||
trailing: const SizedBox(width: 6),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,111 +0,0 @@
|
|||||||
import 'package:easy_debounce/easy_throttle.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
|
||||||
import 'package:pilipala/common/widgets/no_data.dart';
|
|
||||||
import 'package:pilipala/models/follow/result.dart';
|
|
||||||
import 'package:pilipala/pages/follow/index.dart';
|
|
||||||
|
|
||||||
import 'follow_item.dart';
|
|
||||||
|
|
||||||
class FollowList extends StatefulWidget {
|
|
||||||
final FollowController ctr;
|
|
||||||
const FollowList({
|
|
||||||
super.key,
|
|
||||||
required this.ctr,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<FollowList> createState() => _FollowListState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FollowListState extends State<FollowList> {
|
|
||||||
late Future _futureBuilderFuture;
|
|
||||||
final ScrollController scrollController = ScrollController();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_futureBuilderFuture = widget.ctr.queryFollowings('init');
|
|
||||||
scrollController.addListener(
|
|
||||||
() async {
|
|
||||||
if (scrollController.position.pixels >=
|
|
||||||
scrollController.position.maxScrollExtent - 200) {
|
|
||||||
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
|
|
||||||
widget.ctr.queryFollowings('onLoad');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
scrollController.removeListener(() {});
|
|
||||||
scrollController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return RefreshIndicator(
|
|
||||||
onRefresh: () async => await widget.ctr.queryFollowings('init'),
|
|
||||||
child: FutureBuilder(
|
|
||||||
future: _futureBuilderFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
var data = snapshot.data;
|
|
||||||
if (data['status']) {
|
|
||||||
List<FollowItemModel> list = widget.ctr.followList;
|
|
||||||
return Obx(
|
|
||||||
() => list.isNotEmpty
|
|
||||||
? ListView.builder(
|
|
||||||
controller: scrollController,
|
|
||||||
itemCount: list.length + 1,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
if (index == list.length) {
|
|
||||||
return Container(
|
|
||||||
height:
|
|
||||||
MediaQuery.of(context).padding.bottom + 60,
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
bottom:
|
|
||||||
MediaQuery.of(context).padding.bottom),
|
|
||||||
child: Center(
|
|
||||||
child: Obx(
|
|
||||||
() => Text(
|
|
||||||
widget.ctr.loadingText.value,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.outline,
|
|
||||||
fontSize: 13),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return FollowItem(item: list[index]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: const CustomScrollView(slivers: [NoData()]),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return CustomScrollView(
|
|
||||||
slivers: [
|
|
||||||
HttpError(
|
|
||||||
errMsg: data['msg'],
|
|
||||||
fn: () => widget.ctr.queryFollowings('init'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 骨架屏
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,128 +0,0 @@
|
|||||||
import 'package:easy_debounce/easy_throttle.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
|
||||||
import 'package:pilipala/common/widgets/no_data.dart';
|
|
||||||
import 'package:pilipala/http/member.dart';
|
|
||||||
import 'package:pilipala/models/follow/result.dart';
|
|
||||||
import 'package:pilipala/models/member/tags.dart';
|
|
||||||
import 'package:pilipala/pages/follow/index.dart';
|
|
||||||
import 'follow_item.dart';
|
|
||||||
|
|
||||||
class OwnerFollowList extends StatefulWidget {
|
|
||||||
final FollowController ctr;
|
|
||||||
final MemberTagItemModel? tagItem;
|
|
||||||
const OwnerFollowList({super.key, required this.ctr, this.tagItem});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<OwnerFollowList> createState() => _OwnerFollowListState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _OwnerFollowListState extends State<OwnerFollowList>
|
|
||||||
with AutomaticKeepAliveClientMixin {
|
|
||||||
late int mid;
|
|
||||||
late Future _futureBuilderFuture;
|
|
||||||
final ScrollController scrollController = ScrollController();
|
|
||||||
int pn = 1;
|
|
||||||
int ps = 20;
|
|
||||||
late MemberTagItemModel tagItem;
|
|
||||||
RxList<FollowItemModel> followList = <FollowItemModel>[].obs;
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool get wantKeepAlive => true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
mid = widget.ctr.mid;
|
|
||||||
tagItem = widget.tagItem!;
|
|
||||||
_futureBuilderFuture = followUpGroup('init');
|
|
||||||
scrollController.addListener(
|
|
||||||
() async {
|
|
||||||
if (scrollController.position.pixels >=
|
|
||||||
scrollController.position.maxScrollExtent - 200) {
|
|
||||||
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
|
|
||||||
followUpGroup('onLoad');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取分组下up
|
|
||||||
Future followUpGroup(type) async {
|
|
||||||
if (type == 'init') {
|
|
||||||
pn = 1;
|
|
||||||
}
|
|
||||||
var res = await MemberHttp.followUpGroup(mid, tagItem.tagid, pn, ps);
|
|
||||||
if (res['status']) {
|
|
||||||
if (res['data'].isNotEmpty) {
|
|
||||||
if (type == 'init') {
|
|
||||||
followList.value = res['data'];
|
|
||||||
} else {
|
|
||||||
followList.addAll(res['data']);
|
|
||||||
}
|
|
||||||
pn += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
scrollController.removeListener(() {});
|
|
||||||
scrollController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
super.build(context);
|
|
||||||
return RefreshIndicator(
|
|
||||||
onRefresh: () async => await followUpGroup('init'),
|
|
||||||
child: FutureBuilder(
|
|
||||||
future: _futureBuilderFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
var data = snapshot.data;
|
|
||||||
if (data['status']) {
|
|
||||||
return Obx(
|
|
||||||
() => followList.isNotEmpty
|
|
||||||
? ListView.builder(
|
|
||||||
controller: scrollController,
|
|
||||||
itemCount: followList.length + 1,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
if (index == followList.length) {
|
|
||||||
return Container(
|
|
||||||
height:
|
|
||||||
MediaQuery.of(context).padding.bottom + 60,
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
bottom:
|
|
||||||
MediaQuery.of(context).padding.bottom),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return FollowItem(item: followList[index]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: const CustomScrollView(slivers: [NoData()]),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return CustomScrollView(
|
|
||||||
slivers: [
|
|
||||||
HttpError(
|
|
||||||
errMsg: data['msg'],
|
|
||||||
fn: () => widget.ctr.queryFollowings('init'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 骨架屏
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -79,6 +79,13 @@ class _HistoryPageState extends State<HistoryPage> {
|
|||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
// TextButton(
|
||||||
|
// onPressed: () {
|
||||||
|
// _historyController.enableMultiple.value = true;
|
||||||
|
// setState(() {});
|
||||||
|
// },
|
||||||
|
// child: const Text('多选'),
|
||||||
|
// ),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => Get.toNamed('/historySearch'),
|
onPressed: () => Get.toNamed('/historySearch'),
|
||||||
icon: const Icon(Icons.search_outlined),
|
icon: const Icon(Icons.search_outlined),
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
arguments: {
|
arguments: {
|
||||||
'pic': pic,
|
'pic': pic,
|
||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
'videoType': SearchType.media_bangumi,
|
// 'videoType': SearchType.media_bangumi,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -117,7 +117,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
arguments: {
|
arguments: {
|
||||||
'pic': pic,
|
'pic': pic,
|
||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
'videoType': SearchType.media_bangumi,
|
// 'videoType': SearchType.media_bangumi,
|
||||||
'bangumiItem': res['data'],
|
'bangumiItem': res['data'],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -276,7 +276,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
|
|
||||||
class VideoContent extends StatelessWidget {
|
class VideoContent extends StatelessWidget {
|
||||||
final dynamic videoItem;
|
final dynamic videoItem;
|
||||||
final dynamic ctr;
|
final dynamic? ctr;
|
||||||
const VideoContent({super.key, required this.videoItem, this.ctr});
|
const VideoContent({super.key, required this.videoItem, this.ctr});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -297,8 +297,7 @@ class VideoContent extends StatelessWidget {
|
|||||||
maxLines: videoItem.videos > 1 ? 1 : 2,
|
maxLines: videoItem.videos > 1 ? 1 : 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
if (videoItem.showTitle != null) ...[
|
if (videoItem.showTitle != null)
|
||||||
const SizedBox(height: 2),
|
|
||||||
Text(
|
Text(
|
||||||
videoItem.showTitle,
|
videoItem.showTitle,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
@ -306,24 +305,21 @@ class VideoContent extends StatelessWidget {
|
|||||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: Theme.of(context).colorScheme.outline),
|
color: Theme.of(context).colorScheme.outline),
|
||||||
maxLines: 1,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
],
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (videoItem.authorName != '')
|
Row(
|
||||||
Row(
|
children: [
|
||||||
children: [
|
Text(
|
||||||
Text(
|
videoItem.authorName,
|
||||||
videoItem.authorName,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
fontSize:
|
color: Theme.of(context).colorScheme.outline,
|
||||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
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';
|
||||||
|
import 'package:pilipala/http/black.dart';
|
||||||
import 'package:pilipala/models/common/tab_type.dart';
|
import 'package:pilipala/models/common/tab_type.dart';
|
||||||
|
import 'package:pilipala/models/user/black.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class HomeController extends GetxController with GetTickerProviderStateMixin {
|
class HomeController extends GetxController with GetTickerProviderStateMixin {
|
||||||
@ -15,6 +17,13 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
RxBool userLogin = false.obs;
|
RxBool userLogin = false.obs;
|
||||||
RxString userFace = ''.obs;
|
RxString userFace = ''.obs;
|
||||||
var userInfo;
|
var userInfo;
|
||||||
|
static Box setting = GStrorage.setting;
|
||||||
|
late List<int> blackMidsList;
|
||||||
|
|
||||||
|
int currentPage = 1;
|
||||||
|
int pageSize = 50;
|
||||||
|
int total = 0;
|
||||||
|
List<BlackListItem> blackList = [BlackListItem()];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -51,7 +60,33 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
void updateLoginStatus(val) async {
|
void updateLoginStatus(val) async {
|
||||||
userInfo = await userInfoCache.get('userInfoCache');
|
userInfo = await userInfoCache.get('userInfoCache');
|
||||||
userLogin.value = val ?? false;
|
userLogin.value = val ?? false;
|
||||||
if (val) return;
|
if (val) {
|
||||||
|
// 获取黑名单
|
||||||
|
await queryBlacklist();
|
||||||
|
blackMidsList = blackList.map<int>((e) => e.mid!).toList();
|
||||||
|
setting.put(SettingBoxKey.blackMidsList, blackMidsList);
|
||||||
|
return;
|
||||||
|
}
|
||||||
userFace.value = userInfo != null ? userInfo.face : '';
|
userFace.value = userInfo != null ? userInfo.face : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future queryBlacklist({type = 'init'}) async {
|
||||||
|
if (type == 'init') {
|
||||||
|
currentPage = 1;
|
||||||
|
}
|
||||||
|
var result = await BlackHttp.blackList(pn: currentPage, ps: pageSize);
|
||||||
|
if (result['status']) {
|
||||||
|
if (type == 'init') {
|
||||||
|
blackList = result['data'].list;
|
||||||
|
total = result['data'].total;
|
||||||
|
} else {
|
||||||
|
blackList.addAll(result['data'].list);
|
||||||
|
}
|
||||||
|
currentPage += 1;
|
||||||
|
if (blackList.length < total) {
|
||||||
|
await queryBlacklist(type: 'onLoad');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,8 @@ import 'package:pilipala/utils/feed_back.dart';
|
|||||||
import './controller.dart';
|
import './controller.dart';
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatefulWidget {
|
||||||
const HomePage({Key? key}) : super(key: key);
|
Function? callFn;
|
||||||
|
HomePage({Key? key, this.callFn}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HomePage> createState() => _HomePageState();
|
State<HomePage> createState() => _HomePageState();
|
||||||
@ -25,15 +26,16 @@ class _HomePageState extends State<HomePage>
|
|||||||
|
|
||||||
showUserBottonSheet() {
|
showUserBottonSheet() {
|
||||||
feedBack();
|
feedBack();
|
||||||
showModalBottomSheet(
|
widget.callFn!();
|
||||||
context: context,
|
// showModalBottomSheet(
|
||||||
builder: (_) => const SizedBox(
|
// context: context,
|
||||||
height: 450,
|
// builder: (_) => const SizedBox(
|
||||||
child: MinePage(),
|
// height: 450,
|
||||||
),
|
// child: MinePage(),
|
||||||
clipBehavior: Clip.hardEdge,
|
// ),
|
||||||
isScrollControlled: true,
|
// clipBehavior: Clip.hardEdge,
|
||||||
);
|
// isScrollControlled: true,
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -50,37 +52,6 @@ class _HomePageState extends State<HomePage>
|
|||||||
ctr: _homeController,
|
ctr: _homeController,
|
||||||
callback: showUserBottonSheet,
|
callback: showUserBottonSheet,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 42,
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: TabBar(
|
|
||||||
controller: _homeController.tabController,
|
|
||||||
tabs: [
|
|
||||||
for (var i in _homeController.tabs) Tab(text: i['label'])
|
|
||||||
],
|
|
||||||
isScrollable: true,
|
|
||||||
dividerColor: Colors.transparent,
|
|
||||||
enableFeedback: true,
|
|
||||||
splashBorderRadius: BorderRadius.circular(10),
|
|
||||||
onTap: (value) {
|
|
||||||
feedBack();
|
|
||||||
if (_homeController.initialIndex == value) {
|
|
||||||
_homeController.tabsCtrList[value]().animateToTop();
|
|
||||||
}
|
|
||||||
_homeController.initialIndex = value;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
controller: _homeController.tabController,
|
|
||||||
children: _homeController.tabsPageList,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -128,8 +99,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const Expanded(child: SearchPage()),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Obx(
|
Obx(
|
||||||
() => ctr!.userLogin.value
|
() => ctr!.userLogin.value
|
||||||
? Stack(
|
? Stack(
|
||||||
@ -182,6 +151,8 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
const Expanded(child: SearchPage()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
25
lib/pages/home/widgets/left_drawer.dart
Normal file
25
lib/pages/home/widgets/left_drawer.dart
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pilipala/pages/media/index.dart';
|
||||||
|
import 'package:pilipala/pages/mine/index.dart';
|
||||||
|
|
||||||
|
class LeftDrawer extends StatefulWidget {
|
||||||
|
const LeftDrawer({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LeftDrawer> createState() => _LeftDrawerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LeftDrawerState extends State<LeftDrawer> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Drawer(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.84,
|
||||||
|
child: const Column(
|
||||||
|
children: [
|
||||||
|
Expanded(child: MinePage()),
|
||||||
|
Expanded(child: MediaPage()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,112 +1,19 @@
|
|||||||
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 {
|
||||||
Future reqHtml(id) async {
|
var res = await HtmlHttp.reqHtml(id);
|
||||||
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,19 +1,7 @@
|
|||||||
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';
|
||||||
|
|
||||||
@ -24,104 +12,16 @@ class HtmlRenderPage extends StatefulWidget {
|
|||||||
State<HtmlRenderPage> createState() => _HtmlRenderPageState();
|
State<HtmlRenderPage> createState() => _HtmlRenderPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HtmlRenderPageState extends State<HtmlRenderPage>
|
class _HtmlRenderPageState extends State<HtmlRenderPage> {
|
||||||
with TickerProviderStateMixin {
|
HtmlRenderController htmlRenderCtr = Get.put(HtmlRenderController());
|
||||||
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
|
||||||
@ -129,328 +29,88 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
titleSpacing: 0,
|
title: Text(title),
|
||||||
title: Text(
|
|
||||||
title,
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
Get.toNamed('/webview', parameters: {
|
|
||||||
'url': url.startsWith('http') ? 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: Stack(
|
body: SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
SingleChildScrollView(
|
children: [
|
||||||
controller: scrollController,
|
FutureBuilder(
|
||||||
child: Column(
|
future: htmlRenderCtr.reqHtml(),
|
||||||
children: [
|
builder: (context, snapshot) {
|
||||||
FutureBuilder(
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
future: _futureBuilderFuture,
|
var data = snapshot.data;
|
||||||
builder: (context, snapshot) {
|
if (data['status']) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
return Column(
|
||||||
var data = snapshot.data;
|
children: [
|
||||||
fabAnimationCtr.forward();
|
Padding(
|
||||||
if (data['status']) {
|
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
||||||
return Column(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
NetworkImgLayer(
|
||||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
width: 40,
|
||||||
child: Row(
|
height: 40,
|
||||||
|
type: 'avatar',
|
||||||
|
src: htmlRenderCtr.response['avatar']!,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
Text(htmlRenderCtr.response['uname'],
|
||||||
width: 40,
|
style: TextStyle(
|
||||||
height: 40,
|
fontSize: Theme.of(context)
|
||||||
type: 'avatar',
|
.textTheme
|
||||||
src: _htmlRenderCtr.response['avatar']!,
|
.titleSmall!
|
||||||
|
.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(
|
),
|
||||||
htmlContent: _htmlRenderCtr.response['content'],
|
Padding(
|
||||||
),
|
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
||||||
),
|
child: HtmlRender(
|
||||||
Container(
|
htmlContent: htmlRenderCtr.response['content'],
|
||||||
decoration: BoxDecoration(
|
),
|
||||||
border: Border(
|
),
|
||||||
bottom: BorderSide(
|
Container(
|
||||||
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(
|
||||||
top: BorderSide(
|
bottom: BorderSide(
|
||||||
width: 0.6,
|
width: 8,
|
||||||
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(
|
);
|
||||||
children: [
|
} else {
|
||||||
const Text('回复'),
|
return Text('error');
|
||||||
const Spacer(),
|
}
|
||||||
SizedBox(
|
} else {
|
||||||
height: 35,
|
// 骨架屏
|
||||||
child: TextButton.icon(
|
return const SizedBox();
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,14 +20,14 @@ class LiveController extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
crossAxisCount.value =
|
crossAxisCount.value =
|
||||||
setting.get(SettingBoxKey.customRows, defaultValue: 2);
|
setting.get(SettingBoxKey.enableSingleRow, defaultValue: false) ? 1 : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取推荐
|
// 获取推荐
|
||||||
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,15 +21,11 @@ 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();
|
||||||
@ -41,7 +37,7 @@ class _LivePageState extends State<LivePage>
|
|||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 200) {
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
EasyThrottle.throttle('liveList', const Duration(seconds: 1), () {
|
EasyThrottle.throttle('my-throttler', const Duration(seconds: 1), () {
|
||||||
_liveController.isLoadingMore = true;
|
_liveController.isLoadingMore = true;
|
||||||
_liveController.onLoad();
|
_liveController.onLoad();
|
||||||
});
|
});
|
||||||
@ -148,9 +144,9 @@ class _LivePageState extends State<LivePage>
|
|||||||
return SliverGrid(
|
return SliverGrid(
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
// 行间距
|
// 行间距
|
||||||
mainAxisSpacing: StyleString.safeSpace,
|
mainAxisSpacing: StyleString.cardSpace + 4,
|
||||||
// 列间距
|
// 列间距
|
||||||
crossAxisSpacing: StyleString.safeSpace,
|
crossAxisSpacing: StyleString.cardSpace + 4,
|
||||||
// 列数
|
// 列数
|
||||||
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: 0,
|
elevation: crossAxisCount == 1 ? 0 : 1,
|
||||||
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(5, 8, 5, 4),
|
: const EdgeInsets.fromLTRB(9, 8, 9, 8),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
@ -120,18 +120,15 @@ class LiveContent extends StatelessWidget {
|
|||||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Text(
|
||||||
child: Text(
|
liveItem.uname,
|
||||||
liveItem.uname,
|
textAlign: TextAlign.start,
|
||||||
textAlign: TextAlign.start,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
fontSize:
|
color: Theme.of(context).colorScheme.outline,
|
||||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
if (crossAxisCount == 1) ...[
|
if (crossAxisCount == 1) ...[
|
||||||
Text(
|
Text(
|
||||||
@ -172,7 +169,7 @@ class VideoStat extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 50,
|
height: 50,
|
||||||
padding: const EdgeInsets.only(top: 26, left: 10, right: 10),
|
padding: const EdgeInsets.only(top: 22, left: 10, right: 10),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
@ -184,17 +181,18 @@ class VideoStat extends StatelessWidget {
|
|||||||
tileMode: TileMode.mirror,
|
tileMode: TileMode.mirror,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: RichText(
|
child: Row(
|
||||||
maxLines: 1,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
textAlign: TextAlign.justify,
|
children: [
|
||||||
softWrap: false,
|
Text(
|
||||||
text: TextSpan(
|
liveItem!.areaName!,
|
||||||
style: const TextStyle(fontSize: 11, color: Colors.white),
|
style: const TextStyle(fontSize: 11, color: Colors.white),
|
||||||
children: [
|
),
|
||||||
TextSpan(text: liveItem!.areaName!),
|
Text(
|
||||||
TextSpan(text: liveItem!.watchedShow!['text_small']),
|
liveItem!.watchedShow!['text_small'],
|
||||||
],
|
style: const TextStyle(fontSize: 11, color: Colors.white),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,53 +4,11 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/pages/dynamics/index.dart';
|
// import 'package:pilipala/pages/dynamics/index.dart';
|
||||||
import 'package:pilipala/pages/home/view.dart';
|
|
||||||
import 'package:pilipala/pages/media/index.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class MainController extends GetxController {
|
class MainController extends GetxController {
|
||||||
List<Widget> pages = <Widget>[
|
|
||||||
const HomePage(),
|
|
||||||
const DynamicsPage(),
|
|
||||||
const MediaPage(),
|
|
||||||
];
|
|
||||||
RxList navigationBars = [
|
|
||||||
{
|
|
||||||
'icon': const Icon(
|
|
||||||
Icons.favorite_outline,
|
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
'selectIcon': const Icon(
|
|
||||||
Icons.favorite,
|
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
'label': "首页",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'icon': const Icon(
|
|
||||||
Icons.motion_photos_on_outlined,
|
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
'selectIcon': const Icon(
|
|
||||||
Icons.motion_photos_on,
|
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
'label': "动态",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'icon': const Icon(
|
|
||||||
Icons.folder_outlined,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
'selectIcon': const Icon(
|
|
||||||
Icons.folder,
|
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
'label': "媒体库",
|
|
||||||
}
|
|
||||||
].obs;
|
|
||||||
final StreamController<bool> bottomBarStream =
|
final StreamController<bool> bottomBarStream =
|
||||||
StreamController<bool>.broadcast();
|
StreamController<bool>.broadcast();
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/pages/dynamics/index.dart';
|
import 'package:pilipala/pages/dynamics/index.dart';
|
||||||
import 'package:pilipala/pages/home/index.dart';
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
|
import 'package:pilipala/pages/home/widgets/left_drawer.dart';
|
||||||
import 'package:pilipala/pages/media/index.dart';
|
import 'package:pilipala/pages/media/index.dart';
|
||||||
import 'package:pilipala/utils/event_bus.dart';
|
import 'package:pilipala/utils/event_bus.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
@ -18,80 +19,16 @@ class MainApp extends StatefulWidget {
|
|||||||
|
|
||||||
class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
||||||
final MainController _mainController = Get.put(MainController());
|
final MainController _mainController = Get.put(MainController());
|
||||||
final HomeController _homeController = Get.put(HomeController());
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
final DynamicsController _dynamicController = Get.put(DynamicsController());
|
|
||||||
final MediaController _mediaController = Get.put(MediaController());
|
|
||||||
|
|
||||||
PageController? _pageController;
|
|
||||||
|
|
||||||
late AnimationController? _animationController;
|
|
||||||
late Animation<double>? _fadeAnimation;
|
|
||||||
late Animation<double>? _slideAnimation;
|
|
||||||
int selectedIndex = 0;
|
int selectedIndex = 0;
|
||||||
int? _lastSelectTime; //上次点击时间
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_animationController = AnimationController(
|
|
||||||
duration: const Duration(milliseconds: 800),
|
|
||||||
reverseDuration: const Duration(milliseconds: 0),
|
|
||||||
value: 1,
|
|
||||||
vsync: this,
|
|
||||||
);
|
|
||||||
_fadeAnimation =
|
|
||||||
Tween<double>(begin: 0.8, end: 1.0).animate(_animationController!);
|
|
||||||
_slideAnimation =
|
|
||||||
Tween(begin: 0.8, end: 1.0).animate(_animationController!);
|
|
||||||
_lastSelectTime = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
_pageController = PageController(initialPage: selectedIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIndex(int value) async {
|
void openDrawer() {
|
||||||
feedBack();
|
_scaffoldKey.currentState?.openDrawer();
|
||||||
if (selectedIndex != value) {
|
|
||||||
selectedIndex = value;
|
|
||||||
_animationController!.reverse().then((_) {
|
|
||||||
selectedIndex = value;
|
|
||||||
_animationController!.forward();
|
|
||||||
});
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
_pageController!.jumpToPage(value);
|
|
||||||
var currentPage = _mainController.pages[value];
|
|
||||||
if (currentPage is HomePage) {
|
|
||||||
if (_homeController.flag) {
|
|
||||||
// 单击返回顶部 双击并刷新
|
|
||||||
if (DateTime.now().millisecondsSinceEpoch - _lastSelectTime! < 500) {
|
|
||||||
_homeController.onRefresh();
|
|
||||||
} else {
|
|
||||||
_homeController.animateToTop();
|
|
||||||
}
|
|
||||||
_lastSelectTime = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
}
|
|
||||||
_homeController.flag = true;
|
|
||||||
} else {
|
|
||||||
_homeController.flag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentPage is DynamicsPage) {
|
|
||||||
if (_dynamicController.flag) {
|
|
||||||
// 单击返回顶部 双击并刷新
|
|
||||||
if (DateTime.now().millisecondsSinceEpoch - _lastSelectTime! < 500) {
|
|
||||||
_dynamicController.onRefresh();
|
|
||||||
} else {
|
|
||||||
_dynamicController.animateToTop();
|
|
||||||
}
|
|
||||||
_lastSelectTime = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
}
|
|
||||||
_dynamicController.flag = true;
|
|
||||||
} else {
|
|
||||||
_dynamicController.flag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentPage is MediaPage) {
|
|
||||||
_mediaController.queryFavFolder();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -113,55 +50,10 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () => _mainController.onBackPressed(context),
|
onWillPop: () => _mainController.onBackPressed(context),
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
key: _scaffoldKey,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
body: FadeTransition(
|
drawer: const LeftDrawer(),
|
||||||
opacity: _fadeAnimation!,
|
body: HomePage(callFn: openDrawer),
|
||||||
child: SlideTransition(
|
|
||||||
position: Tween<Offset>(
|
|
||||||
begin: const Offset(0, 0.5),
|
|
||||||
end: Offset.zero,
|
|
||||||
).animate(
|
|
||||||
CurvedAnimation(
|
|
||||||
parent: _slideAnimation!,
|
|
||||||
curve: Curves.fastOutSlowIn,
|
|
||||||
reverseCurve: Curves.linear,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: PageView(
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
controller: _pageController,
|
|
||||||
onPageChanged: (index) {
|
|
||||||
selectedIndex = index;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
children: _mainController.pages,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
bottomNavigationBar: StreamBuilder(
|
|
||||||
stream: _mainController.bottomBarStream.stream,
|
|
||||||
initialData: true,
|
|
||||||
builder: (context, AsyncSnapshot snapshot) {
|
|
||||||
return AnimatedSlide(
|
|
||||||
curve: Curves.easeInOutCubicEmphasized,
|
|
||||||
duration: const Duration(milliseconds: 1000),
|
|
||||||
offset: Offset(0, snapshot.data ? 0 : 1),
|
|
||||||
child: NavigationBar(
|
|
||||||
onDestinationSelected: (value) => setIndex(value),
|
|
||||||
selectedIndex: selectedIndex,
|
|
||||||
destinations: <Widget>[
|
|
||||||
..._mainController.navigationBars.map((e) {
|
|
||||||
return NavigationDestination(
|
|
||||||
icon: e['icon'],
|
|
||||||
selectedIcon: e['selectIcon'],
|
|
||||||
label: e['label'],
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
|
||||||
import 'package:pilipala/models/user/fav_folder.dart';
|
|
||||||
import 'package:pilipala/pages/media/index.dart';
|
import 'package:pilipala/pages/media/index.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
|
||||||
|
|
||||||
class MediaPage extends StatefulWidget {
|
class MediaPage extends StatefulWidget {
|
||||||
const MediaPage({super.key});
|
const MediaPage({super.key});
|
||||||
@ -15,7 +12,6 @@ class MediaPage extends StatefulWidget {
|
|||||||
class _MediaPageState extends State<MediaPage>
|
class _MediaPageState extends State<MediaPage>
|
||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
late MediaController mediaController;
|
late MediaController mediaController;
|
||||||
late Future _futureBuilderFuture;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
@ -24,13 +20,6 @@ class _MediaPageState extends State<MediaPage>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
mediaController = Get.put(MediaController());
|
mediaController = Get.put(MediaController());
|
||||||
_futureBuilderFuture = mediaController.queryFavFolder();
|
|
||||||
|
|
||||||
mediaController.userLogin.listen((status) {
|
|
||||||
setState(() {
|
|
||||||
_futureBuilderFuture = mediaController.queryFavFolder();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -38,243 +27,29 @@ class _MediaPageState extends State<MediaPage>
|
|||||||
super.build(context);
|
super.build(context);
|
||||||
Color primary = Theme.of(context).colorScheme.primary;
|
Color primary = Theme.of(context).colorScheme.primary;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(toolbarHeight: 30),
|
body: Column(
|
||||||
body: SingleChildScrollView(
|
children: [
|
||||||
child: Column(
|
for (var i in mediaController.list) ...[
|
||||||
children: [
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: null,
|
onTap: () => i['onTap'](),
|
||||||
title: Padding(
|
dense: true,
|
||||||
padding: const EdgeInsets.only(left: 20),
|
leading: Padding(
|
||||||
child: Text(
|
padding: const EdgeInsets.only(left: 15),
|
||||||
'媒体库',
|
child: Icon(
|
||||||
style: TextStyle(
|
i['icon'],
|
||||||
fontSize: Theme.of(context).textTheme.titleLarge!.fontSize,
|
color: primary,
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.only(left: 15, top: 2, bottom: 2),
|
||||||
|
minLeadingWidth: 0,
|
||||||
|
title: Text(
|
||||||
|
i['title'],
|
||||||
|
style: const TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
for (var i in mediaController.list) ...[
|
|
||||||
ListTile(
|
|
||||||
onTap: () => i['onTap'](),
|
|
||||||
dense: true,
|
|
||||||
leading: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 15),
|
|
||||||
child: Icon(
|
|
||||||
i['icon'],
|
|
||||||
color: primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
contentPadding:
|
|
||||||
const EdgeInsets.only(left: 15, top: 2, bottom: 2),
|
|
||||||
minLeadingWidth: 0,
|
|
||||||
title: Text(
|
|
||||||
i['title'],
|
|
||||||
style: const TextStyle(fontSize: 15),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
Obx(() => mediaController.userLogin.value
|
|
||||||
? favFolder(mediaController, context)
|
|
||||||
: const SizedBox())
|
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget favFolder(mediaController, context) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Divider(
|
|
||||||
height: 35,
|
|
||||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () {},
|
|
||||||
leading: null,
|
|
||||||
dense: true,
|
|
||||||
title: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 10),
|
|
||||||
child: Obx(
|
|
||||||
() => Text.rich(
|
|
||||||
TextSpan(
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: '收藏夹 ',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize:
|
|
||||||
Theme.of(context).textTheme.titleMedium!.fontSize,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
if (mediaController.favFolderData.value.count != null)
|
|
||||||
TextSpan(
|
|
||||||
text: mediaController.favFolderData.value.count
|
|
||||||
.toString(),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize:
|
|
||||||
Theme.of(context).textTheme.titleSmall!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
trailing: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_futureBuilderFuture = mediaController.queryFavFolder();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.refresh,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// const SizedBox(height: 10),
|
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 200 * MediaQuery.of(context).textScaleFactor,
|
|
||||||
child: FutureBuilder(
|
|
||||||
future: _futureBuilderFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
if (snapshot.data == null) {
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
Map data = snapshot.data as Map;
|
|
||||||
if (data['status']) {
|
|
||||||
List favFolderList =
|
|
||||||
mediaController.favFolderData.value.list!;
|
|
||||||
int favFolderCount =
|
|
||||||
mediaController.favFolderData.value.count!;
|
|
||||||
bool flag = favFolderCount > favFolderList.length;
|
|
||||||
return Obx(() => ListView.builder(
|
|
||||||
itemCount:
|
|
||||||
mediaController.favFolderData.value.list!.length +
|
|
||||||
(flag ? 1 : 0),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (flag && index == favFolderList.length) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
right: 14, bottom: 35),
|
|
||||||
child: Center(
|
|
||||||
child: IconButton(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: MaterialStateProperty.all(
|
|
||||||
EdgeInsets.zero),
|
|
||||||
backgroundColor:
|
|
||||||
MaterialStateProperty.resolveWith(
|
|
||||||
(states) {
|
|
||||||
return Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primaryContainer
|
|
||||||
.withOpacity(0.5);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
onPressed: () => Get.toNamed('/fav'),
|
|
||||||
icon: Icon(
|
|
||||||
Icons.arrow_forward_ios,
|
|
||||||
size: 18,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
return FavFolderItem(
|
|
||||||
item: mediaController
|
|
||||||
.favFolderData.value.list![index],
|
|
||||||
index: index);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
return SizedBox(
|
|
||||||
height: 160,
|
|
||||||
child: Center(child: Text(data['msg'])),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 骨架屏
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class FavFolderItem extends StatelessWidget {
|
|
||||||
const FavFolderItem({super.key, this.item, this.index});
|
|
||||||
final FavFolderItemData? item;
|
|
||||||
final int? index;
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
String heroTag = Utils.makeHeroTag(item!.fid);
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
margin: EdgeInsets.only(left: index == 0 ? 20 : 0, right: 14),
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () => Get.toNamed('/favDetail',
|
|
||||||
arguments: item,
|
|
||||||
parameters: {'mediaId': item!.id.toString(), 'heroTag': heroTag}),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
Container(
|
|
||||||
width: 180,
|
|
||||||
height: 110,
|
|
||||||
margin: const EdgeInsets.only(bottom: 8),
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
|
||||||
offset: const Offset(4, -12), // 阴影与容器的距离
|
|
||||||
blurRadius: 0.0, // 高斯的标准偏差与盒子的形状卷积。
|
|
||||||
spreadRadius: 0.0, // 在应用模糊之前,框应该膨胀的量。
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: LayoutBuilder(
|
|
||||||
builder: (context, BoxConstraints box) {
|
|
||||||
return Hero(
|
|
||||||
tag: heroTag,
|
|
||||||
child: NetworkImgLayer(
|
|
||||||
src: item!.cover,
|
|
||||||
width: box.maxWidth,
|
|
||||||
height: box.maxHeight,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' ${item!.title}',
|
|
||||||
overflow: TextOverflow.fade,
|
|
||||||
maxLines: 1,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' 共${item!.mediaCount}条视频',
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.labelSmall!
|
|
||||||
.copyWith(color: Theme.of(context).colorScheme.outline),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,43 +2,23 @@ import 'package:get/get.dart';
|
|||||||
import 'package:pilipala/http/member.dart';
|
import 'package:pilipala/http/member.dart';
|
||||||
|
|
||||||
class ArchiveController extends GetxController {
|
class ArchiveController extends GetxController {
|
||||||
ArchiveController(this.mid);
|
|
||||||
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']!);
|
||||||
print('🐶🐶: $mid');
|
|
||||||
currentOrder.value = orderList.first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户投稿
|
// 获取用户投稿
|
||||||
Future getMemberArchive() async {
|
Future getMemberArchive() async {
|
||||||
var res = await MemberHttp.memberArchive(
|
var res = await MemberHttp.memberArchive(mid: mid, pn: pn);
|
||||||
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];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,12 +5,10 @@ import 'package:loading_more_list/loading_more_list.dart';
|
|||||||
import 'package:pilipala/common/widgets/video_card_h.dart';
|
import 'package:pilipala/common/widgets/video_card_h.dart';
|
||||||
import 'package:pilipala/models/member/archive.dart';
|
import 'package:pilipala/models/member/archive.dart';
|
||||||
import 'package:pilipala/pages/member/archive/index.dart';
|
import 'package:pilipala/pages/member/archive/index.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
|
||||||
import 'package:pull_to_refresh_notification/pull_to_refresh_notification.dart';
|
import 'package:pull_to_refresh_notification/pull_to_refresh_notification.dart';
|
||||||
|
|
||||||
class ArchivePanel extends StatefulWidget {
|
class ArchivePanel extends StatefulWidget {
|
||||||
final int? mid;
|
const ArchivePanel({super.key});
|
||||||
const ArchivePanel({super.key, this.mid});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ArchivePanel> createState() => _ArchivePanelState();
|
State<ArchivePanel> createState() => _ArchivePanelState();
|
||||||
@ -19,21 +17,11 @@ class ArchivePanel extends StatefulWidget {
|
|||||||
class _ArchivePanelState extends State<ArchivePanel>
|
class _ArchivePanelState extends State<ArchivePanel>
|
||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
DateTime lastRefreshTime = DateTime.now();
|
DateTime lastRefreshTime = DateTime.now();
|
||||||
late final LoadMoreListSource source;
|
late final LoadMoreListSource source = LoadMoreListSource();
|
||||||
late final ArchiveController _archiveController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
print('🐶🐶: ${widget.mid}');
|
|
||||||
_archiveController = Get.put(ArchiveController(widget.mid),
|
|
||||||
tag: Utils.makeHeroTag(widget.mid));
|
|
||||||
source = LoadMoreListSource(_archiveController);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
@ -52,63 +40,14 @@ class _ArchivePanelState extends State<ArchivePanel>
|
|||||||
// return PullToRefreshHeader(info, lastRefreshTime);
|
// return PullToRefreshHeader(info, lastRefreshTime);
|
||||||
// },
|
// },
|
||||||
// ),
|
// ),
|
||||||
Padding(
|
const SizedBox(height: 4),
|
||||||
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) {
|
||||||
if (index == 0) {
|
return VideoCardH(videoItem: item);
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
VideoCardH(videoItem: item)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return VideoCardH(videoItem: item);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
indicatorBuilder: _buildIndicator,
|
indicatorBuilder: _buildIndicator,
|
||||||
),
|
),
|
||||||
@ -203,18 +142,14 @@ class _ArchivePanelState extends State<ArchivePanel>
|
|||||||
}
|
}
|
||||||
|
|
||||||
class LoadMoreListSource extends LoadingMoreBase<VListItemModel> {
|
class LoadMoreListSource extends LoadingMoreBase<VListItemModel> {
|
||||||
late ArchiveController ctr;
|
final ArchiveController _archiveController =
|
||||||
LoadMoreListSource(this.ctr);
|
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 ctr.getMemberArchive();
|
var res = await _archiveController.getMemberArchive();
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
if (ctr.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']) {
|
||||||
@ -224,17 +159,4 @@ 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,26 +3,23 @@ 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/member.dart';
|
import 'package:pilipala/http/member.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
|
||||||
import 'package:pilipala/http/video.dart';
|
import 'package:pilipala/http/video.dart';
|
||||||
import 'package:pilipala/models/member/archive.dart';
|
import 'package:pilipala/models/member/archive.dart';
|
||||||
import 'package:pilipala/models/member/info.dart';
|
import 'package:pilipala/models/member/info.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
|
||||||
|
|
||||||
class MemberController extends GetxController {
|
class MemberController extends GetxController {
|
||||||
late int mid;
|
late int mid;
|
||||||
Rx<MemberInfoModel> memberInfo = MemberInfoModel().obs;
|
Rx<MemberInfoModel> memberInfo = MemberInfoModel().obs;
|
||||||
Map? userStat;
|
Map? userStat;
|
||||||
RxString face = ''.obs;
|
String? face;
|
||||||
String? heroTag;
|
String? heroTag;
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
late int ownerMid;
|
late int ownerMid;
|
||||||
// 投稿列表
|
// 投稿列表
|
||||||
RxList<VListItemModel>? archiveList = [VListItemModel()].obs;
|
RxList<VListItemModel>? archiveList = [VListItemModel()].obs;
|
||||||
var userInfo;
|
var userInfo;
|
||||||
RxInt attribute = (-1).obs;
|
Box setting = GStrorage.setting;
|
||||||
RxString attributeText = '关注'.obs;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -30,9 +27,8 @@ 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.value = Get.arguments['face'] ?? '';
|
face = Get.arguments['face'] ?? '';
|
||||||
heroTag = Get.arguments['heroTag'] ?? '';
|
heroTag = Get.arguments['heroTag'] ?? '';
|
||||||
relationSearch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
@ -41,7 +37,6 @@ 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;
|
||||||
}
|
}
|
||||||
@ -69,25 +64,18 @@ class MemberController extends GetxController {
|
|||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (attribute.value == 128) {
|
|
||||||
blockUser();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SmartDialog.show(
|
SmartDialog.show(
|
||||||
useSystem: true,
|
useSystem: true,
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('提示'),
|
title: const Text('提示'),
|
||||||
content: Text(memberInfo.value.isFollowed! ? '取消关注UP主?' : '关注UP主?'),
|
content: Text(memberInfo.value.isFollowed! ? '取消关注该用户?' : '关注该用户?'),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => SmartDialog.dismiss(),
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
child: Text(
|
child: const Text('取消')),
|
||||||
'点错了',
|
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await VideoHttp.relationMod(
|
await VideoHttp.relationMod(
|
||||||
@ -96,7 +84,8 @@ class MemberController extends GetxController {
|
|||||||
reSrc: 11,
|
reSrc: 11,
|
||||||
);
|
);
|
||||||
memberInfo.value.isFollowed = !memberInfo.value.isFollowed!;
|
memberInfo.value.isFollowed = !memberInfo.value.isFollowed!;
|
||||||
relationSearch();
|
SmartDialog.dismiss();
|
||||||
|
SmartDialog.showLoading();
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
memberInfo.update((val) {});
|
memberInfo.update((val) {});
|
||||||
},
|
},
|
||||||
@ -108,26 +97,9 @@ class MemberController extends GetxController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关系查询
|
|
||||||
Future relationSearch() async {
|
|
||||||
if (userInfo == null) return;
|
|
||||||
if (mid == ownerMid) return;
|
|
||||||
var res = await UserHttp.relationSearch(mid);
|
|
||||||
if (res['status']) {
|
|
||||||
attribute.value = res['data']['relation']['attribute'];
|
|
||||||
attributeText.value = attribute.value == 0
|
|
||||||
? '关注'
|
|
||||||
: attribute.value == 2
|
|
||||||
? '已关注'
|
|
||||||
: attribute.value == 6
|
|
||||||
? '已互粉'
|
|
||||||
: '已拉黑';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 拉黑用户
|
// 拉黑用户
|
||||||
Future blockUser() async {
|
Future blockUser(int mid) async {
|
||||||
if (userInfo == null) {
|
if (userInfoCache.get('userInfoCache') == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -137,12 +109,12 @@ class MemberController extends GetxController {
|
|||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('提示'),
|
title: const Text('提示'),
|
||||||
content: Text(attribute.value != 128 ? '确定拉黑UP主?' : '从黑名单移除UP主'),
|
content: const Text('确认拉黑该用户?'),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => SmartDialog.dismiss(),
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
child: Text(
|
child: Text(
|
||||||
'点错了',
|
'取消',
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -150,16 +122,15 @@ class MemberController extends GetxController {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var res = await VideoHttp.relationMod(
|
var res = await VideoHttp.relationMod(
|
||||||
mid: mid,
|
mid: mid,
|
||||||
act: attribute.value != 128 ? 5 : 6,
|
act: 5,
|
||||||
reSrc: 11,
|
reSrc: 11,
|
||||||
);
|
);
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
attribute.value = attribute.value != 128 ? 128 : 0;
|
List<int> blackMidsList = setting
|
||||||
attributeText.value = attribute.value == 128 ? '已拉黑' : '关注';
|
.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
||||||
memberInfo.value.isFollowed = false;
|
blackMidsList.add(mid);
|
||||||
relationSearch();
|
setting.put(SettingBoxKey.blackMidsList, blackMidsList);
|
||||||
memberInfo.update((val) {});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text('确认'),
|
child: const Text('确认'),
|
||||||
@ -169,8 +140,4 @@ class MemberController extends GetxController {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shareUser() {
|
|
||||||
Share.share('${memberInfo.value.name} - https://space.bilibili.com/$mid');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'package:get/get.dart';
|
|||||||
import 'package:pilipala/http/member.dart';
|
import 'package:pilipala/http/member.dart';
|
||||||
|
|
||||||
class MemberDynamicPanelController extends GetxController {
|
class MemberDynamicPanelController extends GetxController {
|
||||||
MemberDynamicPanelController(this.mid);
|
|
||||||
int? mid;
|
int? mid;
|
||||||
String offset = '';
|
String offset = '';
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -10,7 +9,7 @@ class MemberDynamicPanelController extends GetxController {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
mid ??= int.parse(Get.parameters['mid']!);
|
mid = int.parse(Get.parameters['mid']!);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future getMemberDynamic() async {
|
Future getMemberDynamic() async {
|
||||||
|
|||||||
@ -4,13 +4,11 @@ import 'package:get/get.dart';
|
|||||||
import 'package:loading_more_list/loading_more_list.dart';
|
import 'package:loading_more_list/loading_more_list.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/pages/dynamics/widgets/dynamic_panel.dart';
|
import 'package:pilipala/pages/dynamics/widgets/dynamic_panel.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
|
|
||||||
class MemberDynamicPanel extends StatefulWidget {
|
class MemberDynamicPanel extends StatefulWidget {
|
||||||
final int? mid;
|
const MemberDynamicPanel({super.key});
|
||||||
const MemberDynamicPanel({super.key, this.mid});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MemberDynamicPanel> createState() => _MemberDynamicPanelState();
|
State<MemberDynamicPanel> createState() => _MemberDynamicPanelState();
|
||||||
@ -19,20 +17,11 @@ class MemberDynamicPanel extends StatefulWidget {
|
|||||||
class _MemberDynamicPanelState extends State<MemberDynamicPanel>
|
class _MemberDynamicPanelState extends State<MemberDynamicPanel>
|
||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
DateTime lastRefreshTime = DateTime.now();
|
DateTime lastRefreshTime = DateTime.now();
|
||||||
late final LoadMoreListSource source;
|
late final LoadMoreListSource source = LoadMoreListSource();
|
||||||
late final MemberDynamicPanelController _dynamicController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_dynamicController = Get.put(MemberDynamicPanelController(widget.mid),
|
|
||||||
tag: Utils.makeHeroTag(widget.mid));
|
|
||||||
source = LoadMoreListSource(_dynamicController);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
@ -129,13 +118,13 @@ class _MemberDynamicPanelState extends State<MemberDynamicPanel>
|
|||||||
}
|
}
|
||||||
|
|
||||||
class LoadMoreListSource extends LoadingMoreBase<DynamicItemModel> {
|
class LoadMoreListSource extends LoadingMoreBase<DynamicItemModel> {
|
||||||
late MemberDynamicPanelController ctr;
|
final _dynamicController =
|
||||||
LoadMoreListSource(this.ctr);
|
Get.put(MemberDynamicPanelController(), tag: Get.arguments['heroTag']);
|
||||||
|
|
||||||
@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 ctr.getMemberDynamic();
|
var res = await _dynamicController.getMemberDynamic();
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
addAll(res['data'].items);
|
addAll(res['data'].items);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,6 @@ 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';
|
||||||
|
|
||||||
@ -21,26 +20,21 @@ class MemberPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _MemberPageState extends State<MemberPage>
|
class _MemberPageState extends State<MemberPage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late String heroTag;
|
final MemberController _memberController = Get.put(MemberController());
|
||||||
late MemberController _memberController;
|
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
final ScrollController _extendNestCtr = ScrollController();
|
final ScrollController _extendNestCtr = ScrollController();
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
final StreamController<bool> appbarStream = StreamController<bool>();
|
final StreamController<bool> appbarStream = StreamController<bool>();
|
||||||
late int mid;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
mid = int.parse(Get.parameters['mid']!);
|
|
||||||
heroTag = Get.arguments['heroTag'] ?? Utils.makeHeroTag(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(
|
||||||
() {
|
() {
|
||||||
double offset = _extendNestCtr.position.pixels;
|
double offset = _extendNestCtr.position.pixels;
|
||||||
if (offset > 230) {
|
if (offset > 250) {
|
||||||
appbarStream.add(true);
|
appbarStream.add(true);
|
||||||
} else {
|
} else {
|
||||||
appbarStream.add(false);
|
appbarStream.add(false);
|
||||||
@ -69,7 +63,7 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
elevation: 0,
|
elevation: 0,
|
||||||
scrolledUnderElevation: 1,
|
scrolledUnderElevation: 1,
|
||||||
forceElevated: innerBoxIsScrolled,
|
forceElevated: innerBoxIsScrolled,
|
||||||
expandedHeight: 290,
|
expandedHeight: 320,
|
||||||
titleSpacing: 0,
|
titleSpacing: 0,
|
||||||
title: StreamBuilder(
|
title: StreamBuilder(
|
||||||
stream: appbarStream.stream,
|
stream: appbarStream.stream,
|
||||||
@ -83,13 +77,11 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Obx(
|
NetworkImgLayer(
|
||||||
() => NetworkImgLayer(
|
width: 35,
|
||||||
width: 35,
|
height: 35,
|
||||||
height: 35,
|
type: 'avatar',
|
||||||
type: 'avatar',
|
src: _memberController.face ?? '',
|
||||||
src: _memberController.face.value,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Obx(
|
Obx(
|
||||||
@ -115,78 +107,74 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
'/memberSearch?mid=${Get.parameters['mid']}&uname=${_memberController.memberInfo.value.name!}'),
|
'/memberSearch?mid=${Get.parameters['mid']}&uname=${_memberController.memberInfo.value.name!}'),
|
||||||
icon: const Icon(Icons.search_outlined),
|
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 !=
|
// if (_memberController.ownerMid !=
|
||||||
_memberController.mid) ...[
|
// _memberController.mid) ...[
|
||||||
PopupMenuItem(
|
// PopupMenuItem(
|
||||||
onTap: () => _memberController.blockUser(),
|
// onTap: () => _memberController.blockUser(),
|
||||||
child: Row(
|
// child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
// mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
// children: [
|
||||||
const Icon(Icons.block, size: 19),
|
// const Icon(Icons.block, size: 19),
|
||||||
const SizedBox(width: 10),
|
// const SizedBox(width: 10),
|
||||||
Text(_memberController.attribute.value != 128
|
// Text(_memberController.attribute.value != 128
|
||||||
? '加入黑名单'
|
// ? '加入黑名单'
|
||||||
: '移除黑名单'),
|
// : '移除黑名单'),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
PopupMenuItem(
|
// PopupMenuItem(
|
||||||
onTap: () => _memberController.shareUser(),
|
// onTap: () => _memberController.shareUser(),
|
||||||
child: Row(
|
// child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
// mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
// children: [
|
||||||
const Icon(Icons.share_outlined, size: 19),
|
// const Icon(Icons.share_outlined, size: 19),
|
||||||
const SizedBox(width: 10),
|
// const SizedBox(width: 10),
|
||||||
Text(_memberController.ownerMid !=
|
// Text(_memberController.ownerMid !=
|
||||||
_memberController.mid
|
// _memberController.mid
|
||||||
? '分享UP主'
|
// ? '分享UP主'
|
||||||
: '分享我的主页'),
|
// : '分享我的主页'),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
],
|
],
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
background: Stack(
|
background: Stack(
|
||||||
children: [
|
children: [
|
||||||
Obx(
|
// if (_memberController.face != null)
|
||||||
() => _memberController.face.value != ''
|
// Positioned.fill(
|
||||||
? Positioned.fill(
|
// bottom: 10,
|
||||||
bottom: 10,
|
// child: Container(
|
||||||
child: Container(
|
// decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
// image: DecorationImage(
|
||||||
image: DecorationImage(
|
// fit: BoxFit.fitWidth,
|
||||||
fit: BoxFit.fitWidth,
|
// image: NetworkImage(_memberController.face!),
|
||||||
image: NetworkImage(
|
// alignment: Alignment.topCenter,
|
||||||
_memberController.face.value),
|
// isAntiAlias: true,
|
||||||
alignment: Alignment.topCenter,
|
// ),
|
||||||
isAntiAlias: true,
|
// ),
|
||||||
),
|
// foregroundDecoration: BoxDecoration(
|
||||||
),
|
// gradient: LinearGradient(
|
||||||
foregroundDecoration: BoxDecoration(
|
// colors: [
|
||||||
gradient: LinearGradient(
|
// Theme.of(context)
|
||||||
colors: [
|
// .colorScheme
|
||||||
Theme.of(context)
|
// .background
|
||||||
.colorScheme
|
// .withOpacity(0.44),
|
||||||
.background
|
// Theme.of(context).colorScheme.background,
|
||||||
.withOpacity(0.44),
|
// ],
|
||||||
Theme.of(context).colorScheme.background,
|
// begin: Alignment.topCenter,
|
||||||
],
|
// end: Alignment.bottomCenter,
|
||||||
begin: Alignment.topCenter,
|
// stops: const [0.0, 0.46],
|
||||||
end: Alignment.bottomCenter,
|
// ),
|
||||||
stops: const [0.0, 0.46],
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
),
|
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
@ -196,7 +184,159 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.background,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
profileWidget(),
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 18, right: 18),
|
||||||
|
child: FutureBuilder(
|
||||||
|
future: _futureBuilderFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState ==
|
||||||
|
ConnectionState.done) {
|
||||||
|
Map data = snapshot.data!;
|
||||||
|
if (data['status']) {
|
||||||
|
return Obx(
|
||||||
|
() => Stack(
|
||||||
|
alignment: AlignmentDirectional.center,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
profile(_memberController),
|
||||||
|
const SizedBox(height: 14),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
_memberController
|
||||||
|
.memberInfo.value.name!,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodyLarge!
|
||||||
|
.copyWith(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold),
|
||||||
|
)),
|
||||||
|
// const SizedBox(width: 2),
|
||||||
|
// if (_memberController
|
||||||
|
// .memberInfo.value.sex ==
|
||||||
|
// '女')
|
||||||
|
// const Icon(
|
||||||
|
// FontAwesomeIcons.venus,
|
||||||
|
// size: 14,
|
||||||
|
// color: Colors.pink,
|
||||||
|
// ),
|
||||||
|
// if (_memberController
|
||||||
|
// .memberInfo.value.sex ==
|
||||||
|
// '男')
|
||||||
|
// const Icon(
|
||||||
|
// FontAwesomeIcons.mars,
|
||||||
|
// size: 14,
|
||||||
|
// color: Colors.blue,
|
||||||
|
// ),
|
||||||
|
// const SizedBox(width: 4),
|
||||||
|
// Image.asset(
|
||||||
|
// 'assets/images/lv/lv${_memberController.memberInfo.value.level}.png',
|
||||||
|
// height: 11,
|
||||||
|
// ),
|
||||||
|
// const SizedBox(width: 6),
|
||||||
|
// if (_memberController.memberInfo
|
||||||
|
// .value.vip!.status ==
|
||||||
|
// 1 &&
|
||||||
|
// _memberController.memberInfo
|
||||||
|
// .value.vip!.label![
|
||||||
|
// 'img_label_uri_hans'] !=
|
||||||
|
// '') ...[
|
||||||
|
// Image.network(
|
||||||
|
// _memberController.memberInfo
|
||||||
|
// .value.vip!.label![
|
||||||
|
// 'img_label_uri_hans'],
|
||||||
|
// height: 20,
|
||||||
|
// ),
|
||||||
|
// ] else if (_memberController
|
||||||
|
// .memberInfo
|
||||||
|
// .value
|
||||||
|
// .vip!
|
||||||
|
// .status ==
|
||||||
|
// 1 &&
|
||||||
|
// _memberController.memberInfo
|
||||||
|
// .value.vip!.label![
|
||||||
|
// 'img_label_uri_hans_static'] !=
|
||||||
|
// '') ...[
|
||||||
|
// Image.network(
|
||||||
|
// _memberController.memberInfo
|
||||||
|
// .value.vip!.label![
|
||||||
|
// 'img_label_uri_hans_static'],
|
||||||
|
// height: 20,
|
||||||
|
// ),
|
||||||
|
// ]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// if (_memberController.memberInfo.value
|
||||||
|
// .official!['title'] !=
|
||||||
|
// '') ...[
|
||||||
|
// const SizedBox(height: 6),
|
||||||
|
// Text.rich(
|
||||||
|
// maxLines: 2,
|
||||||
|
// TextSpan(
|
||||||
|
// text: _memberController
|
||||||
|
// .memberInfo
|
||||||
|
// .value
|
||||||
|
// .official!['role'] ==
|
||||||
|
// 1
|
||||||
|
// ? '个人认证:'
|
||||||
|
// : '企业认证:',
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .primaryColor,
|
||||||
|
// ),
|
||||||
|
// children: [
|
||||||
|
// TextSpan(
|
||||||
|
// text: _memberController
|
||||||
|
// .memberInfo
|
||||||
|
// .value
|
||||||
|
// .official!['title'],
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// softWrap: true,
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// const SizedBox(height: 4),
|
||||||
|
// if (_memberController
|
||||||
|
// .memberInfo.value.sign !=
|
||||||
|
// '')
|
||||||
|
// SelectableRegion(
|
||||||
|
// magnifierConfiguration:
|
||||||
|
// const TextMagnifierConfiguration(),
|
||||||
|
// focusNode: FocusNode(),
|
||||||
|
// selectionControls:
|
||||||
|
// MaterialTextSelectionControls(),
|
||||||
|
// child: Text(
|
||||||
|
// _memberController
|
||||||
|
// .memberInfo.value.sign!,
|
||||||
|
// textAlign: TextAlign.left,
|
||||||
|
// maxLines: 2,
|
||||||
|
// overflow: TextOverflow.ellipsis,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 骨架屏
|
||||||
|
return profile(_memberController,
|
||||||
|
loadingStatus: true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -207,167 +347,29 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
return MediaQuery.of(context).padding.top + kToolbarHeight;
|
return MediaQuery.of(context).padding.top + kToolbarHeight;
|
||||||
},
|
},
|
||||||
onlyOneScrollInBody: true,
|
onlyOneScrollInBody: true,
|
||||||
body: Column(
|
// body: Column(
|
||||||
children: [
|
// children: [
|
||||||
SizedBox(
|
// SizedBox(
|
||||||
width: double.infinity,
|
// width: double.infinity,
|
||||||
height: 50,
|
// height: 50,
|
||||||
child: TabBar(controller: _tabController, tabs: const [
|
// child: TabBar(controller: _tabController, tabs: const [
|
||||||
Tab(text: '主页'),
|
// Tab(text: '主页'),
|
||||||
Tab(text: '动态'),
|
// Tab(text: '动态'),
|
||||||
Tab(text: '投稿'),
|
// Tab(text: '投稿'),
|
||||||
]),
|
// ]),
|
||||||
),
|
// ),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: TabBarView(
|
// child: TabBarView(
|
||||||
controller: _tabController,
|
// controller: _tabController,
|
||||||
children: [
|
// children: const [
|
||||||
const Text('主页'),
|
// Text('主页'),
|
||||||
MemberDynamicPanel(mid: mid),
|
// MemberDynamicPanel(),
|
||||||
ArchivePanel(mid: mid),
|
// ArchivePanel(),
|
||||||
],
|
// ],
|
||||||
))
|
// ))
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
body: ArchivePanel(),
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget profileWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 18, right: 18),
|
|
||||||
child: FutureBuilder(
|
|
||||||
future: _futureBuilderFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
Map data = snapshot.data!;
|
|
||||||
if (data['status']) {
|
|
||||||
return Obx(
|
|
||||||
() => Stack(
|
|
||||||
alignment: AlignmentDirectional.center,
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
profile(_memberController),
|
|
||||||
const SizedBox(height: 14),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
child: Text(
|
|
||||||
_memberController.memberInfo.value.name!,
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.bodyLarge!
|
|
||||||
.copyWith(fontWeight: FontWeight.bold),
|
|
||||||
)),
|
|
||||||
const SizedBox(width: 2),
|
|
||||||
if (_memberController.memberInfo.value.sex == '女')
|
|
||||||
const Icon(
|
|
||||||
FontAwesomeIcons.venus,
|
|
||||||
size: 14,
|
|
||||||
color: Colors.pink,
|
|
||||||
),
|
|
||||||
if (_memberController.memberInfo.value.sex == '男')
|
|
||||||
const Icon(
|
|
||||||
FontAwesomeIcons.mars,
|
|
||||||
size: 14,
|
|
||||||
color: Colors.blue,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/lv/lv${_memberController.memberInfo.value.level}.png',
|
|
||||||
height: 11,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
if (_memberController
|
|
||||||
.memberInfo.value.vip!.status ==
|
|
||||||
1 &&
|
|
||||||
_memberController.memberInfo.value.vip!
|
|
||||||
.label!['img_label_uri_hans'] !=
|
|
||||||
'') ...[
|
|
||||||
Image.network(
|
|
||||||
_memberController.memberInfo.value.vip!
|
|
||||||
.label!['img_label_uri_hans'],
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
] else if (_memberController
|
|
||||||
.memberInfo.value.vip!.status ==
|
|
||||||
1 &&
|
|
||||||
_memberController.memberInfo.value.vip!
|
|
||||||
.label!['img_label_uri_hans_static'] !=
|
|
||||||
'') ...[
|
|
||||||
Image.network(
|
|
||||||
_memberController.memberInfo.value.vip!
|
|
||||||
.label!['img_label_uri_hans_static'],
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if (_memberController
|
|
||||||
.memberInfo.value.official!['title'] !=
|
|
||||||
'') ...[
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Text.rich(
|
|
||||||
maxLines: 2,
|
|
||||||
TextSpan(
|
|
||||||
text: _memberController
|
|
||||||
.memberInfo.value.official!['role'] ==
|
|
||||||
1
|
|
||||||
? '个人认证:'
|
|
||||||
: '企业认证:',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: _memberController
|
|
||||||
.memberInfo.value.official!['title'],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
softWrap: true,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
if (_memberController.memberInfo.value.sign != '')
|
|
||||||
SelectableText(
|
|
||||||
_memberController.memberInfo.value.sign!,
|
|
||||||
maxLines: _memberController
|
|
||||||
.memberInfo.value.official!['title'] !=
|
|
||||||
''
|
|
||||||
? 1
|
|
||||||
: 2,
|
|
||||||
style: const TextStyle(
|
|
||||||
overflow: TextOverflow.ellipsis),
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return AlertDialog(
|
|
||||||
content: SelectableText(_memberController
|
|
||||||
.memberInfo.value.sign!),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 骨架屏
|
|
||||||
return profile(_memberController, loadingStatus: true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,181 +15,171 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Hero(
|
Hero(
|
||||||
tag: ctr.heroTag!,
|
tag: ctr.heroTag!,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
width: 90,
|
width: 90,
|
||||||
height: 90,
|
height: 90,
|
||||||
type: 'avatar',
|
type: 'avatar',
|
||||||
src: !loadingStatus ? memberInfo.face : ctr.face.value,
|
src: !loadingStatus ? memberInfo.face : ctr.face,
|
||||||
),
|
),
|
||||||
if (!loadingStatus &&
|
if (!loadingStatus &&
|
||||||
memberInfo.liveRoom != null &&
|
memberInfo.liveRoom != null &&
|
||||||
memberInfo.liveRoom!.liveStatus == 1)
|
memberInfo.liveRoom!.liveStatus == 1)
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 14,
|
left: 14,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
LiveItemModel liveItem = LiveItemModel.fromJson({
|
LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||||
'title': memberInfo.liveRoom!.title,
|
'title': memberInfo.liveRoom!.title,
|
||||||
'uname': memberInfo.name,
|
'uname': memberInfo.name,
|
||||||
'face': memberInfo.face,
|
'face': memberInfo.face,
|
||||||
'roomid': memberInfo.liveRoom!.roomId,
|
'roomid': memberInfo.liveRoom!.roomId,
|
||||||
'watched_show': memberInfo.liveRoom!.watchedShow,
|
'watched_show': memberInfo.liveRoom!.watchedShow,
|
||||||
});
|
});
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/liveRoom?roomid=${memberInfo.liveRoom!.roomId}',
|
'/liveRoom?roomid=${memberInfo.liveRoom!.roomId}',
|
||||||
arguments: {'liveItem': liveItem},
|
arguments: {'liveItem': liveItem},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.fromLTRB(6, 2, 6, 2),
|
padding: const EdgeInsets.fromLTRB(6, 2, 6, 2),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
borderRadius:
|
borderRadius:
|
||||||
const BorderRadius.all(Radius.circular(10)),
|
const BorderRadius.all(Radius.circular(10)),
|
||||||
),
|
|
||||||
child: Row(children: [
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/live.gif',
|
|
||||||
height: 10,
|
|
||||||
),
|
),
|
||||||
Text(
|
child: Row(children: [
|
||||||
' 直播中',
|
Image.asset(
|
||||||
style: TextStyle(
|
'assets/images/live.gif',
|
||||||
color: Colors.white,
|
height: 10,
|
||||||
fontSize: Theme.of(context)
|
),
|
||||||
.textTheme
|
Text(
|
||||||
.labelSmall!
|
' 直播中',
|
||||||
.fontSize),
|
style: TextStyle(
|
||||||
)
|
color: Colors.white,
|
||||||
]),
|
fontSize: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.labelSmall!
|
||||||
|
.fontSize),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
)
|
],
|
||||||
],
|
)),
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
// Padding(
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
// padding: const EdgeInsets.only(left: 10, right: 10),
|
||||||
child: Row(
|
// child: Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
// mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
// children: [
|
||||||
InkWell(
|
// InkWell(
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
Get.toNamed(
|
// Get.toNamed(
|
||||||
'/follow?mid=${memberInfo.mid}&name=${memberInfo.name}');
|
// '/follow?mid=${memberInfo.mid}&name=${memberInfo.name}');
|
||||||
},
|
// },
|
||||||
child: Column(
|
// child: Column(
|
||||||
children: [
|
// children: [
|
||||||
Text(
|
// Text(
|
||||||
!loadingStatus
|
// !loadingStatus
|
||||||
? ctr.userStat!['following'].toString()
|
// ? ctr.userStat!['following'].toString()
|
||||||
: '-',
|
// : '-',
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold),
|
// fontWeight: FontWeight.bold),
|
||||||
),
|
// ),
|
||||||
Text(
|
// Text(
|
||||||
'关注',
|
// '关注',
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
fontSize: Theme.of(context)
|
// fontSize: Theme.of(context)
|
||||||
.textTheme
|
// .textTheme
|
||||||
.labelMedium!
|
// .labelMedium!
|
||||||
.fontSize),
|
// .fontSize),
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
InkWell(
|
// InkWell(
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
Get.toNamed(
|
// Get.toNamed(
|
||||||
'/fan?mid=${memberInfo.mid}&name=${memberInfo.name}');
|
// '/fan?mid=${memberInfo.mid}&name=${memberInfo.name}');
|
||||||
},
|
// },
|
||||||
child: Column(
|
// child: Column(
|
||||||
children: [
|
// children: [
|
||||||
Text(
|
// Text(
|
||||||
!loadingStatus
|
// !loadingStatus
|
||||||
? Utils.numFormat(
|
// ? Utils.numFormat(
|
||||||
ctr.userStat!['follower'],
|
// ctr.userStat!['follower'],
|
||||||
)
|
// )
|
||||||
: '-',
|
// : '-',
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold)),
|
// fontWeight: FontWeight.bold)),
|
||||||
Text(
|
// Text('粉丝',
|
||||||
'粉丝',
|
// style: TextStyle(
|
||||||
style: TextStyle(
|
// fontSize: Theme.of(context)
|
||||||
fontSize: Theme.of(context)
|
// .textTheme
|
||||||
.textTheme
|
// .labelMedium!
|
||||||
.labelMedium!
|
// .fontSize))
|
||||||
.fontSize),
|
// ],
|
||||||
)
|
// ),
|
||||||
],
|
// ),
|
||||||
),
|
// Column(
|
||||||
),
|
// children: [
|
||||||
Column(
|
// const Text('-',
|
||||||
children: [
|
// style: TextStyle(fontWeight: FontWeight.bold)),
|
||||||
const Text('-',
|
// Text(
|
||||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
// '获赞',
|
||||||
Text(
|
// style: TextStyle(
|
||||||
'获赞',
|
// fontSize: Theme.of(context)
|
||||||
style: TextStyle(
|
// .textTheme
|
||||||
fontSize: Theme.of(context)
|
// .labelMedium!
|
||||||
.textTheme
|
// .fontSize),
|
||||||
.labelMedium!
|
// )
|
||||||
.fontSize),
|
// ],
|
||||||
)
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
],
|
// ),
|
||||||
),
|
// const SizedBox(height: 10),
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
if (ctr.ownerMid != ctr.mid) ...[
|
if (ctr.ownerMid != ctr.mid) ...[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Obx(
|
TextButton(
|
||||||
() => Expanded(
|
onPressed: () => ctr.actionRelationMod(),
|
||||||
child: TextButton(
|
style: TextButton.styleFrom(
|
||||||
onPressed: () => ctr.actionRelationMod(),
|
padding: const EdgeInsets.only(left: 42, right: 42),
|
||||||
style: TextButton.styleFrom(
|
foregroundColor:
|
||||||
foregroundColor: ctr.attribute.value == -1
|
!loadingStatus && memberInfo.isFollowed!
|
||||||
? Colors.transparent
|
? Theme.of(context).colorScheme.outline
|
||||||
: ctr.attribute.value != 0
|
: Theme.of(context).colorScheme.onPrimary,
|
||||||
? Theme.of(context).colorScheme.outline
|
backgroundColor: !loadingStatus &&
|
||||||
: Theme.of(context)
|
memberInfo.isFollowed!
|
||||||
.colorScheme
|
? Theme.of(context).colorScheme.onInverseSurface
|
||||||
.onPrimary,
|
: Theme.of(context)
|
||||||
backgroundColor: ctr.attribute.value != 0
|
.colorScheme
|
||||||
? Theme.of(context)
|
.primary, // 设置按钮背景色
|
||||||
.colorScheme
|
|
||||||
.onInverseSurface
|
|
||||||
: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary, // 设置按钮背景色
|
|
||||||
),
|
|
||||||
child: Obx(() => Text(ctr.attributeText.value)),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
child: Text(!loadingStatus && memberInfo.isFollowed!
|
||||||
|
? '取关'
|
||||||
|
: '关注'),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Expanded(
|
TextButton(
|
||||||
child: TextButton(
|
onPressed: () {},
|
||||||
onPressed: () {},
|
style: TextButton.styleFrom(
|
||||||
style: TextButton.styleFrom(
|
padding: const EdgeInsets.only(left: 42, right: 42),
|
||||||
backgroundColor: Theme.of(context)
|
backgroundColor:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.onInverseSurface,
|
||||||
.onInverseSurface,
|
|
||||||
),
|
|
||||||
child: const Text('发消息'),
|
|
||||||
),
|
),
|
||||||
|
child: const Text('发消息'),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@ -75,7 +75,11 @@ class MemberSearchController extends GetxController {
|
|||||||
}
|
}
|
||||||
archivePn += 1;
|
archivePn += 1;
|
||||||
hasRequest = true;
|
hasRequest = true;
|
||||||
|
if (res['data'].list.vlist.isEmpty) {
|
||||||
|
loadingStatus.value = 'finish';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// loadingStatus.value = 'finish';
|
// loadingStatus.value = 'finish';
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,7 @@ class _MemberSearchPageState extends State<MemberSearchPage>
|
|||||||
? [
|
? [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text('搜索「${_memberSearchCtr.uname.value}」的动态、视频'),
|
child: Text('搜索「${_memberSearchCtr.uname.value}」的视频'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@ -157,9 +157,22 @@ class _MemberSearchPageState extends State<MemberSearchPage>
|
|||||||
return const VideoCardHSkeleton();
|
return const VideoCardHSkeleton();
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: const CustomScrollView(
|
: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
NoData(),
|
SliverToBoxAdapter(
|
||||||
|
child: SizedBox(
|
||||||
|
height: 400,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'没有搜索到相关内容\n请尝试别的搜索词',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleSmall,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
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';
|
||||||
@ -112,20 +111,4 @@ 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}');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,38 +72,30 @@ class _MinePageState extends State<MinePage> {
|
|||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: LayoutBuilder(
|
body: SingleChildScrollView(
|
||||||
builder: (context, constraint) {
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
return SingleChildScrollView(
|
child: Column(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
children: [
|
||||||
child: SizedBox(
|
const SizedBox(height: 10),
|
||||||
height: constraint.maxHeight,
|
FutureBuilder(
|
||||||
child: Column(
|
future: _futureBuilderFuture,
|
||||||
children: [
|
builder: (context, snapshot) {
|
||||||
const SizedBox(height: 10),
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
FutureBuilder(
|
if (snapshot.data == null) {
|
||||||
future: _futureBuilderFuture,
|
return const SizedBox();
|
||||||
builder: (context, snapshot) {
|
}
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.data['status']) {
|
||||||
if (snapshot.data == null) {
|
return Obx(() => userInfoBuild(mineController, context));
|
||||||
return const SizedBox();
|
} else {
|
||||||
}
|
return userInfoBuild(mineController, context);
|
||||||
if (snapshot.data['status']) {
|
}
|
||||||
return Obx(
|
} else {
|
||||||
() => userInfoBuild(mineController, context));
|
return userInfoBuild(mineController, context);
|
||||||
} else {
|
}
|
||||||
return userInfoBuild(mineController, context);
|
},
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return userInfoBuild(mineController, context);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
],
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -138,85 +130,9 @@ class _MinePageState extends State<MinePage> {
|
|||||||
_mineController.userInfo.value.uname ?? '点击头像登录',
|
_mineController.userInfo.value.uname ?? '点击头像登录',
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/lv/lv${_mineController.userInfo.value.levelInfo != null ? _mineController.userInfo.value.levelInfo!.currentLevel : '0'}.png',
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text.rich(TextSpan(children: [
|
|
||||||
TextSpan(
|
|
||||||
text: '硬币: ',
|
|
||||||
style:
|
|
||||||
TextStyle(color: Theme.of(context).colorScheme.outline)),
|
|
||||||
TextSpan(
|
|
||||||
text: (_mineController.userInfo.value.money ?? 'pilipala')
|
|
||||||
.toString(),
|
|
||||||
style:
|
|
||||||
TextStyle(color: Theme.of(context).colorScheme.primary)),
|
|
||||||
]))
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
if (_mineController.userInfo.value.levelInfo != null) ...[
|
|
||||||
LayoutBuilder(
|
|
||||||
builder: (context, BoxConstraints box) {
|
|
||||||
LevelInfo levelInfo = _mineController.userInfo.value.levelInfo;
|
|
||||||
return SizedBox(
|
|
||||||
width: box.maxWidth,
|
|
||||||
height: 24,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
top: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
child: Container(
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
height: 24,
|
|
||||||
constraints:
|
|
||||||
const BoxConstraints(minWidth: 100), // 设置最小宽度为100
|
|
||||||
width: box.maxWidth *
|
|
||||||
(1 - (levelInfo.currentExp! / levelInfo.nextExp!)),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'${levelInfo.currentExp!}/${levelInfo.nextExp!}',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.onPrimary,
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 23,
|
|
||||||
left: 0,
|
|
||||||
bottom: 0,
|
|
||||||
child: Container(
|
|
||||||
width: box.maxWidth *
|
|
||||||
(_mineController
|
|
||||||
.userInfo.value.levelInfo!.currentExp! /
|
|
||||||
_mineController
|
|
||||||
.userInfo.value.levelInfo!.nextExp!),
|
|
||||||
height: 1,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 12, right: 12),
|
padding: const EdgeInsets.only(left: 12, right: 12),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
@ -264,7 +180,7 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => _mineController.pushFollow(),
|
onTap: () => Get.toNamed('/follow'),
|
||||||
borderRadius: StyleString.mdRadius,
|
borderRadius: StyleString.mdRadius,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -294,7 +210,7 @@ class _MinePageState extends State<MinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => _mineController.pushFans(),
|
onTap: () => Get.toNamed('/fan'),
|
||||||
borderRadius: StyleString.mdRadius,
|
borderRadius: StyleString.mdRadius,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|||||||
@ -14,13 +14,12 @@ 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() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
crossAxisCount.value =
|
crossAxisCount.value =
|
||||||
setting.get(SettingBoxKey.customRows, defaultValue: 2);
|
setting.get(SettingBoxKey.enableSingleRow, defaultValue: false) ? 1 : 2;
|
||||||
if (recVideo.get('cacheList') != null &&
|
if (recVideo.get('cacheList') != null &&
|
||||||
recVideo.get('cacheList').isNotEmpty) {
|
recVideo.get('cacheList').isNotEmpty) {
|
||||||
List<RecVideoItemAppModel> list = [];
|
List<RecVideoItemAppModel> list = [];
|
||||||
@ -29,8 +28,6 @@ class RcmdController extends GetxController {
|
|||||||
}
|
}
|
||||||
videoList.value = list;
|
videoList.value = list;
|
||||||
}
|
}
|
||||||
enableSaveLastData =
|
|
||||||
setting.get(SettingBoxKey.enableSaveLastData, defaultValue: false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取推荐
|
// 获取推荐
|
||||||
@ -52,11 +49,7 @@ class RcmdController extends GetxController {
|
|||||||
videoList.value = res['data'];
|
videoList.value = res['data'];
|
||||||
}
|
}
|
||||||
} else if (type == 'onRefresh') {
|
} else if (type == 'onRefresh') {
|
||||||
if (enableSaveLastData) {
|
videoList.value = res['data'];
|
||||||
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']);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ class SSearchController extends GetxController {
|
|||||||
final FocusNode searchFocusNode = FocusNode();
|
final FocusNode searchFocusNode = FocusNode();
|
||||||
RxString searchKeyWord = ''.obs;
|
RxString searchKeyWord = ''.obs;
|
||||||
Rx<TextEditingController> controller = TextEditingController().obs;
|
Rx<TextEditingController> controller = TextEditingController().obs;
|
||||||
RxList<HotSearchItem> hotSearchList = <HotSearchItem>[].obs;
|
RxList<HotSearchItem> hotSearchList = [HotSearchItem()].obs;
|
||||||
Box histiryWord = GStrorage.historyword;
|
Box histiryWord = GStrorage.historyword;
|
||||||
List historyCacheList = [];
|
List historyCacheList = [];
|
||||||
RxList historyList = [].obs;
|
RxList historyList = [].obs;
|
||||||
@ -27,9 +27,9 @@ class SSearchController extends GetxController {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
if (setting.get(SettingBoxKey.enableSearchWord, defaultValue: true)) {
|
// if (setting.get(SettingBoxKey.enableSearchWord, defaultValue: true)) {
|
||||||
searchDefault();
|
// searchDefault();
|
||||||
}
|
// }
|
||||||
// 其他页面跳转过来
|
// 其他页面跳转过来
|
||||||
if (Get.parameters.keys.isNotEmpty) {
|
if (Get.parameters.keys.isNotEmpty) {
|
||||||
if (Get.parameters['keyword'] != null) {
|
if (Get.parameters['keyword'] != null) {
|
||||||
@ -51,7 +51,7 @@ class SSearchController extends GetxController {
|
|||||||
searchSuggestList.value = [];
|
searchSuggestList.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_debouncer.call(() => querySearchSuggest(value));
|
// _debouncer.call(() => querySearchSuggest(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClear() {
|
void onClear() {
|
||||||
@ -85,9 +85,7 @@ class SSearchController extends GetxController {
|
|||||||
// 获取热搜关键词
|
// 获取热搜关键词
|
||||||
Future queryHotSearchList() async {
|
Future queryHotSearchList() async {
|
||||||
var result = await SearchHttp.hotSearchList();
|
var result = await SearchHttp.hotSearchList();
|
||||||
if (result['status']) {
|
hotSearchList.value = result['data'].list;
|
||||||
hotSearchList.value = result['data'].list;
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,9 +103,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'] is SearchSuggestModel) {
|
searchSuggestList.value = result['data'].tag;
|
||||||
searchSuggestList.value = result['data'].tag;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -140,141 +140,18 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Column(
|
child: _history(),
|
||||||
children: [
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
// 搜索建议
|
|
||||||
_searchSuggest(),
|
|
||||||
// 热搜
|
|
||||||
Visibility(
|
|
||||||
visible: _searchController.enableHotKey,
|
|
||||||
child: hotSearch(_searchController)),
|
|
||||||
// 搜索历史
|
|
||||||
_history()
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _searchSuggest() {
|
|
||||||
SSearchController _ssCtr = _searchController;
|
|
||||||
return Obx(
|
|
||||||
() => _ssCtr.searchSuggestList.isNotEmpty &&
|
|
||||||
_ssCtr.searchSuggestList.first.term != null &&
|
|
||||||
_ssCtr.controller.value.text != ''
|
|
||||||
? ListView.builder(
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemCount: _ssCtr.searchSuggestList.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return InkWell(
|
|
||||||
customBorder: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
),
|
|
||||||
onTap: () => _ssCtr
|
|
||||||
.onClickKeyword(_ssCtr.searchSuggestList[index].term!),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 20, top: 9, bottom: 9),
|
|
||||||
child: _ssCtr.searchSuggestList[index].textRich,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget hotSearch(ctr) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(10, 14, 4, 0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(6, 0, 6, 6),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'大家都在搜',
|
|
||||||
style: Theme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.titleMedium!
|
|
||||||
.copyWith(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 34,
|
|
||||||
child: TextButton.icon(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: MaterialStateProperty.all(const EdgeInsets.only(
|
|
||||||
left: 10, top: 6, bottom: 6, right: 10)),
|
|
||||||
),
|
|
||||||
onPressed: () => ctr.queryHotSearchList(),
|
|
||||||
icon: const Icon(Icons.refresh_outlined, size: 18),
|
|
||||||
label: const Text('刷新'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
LayoutBuilder(
|
|
||||||
builder: (context, boxConstraints) {
|
|
||||||
final double width = boxConstraints.maxWidth;
|
|
||||||
return FutureBuilder(
|
|
||||||
future: _futureBuilderFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
if (snapshot.data == null) {
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
Map data = snapshot.data as Map;
|
|
||||||
if (data['status']) {
|
|
||||||
return Obx(
|
|
||||||
() => HotKeyword(
|
|
||||||
width: width,
|
|
||||||
hotSearchList: _searchController.hotSearchList.value,
|
|
||||||
onClick: (keyword) async {
|
|
||||||
_searchController.searchFocusNode.unfocus();
|
|
||||||
await Future.delayed(
|
|
||||||
const Duration(milliseconds: 150));
|
|
||||||
_searchController.onClickKeyword(keyword);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return HttpError(
|
|
||||||
errMsg: data['msg'],
|
|
||||||
fn: () => setState(() {}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 缓存数据
|
|
||||||
if (_searchController.hotSearchList.isNotEmpty) {
|
|
||||||
return HotKeyword(
|
|
||||||
width: width,
|
|
||||||
hotSearchList: _searchController.hotSearchList,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _history() {
|
Widget _history() {
|
||||||
return Obx(
|
return Obx(
|
||||||
() => Container(
|
() => Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: const EdgeInsets.fromLTRB(10, 25, 6, 0),
|
padding: const EdgeInsets.fromLTRB(10, 4, 6, 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import 'package:pilipala/common/widgets/http_error.dart';
|
|||||||
import 'package:pilipala/models/common/search_type.dart';
|
import 'package:pilipala/models/common/search_type.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'widgets/article_panel.dart';
|
|
||||||
import 'widgets/live_panel.dart';
|
import 'widgets/live_panel.dart';
|
||||||
import 'widgets/media_bangumi_panel.dart';
|
import 'widgets/media_bangumi_panel.dart';
|
||||||
import 'widgets/user_panel.dart';
|
import 'widgets/user_panel.dart';
|
||||||
@ -85,14 +84,12 @@ class _SearchPanelState extends State<SearchPanel>
|
|||||||
ctr: _searchPanelController,
|
ctr: _searchPanelController,
|
||||||
list: list.value,
|
list: list.value,
|
||||||
);
|
);
|
||||||
case SearchType.media_bangumi:
|
// case SearchType.media_bangumi:
|
||||||
return searchMbangumiPanel(context, ctr, list);
|
// return searchMbangumiPanel(context, ctr, list);
|
||||||
case SearchType.bili_user:
|
case SearchType.bili_user:
|
||||||
return searchUserPanel(context, ctr, list);
|
return searchUserPanel(context, ctr, list);
|
||||||
case SearchType.live_room:
|
// case SearchType.live_room:
|
||||||
return searchLivePanel(context, ctr, list);
|
// return searchLivePanel(context, ctr, list);
|
||||||
case SearchType.article:
|
|
||||||
return searchArticlePanel(context, ctr, list);
|
|
||||||
default:
|
default:
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
@ -118,12 +115,12 @@ class _SearchPanelState extends State<SearchPanel>
|
|||||||
switch (widget.searchType) {
|
switch (widget.searchType) {
|
||||||
case SearchType.video:
|
case SearchType.video:
|
||||||
return const VideoCardHSkeleton();
|
return const VideoCardHSkeleton();
|
||||||
case SearchType.media_bangumi:
|
// case SearchType.media_bangumi:
|
||||||
return const MediaBangumiSkeleton();
|
// return const MediaBangumiSkeleton();
|
||||||
case SearchType.bili_user:
|
case SearchType.bili_user:
|
||||||
return const VideoCardHSkeleton();
|
return const VideoCardHSkeleton();
|
||||||
case SearchType.live_room:
|
// case SearchType.live_room:
|
||||||
return const VideoCardHSkeleton();
|
// return const VideoCardHSkeleton();
|
||||||
default:
|
default:
|
||||||
return const VideoCardHSkeleton();
|
return const VideoCardHSkeleton();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,107 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:pilipala/common/constants.dart';
|
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
|
||||||
import 'package:pilipala/utils/utils.dart';
|
|
||||||
|
|
||||||
Widget searchArticlePanel(BuildContext context, ctr, list) {
|
|
||||||
TextStyle textStyle = TextStyle(
|
|
||||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline);
|
|
||||||
return ListView.builder(
|
|
||||||
controller: ctr!.scrollController,
|
|
||||||
itemCount: list.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return InkWell(
|
|
||||||
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(
|
|
||||||
padding: const EdgeInsets.fromLTRB(
|
|
||||||
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
|
||||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
|
||||||
double width = (boxConstraints.maxWidth -
|
|
||||||
StyleString.cardSpace *
|
|
||||||
6 /
|
|
||||||
MediaQuery.of(context).textScaleFactor) /
|
|
||||||
2;
|
|
||||||
return Container(
|
|
||||||
constraints: const BoxConstraints(minHeight: 88),
|
|
||||||
height: width / StyleString.aspectRatio,
|
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (list[index].imageUrls != null &&
|
|
||||||
list[index].imageUrls.isNotEmpty)
|
|
||||||
AspectRatio(
|
|
||||||
aspectRatio: StyleString.aspectRatio,
|
|
||||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
|
||||||
double maxWidth = boxConstraints.maxWidth;
|
|
||||||
double maxHeight = boxConstraints.maxHeight;
|
|
||||||
return NetworkImgLayer(
|
|
||||||
width: maxWidth,
|
|
||||||
height: maxHeight,
|
|
||||||
src: list[index].imageUrls.first,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(10, 2, 6, 0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
RichText(
|
|
||||||
maxLines: 2,
|
|
||||||
text: TextSpan(
|
|
||||||
children: [
|
|
||||||
for (var i in list[index].title) ...[
|
|
||||||
TextSpan(
|
|
||||||
text: i['text'],
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
letterSpacing: 0.3,
|
|
||||||
color: i['type'] == 'em'
|
|
||||||
? Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary
|
|
||||||
: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
Text(
|
|
||||||
Utils.dateFormat(list[index].pubTime,
|
|
||||||
formatType: 'detail'),
|
|
||||||
style: textStyle),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text('${list[index].view}浏览', style: textStyle),
|
|
||||||
Text(' • ', style: textStyle),
|
|
||||||
Text('${list[index].reply}评论', style: textStyle),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -124,7 +124,7 @@ Widget searchMbangumiPanel(BuildContext context, ctr, list) {
|
|||||||
arguments: {
|
arguments: {
|
||||||
'pic': pic,
|
'pic': pic,
|
||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
'videoType': SearchType.media_bangumi,
|
// 'videoType': SearchType.media_bangumi,
|
||||||
'bangumiItem': res['data'],
|
'bangumiItem': res['data'],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -38,26 +38,11 @@ Widget searchUserPanel(BuildContext context, ctr, list) {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Text(
|
||||||
children: [
|
i!.uname,
|
||||||
Text(
|
style: const TextStyle(
|
||||||
i!.uname,
|
fontSize: 14,
|
||||||
style: const TextStyle(
|
),
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/lv/lv${i!.level}.png',
|
|
||||||
height: 11,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text('粉丝:${i.fans} ', style: style),
|
|
||||||
Text(' 视频:${i.videos}', style: style)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
if (i.officialVerify['desc'] != '')
|
if (i.officialVerify['desc'] != '')
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@ -79,12 +79,6 @@ 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,8 +2,6 @@ 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});
|
||||||
@ -16,7 +14,6 @@ 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()
|
||||||
@ -32,36 +29,24 @@ 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;
|
||||||
await setting.put(SettingBoxKey.displayMode, preferred.toString());
|
// GStorage().setDisplayModeType(preferred!);
|
||||||
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 getDisplayModeType(modes);
|
// var res = await GStorage().getDisplayModeType();
|
||||||
|
// 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(
|
||||||
|
|||||||
@ -1,304 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
|
||||||
import 'package:pilipala/plugin/pl_player/models/play_speed.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
|
||||||
|
|
||||||
class PlaySpeedPage extends StatefulWidget {
|
|
||||||
const PlaySpeedPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<PlaySpeedPage> createState() => _PlaySpeedPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
|
||||||
Box videoStorage = GStrorage.video;
|
|
||||||
late double playSpeedDefault;
|
|
||||||
late double longPressSpeedDefault;
|
|
||||||
late List customSpeedsList;
|
|
||||||
List<Map<dynamic, dynamic>> sheetMenu = [
|
|
||||||
{
|
|
||||||
'id': 1,
|
|
||||||
'title': '设置为默认倍速',
|
|
||||||
'leading': const Icon(
|
|
||||||
Icons.speed,
|
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': 2,
|
|
||||||
'title': '设置为默认长按倍速',
|
|
||||||
'leading': const Icon(
|
|
||||||
Icons.speed_sharp,
|
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': -1,
|
|
||||||
'title': '删除该项',
|
|
||||||
'leading': const Icon(
|
|
||||||
Icons.delete_outline,
|
|
||||||
size: 21,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
// 默认倍速
|
|
||||||
playSpeedDefault =
|
|
||||||
videoStorage.get(VideoBoxKey.playSpeedDefault, defaultValue: 1.0);
|
|
||||||
// 默认长按倍速
|
|
||||||
longPressSpeedDefault =
|
|
||||||
videoStorage.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 2.0);
|
|
||||||
// 自定义倍速
|
|
||||||
customSpeedsList =
|
|
||||||
videoStorage.get(VideoBoxKey.customSpeedsList, defaultValue: []);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加自定义倍速
|
|
||||||
void onAddSpeed() {
|
|
||||||
double customSpeed = 1.0;
|
|
||||||
SmartDialog.show(
|
|
||||||
useSystem: true,
|
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('添加倍速'),
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
// const Text('输入你想要的视频倍速,例如:1.0'),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
TextField(
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: '自定义倍速',
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(6.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onChanged: (e) {
|
|
||||||
customSpeed = double.parse(e);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => SmartDialog.dismiss(),
|
|
||||||
child: const Text('取消'),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
customSpeedsList.add(customSpeed);
|
|
||||||
await videoStorage.put(
|
|
||||||
VideoBoxKey.customSpeedsList, customSpeedsList);
|
|
||||||
setState(() {});
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
},
|
|
||||||
child: const Text('确认添加'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设定倍速弹窗
|
|
||||||
void showBottomSheet(type, i) {
|
|
||||||
showModalBottomSheet<void>(
|
|
||||||
context: context,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.only(top: 10),
|
|
||||||
child: ListView.builder(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const ClampingScrollPhysics(),
|
|
||||||
//重要
|
|
||||||
itemCount: sheetMenu.length,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
return ListTile(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
menuAction(type, i, sheetMenu[index]['id']);
|
|
||||||
},
|
|
||||||
minLeadingWidth: 0,
|
|
||||||
iconColor: Theme.of(context).colorScheme.onSurface,
|
|
||||||
leading: sheetMenu[index]['leading'],
|
|
||||||
title: Text(
|
|
||||||
sheetMenu[index]['title'],
|
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void menuAction(type, index, id) async {
|
|
||||||
double chooseSpeed = 1.0;
|
|
||||||
if (type == 'system' && id == -1) {
|
|
||||||
SmartDialog.showToast('系统预设倍速不支持删除');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 获取当前选中的倍速值
|
|
||||||
if (type == 'system') {
|
|
||||||
chooseSpeed = PlaySpeed.values[index].value;
|
|
||||||
} else {
|
|
||||||
chooseSpeed = customSpeedsList[index];
|
|
||||||
}
|
|
||||||
// 设置
|
|
||||||
if (id == 1) {
|
|
||||||
// 设置默认倍速
|
|
||||||
playSpeedDefault = chooseSpeed;
|
|
||||||
videoStorage.put(VideoBoxKey.playSpeedDefault, playSpeedDefault);
|
|
||||||
} else if (id == 2) {
|
|
||||||
// 设置默认长按倍速
|
|
||||||
longPressSpeedDefault = chooseSpeed;
|
|
||||||
videoStorage.put(
|
|
||||||
VideoBoxKey.longPressSpeedDefault, longPressSpeedDefault);
|
|
||||||
} else if (id == -1) {
|
|
||||||
if (customSpeedsList[index] == playSpeedDefault) {
|
|
||||||
playSpeedDefault = 1.0;
|
|
||||||
videoStorage.put(VideoBoxKey.playSpeedDefault, playSpeedDefault);
|
|
||||||
}
|
|
||||||
if (customSpeedsList[index] == longPressSpeedDefault) {
|
|
||||||
longPressSpeedDefault = 2.0;
|
|
||||||
videoStorage.put(
|
|
||||||
VideoBoxKey.longPressSpeedDefault, longPressSpeedDefault);
|
|
||||||
}
|
|
||||||
customSpeedsList.removeAt(index);
|
|
||||||
await videoStorage.put(VideoBoxKey.customSpeedsList, customSpeedsList);
|
|
||||||
}
|
|
||||||
setState(() {});
|
|
||||||
SmartDialog.showToast('操作成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
elevation: 0,
|
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
titleSpacing: 0,
|
|
||||||
centerTitle: false,
|
|
||||||
title: Text(
|
|
||||||
'倍速设置',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.only(left: 14, right: 14, top: 6, bottom: 0),
|
|
||||||
child: Text(
|
|
||||||
'点击下方按钮设置默认(长按)倍速',
|
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
dense: false,
|
|
||||||
title: const Text('默认倍速'),
|
|
||||||
subtitle: Text(playSpeedDefault.toString()),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
dense: false,
|
|
||||||
title: const Text('默认长按倍速'),
|
|
||||||
subtitle: Text(longPressSpeedDefault.toString()),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
left: 14,
|
|
||||||
right: 14,
|
|
||||||
bottom: 10,
|
|
||||||
top: 20,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'系统预设倍速',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
left: 18,
|
|
||||||
right: 18,
|
|
||||||
bottom: 30,
|
|
||||||
),
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.start,
|
|
||||||
spacing: 8,
|
|
||||||
runSpacing: 2,
|
|
||||||
children: [
|
|
||||||
for (var i in PlaySpeed.values) ...[
|
|
||||||
FilledButton.tonal(
|
|
||||||
onPressed: () => showBottomSheet('system', i.index),
|
|
||||||
child: Text(i.description),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
left: 14,
|
|
||||||
right: 14,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'自定义倍速',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => onAddSpeed(),
|
|
||||||
child: const Text('添加'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: 18,
|
|
||||||
right: 18,
|
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 40,
|
|
||||||
),
|
|
||||||
child: customSpeedsList.isNotEmpty
|
|
||||||
? Wrap(
|
|
||||||
alignment: WrapAlignment.start,
|
|
||||||
spacing: 8,
|
|
||||||
runSpacing: 2,
|
|
||||||
children: [
|
|
||||||
for (int i = 0; i < customSpeedsList.length; i++) ...[
|
|
||||||
FilledButton.tonal(
|
|
||||||
onPressed: () => showBottomSheet('custom', i),
|
|
||||||
child: Text(customSpeedsList[i].toString()),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: SizedBox(
|
|
||||||
height: 80,
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'未添加',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/video/play/quality.dart';
|
import 'package:pilipala/models/video/play/quality.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||||
@ -55,18 +54,6 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
|
||||||
dense: false,
|
|
||||||
onTap: () => Get.toNamed('/playSpeedSet'),
|
|
||||||
title: Text('倍速设置', style: titleStyle),
|
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 17),
|
|
||||||
),
|
|
||||||
const SetSwitchItem(
|
|
||||||
title: '开启1080P',
|
|
||||||
subTitle: '免登录查看1080P视频',
|
|
||||||
setKey: SettingBoxKey.p1080,
|
|
||||||
defaultVal: true,
|
|
||||||
),
|
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '自动播放',
|
title: '自动播放',
|
||||||
subTitle: '进入详情页自动播放',
|
subTitle: '进入详情页自动播放',
|
||||||
|
|||||||
@ -22,14 +22,12 @@ class _StyleSettingState extends State<StyleSetting> {
|
|||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
late int picQuality;
|
late int picQuality;
|
||||||
late ThemeType _tempThemeValue;
|
late ThemeType _tempThemeValue;
|
||||||
late dynamic defaultCustomRows;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
picQuality = setting.get(SettingBoxKey.defaultPicQa, defaultValue: 10);
|
picQuality = setting.get(SettingBoxKey.defaultPicQa, defaultValue: 10);
|
||||||
_tempThemeValue = settingController.themeType.value;
|
_tempThemeValue = settingController.themeType.value;
|
||||||
defaultCustomRows = setting.get(SettingBoxKey.customRows, defaultValue: 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -78,37 +76,12 @@ class _StyleSettingState extends State<StyleSetting> {
|
|||||||
setKey: SettingBoxKey.iosTransition,
|
setKey: SettingBoxKey.iosTransition,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
// SetSwitchItem(
|
SetSwitchItem(
|
||||||
// title: '首页单列',
|
title: '首页单列',
|
||||||
// subTitle: '每行展示一个内容卡片',
|
subTitle: '每行展示一个内容卡片',
|
||||||
// setKey: SettingBoxKey.enableSingleRow,
|
setKey: SettingBoxKey.enableSingleRow,
|
||||||
// defaultVal: false,
|
defaultVal: false,
|
||||||
// callFn: (val) => {SmartDialog.showToast('下次启动时生效')},
|
callFn: (val) => {SmartDialog.showToast('下次启动时生效')},
|
||||||
// ),
|
|
||||||
ListTile(
|
|
||||||
dense: false,
|
|
||||||
title: Text('自定义列数', style: titleStyle),
|
|
||||||
subtitle: Text(
|
|
||||||
'当前列数',
|
|
||||||
style: subTitleStyle,
|
|
||||||
),
|
|
||||||
trailing: PopupMenuButton(
|
|
||||||
initialValue: defaultCustomRows,
|
|
||||||
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
|
||||||
onSelected: (item) {
|
|
||||||
defaultCustomRows = item;
|
|
||||||
setting.put(SettingBoxKey.customRows, item);
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
|
||||||
for (var i in [1, 2, 3, 4, 5]) ...[
|
|
||||||
PopupMenuItem(
|
|
||||||
value: i,
|
|
||||||
child: Text(i.toString()),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
|
|||||||
@ -13,13 +13,12 @@ import 'package:pilipala/models/video/play/quality.dart';
|
|||||||
import 'package:pilipala/models/video/play/url.dart';
|
import 'package:pilipala/models/video/play/url.dart';
|
||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
|
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
|
||||||
|
import 'package:pilipala/pages/video/detail/widgets/header_control.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import 'package:screen_brightness/screen_brightness.dart';
|
import 'package:screen_brightness/screen_brightness.dart';
|
||||||
|
|
||||||
import 'widgets/header_control.dart';
|
|
||||||
|
|
||||||
class VideoDetailController extends GetxController
|
class VideoDetailController extends GetxController
|
||||||
with GetSingleTickerProviderStateMixin {
|
with GetSingleTickerProviderStateMixin {
|
||||||
/// 路由传参
|
/// 路由传参
|
||||||
@ -110,8 +109,6 @@ class VideoDetailController extends GetxController
|
|||||||
enableHeart = false;
|
enableHeart = false;
|
||||||
}
|
}
|
||||||
danmakuCid.value = cid.value;
|
danmakuCid.value = cid.value;
|
||||||
|
|
||||||
///
|
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
floating = Floating();
|
floating = Floating();
|
||||||
}
|
}
|
||||||
@ -215,15 +212,14 @@ class VideoDetailController extends GetxController
|
|||||||
direction: (firstVideo.width! - firstVideo.height!) > 0
|
direction: (firstVideo.width! - firstVideo.height!) > 0
|
||||||
? 'horizontal'
|
? 'horizontal'
|
||||||
: 'vertical',
|
: 'vertical',
|
||||||
|
// 默认1倍速
|
||||||
|
speed: 1.0,
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid.value,
|
cid: cid.value,
|
||||||
enableHeart: enableHeart,
|
enableHeart: enableHeart,
|
||||||
isFirstTime: isFirstTime,
|
isFirstTime: isFirstTime,
|
||||||
autoplay: autoplay,
|
autoplay: autoplay,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// 开启自动全屏时,在player初始化完成后立即传入headerControl
|
|
||||||
plPlayerController.headerControl = headerControl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 视频链接
|
// 视频链接
|
||||||
@ -274,8 +270,8 @@ class VideoDetailController extends GetxController
|
|||||||
currentDecodeFormats = flag
|
currentDecodeFormats = flag
|
||||||
? currentDecodeFormats
|
? currentDecodeFormats
|
||||||
: VideoDecodeFormatsCode.fromString(supportDecodeFormats.first)!;
|
: VideoDecodeFormatsCode.fromString(supportDecodeFormats.first)!;
|
||||||
} catch (err) {
|
} catch (e) {
|
||||||
SmartDialog.showToast('DecodeFormats error: $err');
|
print(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 取出符合当前解码格式的videoItem
|
/// 取出符合当前解码格式的videoItem
|
||||||
@ -287,7 +283,7 @@ class VideoDetailController extends GetxController
|
|||||||
}
|
}
|
||||||
videoUrl = firstVideo.baseUrl!;
|
videoUrl = firstVideo.baseUrl!;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
SmartDialog.showToast('firstVideo error: $err');
|
print(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 优先顺序 设置中指定质量 -> 当前可选的最高质量
|
/// 优先顺序 设置中指定质量 -> 当前可选的最高质量
|
||||||
@ -297,6 +293,7 @@ class VideoDetailController extends GetxController
|
|||||||
try {
|
try {
|
||||||
int resultAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
|
int resultAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
|
||||||
defaultValue: AudioQuality.hiRes.code);
|
defaultValue: AudioQuality.hiRes.code);
|
||||||
|
|
||||||
if (data.dash!.dolby?.audio?.isNotEmpty == true) {
|
if (data.dash!.dolby?.audio?.isNotEmpty == true) {
|
||||||
// 杜比
|
// 杜比
|
||||||
audiosList.insert(0, data.dash!.dolby!.audio!.first);
|
audiosList.insert(0, data.dash!.dolby!.audio!.first);
|
||||||
@ -310,20 +307,16 @@ class VideoDetailController extends GetxController
|
|||||||
if (audiosList.isNotEmpty) {
|
if (audiosList.isNotEmpty) {
|
||||||
List<int> numbers = audiosList.map((map) => map.id!).toList();
|
List<int> numbers = audiosList.map((map) => map.id!).toList();
|
||||||
int closestNumber = Utils.findClosestNumber(resultAudioQa, numbers);
|
int closestNumber = Utils.findClosestNumber(resultAudioQa, numbers);
|
||||||
if (!numbers.contains(resultAudioQa) &&
|
if (!numbers.contains(resultAudioQa)) {
|
||||||
numbers.any((e) => e > resultAudioQa)) {
|
|
||||||
closestNumber = 30280;
|
closestNumber = 30280;
|
||||||
}
|
}
|
||||||
firstAudio = audiosList.firstWhere((e) => e.id == closestNumber);
|
firstAudio = audiosList.firstWhere((e) => e.id == closestNumber);
|
||||||
} else {
|
|
||||||
firstAudio = AudioItem();
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (e) {
|
||||||
firstAudio = audiosList.isNotEmpty ? audiosList.first : AudioItem();
|
print(e);
|
||||||
SmartDialog.showToast('firstAudio error: $err');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
audioUrl = firstAudio.baseUrl ?? '';
|
audioUrl = firstAudio!.baseUrl ?? '';
|
||||||
//
|
//
|
||||||
if (firstAudio.id != null) {
|
if (firstAudio.id != null) {
|
||||||
currentAudioQa = AudioQualityCode.fromCode(firstAudio.id!)!;
|
currentAudioQa = AudioQualityCode.fromCode(firstAudio.id!)!;
|
||||||
|
|||||||
@ -17,8 +17,6 @@ import 'package:pilipala/utils/id_utils.dart';
|
|||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
import 'widgets/group_panel.dart';
|
|
||||||
|
|
||||||
class VideoIntroController extends GetxController {
|
class VideoIntroController extends GetxController {
|
||||||
// 视频bvid
|
// 视频bvid
|
||||||
String bvid = Get.parameters['bvid']!;
|
String bvid = Get.parameters['bvid']!;
|
||||||
@ -61,11 +59,14 @@ class VideoIntroController extends GetxController {
|
|||||||
RxString total = '1'.obs;
|
RxString total = '1'.obs;
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
bool isPaused = false;
|
bool isPaused = false;
|
||||||
String heroTag = Get.arguments['heroTag'];
|
String heroTag = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
try {
|
||||||
|
heroTag = Get.arguments['heroTag'];
|
||||||
|
} catch (_) {}
|
||||||
userInfo = userInfoCache.get('userInfoCache');
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
if (Get.arguments.isNotEmpty) {
|
if (Get.arguments.isNotEmpty) {
|
||||||
if (Get.arguments.containsKey('videoItem')) {
|
if (Get.arguments.containsKey('videoItem')) {
|
||||||
@ -106,10 +107,9 @@ class VideoIntroController extends GetxController {
|
|||||||
if (videoDetail.value.pages!.isNotEmpty && lastPlayCid.value == 0) {
|
if (videoDetail.value.pages!.isNotEmpty && lastPlayCid.value == 0) {
|
||||||
lastPlayCid.value = videoDetail.value.pages!.first.cid!;
|
lastPlayCid.value = videoDetail.value.pages!.first.cid!;
|
||||||
}
|
}
|
||||||
// Get.find<VideoDetailController>(tag: heroTag).tabs.value = [
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
|
||||||
// '简介',
|
.tabs
|
||||||
// '评论 ${result['data']!.stat!.reply}'
|
.value = ['简介', '评论 ${result['data']!.stat!.reply}'];
|
||||||
// ];
|
|
||||||
// 获取到粉丝数再返回
|
// 获取到粉丝数再返回
|
||||||
await queryUserStat();
|
await queryUserStat();
|
||||||
}
|
}
|
||||||
@ -430,20 +430,6 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
followStatus['attribute'] = actionStatus;
|
followStatus['attribute'] = actionStatus;
|
||||||
followStatus.refresh();
|
followStatus.refresh();
|
||||||
if (actionStatus == 2) {
|
|
||||||
if (context.mounted) {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: const Text('关注成功'),
|
|
||||||
duration: const Duration(seconds: 2),
|
|
||||||
action: SnackBarAction(
|
|
||||||
label: '设置分组',
|
|
||||||
onPressed: setFollowGroup,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
},
|
},
|
||||||
@ -459,7 +445,7 @@ class VideoIntroController extends GetxController {
|
|||||||
Future changeSeasonOrbangu(bvid, cid, aid) async {
|
Future changeSeasonOrbangu(bvid, cid, aid) async {
|
||||||
// 重新获取视频资源
|
// 重新获取视频资源
|
||||||
VideoDetailController videoDetailCtr =
|
VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: heroTag);
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
||||||
videoDetailCtr.bvid = bvid;
|
videoDetailCtr.bvid = bvid;
|
||||||
videoDetailCtr.cid.value = cid;
|
videoDetailCtr.cid.value = cid;
|
||||||
videoDetailCtr.danmakuCid.value = cid;
|
videoDetailCtr.danmakuCid.value = cid;
|
||||||
@ -468,7 +454,7 @@ class VideoIntroController extends GetxController {
|
|||||||
try {
|
try {
|
||||||
/// 未渲染回复组件时可能异常
|
/// 未渲染回复组件时可能异常
|
||||||
VideoReplyController videoReplyCtr =
|
VideoReplyController videoReplyCtr =
|
||||||
Get.find<VideoReplyController>(tag: heroTag);
|
Get.find<VideoReplyController>(tag: Get.arguments['heroTag']);
|
||||||
videoReplyCtr.aid = aid;
|
videoReplyCtr.aid = aid;
|
||||||
videoReplyCtr.queryReplyList(type: 'init');
|
videoReplyCtr.queryReplyList(type: 'init');
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
@ -509,19 +495,7 @@ class VideoIntroController extends GetxController {
|
|||||||
/// 列表循环或者顺序播放时,自动播放下一个
|
/// 列表循环或者顺序播放时,自动播放下一个
|
||||||
void nextPlay() {
|
void nextPlay() {
|
||||||
late List episodes;
|
late List episodes;
|
||||||
// if (videoDetail.value.ugcSeason != null) {
|
bool isPages = false;
|
||||||
// UgcSeason ugcSeason = videoDetail.value.ugcSeason!;
|
|
||||||
// List<SectionItem> sections = ugcSeason.sections!;
|
|
||||||
// for (int i = 0; i < sections.length; i++) {
|
|
||||||
// List<EpisodeItem> episodesList = sections[i].episodes!;
|
|
||||||
// for (int j = 0; j < episodesList.length; j++) {
|
|
||||||
// if (episodesList[j].cid == lastPlayCid.value) {
|
|
||||||
// episodes = episodesList;
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (videoDetail.value.ugcSeason != null) {
|
if (videoDetail.value.ugcSeason != null) {
|
||||||
UgcSeason ugcSeason = videoDetail.value.ugcSeason!;
|
UgcSeason ugcSeason = videoDetail.value.ugcSeason!;
|
||||||
List<SectionItem> sections = ugcSeason.sections!;
|
List<SectionItem> sections = ugcSeason.sections!;
|
||||||
@ -531,6 +505,11 @@ class VideoIntroController extends GetxController {
|
|||||||
List<EpisodeItem> episodesList = sections[i].episodes!;
|
List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||||
episodes.addAll(episodesList);
|
episodes.addAll(episodesList);
|
||||||
}
|
}
|
||||||
|
} else if (videoDetail.value.pages != null) {
|
||||||
|
isPages = true;
|
||||||
|
List<Part> pages = videoDetail.value.pages!;
|
||||||
|
episodes = [];
|
||||||
|
episodes.addAll(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
int currentIndex = episodes.indexWhere((e) => e.cid == lastPlayCid.value);
|
int currentIndex = episodes.indexWhere((e) => e.cid == lastPlayCid.value);
|
||||||
@ -549,16 +528,8 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int cid = episodes[nextIndex].cid!;
|
int cid = episodes[nextIndex].cid!;
|
||||||
String bvid = episodes[nextIndex].bvid!;
|
String rBvid = isPages ? bvid : episodes[nextIndex].bvid;
|
||||||
int aid = episodes[nextIndex].aid!;
|
int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[nextIndex].aid!;
|
||||||
changeSeasonOrbangu(bvid, cid, aid);
|
changeSeasonOrbangu(rBvid, cid, rAid);
|
||||||
}
|
|
||||||
|
|
||||||
// 设置关注分组
|
|
||||||
void setFollowGroup() {
|
|
||||||
Get.bottomSheet(
|
|
||||||
GroupPanel(mid: videoDetail.value.owner!.mid!),
|
|
||||||
isScrollControlled: true,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -199,9 +199,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
// 视频介绍
|
// 视频介绍
|
||||||
showIntroDetail() {
|
showIntroDetail() {
|
||||||
if (loadingStatus) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
feedBack();
|
feedBack();
|
||||||
showBottomSheet(
|
showBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@ -238,82 +235,106 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
? Column(
|
? Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
|
||||||
behavior: HitTestBehavior.translucent,
|
|
||||||
onTap: () => showIntroDetail(),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 6),
|
|
||||||
child: Text(
|
|
||||||
!loadingStatus
|
|
||||||
? widget.videoDetail!.title
|
|
||||||
: videoItem['title'],
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
onTap: () => showIntroDetail(),
|
onTap: () => showIntroDetail(),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
StatView(
|
Expanded(
|
||||||
theme: 'gray',
|
child: Text(
|
||||||
view: !widget.loadingStatus
|
!loadingStatus
|
||||||
? widget.videoDetail!.stat!.view
|
? widget.videoDetail!.title
|
||||||
: videoItem['stat'].view,
|
: videoItem['title'],
|
||||||
size: 'medium',
|
style: const TextStyle(
|
||||||
),
|
fontSize: 16,
|
||||||
const SizedBox(width: 10),
|
fontWeight: FontWeight.w500,
|
||||||
StatDanMu(
|
|
||||||
theme: 'gray',
|
|
||||||
danmu: !widget.loadingStatus
|
|
||||||
? widget.videoDetail!.stat!.danmaku
|
|
||||||
: videoItem['stat'].danmaku,
|
|
||||||
size: 'medium',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Text(
|
|
||||||
Utils.dateFormat(
|
|
||||||
!widget.loadingStatus
|
|
||||||
? widget.videoDetail!.pubdate
|
|
||||||
: videoItem['pubdate'],
|
|
||||||
formatType: 'detail'),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: t.colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
if (videoIntroController.isShowOnlineTotal)
|
|
||||||
Obx(
|
|
||||||
() => Text(
|
|
||||||
'${videoIntroController.total.value}人在看',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: t.colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
// const SizedBox(width: 20),
|
||||||
|
// SizedBox(
|
||||||
|
// width: 34,
|
||||||
|
// height: 34,
|
||||||
|
// child: IconButton(
|
||||||
|
// style: ButtonStyle(
|
||||||
|
// padding:
|
||||||
|
// MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
|
// backgroundColor:
|
||||||
|
// MaterialStateProperty.resolveWith((states) {
|
||||||
|
// return t.highlightColor.withOpacity(0.2);
|
||||||
|
// }),
|
||||||
|
// ),
|
||||||
|
// onPressed: showIntroDetail,
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons.more_horiz,
|
||||||
|
// color: Theme.of(context).colorScheme.primary,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 7),
|
// GestureDetector(
|
||||||
// 点赞收藏转发 布局样式1
|
// behavior: HitTestBehavior.translucent,
|
||||||
// SingleChildScrollView(
|
// onTap: () => showIntroDetail(),
|
||||||
// padding: const EdgeInsets.only(top: 7, bottom: 7),
|
// child: Row(
|
||||||
// scrollDirection: Axis.horizontal,
|
// children: [
|
||||||
// child: actionRow(
|
// StatView(
|
||||||
// context,
|
// theme: 'gray',
|
||||||
// videoIntroController,
|
// view: !widget.loadingStatus
|
||||||
// videoDetailCtr,
|
// ? widget.videoDetail!.stat!.view
|
||||||
|
// : videoItem['stat'].view,
|
||||||
|
// size: 'medium',
|
||||||
|
// ),
|
||||||
|
// const SizedBox(width: 10),
|
||||||
|
// StatDanMu(
|
||||||
|
// theme: 'gray',
|
||||||
|
// danmu: !widget.loadingStatus
|
||||||
|
// ? widget.videoDetail!.stat!.danmaku
|
||||||
|
// : videoItem['stat'].danmaku,
|
||||||
|
// size: 'medium',
|
||||||
|
// ),
|
||||||
|
// const SizedBox(width: 10),
|
||||||
|
// Text(
|
||||||
|
// Utils.dateFormat(
|
||||||
|
// !widget.loadingStatus
|
||||||
|
// ? widget.videoDetail!.pubdate
|
||||||
|
// : videoItem['pubdate'],
|
||||||
|
// formatType: 'detail'),
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color: t.colorScheme.outline,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// const SizedBox(width: 10),
|
||||||
|
// if (videoIntroController.isShowOnlineTotal)
|
||||||
|
// Obx(
|
||||||
|
// () => Text(
|
||||||
|
// '${videoIntroController.total.value}人在看',
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color: t.colorScheme.outline,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
|
// const SizedBox(height: 7),
|
||||||
|
// 点赞收藏转发 布局样式1
|
||||||
|
SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.only(top: 10, bottom: 7),
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: actionRow(
|
||||||
|
context,
|
||||||
|
videoIntroController,
|
||||||
|
videoDetailCtr,
|
||||||
|
),
|
||||||
|
),
|
||||||
// 点赞收藏转发 布局样式2
|
// 点赞收藏转发 布局样式2
|
||||||
actionGrid(context, videoIntroController),
|
// actionGrid(context, videoIntroController),
|
||||||
// 合集
|
// 合集
|
||||||
if (!loadingStatus &&
|
if (!loadingStatus &&
|
||||||
widget.videoDetail!.ugcSeason != null) ...[
|
widget.videoDetail!.ugcSeason != null) ...[
|
||||||
@ -361,14 +382,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(owner.name,
|
Text(owner.name,
|
||||||
style: const TextStyle(fontSize: 13)),
|
style: const TextStyle(fontSize: 13)),
|
||||||
const SizedBox(width: 6),
|
|
||||||
Text(
|
|
||||||
follower,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: t.textTheme.labelSmall!.fontSize,
|
|
||||||
color: outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
AnimatedOpacity(
|
AnimatedOpacity(
|
||||||
opacity: loadingStatus ? 0 : 1,
|
opacity: loadingStatus ? 0 : 1,
|
||||||
@ -431,7 +444,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
Widget actionGrid(BuildContext context, videoIntroController) {
|
Widget actionGrid(BuildContext context, videoIntroController) {
|
||||||
return LayoutBuilder(builder: (context, constraints) {
|
return LayoutBuilder(builder: (context, constraints) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.only(top: 6, bottom: 4),
|
padding: const EdgeInsets.only(top: 6, bottom: 10),
|
||||||
height: constraints.maxWidth / 5 * 0.8,
|
height: constraints.maxWidth / 5 * 0.8,
|
||||||
child: GridView.count(
|
child: GridView.count(
|
||||||
primary: false,
|
primary: false,
|
||||||
@ -450,12 +463,12 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
? widget.videoDetail!.stat!.like!.toString()
|
? widget.videoDetail!.stat!.like!.toString()
|
||||||
: '-'),
|
: '-'),
|
||||||
),
|
),
|
||||||
// ActionItem(
|
ActionItem(
|
||||||
// icon: const Icon(FontAwesomeIcons.clock),
|
icon: const Icon(FontAwesomeIcons.clock),
|
||||||
// onTap: () => videoIntroController.actionShareVideo(),
|
onTap: () => videoIntroController.actionShareVideo(),
|
||||||
// selectStatus: false,
|
selectStatus: false,
|
||||||
// loadingStatus: loadingStatus,
|
loadingStatus: loadingStatus,
|
||||||
// text: '稍后再看'),
|
text: '稍后再看'),
|
||||||
Obx(
|
Obx(
|
||||||
() => ActionItem(
|
() => ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.b),
|
icon: const Icon(FontAwesomeIcons.b),
|
||||||
@ -471,28 +484,22 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
() => ActionItem(
|
() => ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.star),
|
icon: const Icon(FontAwesomeIcons.star),
|
||||||
selectIcon: const Icon(FontAwesomeIcons.solidStar),
|
selectIcon: const Icon(FontAwesomeIcons.solidStar),
|
||||||
|
// onTap: () => videoIntroController.actionFavVideo(),
|
||||||
onTap: () => showFavBottomSheet(),
|
onTap: () => showFavBottomSheet(),
|
||||||
onLongPress: () => showFavBottomSheet(type: 'longPress'),
|
|
||||||
selectStatus: videoIntroController.hasFav.value,
|
selectStatus: videoIntroController.hasFav.value,
|
||||||
loadingStatus: loadingStatus,
|
loadingStatus: loadingStatus,
|
||||||
text: !loadingStatus
|
text: !loadingStatus
|
||||||
? widget.videoDetail!.stat!.favorite!.toString()
|
? widget.videoDetail!.stat!.favorite!.toString()
|
||||||
: '-'),
|
: '-'),
|
||||||
),
|
),
|
||||||
ActionItem(
|
|
||||||
icon: const Icon(FontAwesomeIcons.comment),
|
|
||||||
onTap: () => videoDetailCtr.tabCtr.animateTo(1),
|
|
||||||
selectStatus: false,
|
|
||||||
loadingStatus: loadingStatus,
|
|
||||||
text: !loadingStatus
|
|
||||||
? widget.videoDetail!.stat!.reply!.toString()
|
|
||||||
: '评论'),
|
|
||||||
ActionItem(
|
ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
||||||
onTap: () => videoIntroController.actionShareVideo(),
|
onTap: () => videoIntroController.actionShareVideo(),
|
||||||
selectStatus: false,
|
selectStatus: false,
|
||||||
loadingStatus: loadingStatus,
|
loadingStatus: loadingStatus,
|
||||||
text: '分享'),
|
text: !loadingStatus
|
||||||
|
? widget.videoDetail!.stat!.share!.toString()
|
||||||
|
: '-'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -501,52 +508,52 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
Widget actionRow(BuildContext context, videoIntroController, videoDetailCtr) {
|
Widget actionRow(BuildContext context, videoIntroController, videoDetailCtr) {
|
||||||
return Row(children: [
|
return Row(children: [
|
||||||
Obx(
|
// Obx(
|
||||||
() => ActionRowItem(
|
// () => ActionRowItem(
|
||||||
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
// icon: const Icon(FontAwesomeIcons.thumbsUp),
|
||||||
onTap: () => videoIntroController.actionLikeVideo(),
|
// onTap: () => videoIntroController.actionLikeVideo(),
|
||||||
selectStatus: videoIntroController.hasLike.value,
|
// selectStatus: videoIntroController.hasLike.value,
|
||||||
loadingStatus: loadingStatus,
|
// loadingStatus: loadingStatus,
|
||||||
text:
|
// text:
|
||||||
!loadingStatus ? widget.videoDetail!.stat!.like!.toString() : '-',
|
// !loadingStatus ? widget.videoDetail!.stat!.like!.toString() : '-',
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
const SizedBox(width: 8),
|
// const SizedBox(width: 8),
|
||||||
Obx(
|
// Obx(
|
||||||
() => ActionRowItem(
|
// () => ActionRowItem(
|
||||||
icon: const Icon(FontAwesomeIcons.b),
|
// icon: const Icon(FontAwesomeIcons.b),
|
||||||
onTap: () => videoIntroController.actionCoinVideo(),
|
// onTap: () => videoIntroController.actionCoinVideo(),
|
||||||
selectStatus: videoIntroController.hasCoin.value,
|
// selectStatus: videoIntroController.hasCoin.value,
|
||||||
loadingStatus: loadingStatus,
|
// loadingStatus: loadingStatus,
|
||||||
text:
|
// text:
|
||||||
!loadingStatus ? widget.videoDetail!.stat!.coin!.toString() : '-',
|
// !loadingStatus ? widget.videoDetail!.stat!.coin!.toString() : '-',
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
const SizedBox(width: 8),
|
// const SizedBox(width: 8),
|
||||||
Obx(
|
// Obx(
|
||||||
() => ActionRowItem(
|
// () => ActionRowItem(
|
||||||
icon: const Icon(FontAwesomeIcons.heart),
|
// icon: const Icon(FontAwesomeIcons.heart),
|
||||||
onTap: () => showFavBottomSheet(),
|
// onTap: () => showFavBottomSheet(),
|
||||||
onLongPress: () => showFavBottomSheet(type: 'longPress'),
|
// onLongPress: () => showFavBottomSheet(type: 'longPress'),
|
||||||
selectStatus: videoIntroController.hasFav.value,
|
// selectStatus: videoIntroController.hasFav.value,
|
||||||
loadingStatus: loadingStatus,
|
// loadingStatus: loadingStatus,
|
||||||
text: !loadingStatus
|
// text: !loadingStatus
|
||||||
? widget.videoDetail!.stat!.favorite!.toString()
|
// ? widget.videoDetail!.stat!.favorite!.toString()
|
||||||
: '-',
|
// : '-',
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
const SizedBox(width: 8),
|
// const SizedBox(width: 8),
|
||||||
ActionRowItem(
|
// ActionRowItem(
|
||||||
icon: const Icon(FontAwesomeIcons.comment),
|
// icon: const Icon(FontAwesomeIcons.comment),
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
videoDetailCtr.tabCtr.animateTo(1);
|
// videoDetailCtr.tabCtr.animateTo(1);
|
||||||
},
|
// },
|
||||||
selectStatus: false,
|
// selectStatus: false,
|
||||||
loadingStatus: loadingStatus,
|
// loadingStatus: loadingStatus,
|
||||||
text:
|
// text:
|
||||||
!loadingStatus ? widget.videoDetail!.stat!.reply!.toString() : '-',
|
// !loadingStatus ? widget.videoDetail!.stat!.reply!.toString() : '-',
|
||||||
),
|
// ),
|
||||||
const SizedBox(width: 8),
|
// const SizedBox(width: 8),
|
||||||
ActionRowItem(
|
ActionRowItem(
|
||||||
icon: const Icon(FontAwesomeIcons.share),
|
icon: const Icon(FontAwesomeIcons.share),
|
||||||
onTap: () => videoIntroController.actionShareVideo(),
|
onTap: () => videoIntroController.actionShareVideo(),
|
||||||
|
|||||||
@ -6,7 +6,6 @@ class ActionItem extends StatelessWidget {
|
|||||||
final Icon? icon;
|
final Icon? icon;
|
||||||
final Icon? selectIcon;
|
final Icon? selectIcon;
|
||||||
final Function? onTap;
|
final Function? onTap;
|
||||||
final Function? onLongPress;
|
|
||||||
final bool? loadingStatus;
|
final bool? loadingStatus;
|
||||||
final String? text;
|
final String? text;
|
||||||
final bool selectStatus;
|
final bool selectStatus;
|
||||||
@ -16,7 +15,6 @@ class ActionItem extends StatelessWidget {
|
|||||||
this.icon,
|
this.icon,
|
||||||
this.selectIcon,
|
this.selectIcon,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.onLongPress,
|
|
||||||
this.loadingStatus,
|
this.loadingStatus,
|
||||||
this.text,
|
this.text,
|
||||||
this.selectStatus = false,
|
this.selectStatus = false,
|
||||||
@ -29,9 +27,6 @@ class ActionItem extends StatelessWidget {
|
|||||||
feedBack(),
|
feedBack(),
|
||||||
onTap!(),
|
onTap!(),
|
||||||
},
|
},
|
||||||
onLongPress: () => {
|
|
||||||
if (onLongPress != null) {onLongPress!()}
|
|
||||||
},
|
|
||||||
borderRadius: StyleString.mdRadius,
|
borderRadius: StyleString.mdRadius,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|||||||
@ -1,156 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
|
||||||
import 'package:pilipala/http/member.dart';
|
|
||||||
import 'package:pilipala/models/member/tags.dart';
|
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
|
||||||
|
|
||||||
class GroupPanel extends StatefulWidget {
|
|
||||||
final int? mid;
|
|
||||||
const GroupPanel({super.key, this.mid});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<GroupPanel> createState() => _GroupPanelState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _GroupPanelState extends State<GroupPanel> {
|
|
||||||
Box localCache = GStrorage.localCache;
|
|
||||||
late double sheetHeight;
|
|
||||||
late Future _futureBuilderFuture;
|
|
||||||
late List<MemberTagItemModel> tagsList;
|
|
||||||
bool showDefault = true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
sheetHeight = localCache.get('sheetHeight');
|
|
||||||
_futureBuilderFuture = MemberHttp.followUpTags();
|
|
||||||
}
|
|
||||||
|
|
||||||
void onSave() async {
|
|
||||||
feedBack();
|
|
||||||
// 是否有选中的 有选中的带id,没选使用默认0
|
|
||||||
bool anyHasChecked = tagsList.any((e) => e.checked == true);
|
|
||||||
late String tagids;
|
|
||||||
if (anyHasChecked) {
|
|
||||||
List checkedList = tagsList.where((e) => e.checked == true).toList();
|
|
||||||
List<int> tagidList = checkedList.map<int>((e) => e.tagid).toList();
|
|
||||||
tagids = tagidList.join(',');
|
|
||||||
} else {
|
|
||||||
tagids = '0';
|
|
||||||
}
|
|
||||||
// 保存
|
|
||||||
var res = await MemberHttp.addUsers(widget.mid, tagids);
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
if (res['status']) {
|
|
||||||
Get.back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
height: sheetHeight,
|
|
||||||
color: Theme.of(context).colorScheme.background,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
AppBar(
|
|
||||||
centerTitle: false,
|
|
||||||
elevation: 0,
|
|
||||||
leading: IconButton(
|
|
||||||
onPressed: () => Get.back(),
|
|
||||||
icon: const Icon(Icons.close_outlined)),
|
|
||||||
title:
|
|
||||||
Text('设置关注分组', style: Theme.of(context).textTheme.titleMedium),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Material(
|
|
||||||
child: FutureBuilder(
|
|
||||||
future: _futureBuilderFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
Map data = snapshot.data as Map;
|
|
||||||
if (data['status']) {
|
|
||||||
tagsList = data['data'];
|
|
||||||
return ListView.builder(
|
|
||||||
itemCount: data['data'].length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return ListTile(
|
|
||||||
onTap: () {
|
|
||||||
data['data'][index].checked =
|
|
||||||
!data['data'][index].checked;
|
|
||||||
showDefault =
|
|
||||||
!data['data'].any((e) => e.checked == true);
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
dense: true,
|
|
||||||
leading: const Icon(Icons.group_outlined),
|
|
||||||
minLeadingWidth: 0,
|
|
||||||
title: Text(data['data'][index].name),
|
|
||||||
subtitle: data['data'][index].tip != ''
|
|
||||||
? Text(data['data'][index].tip)
|
|
||||||
: null,
|
|
||||||
trailing: Transform.scale(
|
|
||||||
scale: 0.9,
|
|
||||||
child: Checkbox(
|
|
||||||
value: data['data'][index].checked,
|
|
||||||
onChanged: (bool? checkValue) {
|
|
||||||
data['data'][index].checked = checkValue;
|
|
||||||
showDefault = !data['data']
|
|
||||||
.any((e) => e.checked == true);
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return HttpError(
|
|
||||||
errMsg: data['msg'],
|
|
||||||
fn: () => setState(() {}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 骨架屏
|
|
||||||
return const Text('请求中');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Divider(
|
|
||||||
height: 1,
|
|
||||||
color: Theme.of(context).disabledColor.withOpacity(0.08),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: 20,
|
|
||||||
right: 20,
|
|
||||||
top: 12,
|
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 12,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => onSave(),
|
|
||||||
style: TextButton.styleFrom(
|
|
||||||
padding: const EdgeInsets.only(left: 30, right: 30),
|
|
||||||
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
|
||||||
backgroundColor:
|
|
||||||
Theme.of(context).colorScheme.primary, // 设置按钮背景色
|
|
||||||
),
|
|
||||||
child: Text(showDefault ? '保存至默认分组' : '保存'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
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';
|
||||||
@ -58,29 +57,13 @@ class IntroDetail extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
Row(
|
Text(
|
||||||
children: [
|
Utils.dateFormat(videoDetail!.pubdate,
|
||||||
StatView(
|
formatType: 'detail'),
|
||||||
theme: 'gray',
|
style: TextStyle(
|
||||||
view: videoDetail!.stat!.view,
|
fontSize: 12,
|
||||||
size: 'medium',
|
color: Theme.of(context).colorScheme.outline,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
|
||||||
StatDanMu(
|
|
||||||
theme: 'gray',
|
|
||||||
danmu: videoDetail!.stat!.danmaku,
|
|
||||||
size: 'medium',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Text(
|
|
||||||
Utils.dateFormat(videoDetail!.pubdate,
|
|
||||||
formatType: 'detail'),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -130,50 +113,7 @@ class IntroDetail extends StatelessWidget {
|
|||||||
final currentDesc = descV2[index];
|
final currentDesc = descV2[index];
|
||||||
switch (currentDesc.type) {
|
switch (currentDesc.type) {
|
||||||
case 1:
|
case 1:
|
||||||
List<InlineSpan> spanChildren = [];
|
return TextSpan(text: currentDesc.rawText);
|
||||||
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);
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/models/video_detail_res.dart';
|
import 'package:pilipala/models/video_detail_res.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
|
||||||
|
|
||||||
class PagesPanel extends StatefulWidget {
|
class PagesPanel extends StatefulWidget {
|
||||||
final List<Part> pages;
|
final List<Part> pages;
|
||||||
@ -23,23 +22,13 @@ class PagesPanel extends StatefulWidget {
|
|||||||
|
|
||||||
class _PagesPanelState extends State<PagesPanel> {
|
class _PagesPanelState extends State<PagesPanel> {
|
||||||
late List<Part> episodes;
|
late List<Part> episodes;
|
||||||
late int cid;
|
|
||||||
late int currentIndex;
|
late int currentIndex;
|
||||||
String heroTag = Get.arguments['heroTag'];
|
|
||||||
late VideoDetailController _videoDetailController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
cid = widget.cid!;
|
|
||||||
episodes = widget.pages;
|
episodes = widget.pages;
|
||||||
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
currentIndex = episodes.indexWhere((e) => e.cid == widget.cid);
|
||||||
currentIndex = episodes.indexWhere((e) => e.cid == cid);
|
|
||||||
_videoDetailController.cid.listen((p0) {
|
|
||||||
cid = p0;
|
|
||||||
setState(() {});
|
|
||||||
currentIndex = episodes.indexWhere((e) => e.cid == cid);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeFucCall(item, i) async {
|
void changeFucCall(item, i) async {
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
for (int i = 0; i < sections.length; i++) {
|
for (int i = 0; i < sections.length; i++) {
|
||||||
List<EpisodeItem> episodesList = sections[i].episodes!;
|
List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||||
for (int j = 0; j < episodesList.length; j++) {
|
for (int j = 0; j < episodesList.length; j++) {
|
||||||
if (episodesList[j].cid == cid) {
|
if (episodesList[j].cid == widget.cid) {
|
||||||
episodes = episodesList;
|
episodes = episodesList;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
// episodes = widget.ugcSeason.sections!
|
// episodes = widget.ugcSeason.sections!
|
||||||
// .firstWhere((e) => e.seasonId == widget.ugcSeason.id)
|
// .firstWhere((e) => e.seasonId == widget.ugcSeason.id)
|
||||||
// .episodes!;
|
// .episodes!;
|
||||||
currentIndex = episodes.indexWhere((e) => e.cid == cid);
|
currentIndex = episodes.indexWhere((e) => e.cid == widget.cid);
|
||||||
_videoDetailController.cid.listen((p0) {
|
_videoDetailController.cid.listen((p0) {
|
||||||
cid = p0;
|
cid = p0;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -68,9 +68,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
item.aid,
|
item.aid,
|
||||||
);
|
);
|
||||||
currentIndex = i;
|
currentIndex = i;
|
||||||
setState(() {});
|
|
||||||
Get.back();
|
Get.back();
|
||||||
setState(() {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -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,7 +39,6 @@ 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
|
||||||
@ -47,29 +46,22 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
|
||||||
int oid = widget.bvid != null ? IdUtils.bv2av(widget.bvid!) : 0;
|
int oid = widget.bvid != null ? IdUtils.bv2av(widget.bvid!) : 0;
|
||||||
heroTag = Get.arguments['heroTag'];
|
super.initState();
|
||||||
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 =
|
_videoReplyController = Get.put(VideoReplyController(oid, '', replyLevel),
|
||||||
Get.put(VideoReplyController(oid, '', replyLevel), tag: heroTag);
|
tag: Get.arguments['heroTag']);
|
||||||
}
|
}
|
||||||
|
|
||||||
fabAnimationCtr = AnimationController(
|
fabAnimationCtr = AnimationController(
|
||||||
vsync: this, duration: const Duration(milliseconds: 300));
|
vsync: this, duration: const Duration(milliseconds: 300));
|
||||||
|
|
||||||
_futureBuilderFuture = _videoReplyController.queryReplyList();
|
_futureBuilderFuture = _videoReplyController.queryReplyList();
|
||||||
|
|
||||||
fabAnimationCtr.forward();
|
|
||||||
scrollListener();
|
|
||||||
}
|
|
||||||
|
|
||||||
void scrollListener() {
|
|
||||||
scrollController = _videoReplyController.scrollController;
|
scrollController = _videoReplyController.scrollController;
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
() {
|
() {
|
||||||
@ -89,6 +81,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
fabAnimationCtr.forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showFab() {
|
void _showFab() {
|
||||||
@ -108,7 +101,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
// 展示二级回复
|
// 展示二级回复
|
||||||
void replyReply(replyItem) {
|
void replyReply(replyItem) {
|
||||||
VideoDetailController videoDetailCtr =
|
VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: heroTag);
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
||||||
if (replyItem != null) {
|
if (replyItem != null) {
|
||||||
videoDetailCtr.oid = replyItem.oid;
|
videoDetailCtr.oid = replyItem.oid;
|
||||||
videoDetailCtr.fRpid = replyItem.rpid!;
|
videoDetailCtr.fRpid = replyItem.rpid!;
|
||||||
@ -119,10 +112,9 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
scrollController.removeListener(() {});
|
super.dispose();
|
||||||
fabAnimationCtr.dispose();
|
fabAnimationCtr.dispose();
|
||||||
scrollController.dispose();
|
scrollController.dispose();
|
||||||
super.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -136,7 +128,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
CustomScrollView(
|
CustomScrollView(
|
||||||
controller: scrollController,
|
controller: _videoReplyController.scrollController,
|
||||||
key: const PageStorageKey<String>('评论'),
|
key: const PageStorageKey<String>('评论'),
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
SliverPersistentHeader(
|
SliverPersistentHeader(
|
||||||
@ -195,7 +187,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) {
|
||||||
var data = snapshot.data;
|
Map data = snapshot.data as Map;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
// 请求成功
|
// 请求成功
|
||||||
return Obx(
|
return Obx(
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import 'package:pilipala/pages/preview/index.dart';
|
|||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
@ -668,11 +667,10 @@ InlineSpan buildContent(
|
|||||||
// 匹配 jumpUrl
|
// 匹配 jumpUrl
|
||||||
String matchUrl = matchMember;
|
String matchUrl = matchMember;
|
||||||
if (content.jumpUrl.isNotEmpty && hasMatchMember) {
|
if (content.jumpUrl.isNotEmpty && hasMatchMember) {
|
||||||
List urlKeys = content.jumpUrl.keys.toList().reversed.toList();
|
List urlKeys = content.jumpUrl.keys.toList();
|
||||||
matchUrl = matchMember.splitMapJoin(
|
matchUrl = matchMember.splitMapJoin(
|
||||||
/// RegExp.escape() 转义特殊字符
|
/// RegExp.escape() 转义特殊字符
|
||||||
RegExp(urlKeys.map((key) => key).join("|")),
|
RegExp(RegExp.escape(urlKeys.join("|"))),
|
||||||
// RegExp(RegExp.escape(urlKeys.join("|"))),
|
|
||||||
onMatch: (Match match) {
|
onMatch: (Match match) {
|
||||||
String matchStr = match[0]!;
|
String matchStr = match[0]!;
|
||||||
String appUrlSchema = content.jumpUrl[matchStr]['app_url_schema'];
|
String appUrlSchema = content.jumpUrl[matchStr]['app_url_schema'];
|
||||||
@ -690,26 +688,14 @@ InlineSpan buildContent(
|
|||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () {
|
..onTap = () {
|
||||||
if (appUrlSchema == '') {
|
if (appUrlSchema == '') {
|
||||||
String str = Uri.parse(matchStr).pathSegments[0];
|
Get.toNamed(
|
||||||
Map matchRes = IdUtils.matchAvorBv(input: str);
|
'/webview',
|
||||||
List matchKeys = matchRes.keys.toList();
|
parameters: {
|
||||||
if (matchKeys.isNotEmpty) {
|
'url': matchStr,
|
||||||
if (matchKeys.first == 'BV') {
|
'type': 'url',
|
||||||
Get.toNamed(
|
'pageTitle': ''
|
||||||
'/searchResult',
|
},
|
||||||
parameters: {'keyword': matchRes['BV']},
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Get.toNamed(
|
|
||||||
'/webview',
|
|
||||||
parameters: {
|
|
||||||
'url': matchStr,
|
|
||||||
'type': 'url',
|
|
||||||
'pageTitle': ''
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (appUrlSchema.startsWith('bilibili://search') &&
|
if (appUrlSchema.startsWith('bilibili://search') &&
|
||||||
enableWordRe) {
|
enableWordRe) {
|
||||||
@ -758,14 +744,11 @@ InlineSpan buildContent(
|
|||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () {
|
..onTap = () {
|
||||||
// 跳转到指定位置
|
// 跳转到指定位置
|
||||||
try {
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
|
||||||
Get.find<VideoDetailController>(
|
.plPlayerController
|
||||||
tag: Get.arguments['heroTag'])
|
.seekTo(
|
||||||
.plPlayerController
|
Duration(seconds: Utils.duration(matchStr)),
|
||||||
.seekTo(
|
);
|
||||||
Duration(seconds: Utils.duration(matchStr)),
|
|
||||||
);
|
|
||||||
} catch (_) {}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -26,6 +26,11 @@ 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;
|
||||||
@ -44,11 +49,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;
|
||||||
// 添加置顶回复
|
// 添加置顶回复
|
||||||
@ -67,10 +72,6 @@ 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,4 +1,3 @@
|
|||||||
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';
|
||||||
@ -55,9 +54,9 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
|||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 300) {
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
if (!_videoReplyReplyController.isLoadingMore) {
|
||||||
_videoReplyReplyController.queryReplyList(type: 'onLoad');
|
_videoReplyReplyController.onLoad();
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user