Merge branch 'main' into feature-notice
This commit is contained in:
21
README.md
21
README.md
@ -3,16 +3,23 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<h1>PiliPala</h1>
|
<h1>PiliPala</h1>
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
</div>
|
||||||
<p>使用Flutter开发的BiliBili第三方客户端</p>
|
<p>使用Flutter开发的BiliBili第三方客户端</p>
|
||||||
<br/>
|
|
||||||
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/sreenshot/510shots_so.png" width="32%" alt="home" />
|
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/sreenshot/510shots_so.png" width="32%" alt="home" />
|
||||||
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/sreenshot/174shots_so.png" width="32%" alt="home" />
|
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/sreenshot/174shots_so.png" width="32%" alt="home" />
|
||||||
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/sreenshot/850shots_so.png" width="32%" alt="home" />
|
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/sreenshot/850shots_so.png" width="32%" alt="home" />
|
||||||
<br/>
|
<br/>
|
||||||
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/sreenshot/main_screen.png" width="96%" alt="home" />
|
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/sreenshot/main_screen.png" width="96%" alt="home" />
|
||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## 开发环境
|
## 开发环境
|
||||||
|
11
change_log/1.0.12.1114.md
Normal file
11
change_log/1.0.12.1114.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
## 1.0.12
|
||||||
|
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
+ iOS端视频播放时没有声音
|
||||||
|
+ 超过6分钟弹幕不显示
|
||||||
|
+ 视频详情页网络异常
|
||||||
|
|
||||||
|
|
||||||
|
更多更新日志可在Github上查看
|
||||||
|
问题反馈、功能建议请查看「关于」页面。
|
@ -1,6 +1,12 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- appscheme (1.0.4):
|
- appscheme (1.0.4):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- audio_service (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- audio_session (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- auto_orientation (0.0.1):
|
||||||
|
- Flutter
|
||||||
- connectivity_plus (0.0.1):
|
- connectivity_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- ReachabilitySwift
|
- ReachabilitySwift
|
||||||
@ -56,6 +62,9 @@ PODS:
|
|||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- appscheme (from `.symlinks/plugins/appscheme/ios`)
|
- appscheme (from `.symlinks/plugins/appscheme/ios`)
|
||||||
|
- audio_service (from `.symlinks/plugins/audio_service/ios`)
|
||||||
|
- audio_session (from `.symlinks/plugins/audio_session/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`)
|
||||||
@ -88,6 +97,12 @@ SPEC REPOS:
|
|||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
appscheme:
|
appscheme:
|
||||||
:path: ".symlinks/plugins/appscheme/ios"
|
:path: ".symlinks/plugins/appscheme/ios"
|
||||||
|
audio_service:
|
||||||
|
:path: ".symlinks/plugins/audio_service/ios"
|
||||||
|
audio_session:
|
||||||
|
:path: ".symlinks/plugins/audio_session/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:
|
||||||
@ -135,8 +150,11 @@ EXTERNAL SOURCES:
|
|||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
appscheme: b1c3f8862331cb20430cf9e0e4af85dbc1572ad8
|
appscheme: b1c3f8862331cb20430cf9e0e4af85dbc1572ad8
|
||||||
|
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
||||||
|
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
||||||
|
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||||
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
||||||
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
|
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
@ -145,17 +163,17 @@ SPEC CHECKSUMS:
|
|||||||
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
|
||||||
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
|
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
||||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||||
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
||||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||||
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
||||||
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
||||||
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
|
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
|
||||||
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
||||||
status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446
|
status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446
|
||||||
system_proxy: bec1a5c5af67dd3e3ebf43979400a8756c04cc44
|
system_proxy: bec1a5c5af67dd3e3ebf43979400a8756c04cc44
|
||||||
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
|
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
|
||||||
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
|
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
|
||||||
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
|
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
|
||||||
webview_cookie_manager: eaf920722b493bd0f7611b5484771ca53fed03f7
|
webview_cookie_manager: eaf920722b493bd0f7611b5484771ca53fed03f7
|
||||||
@ -163,4 +181,4 @@ SPEC CHECKSUMS:
|
|||||||
|
|
||||||
PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b
|
PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b
|
||||||
|
|
||||||
COCOAPODS: 1.12.1
|
COCOAPODS: 1.14.3
|
||||||
|
@ -157,7 +157,7 @@
|
|||||||
97C146E61CF9000F007C117D /* Project object */ = {
|
97C146E61CF9000F007C117D /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 1300;
|
LastUpgradeCheck = 1430;
|
||||||
ORGANIZATIONNAME = "";
|
ORGANIZATIONNAME = "";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
97C146ED1CF9000F007C117D = {
|
97C146ED1CF9000F007C117D = {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1300"
|
LastUpgradeVersion = "1430"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
@ -9,7 +9,11 @@ class StyleString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Constants {
|
class Constants {
|
||||||
static const String appKey = '27eb53fc9058f8c3';
|
// 27eb53fc9058f8c3 移动端 Android
|
||||||
|
// 4409e2ce8ffd12b8 TV端
|
||||||
|
static const String appKey = '4409e2ce8ffd12b8';
|
||||||
|
// 59b43e04ad6965f34319062b478f83dd TV端
|
||||||
|
static const String appSec = '59b43e04ad6965f34319062b478f83dd';
|
||||||
static const String thirdSign = '04224646d1fea004e79606d3b038c84a';
|
static const String thirdSign = '04224646d1fea004e79606d3b038c84a';
|
||||||
static const String thirdApi =
|
static const String thirdApi =
|
||||||
'https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png';
|
'https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png';
|
||||||
|
@ -1,37 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
// Widget pBadge(
|
|
||||||
// text,
|
|
||||||
// context,
|
|
||||||
// double? top,
|
|
||||||
// double? right,
|
|
||||||
// double? bottom,
|
|
||||||
// double? left, {
|
|
||||||
// type = 'primary',
|
|
||||||
// }) {
|
|
||||||
// Color bgColor = Theme.of(context).colorScheme.primary;
|
|
||||||
// Color color = Theme.of(context).colorScheme.onPrimary;
|
|
||||||
// if (type == 'gray') {
|
|
||||||
// bgColor = Colors.black54.withOpacity(0.4);
|
|
||||||
// color = Colors.white;
|
|
||||||
// }
|
|
||||||
// return Positioned(
|
|
||||||
// top: top,
|
|
||||||
// left: left,
|
|
||||||
// right: right,
|
|
||||||
// bottom: bottom,
|
|
||||||
// child: Container(
|
|
||||||
// padding: const EdgeInsets.symmetric(vertical: 1, horizontal: 6),
|
|
||||||
// decoration:
|
|
||||||
// BoxDecoration(borderRadius: BorderRadius.circular(4), color: bgColor),
|
|
||||||
// child: Text(
|
|
||||||
// text,
|
|
||||||
// style: TextStyle(fontSize: 11, color: color),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
class PBadge extends StatelessWidget {
|
class PBadge extends StatelessWidget {
|
||||||
final String? text;
|
final String? text;
|
||||||
final double? top;
|
final double? top;
|
||||||
|
47
lib/common/widgets/content_container.dart
Normal file
47
lib/common/widgets/content_container.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ContentContainer extends StatelessWidget {
|
||||||
|
final Widget? contentWidget;
|
||||||
|
final Widget? bottomWidget;
|
||||||
|
final bool isScrollable;
|
||||||
|
final Clip? childClipBehavior;
|
||||||
|
|
||||||
|
const ContentContainer(
|
||||||
|
{Key? key,
|
||||||
|
this.contentWidget,
|
||||||
|
this.bottomWidget,
|
||||||
|
this.isScrollable = true,
|
||||||
|
this.childClipBehavior})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return LayoutBuilder(
|
||||||
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
clipBehavior: childClipBehavior ?? Clip.hardEdge,
|
||||||
|
physics: isScrollable ? null : NeverScrollableScrollPhysics(),
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: constraints.copyWith(
|
||||||
|
minHeight: constraints.maxHeight,
|
||||||
|
maxHeight: double.infinity,
|
||||||
|
),
|
||||||
|
child: IntrinsicHeight(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
if (contentWidget != null)
|
||||||
|
Expanded(
|
||||||
|
child: contentWidget!,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Spacer(),
|
||||||
|
if (bottomWidget != null) bottomWidget!,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -17,6 +17,10 @@ class VideoCardH extends StatelessWidget {
|
|||||||
final Function()? longPress;
|
final Function()? longPress;
|
||||||
final Function()? longPressEnd;
|
final Function()? longPressEnd;
|
||||||
final String source;
|
final String source;
|
||||||
|
final bool showOwner;
|
||||||
|
final bool showView;
|
||||||
|
final bool showDanmaku;
|
||||||
|
final bool showPubdate;
|
||||||
|
|
||||||
const VideoCardH({
|
const VideoCardH({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -24,6 +28,10 @@ class VideoCardH extends StatelessWidget {
|
|||||||
this.longPress,
|
this.longPress,
|
||||||
this.longPressEnd,
|
this.longPressEnd,
|
||||||
this.source = 'normal',
|
this.source = 'normal',
|
||||||
|
this.showOwner = true,
|
||||||
|
this.showView = true,
|
||||||
|
this.showDanmaku = true,
|
||||||
|
this.showPubdate = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -103,7 +111,14 @@ class VideoCardH extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
VideoContent(videoItem: videoItem, source: source)
|
VideoContent(
|
||||||
|
videoItem: videoItem,
|
||||||
|
source: source,
|
||||||
|
showOwner: showOwner,
|
||||||
|
showView: showView,
|
||||||
|
showDanmaku: showDanmaku,
|
||||||
|
showPubdate: showPubdate,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -119,8 +134,20 @@ class VideoContent extends StatelessWidget {
|
|||||||
// ignore: prefer_typing_uninitialized_variables
|
// ignore: prefer_typing_uninitialized_variables
|
||||||
final videoItem;
|
final videoItem;
|
||||||
final String source;
|
final String source;
|
||||||
const VideoContent(
|
final bool showOwner;
|
||||||
{super.key, required this.videoItem, this.source = 'normal'});
|
final bool showView;
|
||||||
|
final bool showDanmaku;
|
||||||
|
final bool showPubdate;
|
||||||
|
|
||||||
|
const VideoContent({
|
||||||
|
super.key,
|
||||||
|
required this.videoItem,
|
||||||
|
this.source = 'normal',
|
||||||
|
this.showOwner = true,
|
||||||
|
this.showView = true,
|
||||||
|
this.showDanmaku = true,
|
||||||
|
this.showPubdate = false,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -179,34 +206,40 @@ class VideoContent extends StatelessWidget {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// const SizedBox(height: 4),
|
// const SizedBox(height: 4),
|
||||||
Row(
|
if (showPubdate)
|
||||||
children: [
|
Text(
|
||||||
Text(
|
Utils.dateFormat(videoItem.pubdate!),
|
||||||
videoItem.owner.name,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 11, color: Theme.of(context).colorScheme.outline),
|
||||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
),
|
||||||
color: Theme.of(context).colorScheme.outline,
|
if (showOwner)
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
videoItem.owner.name,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
StatView(
|
if (showView) ...[
|
||||||
theme: 'gray',
|
StatView(
|
||||||
view: videoItem.stat.view,
|
theme: 'gray',
|
||||||
),
|
view: videoItem.stat.view,
|
||||||
const SizedBox(width: 8),
|
),
|
||||||
StatDanMu(
|
const SizedBox(width: 8),
|
||||||
theme: 'gray',
|
],
|
||||||
danmu: videoItem.stat.danmaku,
|
if (showDanmaku)
|
||||||
),
|
StatDanMu(
|
||||||
// Text(
|
theme: 'gray',
|
||||||
// Utils.dateFormat(videoItem.pubdate!),
|
danmu: videoItem.stat.danmaku,
|
||||||
// style: TextStyle(
|
),
|
||||||
// fontSize: 11,
|
|
||||||
// color: Theme.of(context).colorScheme.outline),
|
|
||||||
// )
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
// SizedBox(
|
// SizedBox(
|
||||||
// width: 20,
|
// width: 20,
|
||||||
|
@ -333,8 +333,10 @@ class VideoStat extends StatelessWidget {
|
|||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: '${videoItem.stat.view}观看'),
|
if (videoItem.stat.view != '-')
|
||||||
TextSpan(text: ' • ${videoItem.stat.danmu}弹幕'),
|
TextSpan(text: '${videoItem.stat.view}观看'),
|
||||||
|
if (videoItem.stat.danmu != '-')
|
||||||
|
TextSpan(text: ' • ${videoItem.stat.danmu}弹幕'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -215,7 +215,7 @@ class Api {
|
|||||||
// 粉丝
|
// 粉丝
|
||||||
// vmid 用户id pn 页码 ps 每页个数,最大50 order: desc
|
// vmid 用户id pn 页码 ps 每页个数,最大50 order: desc
|
||||||
// order_type 排序规则 最近访问传空,最常访问传 attention
|
// order_type 排序规则 最近访问传空,最常访问传 attention
|
||||||
static const String fans = 'https://api.bilibili.com/x/relation/fans';
|
static const String fans = '/x/relation/fans';
|
||||||
|
|
||||||
// 直播
|
// 直播
|
||||||
// ?page=1&page_size=30&platform=web
|
// ?page=1&page_size=30&platform=web
|
||||||
@ -312,6 +312,10 @@ class Api {
|
|||||||
|
|
||||||
static const String webDanmaku = '/x/v2/dm/web/seg.so';
|
static const String webDanmaku = '/x/v2/dm/web/seg.so';
|
||||||
|
|
||||||
|
//发送视频弹幕
|
||||||
|
//https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/action.md
|
||||||
|
static const String shootDanmaku = '/x/v2/dm/post';
|
||||||
|
|
||||||
// up主分组
|
// up主分组
|
||||||
static const String followUpTag = '/x/relation/tags';
|
static const String followUpTag = '/x/relation/tags';
|
||||||
|
|
||||||
@ -405,4 +409,49 @@ class Api {
|
|||||||
/// local_id
|
/// local_id
|
||||||
static const getWebKey =
|
static const getWebKey =
|
||||||
'https://passport.bilibili.com/x/passport-login/web/key';
|
'https://passport.bilibili.com/x/passport-login/web/key';
|
||||||
|
|
||||||
|
/// cookie转access_key
|
||||||
|
static const cookieToKey =
|
||||||
|
'https://passport.bilibili.com/x/passport-tv-login/h5/qrcode/confirm';
|
||||||
|
|
||||||
|
/// 申请二维码(TV端)
|
||||||
|
static const getTVCode =
|
||||||
|
'https://passport.snm0516.aisee.tv/x/passport-tv-login/qrcode/auth_code';
|
||||||
|
|
||||||
|
///扫码登录(TV端)
|
||||||
|
static const qrcodePoll =
|
||||||
|
'https://passport.bilibili.com/x/passport-tv-login/qrcode/poll';
|
||||||
|
|
||||||
|
/// 置顶视频
|
||||||
|
static const getTopVideoApi = '/x/space/top/arc';
|
||||||
|
|
||||||
|
/// 主页 - 最近投币的视频
|
||||||
|
/// vmid
|
||||||
|
/// gaia_source = main_web
|
||||||
|
/// web_location
|
||||||
|
/// w_rid
|
||||||
|
/// wts
|
||||||
|
static const getRecentCoinVideoApi = '/x/space/coin/video';
|
||||||
|
|
||||||
|
/// 最近点赞的视频
|
||||||
|
static const getRecentLikeVideoApi = '/x/space/like/video';
|
||||||
|
|
||||||
|
/// 最近追番
|
||||||
|
static const getRecentBangumiApi = '/x/space/bangumi/follow/list';
|
||||||
|
|
||||||
|
/// 用户专栏
|
||||||
|
static const getMemberSeasonsApi = '/x/polymer/web-space/home/seasons_series';
|
||||||
|
|
||||||
|
/// 获赞数 播放数
|
||||||
|
/// mid
|
||||||
|
static const getMemberViewApi = '/x/space/upstat';
|
||||||
|
|
||||||
|
/// 查询某个专栏
|
||||||
|
/// mid
|
||||||
|
/// season_id
|
||||||
|
/// sort_reverse
|
||||||
|
/// page_num
|
||||||
|
/// page_size
|
||||||
|
static const getSeasonDetailApi =
|
||||||
|
'/x/polymer/web-space/seasons_archives_list';
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,72 @@ class DanmakaHttp {
|
|||||||
);
|
);
|
||||||
return DmSegMobileReply.fromBuffer(response.data);
|
return DmSegMobileReply.fromBuffer(response.data);
|
||||||
}
|
}
|
||||||
|
static Future shootDanmaku({
|
||||||
|
int type = 1,//弹幕类选择(1:视频弹幕 2:漫画弹幕)
|
||||||
|
required int oid,// 视频cid
|
||||||
|
required String msg,//弹幕文本(长度小于 100 字符)
|
||||||
|
int mode = 1,// 弹幕类型(1:滚动弹幕 4:底端弹幕 5:顶端弹幕 6:逆向弹幕(不能使用) 7:高级弹幕 8:代码弹幕(不能使用) 9:BAS弹幕(pool必须为2))
|
||||||
|
// String? aid,// 稿件avid
|
||||||
|
// String? bvid,// bvid与aid必须有一个
|
||||||
|
required String bvid,
|
||||||
|
int? progress,// 弹幕出现在视频内的时间(单位为毫秒,默认为0)
|
||||||
|
int? color,// 弹幕颜色(默认白色,16777215)
|
||||||
|
int? fontsize,// 弹幕字号(默认25)
|
||||||
|
int? pool,// 弹幕池选择(0:普通池 1:字幕池 2:特殊池(代码/BAS弹幕)默认普通池,0)
|
||||||
|
//int? rnd,// 当前时间戳*1000000(若无此项,则发送弹幕冷却时间限制为90s;若有此项,则发送弹幕冷却时间限制为5s)
|
||||||
|
int? colorful,//60001:专属渐变彩色(需要会员)
|
||||||
|
int? checkbox_type,//是否带 UP 身份标识(0:普通;4:带有标识)
|
||||||
|
// String? csrf,//CSRF Token(位于 Cookie) Cookie 方式必要
|
||||||
|
// String? access_key,// APP 登录 Token APP 方式必要
|
||||||
|
}) async {
|
||||||
|
// 构建参数对象
|
||||||
|
// assert(aid != null || bvid != null);
|
||||||
|
// assert(csrf != null || access_key != null);
|
||||||
|
assert(msg.length < 100);
|
||||||
|
// 构建参数对象
|
||||||
|
var params = <String, dynamic>{
|
||||||
|
'type': type,
|
||||||
|
'oid': oid,
|
||||||
|
'msg': msg,
|
||||||
|
'mode': mode,
|
||||||
|
//'aid': aid,
|
||||||
|
'bvid': bvid,
|
||||||
|
'progress': progress,
|
||||||
|
'color': color,
|
||||||
|
'fontsize': fontsize,
|
||||||
|
'pool': pool,
|
||||||
|
'rnd': DateTime.now().microsecondsSinceEpoch,
|
||||||
|
'colorful': colorful,
|
||||||
|
'checkbox_type': checkbox_type,
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
// 'access_key': access_key,
|
||||||
|
}..removeWhere((key, value) => value == null);
|
||||||
|
|
||||||
|
var response = await Request().post(
|
||||||
|
Api.shootDanmaku,
|
||||||
|
data: params,
|
||||||
|
options: Options(
|
||||||
|
contentType: Headers.formUrlEncodedContentType,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (response.statusCode != 200) {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': '弹幕发送失败,状态码:${response.statusCode}',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (response.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': response.data['data'],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': "${response.data['code']}: ${response.data['message']}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,30 +115,24 @@ class Request {
|
|||||||
idleTimeout: const Duration(milliseconds: 10000),
|
idleTimeout: const Duration(milliseconds: 10000),
|
||||||
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
|
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
|
||||||
),
|
),
|
||||||
)
|
);
|
||||||
|
|
||||||
/// 设置代理
|
/// 设置代理
|
||||||
..httpClientAdapter = IOHttpClientAdapter(
|
if (enableSystemProxy) {
|
||||||
|
dio.httpClientAdapter = IOHttpClientAdapter(
|
||||||
createHttpClient: () {
|
createHttpClient: () {
|
||||||
final client = HttpClient();
|
final client = HttpClient();
|
||||||
// Config the client.
|
// Config the client.
|
||||||
client.findProxy = (uri) {
|
client.findProxy = (uri) {
|
||||||
if (enableSystemProxy) {
|
// return 'PROXY host:port';
|
||||||
print('🌹:$systemProxyHost');
|
return 'PROXY $systemProxyHost:$systemProxyPort';
|
||||||
print('🌹:$systemProxyPort');
|
|
||||||
|
|
||||||
// return 'PROXY host:port';
|
|
||||||
return 'PROXY $systemProxyHost:$systemProxyPort';
|
|
||||||
} else {
|
|
||||||
// 不设置代理
|
|
||||||
return 'DIRECT';
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
client.badCertificateCallback =
|
client.badCertificateCallback =
|
||||||
(X509Certificate cert, String host, int port) => true;
|
(X509Certificate cert, String host, int port) => true;
|
||||||
return client;
|
return client;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//添加拦截器
|
//添加拦截器
|
||||||
dio.interceptors.add(ApiInterceptor());
|
dio.interceptors.add(ApiInterceptor());
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:pilipala/common/constants.dart';
|
||||||
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/follow/result.dart';
|
||||||
import 'package:pilipala/models/member/archive.dart';
|
import 'package:pilipala/models/member/archive.dart';
|
||||||
|
import 'package:pilipala/models/member/coin.dart';
|
||||||
import 'package:pilipala/models/member/info.dart';
|
import 'package:pilipala/models/member/info.dart';
|
||||||
|
import 'package:pilipala/models/member/seasons.dart';
|
||||||
import 'package:pilipala/models/member/tags.dart';
|
import 'package:pilipala/models/member/tags.dart';
|
||||||
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import 'package:pilipala/utils/wbi_sign.dart';
|
import 'package:pilipala/utils/wbi_sign.dart';
|
||||||
|
|
||||||
class MemberHttp {
|
class MemberHttp {
|
||||||
@ -215,4 +222,243 @@ class MemberHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取up置顶
|
||||||
|
static Future getTopVideo(String? vmid) async {
|
||||||
|
var res = await Request().get(Api.getTopVideoApi);
|
||||||
|
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'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取uo专栏
|
||||||
|
static Future getMemberSeasons(int? mid, int? pn, int? ps) async {
|
||||||
|
var res = await Request().get(Api.getMemberSeasonsApi, data: {
|
||||||
|
'mid': mid,
|
||||||
|
'page_num': pn,
|
||||||
|
'page_size': ps,
|
||||||
|
});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': MemberSeasonsDataModel.fromJson(res.data['data']['items_lists'])
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 最近投币
|
||||||
|
static Future getRecentCoinVideo({required int mid}) async {
|
||||||
|
Map params = await WbiSign().makSign({
|
||||||
|
'mid': mid,
|
||||||
|
'gaia_source': 'main_web',
|
||||||
|
'web_location': 333.999,
|
||||||
|
});
|
||||||
|
var res = await Request().get(
|
||||||
|
Api.getRecentCoinVideoApi,
|
||||||
|
data: {
|
||||||
|
'vmid': mid,
|
||||||
|
'gaia_source': 'main_web',
|
||||||
|
'web_location': 333.999,
|
||||||
|
'w_rid': params['w_rid'],
|
||||||
|
'wts': params['wts'],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': res.data['data']
|
||||||
|
.map<MemberCoinsDataModel>((e) => MemberCoinsDataModel.fromJson(e))
|
||||||
|
.toList(),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 最近点赞
|
||||||
|
static Future getRecentLikeVideo({required int mid}) async {
|
||||||
|
Map params = await WbiSign().makSign({
|
||||||
|
'mid': mid,
|
||||||
|
'gaia_source': 'main_web',
|
||||||
|
'web_location': 333.999,
|
||||||
|
});
|
||||||
|
var res = await Request().get(
|
||||||
|
Api.getRecentLikeVideoApi,
|
||||||
|
data: {
|
||||||
|
'vmid': mid,
|
||||||
|
'gaia_source': 'main_web',
|
||||||
|
'web_location': 333.999,
|
||||||
|
'w_rid': params['w_rid'],
|
||||||
|
'wts': params['wts'],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': MemberSeasonsDataModel.fromJson(res.data['data']['items_lists'])
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查看某个专栏
|
||||||
|
static Future getSeasonDetail({
|
||||||
|
required int mid,
|
||||||
|
required int seasonId,
|
||||||
|
bool sortReverse = false,
|
||||||
|
required int pn,
|
||||||
|
required int ps,
|
||||||
|
}) async {
|
||||||
|
var res = await Request().get(
|
||||||
|
Api.getSeasonDetailApi,
|
||||||
|
data: {
|
||||||
|
'mid': mid,
|
||||||
|
'season_id': seasonId,
|
||||||
|
'sort_reverse': sortReverse,
|
||||||
|
'page_num': pn,
|
||||||
|
'page_size': ps,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
try {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': MemberSeasonsList.fromJson(res.data['data'])
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
print(err);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取TV authCode
|
||||||
|
static Future getTVCode() async {
|
||||||
|
SmartDialog.showLoading();
|
||||||
|
var params = {
|
||||||
|
'appkey': Constants.appKey,
|
||||||
|
'local_id': '0',
|
||||||
|
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
|
||||||
|
};
|
||||||
|
String sign = Utils.appSign(
|
||||||
|
params,
|
||||||
|
Constants.appKey,
|
||||||
|
Constants.appSec,
|
||||||
|
);
|
||||||
|
var res = await Request()
|
||||||
|
.post(Api.getTVCode, queryParameters: {...params, 'sign': sign});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': res.data['data']['auth_code'],
|
||||||
|
'msg': '操作成功'
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取access_key
|
||||||
|
static Future cookieToKey() async {
|
||||||
|
var authCodeRes = await getTVCode();
|
||||||
|
if (authCodeRes['status']) {
|
||||||
|
var res = await Request().post(Api.cookieToKey, queryParameters: {
|
||||||
|
'auth_code': authCodeRes['data'],
|
||||||
|
'build': 708200,
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
});
|
||||||
|
await Future.delayed(const Duration(milliseconds: 300));
|
||||||
|
await qrcodePoll(authCodeRes['data']);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {'status': true, 'data': [], 'msg': '操作成功'};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future qrcodePoll(authCode) async {
|
||||||
|
var params = {
|
||||||
|
'appkey': Constants.appKey,
|
||||||
|
'auth_code': authCode.toString(),
|
||||||
|
'local_id': '0',
|
||||||
|
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
|
||||||
|
};
|
||||||
|
String sign = Utils.appSign(
|
||||||
|
params,
|
||||||
|
Constants.appKey,
|
||||||
|
Constants.appSec,
|
||||||
|
);
|
||||||
|
var res = await Request()
|
||||||
|
.post(Api.qrcodePoll, queryParameters: {...params, 'sign': sign});
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
String accessKey = res.data['data']['access_token'];
|
||||||
|
Box localCache = GStrorage.localCache;
|
||||||
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
var userInfo = userInfoCache.get('userInfoCache');
|
||||||
|
localCache.put(
|
||||||
|
LocalCacheKey.accessKey, {'mid': userInfo.mid, 'value': accessKey});
|
||||||
|
return {'status': true, 'data': [], 'msg': '操作成功'};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取up播放数、点赞数
|
||||||
|
static Future memberView({required int mid}) async {
|
||||||
|
var res = await Request().get(Api.getMemberViewApi, data: {'mid': mid});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {'status': true, 'data': res.data['data']};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ class UserHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户凭证
|
// 获取用户凭证 失效
|
||||||
static Future thirdLogin() async {
|
static Future thirdLogin() async {
|
||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
'https://passport.bilibili.com/login/app/third',
|
'https://passport.bilibili.com/login/app/third',
|
||||||
|
@ -118,7 +118,7 @@ class RcmdStat {
|
|||||||
|
|
||||||
RcmdStat.fromJson(Map<String, dynamic> json) {
|
RcmdStat.fromJson(Map<String, dynamic> json) {
|
||||||
view = json["cover_left_text_1"];
|
view = json["cover_left_text_1"];
|
||||||
danmu = json['cover_left_text_2'];
|
danmu = json['cover_left_text_2'] ?? '-';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
89
lib/models/member/coin.dart
Normal file
89
lib/models/member/coin.dart
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
class MemberCoinsDataModel {
|
||||||
|
MemberCoinsDataModel({
|
||||||
|
this.aid,
|
||||||
|
this.bvid,
|
||||||
|
this.cid,
|
||||||
|
this.coins,
|
||||||
|
this.copyright,
|
||||||
|
this.ctime,
|
||||||
|
this.desc,
|
||||||
|
this.duration,
|
||||||
|
this.owner,
|
||||||
|
this.pic,
|
||||||
|
this.pubLocation,
|
||||||
|
this.pubdate,
|
||||||
|
this.resourceType,
|
||||||
|
this.state,
|
||||||
|
this.subtitle,
|
||||||
|
this.time,
|
||||||
|
this.title,
|
||||||
|
this.tname,
|
||||||
|
this.videos,
|
||||||
|
this.view,
|
||||||
|
this.danmaku,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? aid;
|
||||||
|
String? bvid;
|
||||||
|
int? cid;
|
||||||
|
int? coins;
|
||||||
|
int? copyright;
|
||||||
|
int? ctime;
|
||||||
|
String? desc;
|
||||||
|
int? duration;
|
||||||
|
Owner? owner;
|
||||||
|
String? pic;
|
||||||
|
String? pubLocation;
|
||||||
|
int? pubdate;
|
||||||
|
String? resourceType;
|
||||||
|
int? state;
|
||||||
|
String? subtitle;
|
||||||
|
int? time;
|
||||||
|
String? title;
|
||||||
|
String? tname;
|
||||||
|
int? videos;
|
||||||
|
int? view;
|
||||||
|
int? danmaku;
|
||||||
|
|
||||||
|
MemberCoinsDataModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
aid = json['aid'];
|
||||||
|
bvid = json['bvid'];
|
||||||
|
cid = json['cid'];
|
||||||
|
coins = json['coins'];
|
||||||
|
copyright = json['copyright'];
|
||||||
|
ctime = json['ctime'];
|
||||||
|
desc = json['desc'];
|
||||||
|
duration = json['duration'];
|
||||||
|
owner = Owner.fromJson(json['owner']);
|
||||||
|
pic = json['pic'];
|
||||||
|
pubLocation = json['pub_location'];
|
||||||
|
pubdate = json['pubdate'];
|
||||||
|
resourceType = json['resource_type'];
|
||||||
|
state = json['state'];
|
||||||
|
subtitle = json['subtitle'];
|
||||||
|
time = json['time'];
|
||||||
|
title = json['title'];
|
||||||
|
tname = json['tname'];
|
||||||
|
videos = json['videos'];
|
||||||
|
view = json['stat']['view'];
|
||||||
|
danmaku = json['stat']['danmaku'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Owner {
|
||||||
|
Owner({
|
||||||
|
this.mid,
|
||||||
|
this.name,
|
||||||
|
this.face,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? mid;
|
||||||
|
String? name;
|
||||||
|
String? face;
|
||||||
|
|
||||||
|
Owner.fromJson(Map<String, dynamic> json) {
|
||||||
|
mid = json['mid'];
|
||||||
|
name = json['name'];
|
||||||
|
face = json['face'];
|
||||||
|
}
|
||||||
|
}
|
108
lib/models/member/seasons.dart
Normal file
108
lib/models/member/seasons.dart
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
class MemberSeasonsDataModel {
|
||||||
|
MemberSeasonsDataModel({
|
||||||
|
this.page,
|
||||||
|
this.seasonsList,
|
||||||
|
});
|
||||||
|
|
||||||
|
Map? page;
|
||||||
|
List<MemberSeasonsList>? seasonsList;
|
||||||
|
|
||||||
|
MemberSeasonsDataModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
page = json['page'];
|
||||||
|
seasonsList = json['seasons_list'] != null
|
||||||
|
? json['seasons_list']
|
||||||
|
.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
|
||||||
|
.toList()
|
||||||
|
: [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemberSeasonsList {
|
||||||
|
MemberSeasonsList({
|
||||||
|
this.archives,
|
||||||
|
this.meta,
|
||||||
|
this.recentAids,
|
||||||
|
this.page,
|
||||||
|
});
|
||||||
|
|
||||||
|
List<MemberArchiveItem>? archives;
|
||||||
|
MamberMeta? meta;
|
||||||
|
List? recentAids;
|
||||||
|
Map? page;
|
||||||
|
|
||||||
|
MemberSeasonsList.fromJson(Map<String, dynamic> json) {
|
||||||
|
archives = json['archives'] != null
|
||||||
|
? json['archives']
|
||||||
|
.map<MemberArchiveItem>((e) => MemberArchiveItem.fromJson(e))
|
||||||
|
.toList()
|
||||||
|
: [];
|
||||||
|
meta = MamberMeta.fromJson(json['meta']);
|
||||||
|
page = json['page'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MemberArchiveItem {
|
||||||
|
MemberArchiveItem({
|
||||||
|
this.aid,
|
||||||
|
this.bvid,
|
||||||
|
this.ctime,
|
||||||
|
this.duration,
|
||||||
|
this.pic,
|
||||||
|
this.cover,
|
||||||
|
this.pubdate,
|
||||||
|
this.view,
|
||||||
|
this.title,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? aid;
|
||||||
|
String? bvid;
|
||||||
|
int? ctime;
|
||||||
|
int? duration;
|
||||||
|
String? pic;
|
||||||
|
String? cover;
|
||||||
|
int? pubdate;
|
||||||
|
int? view;
|
||||||
|
String? title;
|
||||||
|
|
||||||
|
MemberArchiveItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
aid = json['aid'];
|
||||||
|
bvid = json['bvid'];
|
||||||
|
ctime = json['ctime'];
|
||||||
|
duration = json['duration'];
|
||||||
|
pic = json['pic'];
|
||||||
|
cover = json['pic'];
|
||||||
|
pubdate = json['pubdate'];
|
||||||
|
view = json['stat']['view'];
|
||||||
|
title = json['title'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MamberMeta {
|
||||||
|
MamberMeta({
|
||||||
|
this.cover,
|
||||||
|
this.description,
|
||||||
|
this.mid,
|
||||||
|
this.name,
|
||||||
|
this.ptime,
|
||||||
|
this.seasonId,
|
||||||
|
this.total,
|
||||||
|
});
|
||||||
|
|
||||||
|
String? cover;
|
||||||
|
String? description;
|
||||||
|
int? mid;
|
||||||
|
String? name;
|
||||||
|
int? ptime;
|
||||||
|
int? seasonId;
|
||||||
|
int? total;
|
||||||
|
|
||||||
|
MamberMeta.fromJson(Map<String, dynamic> json) {
|
||||||
|
cover = json['cover'];
|
||||||
|
description = json['description'];
|
||||||
|
mid = json['mid'];
|
||||||
|
name = json['name'];
|
||||||
|
ptime = json['ptime'];
|
||||||
|
seasonId = json['season_id'];
|
||||||
|
total = json['total'];
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,3 @@
|
|||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:pilipala/models/video/play/quality.dart';
|
import 'package:pilipala/models/video/play/quality.dart';
|
||||||
|
|
||||||
class PlayUrlModel {
|
class PlayUrlModel {
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
@ -34,11 +31,6 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Divider(
|
|
||||||
thickness: 8,
|
|
||||||
height: 10,
|
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
|
||||||
),
|
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/images/logo/logo_android_2.png',
|
'assets/images/logo/logo_android_2.png',
|
||||||
width: 150,
|
width: 150,
|
||||||
@ -83,9 +75,9 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
Divider(
|
Divider(
|
||||||
thickness: 8,
|
thickness: 1,
|
||||||
height: 30,
|
height: 30,
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
color: Theme.of(context).colorScheme.outlineVariant,
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => _aboutController.githubUrl(),
|
onTap: () => _aboutController.githubUrl(),
|
||||||
@ -134,11 +126,6 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
title: const Text('赞助'),
|
title: const Text('赞助'),
|
||||||
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
||||||
),
|
),
|
||||||
Divider(
|
|
||||||
thickness: 8,
|
|
||||||
height: 30,
|
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -5,7 +5,6 @@ import 'package:get/get.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
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/http_error.dart';
|
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.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';
|
||||||
|
@ -6,6 +6,7 @@ import 'package:flutter/rendering.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
import 'package:pilipala/pages/main/index.dart';
|
import 'package:pilipala/pages/main/index.dart';
|
||||||
import 'package:pilipala/pages/rcmd/view.dart';
|
import 'package:pilipala/pages/rcmd/view.dart';
|
||||||
|
|
||||||
@ -35,6 +36,8 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
scrollController = _bangumidController.scrollController;
|
scrollController = _bangumidController.scrollController;
|
||||||
StreamController<bool> mainStream =
|
StreamController<bool> mainStream =
|
||||||
Get.find<MainController>().bottomBarStream;
|
Get.find<MainController>().bottomBarStream;
|
||||||
|
StreamController<bool> searchBarStream =
|
||||||
|
Get.find<HomeController>().searchBarStream;
|
||||||
_futureBuilderFuture = _bangumidController.queryBangumiListFeed();
|
_futureBuilderFuture = _bangumidController.queryBangumiListFeed();
|
||||||
_futureBuilderFutureFollow = _bangumidController.queryBangumiFollow();
|
_futureBuilderFutureFollow = _bangumidController.queryBangumiFollow();
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
@ -51,8 +54,10 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
scrollController.position.userScrollDirection;
|
scrollController.position.userScrollDirection;
|
||||||
if (direction == ScrollDirection.forward) {
|
if (direction == ScrollDirection.forward) {
|
||||||
mainStream.add(true);
|
mainStream.add(true);
|
||||||
|
searchBarStream.add(true);
|
||||||
} else if (direction == ScrollDirection.reverse) {
|
} else if (direction == ScrollDirection.reverse) {
|
||||||
mainStream.add(false);
|
mainStream.add(false);
|
||||||
|
searchBarStream.add(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -95,8 +95,12 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
// 根据position判断是否有已缓存弹幕。没有则请求对应段
|
// 根据position判断是否有已缓存弹幕。没有则请求对应段
|
||||||
int segIndex = (currentPosition / (6 * 60 * 1000)).ceil();
|
int segIndex = (currentPosition / (6 * 60 * 1000)).ceil();
|
||||||
segIndex = segIndex < 1 ? 1 : segIndex;
|
segIndex = segIndex < 1 ? 1 : segIndex;
|
||||||
if (ctr.dmSegList[segIndex - 1].elems.isEmpty &&
|
print('🌹🌹: ${segIndex}');
|
||||||
!ctr.hasrequestSeg.contains(segIndex - 1)) {
|
print('🌹🌹: ${ctr.dmSegList.length}');
|
||||||
|
print('🌹🌹: ${ctr.hasrequestSeg.contains(segIndex - 1)}');
|
||||||
|
if (segIndex - 1 >= ctr.dmSegList.length ||
|
||||||
|
(ctr.dmSegList[segIndex - 1].elems.isEmpty &&
|
||||||
|
!ctr.hasrequestSeg.contains(segIndex - 1))) {
|
||||||
ctr.hasrequestSeg.add(segIndex - 1);
|
ctr.hasrequestSeg.add(segIndex - 1);
|
||||||
ctr.currentSegIndex = segIndex;
|
ctr.currentSegIndex = segIndex;
|
||||||
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
|
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
|
||||||
|
@ -231,6 +231,15 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: Container(
|
||||||
|
height: 6,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onInverseSurface
|
||||||
|
.withOpacity(0.5),
|
||||||
|
),
|
||||||
|
),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
@ -1,8 +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/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
|
||||||
import 'package:pilipala/pages/preview/index.dart';
|
|
||||||
|
|
||||||
// 富文本
|
// 富文本
|
||||||
InlineSpan richNode(item, context) {
|
InlineSpan richNode(item, context) {
|
||||||
@ -11,13 +9,11 @@ InlineSpan richNode(item, context) {
|
|||||||
TextStyle authorStyle =
|
TextStyle authorStyle =
|
||||||
TextStyle(color: Theme.of(context).colorScheme.primary);
|
TextStyle(color: Theme.of(context).colorScheme.primary);
|
||||||
List<InlineSpan> spanChilds = [];
|
List<InlineSpan> spanChilds = [];
|
||||||
String contentType = 'desc';
|
|
||||||
|
|
||||||
dynamic richTextNodes;
|
dynamic richTextNodes;
|
||||||
if (item.modules.moduleDynamic.desc != null) {
|
if (item.modules.moduleDynamic.desc != null) {
|
||||||
richTextNodes = item.modules.moduleDynamic.desc.richTextNodes;
|
richTextNodes = item.modules.moduleDynamic.desc.richTextNodes;
|
||||||
} else if (item.modules.moduleDynamic.major != null) {
|
} else if (item.modules.moduleDynamic.major != null) {
|
||||||
contentType = 'major';
|
|
||||||
// 动态页面 richTextNodes 层级可能与主页动态层级不同
|
// 动态页面 richTextNodes 层级可能与主页动态层级不同
|
||||||
richTextNodes =
|
richTextNodes =
|
||||||
item.modules.moduleDynamic.major.opus.summary.richTextNodes;
|
item.modules.moduleDynamic.major.opus.summary.richTextNodes;
|
||||||
|
@ -56,67 +56,73 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
floating: true,
|
floating: true,
|
||||||
pinned: false,
|
pinned: false,
|
||||||
delegate: _SliverHeaderDelegate(
|
delegate: _SliverHeaderDelegate(
|
||||||
height: 90,
|
height: 124,
|
||||||
child: Container(
|
child: Column(
|
||||||
height: 90,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
color: Theme.of(context).colorScheme.background,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
Container(
|
||||||
Expanded(
|
color: Theme.of(context).colorScheme.background,
|
||||||
child: ListView(
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||||
scrollDirection: Axis.horizontal,
|
child: Row(
|
||||||
controller: scrollController,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
const SizedBox(width: 10),
|
children: [
|
||||||
if (liveList.isNotEmpty) ...[
|
const Text('最新关注'),
|
||||||
for (int i = 0; i < liveList.length; i++) ...[
|
GestureDetector(
|
||||||
upItemBuild(liveList[i], i)
|
onTap: () {
|
||||||
],
|
feedBack();
|
||||||
VerticalDivider(
|
Get.toNamed('/follow?mid=${userInfo.mid}');
|
||||||
indent: 20,
|
},
|
||||||
endIndent: 40,
|
child: Container(
|
||||||
width: 26,
|
padding: const EdgeInsets.only(top: 5, bottom: 5),
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary
|
|
||||||
.withOpacity(0.5),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
for (int i = 0; i < upList.length; i++) ...[
|
|
||||||
upItemBuild(upList[i], i)
|
|
||||||
],
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Material(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () => {
|
|
||||||
feedBack(),
|
|
||||||
Get.toNamed('/follow?mid=${userInfo.mid}')
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
height: 100,
|
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.secondaryContainer
|
|
||||||
.withOpacity(0.3),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
child: Text(
|
||||||
'全部',
|
'查看全部',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).colorScheme.outline),
|
||||||
.colorScheme
|
|
||||||
.onSecondaryContainer),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
)),
|
Container(
|
||||||
),
|
height: 90,
|
||||||
|
color: Theme.of(context).colorScheme.background,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
controller: scrollController,
|
||||||
|
children: [
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
if (liveList.isNotEmpty) ...[
|
||||||
|
for (int i = 0; i < liveList.length; i++) ...[
|
||||||
|
upItemBuild(liveList[i], i)
|
||||||
|
],
|
||||||
|
VerticalDivider(
|
||||||
|
indent: 20,
|
||||||
|
endIndent: 40,
|
||||||
|
width: 26,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary
|
||||||
|
.withOpacity(0.5),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
for (int i = 0; i < upList.length; i++) ...[
|
||||||
|
upItemBuild(upList[i], i)
|
||||||
|
],
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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: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/models/follow/result.dart';
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import 'dart:math';
|
|
||||||
|
|
||||||
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:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
@ -11,7 +11,6 @@ import 'package:pilipala/models/bangumi/info.dart';
|
|||||||
import 'package:pilipala/models/common/business_type.dart';
|
import 'package:pilipala/models/common/business_type.dart';
|
||||||
import 'package:pilipala/models/common/search_type.dart';
|
import 'package:pilipala/models/common/search_type.dart';
|
||||||
import 'package:pilipala/models/live/item.dart';
|
import 'package:pilipala/models/live/item.dart';
|
||||||
import 'package:pilipala/pages/history/index.dart';
|
|
||||||
import 'package:pilipala/pages/history_search/index.dart';
|
import 'package:pilipala/pages/history_search/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/id_utils.dart';
|
||||||
|
@ -131,7 +131,6 @@ class _HistorySearchPageState extends State<HistorySearchPage> {
|
|||||||
onChoose: null,
|
onChoose: null,
|
||||||
onUpdateMultiple: () => null,
|
onUpdateMultiple: () => null,
|
||||||
);
|
);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
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';
|
||||||
@ -15,6 +17,10 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
RxBool userLogin = false.obs;
|
RxBool userLogin = false.obs;
|
||||||
RxString userFace = ''.obs;
|
RxString userFace = ''.obs;
|
||||||
var userInfo;
|
var userInfo;
|
||||||
|
Box setting = GStrorage.setting;
|
||||||
|
late final StreamController<bool> searchBarStream =
|
||||||
|
StreamController<bool>.broadcast();
|
||||||
|
late bool hideSearchBar;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -33,6 +39,8 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
length: tabs.length,
|
length: tabs.length,
|
||||||
vsync: this,
|
vsync: this,
|
||||||
);
|
);
|
||||||
|
hideSearchBar =
|
||||||
|
setting.get(SettingBoxKey.hideSearchBar, defaultValue: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onRefresh() {
|
void onRefresh() {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
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/pages/main/index.dart';
|
|
||||||
import 'package:pilipala/pages/mine/index.dart';
|
import 'package:pilipala/pages/mine/index.dart';
|
||||||
import 'package:pilipala/pages/search/index.dart';
|
import 'package:pilipala/pages/search/index.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
@ -18,11 +19,17 @@ class _HomePageState extends State<HomePage>
|
|||||||
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
|
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
|
||||||
final HomeController _homeController = Get.put(HomeController());
|
final HomeController _homeController = Get.put(HomeController());
|
||||||
List videoList = [];
|
List videoList = [];
|
||||||
Stream<bool> stream = Get.find<MainController>().bottomBarStream.stream;
|
late Stream<bool> stream;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
stream = _homeController.searchBarStream.stream;
|
||||||
|
}
|
||||||
|
|
||||||
showUserBottonSheet() {
|
showUserBottonSheet() {
|
||||||
feedBack();
|
feedBack();
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
@ -46,7 +53,9 @@ class _HomePageState extends State<HomePage>
|
|||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
CustomAppBar(
|
CustomAppBar(
|
||||||
stream: stream,
|
stream: _homeController.hideSearchBar
|
||||||
|
? stream
|
||||||
|
: StreamController<bool>.broadcast().stream,
|
||||||
ctr: _homeController,
|
ctr: _homeController,
|
||||||
callback: showUserBottonSheet,
|
callback: showUserBottonSheet,
|
||||||
),
|
),
|
||||||
@ -65,6 +74,7 @@ class _HomePageState extends State<HomePage>
|
|||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
enableFeedback: true,
|
enableFeedback: true,
|
||||||
splashBorderRadius: BorderRadius.circular(10),
|
splashBorderRadius: BorderRadius.circular(10),
|
||||||
|
tabAlignment: TabAlignment.center,
|
||||||
onTap: (value) {
|
onTap: (value) {
|
||||||
feedBack();
|
feedBack();
|
||||||
if (_homeController.initialIndex == value) {
|
if (_homeController.initialIndex == value) {
|
||||||
@ -118,7 +128,7 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
duration: const Duration(milliseconds: 500),
|
duration: const Duration(milliseconds: 500),
|
||||||
height: snapshot.data
|
height: snapshot.data
|
||||||
? MediaQuery.of(context).padding.top + 52
|
? MediaQuery.of(context).padding.top + 52
|
||||||
: MediaQuery.of(context).padding.top,
|
: MediaQuery.of(context).padding.top - 10,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: 20,
|
left: 20,
|
||||||
|
@ -9,6 +9,7 @@ import 'package:pilipala/common/widgets/overlay_pop.dart';
|
|||||||
import 'package:pilipala/common/skeleton/video_card_h.dart';
|
import 'package:pilipala/common/skeleton/video_card_h.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/common/widgets/video_card_h.dart';
|
import 'package:pilipala/common/widgets/video_card_h.dart';
|
||||||
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
import 'package:pilipala/pages/hot/controller.dart';
|
import 'package:pilipala/pages/hot/controller.dart';
|
||||||
import 'package:pilipala/pages/main/index.dart';
|
import 'package:pilipala/pages/main/index.dart';
|
||||||
|
|
||||||
@ -35,6 +36,8 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
|||||||
scrollController = _hotController.scrollController;
|
scrollController = _hotController.scrollController;
|
||||||
StreamController<bool> mainStream =
|
StreamController<bool> mainStream =
|
||||||
Get.find<MainController>().bottomBarStream;
|
Get.find<MainController>().bottomBarStream;
|
||||||
|
StreamController<bool> searchBarStream =
|
||||||
|
Get.find<HomeController>().searchBarStream;
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
@ -49,8 +52,10 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
|||||||
scrollController.position.userScrollDirection;
|
scrollController.position.userScrollDirection;
|
||||||
if (direction == ScrollDirection.forward) {
|
if (direction == ScrollDirection.forward) {
|
||||||
mainStream.add(true);
|
mainStream.add(true);
|
||||||
|
searchBarStream.add(true);
|
||||||
} else if (direction == ScrollDirection.reverse) {
|
} else if (direction == ScrollDirection.reverse) {
|
||||||
mainStream.add(false);
|
mainStream.add(false);
|
||||||
|
searchBarStream.add(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -9,7 +9,6 @@ import 'package:pilipala/common/widgets/html_render.dart';
|
|||||||
import 'package:pilipala/common/widgets/http_error.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/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/reply/widgets/reply_item.dart';
|
||||||
import 'package:pilipala/pages/video/detail/replyNew/index.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';
|
||||||
|
@ -9,6 +9,7 @@ import 'package:pilipala/common/skeleton/video_card_v.dart';
|
|||||||
import 'package:pilipala/common/widgets/animated_dialog.dart';
|
import 'package:pilipala/common/widgets/animated_dialog.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/common/widgets/overlay_pop.dart';
|
import 'package:pilipala/common/widgets/overlay_pop.dart';
|
||||||
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
import 'package:pilipala/pages/main/index.dart';
|
import 'package:pilipala/pages/main/index.dart';
|
||||||
import 'package:pilipala/pages/rcmd/index.dart';
|
import 'package:pilipala/pages/rcmd/index.dart';
|
||||||
|
|
||||||
@ -38,6 +39,8 @@ class _LivePageState extends State<LivePage>
|
|||||||
scrollController = _liveController.scrollController;
|
scrollController = _liveController.scrollController;
|
||||||
StreamController<bool> mainStream =
|
StreamController<bool> mainStream =
|
||||||
Get.find<MainController>().bottomBarStream;
|
Get.find<MainController>().bottomBarStream;
|
||||||
|
StreamController<bool> searchBarStream =
|
||||||
|
Get.find<HomeController>().searchBarStream;
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
@ -52,8 +55,10 @@ class _LivePageState extends State<LivePage>
|
|||||||
scrollController.position.userScrollDirection;
|
scrollController.position.userScrollDirection;
|
||||||
if (direction == ScrollDirection.forward) {
|
if (direction == ScrollDirection.forward) {
|
||||||
mainStream.add(true);
|
mainStream.add(true);
|
||||||
|
searchBarStream.add(true);
|
||||||
} else if (direction == ScrollDirection.reverse) {
|
} else if (direction == ScrollDirection.reverse) {
|
||||||
mainStream.add(false);
|
mainStream.add(false);
|
||||||
|
searchBarStream.add(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -67,6 +72,7 @@ class _LivePageState extends State<LivePage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
super.build(context);
|
||||||
return Container(
|
return Container(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
margin: const EdgeInsets.only(
|
margin: const EdgeInsets.only(
|
||||||
|
@ -52,7 +52,6 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final videoHeight = MediaQuery.of(context).size.width * 9 / 16;
|
|
||||||
Widget childWhenDisabled = Scaffold(
|
Widget childWhenDisabled = Scaffold(
|
||||||
primary: true,
|
primary: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
@ -3,7 +3,6 @@ import 'dart:io';
|
|||||||
import 'package:floating/floating.dart';
|
import 'package:floating/floating.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/video/play/url.dart';
|
import 'package:pilipala/models/video/play/url.dart';
|
||||||
import 'package:pilipala/pages/liveRoom/index.dart';
|
import 'package:pilipala/pages/liveRoom/index.dart';
|
||||||
@ -43,10 +42,6 @@ class _BottomControlState extends State<BottomControl> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
const textStyle = TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 12,
|
|
||||||
);
|
|
||||||
return AppBar(
|
return AppBar(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
|
@ -55,6 +55,7 @@ class MainController extends GetxController {
|
|||||||
StreamController<bool>.broadcast();
|
StreamController<bool>.broadcast();
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
DateTime? _lastPressedAt;
|
DateTime? _lastPressedAt;
|
||||||
|
late bool hideTabBar;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -62,6 +63,7 @@ class MainController extends GetxController {
|
|||||||
if (setting.get(SettingBoxKey.autoUpdate, defaultValue: false)) {
|
if (setting.get(SettingBoxKey.autoUpdate, defaultValue: false)) {
|
||||||
Utils.checkUpdata();
|
Utils.checkUpdata();
|
||||||
}
|
}
|
||||||
|
hideTabBar = setting.get(SettingBoxKey.hideTabBar, defaultValue: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> onBackPressed(BuildContext context) {
|
Future<bool> onBackPressed(BuildContext context) {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
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';
|
||||||
@ -113,8 +115,8 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
MediaQuery.of(context).size.width * 9 / 16;
|
MediaQuery.of(context).size.width * 9 / 16;
|
||||||
localCache.put('sheetHeight', sheetHeight);
|
localCache.put('sheetHeight', sheetHeight);
|
||||||
localCache.put('statusBarHeight', statusBarHeight);
|
localCache.put('statusBarHeight', statusBarHeight);
|
||||||
return WillPopScope(
|
return PopScope(
|
||||||
onWillPop: () => _mainController.onBackPressed(context),
|
onPopInvoked: (bool status) => _mainController.onBackPressed(context),
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
body: FadeTransition(
|
body: FadeTransition(
|
||||||
@ -142,7 +144,9 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: StreamBuilder(
|
bottomNavigationBar: StreamBuilder(
|
||||||
stream: _mainController.bottomBarStream.stream,
|
stream: _mainController.hideTabBar
|
||||||
|
? _mainController.bottomBarStream.stream
|
||||||
|
: StreamController<bool>.broadcast().stream,
|
||||||
initialData: true,
|
initialData: true,
|
||||||
builder: (context, AsyncSnapshot snapshot) {
|
builder: (context, AsyncSnapshot snapshot) {
|
||||||
return AnimatedSlide(
|
return AnimatedSlide(
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
library archive_panel;
|
|
||||||
|
|
||||||
export './controller.dart';
|
|
||||||
export 'index.dart';
|
|
@ -1,240 +0,0 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:loading_more_list/loading_more_list.dart';
|
|
||||||
import 'package:pilipala/common/widgets/video_card_h.dart';
|
|
||||||
import 'package:pilipala/models/member/archive.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';
|
|
||||||
|
|
||||||
class ArchivePanel extends StatefulWidget {
|
|
||||||
final int? mid;
|
|
||||||
const ArchivePanel({super.key, this.mid});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<ArchivePanel> createState() => _ArchivePanelState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ArchivePanelState extends State<ArchivePanel>
|
|
||||||
with AutomaticKeepAliveClientMixin {
|
|
||||||
DateTime lastRefreshTime = DateTime.now();
|
|
||||||
late final LoadMoreListSource source;
|
|
||||||
late final ArchiveController _archiveController;
|
|
||||||
|
|
||||||
@override
|
|
||||||
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
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
super.build(context);
|
|
||||||
return PullToRefreshNotification(
|
|
||||||
onRefresh: () async {
|
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
maxDragOffset: 50,
|
|
||||||
child: GlowNotificationWidget(
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
// 下拉刷新指示器
|
|
||||||
// PullToRefreshContainer(
|
|
||||||
// (PullToRefreshScrollNotificationInfo? info) {
|
|
||||||
// return PullToRefreshHeader(info, lastRefreshTime);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.only(left: 14, top: 8, bottom: 8, right: 8),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
const Text('排序方式'),
|
|
||||||
SizedBox(
|
|
||||||
height: 35,
|
|
||||||
width: 85,
|
|
||||||
child: TextButton(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
// _archiveController.order = 'click';
|
|
||||||
// _archiveController.pn = 1;
|
|
||||||
_archiveController.toggleSort();
|
|
||||||
source.refresh(true);
|
|
||||||
// LoadMoreListSource().loadData();
|
|
||||||
},
|
|
||||||
child: Obx(
|
|
||||||
() => AnimatedSwitcher(
|
|
||||||
duration: const Duration(milliseconds: 400),
|
|
||||||
transitionBuilder:
|
|
||||||
(Widget child, Animation<double> animation) {
|
|
||||||
return ScaleTransition(
|
|
||||||
scale: animation, child: child);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
_archiveController.currentOrder['label']!,
|
|
||||||
key: ValueKey<String>(
|
|
||||||
_archiveController.currentOrder['label']!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: LoadingMoreList<VListItemModel>(
|
|
||||||
ListConfig<VListItemModel>(
|
|
||||||
sourceList: source,
|
|
||||||
itemBuilder:
|
|
||||||
(BuildContext c, VListItemModel item, int index) {
|
|
||||||
if (index == 0) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
VideoCardH(videoItem: item)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return VideoCardH(videoItem: item);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
indicatorBuilder: _buildIndicator,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
showGlowLeading: false,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildIndicator(BuildContext context, IndicatorStatus status) {
|
|
||||||
TextStyle style =
|
|
||||||
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
|
|
||||||
Widget? widget;
|
|
||||||
switch (status) {
|
|
||||||
case IndicatorStatus.none:
|
|
||||||
widget = Container(height: 0.0);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.loadingMoreBusying:
|
|
||||||
widget = Text('加载中...', style: style);
|
|
||||||
widget = _setbackground(false, widget, height: 60.0);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.fullScreenBusying:
|
|
||||||
widget = Text('加载中...', style: style);
|
|
||||||
widget = _setbackground(true, widget);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.error:
|
|
||||||
|
|
||||||
/// TODO 异常逻辑
|
|
||||||
widget = Text('没有更多了', style: style);
|
|
||||||
widget = _setbackground(false, widget);
|
|
||||||
|
|
||||||
widget = GestureDetector(
|
|
||||||
onTap: () {},
|
|
||||||
child: widget,
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.fullScreenError:
|
|
||||||
|
|
||||||
/// TODO 异常逻辑
|
|
||||||
widget = Text('没有更多了', style: style);
|
|
||||||
widget = _setbackground(true, widget);
|
|
||||||
widget = GestureDetector(
|
|
||||||
onTap: () {},
|
|
||||||
child: widget,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.noMoreLoad:
|
|
||||||
widget = Text('没有更多了', style: style);
|
|
||||||
widget = _setbackground(false, widget, height: 60.0);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.empty:
|
|
||||||
widget = Text('用户没有投稿', style: style);
|
|
||||||
widget = _setbackground(true, widget);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _setbackground(bool full, Widget widget, {double height = 100}) {
|
|
||||||
widget = Padding(
|
|
||||||
padding: height == double.infinity
|
|
||||||
? EdgeInsets.zero
|
|
||||||
: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
|
||||||
child: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: height,
|
|
||||||
color: Theme.of(context).colorScheme.background,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: widget,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget getIndicator(BuildContext context) {
|
|
||||||
final TargetPlatform platform = Theme.of(context).platform;
|
|
||||||
return platform == TargetPlatform.iOS
|
|
||||||
? const CupertinoActivityIndicator(
|
|
||||||
animating: true,
|
|
||||||
radius: 16.0,
|
|
||||||
)
|
|
||||||
: CircularProgressIndicator(
|
|
||||||
strokeWidth: 2.0,
|
|
||||||
valueColor:
|
|
||||||
AlwaysStoppedAnimation<Color>(Theme.of(context).primaryColor),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LoadMoreListSource extends LoadingMoreBase<VListItemModel> {
|
|
||||||
late ArchiveController ctr;
|
|
||||||
LoadMoreListSource(this.ctr);
|
|
||||||
bool forceRefresh = false;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> loadData([bool isloadMoreAction = false]) async {
|
|
||||||
bool isSuccess = false;
|
|
||||||
var res = await ctr.getMemberArchive();
|
|
||||||
if (res['status']) {
|
|
||||||
if (ctr.pn == 2) {
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
addAll(res['data'].list.vlist);
|
|
||||||
}
|
|
||||||
if (length < res['data'].page['count']) {
|
|
||||||
isSuccess = true;
|
|
||||||
} else {
|
|
||||||
isSuccess = false;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,6 +6,7 @@ import 'package:pilipala/http/member.dart';
|
|||||||
import 'package:pilipala/http/user.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/coin.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';
|
import 'package:share_plus/share_plus.dart';
|
||||||
@ -13,16 +14,17 @@ 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;
|
late Map userStat;
|
||||||
RxString face = ''.obs;
|
RxString face = ''.obs;
|
||||||
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;
|
dynamic userInfo;
|
||||||
RxInt attribute = (-1).obs;
|
RxInt attribute = (-1).obs;
|
||||||
RxString attributeText = '关注'.obs;
|
RxString attributeText = '关注'.obs;
|
||||||
|
RxList<MemberCoinsDataModel> recentCoinsList = <MemberCoinsDataModel>[].obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -38,6 +40,7 @@ class MemberController extends GetxController {
|
|||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
Future<Map<String, dynamic>> getInfo() async {
|
Future<Map<String, dynamic>> getInfo() async {
|
||||||
await getMemberStat();
|
await getMemberStat();
|
||||||
|
await getMemberView();
|
||||||
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'];
|
||||||
@ -55,13 +58,14 @@ class MemberController extends GetxController {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future getMemberCardInfo() async {
|
// 获取用户播放数 获赞数
|
||||||
// var res = await MemberHttp.memberCardInfo(mid: mid);
|
Future<Map<String, dynamic>> getMemberView() async {
|
||||||
// if (res['status']) {
|
var res = await MemberHttp.memberView(mid: mid);
|
||||||
// print(userStat);
|
if (res['status']) {
|
||||||
// }
|
userStat.addAll(res['data']);
|
||||||
// return res;
|
}
|
||||||
// }
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
// 关注/取关up
|
// 关注/取关up
|
||||||
Future actionRelationMod() async {
|
Future actionRelationMod() async {
|
||||||
@ -173,4 +177,35 @@ class MemberController extends GetxController {
|
|||||||
void shareUser() {
|
void shareUser() {
|
||||||
Share.share('${memberInfo.value.name} - https://space.bilibili.com/$mid');
|
Share.share('${memberInfo.value.name} - https://space.bilibili.com/$mid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 请求专栏
|
||||||
|
Future getMemberSeasons() async {
|
||||||
|
if (userInfo == null) return;
|
||||||
|
var res = await MemberHttp.getMemberSeasons(mid, 1, 10);
|
||||||
|
if (!res['status']) {
|
||||||
|
SmartDialog.showToast("用户专栏请求异常:${res['msg']}");
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 请求投币视频
|
||||||
|
Future getRecentCoinVideo() async {
|
||||||
|
if (userInfo == null) return;
|
||||||
|
var res = await MemberHttp.getRecentCoinVideo(mid: mid);
|
||||||
|
recentCoinsList.value = res['data'];
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 跳转查看动态
|
||||||
|
void pushDynamicsPage() => Get.toNamed('/memberDynamics?mid=$mid');
|
||||||
|
|
||||||
|
// 跳转查看投稿
|
||||||
|
void pushArchivesPage() => Get.toNamed('/memberArchive?mid=$mid');
|
||||||
|
|
||||||
|
// 跳转查看专栏
|
||||||
|
void pushSeasonsPage() {}
|
||||||
|
// 跳转查看最近投币
|
||||||
|
void pushRecentCoinsPage() async {
|
||||||
|
if (recentCoinsList.isNotEmpty) {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:pilipala/http/member.dart';
|
|
||||||
|
|
||||||
class MemberDynamicPanelController extends GetxController {
|
|
||||||
MemberDynamicPanelController(this.mid);
|
|
||||||
int? mid;
|
|
||||||
String offset = '';
|
|
||||||
int count = 0;
|
|
||||||
bool hasMore = true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
mid ??= int.parse(Get.parameters['mid']!);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future getMemberDynamic() async {
|
|
||||||
if (!hasMore) {
|
|
||||||
return {'status': false};
|
|
||||||
}
|
|
||||||
var res = await MemberHttp.memberDynamic(
|
|
||||||
offset: offset,
|
|
||||||
mid: mid,
|
|
||||||
);
|
|
||||||
if (res['status']) {
|
|
||||||
offset = res['data'].offset;
|
|
||||||
hasMore = res['data'].hasMore;
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,152 +0,0 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:loading_more_list/loading_more_list.dart';
|
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
|
||||||
import 'package:pilipala/pages/dynamics/widgets/dynamic_panel.dart';
|
|
||||||
import 'package:pilipala/utils/utils.dart';
|
|
||||||
|
|
||||||
import 'controller.dart';
|
|
||||||
|
|
||||||
class MemberDynamicPanel extends StatefulWidget {
|
|
||||||
final int? mid;
|
|
||||||
const MemberDynamicPanel({super.key, this.mid});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MemberDynamicPanel> createState() => _MemberDynamicPanelState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MemberDynamicPanelState extends State<MemberDynamicPanel>
|
|
||||||
with AutomaticKeepAliveClientMixin {
|
|
||||||
DateTime lastRefreshTime = DateTime.now();
|
|
||||||
late final LoadMoreListSource source;
|
|
||||||
late final MemberDynamicPanelController _dynamicController;
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool get wantKeepAlive => true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_dynamicController = Get.put(MemberDynamicPanelController(widget.mid),
|
|
||||||
tag: Utils.makeHeroTag(widget.mid));
|
|
||||||
source = LoadMoreListSource(_dynamicController);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
super.build(context);
|
|
||||||
return LoadingMoreList<DynamicItemModel>(
|
|
||||||
ListConfig<DynamicItemModel>(
|
|
||||||
sourceList: source,
|
|
||||||
itemBuilder: (BuildContext c, DynamicItemModel item, int index) {
|
|
||||||
return DynamicPanel(item: item);
|
|
||||||
},
|
|
||||||
indicatorBuilder: _buildIndicator,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildIndicator(BuildContext context, IndicatorStatus status) {
|
|
||||||
TextStyle style =
|
|
||||||
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
|
|
||||||
Widget? widget;
|
|
||||||
switch (status) {
|
|
||||||
case IndicatorStatus.none:
|
|
||||||
widget = Container(height: 0.0);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.loadingMoreBusying:
|
|
||||||
widget = Text('加载中...', style: style);
|
|
||||||
widget = _setbackground(false, widget, height: 60.0);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.fullScreenBusying:
|
|
||||||
widget = Text('加载中...', style: style);
|
|
||||||
widget = _setbackground(true, widget);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.error:
|
|
||||||
|
|
||||||
/// TODO 异常逻辑
|
|
||||||
widget = Text('没有更多了', style: style);
|
|
||||||
widget = _setbackground(false, widget);
|
|
||||||
|
|
||||||
widget = GestureDetector(
|
|
||||||
onTap: () {},
|
|
||||||
child: widget,
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.fullScreenError:
|
|
||||||
|
|
||||||
/// TODO 异常逻辑
|
|
||||||
widget = Text('没有更多了', style: style);
|
|
||||||
widget = _setbackground(true, widget);
|
|
||||||
widget = GestureDetector(
|
|
||||||
onTap: () {},
|
|
||||||
child: widget,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.noMoreLoad:
|
|
||||||
widget = Text('没有更多了', style: style);
|
|
||||||
widget = _setbackground(false, widget, height: 60.0);
|
|
||||||
break;
|
|
||||||
case IndicatorStatus.empty:
|
|
||||||
widget = Text('用户没有投稿', style: style);
|
|
||||||
widget = _setbackground(true, widget);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _setbackground(bool full, Widget widget, {double height = 100}) {
|
|
||||||
widget = Padding(
|
|
||||||
padding: height == double.infinity
|
|
||||||
? EdgeInsets.zero
|
|
||||||
: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
|
||||||
child: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: height,
|
|
||||||
color: Theme.of(context).colorScheme.background,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: widget,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget getIndicator(BuildContext context) {
|
|
||||||
final TargetPlatform platform = Theme.of(context).platform;
|
|
||||||
return platform == TargetPlatform.iOS
|
|
||||||
? const CupertinoActivityIndicator(
|
|
||||||
animating: true,
|
|
||||||
radius: 16.0,
|
|
||||||
)
|
|
||||||
: CircularProgressIndicator(
|
|
||||||
strokeWidth: 2.0,
|
|
||||||
valueColor:
|
|
||||||
AlwaysStoppedAnimation<Color>(Theme.of(context).primaryColor),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LoadMoreListSource extends LoadingMoreBase<DynamicItemModel> {
|
|
||||||
late MemberDynamicPanelController ctr;
|
|
||||||
LoadMoreListSource(this.ctr);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> loadData([bool isloadMoreAction = false]) async {
|
|
||||||
bool isSuccess = false;
|
|
||||||
var res = await ctr.getMemberDynamic();
|
|
||||||
if (res['status']) {
|
|
||||||
addAll(res['data'].items);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (res['data'].hasMore) {
|
|
||||||
isSuccess = true;
|
|
||||||
} else {
|
|
||||||
isSuccess = false;
|
|
||||||
}
|
|
||||||
} catch (_) {}
|
|
||||||
|
|
||||||
return isSuccess;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +1,16 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/pages/member/archive/view.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 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
|
import 'widgets/conis.dart';
|
||||||
import 'widgets/profile.dart';
|
import 'widgets/profile.dart';
|
||||||
|
import 'widgets/seasons.dart';
|
||||||
|
|
||||||
class MemberPage extends StatefulWidget {
|
class MemberPage extends StatefulWidget {
|
||||||
const MemberPage({super.key});
|
const MemberPage({super.key});
|
||||||
@ -23,9 +23,10 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late String heroTag;
|
late String heroTag;
|
||||||
late MemberController _memberController;
|
late MemberController _memberController;
|
||||||
Future? _futureBuilderFuture;
|
late Future _futureBuilderFuture;
|
||||||
|
late Future _memberSeasonsFuture;
|
||||||
|
late Future _memberCoinsFuture;
|
||||||
final ScrollController _extendNestCtr = ScrollController();
|
final ScrollController _extendNestCtr = ScrollController();
|
||||||
late TabController _tabController;
|
|
||||||
final StreamController<bool> appbarStream = StreamController<bool>();
|
final StreamController<bool> appbarStream = StreamController<bool>();
|
||||||
late int mid;
|
late int mid;
|
||||||
|
|
||||||
@ -35,12 +36,13 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
mid = int.parse(Get.parameters['mid']!);
|
mid = int.parse(Get.parameters['mid']!);
|
||||||
heroTag = Get.arguments['heroTag'] ?? Utils.makeHeroTag(mid);
|
heroTag = Get.arguments['heroTag'] ?? Utils.makeHeroTag(mid);
|
||||||
_memberController = Get.put(MemberController(), tag: heroTag);
|
_memberController = Get.put(MemberController(), tag: heroTag);
|
||||||
_tabController = TabController(length: 3, vsync: this, initialIndex: 2);
|
|
||||||
_futureBuilderFuture = _memberController.getInfo();
|
_futureBuilderFuture = _memberController.getInfo();
|
||||||
|
_memberSeasonsFuture = _memberController.getMemberSeasons();
|
||||||
|
_memberCoinsFuture = _memberController.getRecentCoinVideo();
|
||||||
_extendNestCtr.addListener(
|
_extendNestCtr.addListener(
|
||||||
() {
|
() {
|
||||||
double offset = _extendNestCtr.position.pixels;
|
double offset = _extendNestCtr.position.pixels;
|
||||||
if (offset > 230) {
|
if (offset > 100) {
|
||||||
appbarStream.add(true);
|
appbarStream.add(true);
|
||||||
} else {
|
} else {
|
||||||
appbarStream.add(false);
|
appbarStream.add(false);
|
||||||
@ -59,183 +61,222 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
primary: true,
|
primary: true,
|
||||||
body: ExtendedNestedScrollView(
|
body: Column(
|
||||||
controller: _extendNestCtr,
|
children: [
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
AppBar(
|
||||||
return <Widget>[
|
title: StreamBuilder(
|
||||||
SliverAppBar(
|
stream: appbarStream.stream,
|
||||||
pinned: false,
|
initialData: false,
|
||||||
primary: true,
|
builder: (context, AsyncSnapshot snapshot) {
|
||||||
elevation: 0,
|
return AnimatedOpacity(
|
||||||
scrolledUnderElevation: 1,
|
opacity: snapshot.data ? 1 : 0,
|
||||||
forceElevated: innerBoxIsScrolled,
|
curve: Curves.easeOut,
|
||||||
expandedHeight: 290,
|
duration: const Duration(milliseconds: 500),
|
||||||
titleSpacing: 0,
|
child: Row(
|
||||||
title: StreamBuilder(
|
children: [
|
||||||
stream: appbarStream.stream,
|
Row(
|
||||||
initialData: false,
|
children: [
|
||||||
builder: (context, AsyncSnapshot snapshot) {
|
Obx(
|
||||||
return AnimatedOpacity(
|
() => NetworkImgLayer(
|
||||||
opacity: snapshot.data ? 1 : 0,
|
width: 35,
|
||||||
curve: Curves.easeOut,
|
height: 35,
|
||||||
duration: const Duration(milliseconds: 500),
|
type: 'avatar',
|
||||||
child: Row(
|
src: _memberController.face.value,
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Obx(
|
|
||||||
() => NetworkImgLayer(
|
|
||||||
width: 35,
|
|
||||||
height: 35,
|
|
||||||
type: 'avatar',
|
|
||||||
src: _memberController.face.value,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
),
|
||||||
Obx(
|
const SizedBox(width: 10),
|
||||||
() => Text(
|
Obx(
|
||||||
_memberController.memberInfo.value.name ?? '',
|
() => Text(
|
||||||
style: TextStyle(
|
_memberController.memberInfo.value.name ?? '',
|
||||||
color: Theme.of(context)
|
style: TextStyle(
|
||||||
.colorScheme
|
color: Theme.of(context)
|
||||||
.onBackground,
|
.colorScheme
|
||||||
fontSize: 14),
|
.onBackground,
|
||||||
),
|
fontSize: 14),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
)
|
],
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: () => Get.toNamed(
|
|
||||||
'/memberSearch?mid=${Get.parameters['mid']}&uname=${_memberController.memberInfo.value.name!}'),
|
|
||||||
icon: const Icon(Icons.search_outlined),
|
|
||||||
),
|
|
||||||
PopupMenuButton(
|
|
||||||
icon: const Icon(Icons.more_vert),
|
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
|
||||||
if (_memberController.ownerMid !=
|
|
||||||
_memberController.mid) ...[
|
|
||||||
PopupMenuItem(
|
|
||||||
onTap: () => _memberController.blockUser(),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.block, size: 19),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Text(_memberController.attribute.value != 128
|
|
||||||
? '加入黑名单'
|
|
||||||
: '移除黑名单'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Get.toNamed(
|
||||||
|
'/memberSearch?mid=${Get.parameters['mid']}&uname=${_memberController.memberInfo.value.name!}'),
|
||||||
|
icon: const Icon(Icons.search_outlined),
|
||||||
|
),
|
||||||
|
PopupMenuButton(
|
||||||
|
icon: const Icon(Icons.more_vert),
|
||||||
|
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||||
|
if (_memberController.ownerMid != _memberController.mid) ...[
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
onTap: () => _memberController.shareUser(),
|
onTap: () => _memberController.blockUser(),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.share_outlined, size: 19),
|
const Icon(Icons.block, size: 19),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(_memberController.ownerMid !=
|
Text(_memberController.attribute.value != 128
|
||||||
_memberController.mid
|
? '加入黑名单'
|
||||||
? '分享UP主'
|
: '移除黑名单'),
|
||||||
: '分享我的主页'),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
],
|
],
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: () => _memberController.shareUser(),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.share_outlined, size: 19),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Text(_memberController.ownerMid != _memberController.mid
|
||||||
|
? '分享UP主'
|
||||||
|
: '分享我的主页'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
controller: _extendNestCtr,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: MediaQuery.of(context).padding.bottom + 20,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
child: Column(
|
||||||
],
|
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
|
||||||
background: Stack(
|
|
||||||
children: [
|
children: [
|
||||||
|
profileWidget(),
|
||||||
|
|
||||||
|
/// 动态链接
|
||||||
|
ListTile(
|
||||||
|
onTap: _memberController.pushDynamicsPage,
|
||||||
|
title: const Text('Ta的动态'),
|
||||||
|
trailing:
|
||||||
|
const Icon(Icons.arrow_forward_outlined, size: 19),
|
||||||
|
),
|
||||||
|
|
||||||
|
/// 视频
|
||||||
|
ListTile(
|
||||||
|
onTap: _memberController.pushArchivesPage,
|
||||||
|
title: const Text('Ta的投稿'),
|
||||||
|
trailing:
|
||||||
|
const Icon(Icons.arrow_forward_outlined, size: 19),
|
||||||
|
),
|
||||||
|
|
||||||
|
/// 专栏
|
||||||
|
ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
title: const Text('Ta的专栏'),
|
||||||
|
),
|
||||||
|
MediaQuery.removePadding(
|
||||||
|
removeTop: true,
|
||||||
|
removeBottom: true,
|
||||||
|
context: context,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: StyleString.safeSpace,
|
||||||
|
right: StyleString.safeSpace,
|
||||||
|
),
|
||||||
|
child: FutureBuilder(
|
||||||
|
future: _memberSeasonsFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState ==
|
||||||
|
ConnectionState.done) {
|
||||||
|
if (snapshot.data == null) {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
if (snapshot.data['status']) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
if (data['data'].seasonsList.isEmpty) {
|
||||||
|
return commenWidget('用户没有设置专栏');
|
||||||
|
} else {
|
||||||
|
return MemberSeasonsPanel(data: data['data']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 请求错误
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
/// 收藏
|
||||||
|
|
||||||
|
/// 追番
|
||||||
|
/// 最近投币
|
||||||
Obx(
|
Obx(
|
||||||
() => _memberController.face.value != ''
|
() => _memberController.recentCoinsList.isNotEmpty
|
||||||
? Positioned.fill(
|
? ListTile(
|
||||||
bottom: 10,
|
onTap: () {},
|
||||||
child: Container(
|
title: const Text('最近投币的视频'),
|
||||||
decoration: BoxDecoration(
|
// trailing: const Icon(Icons.arrow_forward_outlined,
|
||||||
image: DecorationImage(
|
// size: 19),
|
||||||
fit: BoxFit.fitWidth,
|
|
||||||
image: NetworkImage(
|
|
||||||
_memberController.face.value),
|
|
||||||
alignment: Alignment.topCenter,
|
|
||||||
isAntiAlias: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
foregroundDecoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
colors: [
|
|
||||||
Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.background
|
|
||||||
.withOpacity(0.44),
|
|
||||||
Theme.of(context).colorScheme.background,
|
|
||||||
],
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
stops: const [0.0, 0.46],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
),
|
),
|
||||||
Positioned(
|
MediaQuery.removePadding(
|
||||||
left: 0,
|
removeTop: true,
|
||||||
right: 0,
|
removeBottom: true,
|
||||||
bottom: 0,
|
context: context,
|
||||||
height: 20,
|
child: Padding(
|
||||||
child: Container(
|
padding: const EdgeInsets.only(
|
||||||
color: Theme.of(context).colorScheme.background,
|
left: StyleString.safeSpace,
|
||||||
|
right: StyleString.safeSpace,
|
||||||
|
),
|
||||||
|
child: FutureBuilder(
|
||||||
|
future: _memberCoinsFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState ==
|
||||||
|
ConnectionState.done) {
|
||||||
|
if (snapshot.data == null) {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
if (snapshot.data['status']) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
return MemberCoinsPanel(data: data['data']);
|
||||||
|
} else {
|
||||||
|
// 请求错误
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
profileWidget(),
|
// 最近点赞
|
||||||
|
// ListTile(
|
||||||
|
// onTap: () {},
|
||||||
|
// title: const Text('最近点赞的视频'),
|
||||||
|
// trailing:
|
||||||
|
// const Icon(Icons.arrow_forward_outlined, size: 19),
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
];
|
),
|
||||||
},
|
],
|
||||||
pinnedHeaderSliverHeightBuilder: () {
|
|
||||||
return MediaQuery.of(context).padding.top + kToolbarHeight;
|
|
||||||
},
|
|
||||||
onlyOneScrollInBody: true,
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 50,
|
|
||||||
child: TabBar(controller: _tabController, tabs: const [
|
|
||||||
Tab(text: '主页'),
|
|
||||||
Tab(text: '动态'),
|
|
||||||
Tab(text: '投稿'),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
controller: _tabController,
|
|
||||||
children: [
|
|
||||||
const Text('主页'),
|
|
||||||
MemberDynamicPanel(mid: mid),
|
|
||||||
ArchivePanel(mid: mid),
|
|
||||||
],
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget profileWidget() {
|
Widget profileWidget() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: 18, right: 18),
|
padding: const EdgeInsets.only(left: 18, right: 18, bottom: 20),
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
@ -250,7 +291,7 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
profile(_memberController),
|
profile(_memberController),
|
||||||
const SizedBox(height: 14),
|
const SizedBox(height: 20),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
@ -260,7 +301,7 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.bodyLarge!
|
.titleMedium!
|
||||||
.copyWith(fontWeight: FontWeight.bold),
|
.copyWith(fontWeight: FontWeight.bold),
|
||||||
)),
|
)),
|
||||||
const SizedBox(width: 2),
|
const SizedBox(width: 2),
|
||||||
@ -332,29 +373,11 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
softWrap: true,
|
softWrap: true,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 6),
|
||||||
if (_memberController.memberInfo.value.sign != '')
|
if (_memberController.memberInfo.value.sign != '')
|
||||||
SelectableText(
|
SelectableText(
|
||||||
_memberController.memberInfo.value.sign!,
|
_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!),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -371,4 +394,22 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget commenWidget(msg) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 20,
|
||||||
|
bottom: 30,
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
msg,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.labelMedium!
|
||||||
|
.copyWith(color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
31
lib/pages/member/widgets/conis.dart
Normal file
31
lib/pages/member/widgets/conis.dart
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pilipala/common/constants.dart';
|
||||||
|
import 'package:pilipala/models/member/coin.dart';
|
||||||
|
import 'package:pilipala/pages/member_coin/widgets/item.dart';
|
||||||
|
|
||||||
|
class MemberCoinsPanel extends StatelessWidget {
|
||||||
|
final List<MemberCoinsDataModel>? data;
|
||||||
|
const MemberCoinsPanel({super.key, this.data});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return LayoutBuilder(
|
||||||
|
builder: (context, boxConstraints) {
|
||||||
|
return GridView.builder(
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 2, // Use a fixed count for GridView
|
||||||
|
crossAxisSpacing: StyleString.safeSpace,
|
||||||
|
mainAxisSpacing: StyleString.safeSpace,
|
||||||
|
childAspectRatio: 0.94,
|
||||||
|
),
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: data!.length,
|
||||||
|
itemBuilder: (context, i) {
|
||||||
|
return MemberCoinsItem(coinItem: data![i]);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,7 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
return Builder(
|
return Builder(
|
||||||
builder: ((context) {
|
builder: ((context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(top: 3 * MediaQuery.of(context).padding.top),
|
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top - 20),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Hero(
|
Hero(
|
||||||
@ -78,7 +78,8 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
padding:
|
||||||
|
const EdgeInsets.only(top: 10, left: 10, right: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
@ -136,8 +137,14 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
const Text('-',
|
Text(
|
||||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
!loadingStatus
|
||||||
|
? Utils.numFormat(
|
||||||
|
ctr.userStat!['likes'],
|
||||||
|
)
|
||||||
|
: '-',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold)),
|
||||||
Text(
|
Text(
|
||||||
'获赞',
|
'获赞',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
85
lib/pages/member/widgets/seasons.dart
Normal file
85
lib/pages/member/widgets/seasons.dart
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/constants.dart';
|
||||||
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
|
import 'package:pilipala/models/member/seasons.dart';
|
||||||
|
import 'package:pilipala/pages/member_seasons/widgets/item.dart';
|
||||||
|
|
||||||
|
class MemberSeasonsPanel extends StatelessWidget {
|
||||||
|
final MemberSeasonsDataModel? data;
|
||||||
|
const MemberSeasonsPanel({super.key, this.data});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemCount: data!.seasonsList!.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
MemberSeasonsList item = data!.seasonsList![index];
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 12, right: 4),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 12, left: 4),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
item.meta!.name!,
|
||||||
|
maxLines: 1,
|
||||||
|
style: Theme.of(context).textTheme.titleSmall!,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
PBadge(
|
||||||
|
stack: 'relative',
|
||||||
|
size: 'small',
|
||||||
|
text: item.meta!.total.toString(),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
SizedBox(
|
||||||
|
width: 35,
|
||||||
|
height: 35,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () => Get.toNamed(
|
||||||
|
'/memberSeasons?mid=${item.meta!.mid}&seasonId=${item.meta!.seasonId}'),
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
|
),
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.arrow_forward,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
LayoutBuilder(
|
||||||
|
builder: (context, boxConstraints) {
|
||||||
|
return GridView.builder(
|
||||||
|
gridDelegate:
|
||||||
|
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 2, // Use a fixed count for GridView
|
||||||
|
crossAxisSpacing: StyleString.safeSpace,
|
||||||
|
mainAxisSpacing: StyleString.safeSpace,
|
||||||
|
childAspectRatio: 0.94,
|
||||||
|
),
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: item.archives!.length,
|
||||||
|
itemBuilder: (context, i) {
|
||||||
|
return MemberSeasonsItem(seasonItem: item.archives![i]);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,11 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/http/member.dart';
|
import 'package:pilipala/http/member.dart';
|
||||||
|
import 'package:pilipala/models/member/archive.dart';
|
||||||
|
|
||||||
class ArchiveController extends GetxController {
|
class MemberArchiveController extends GetxController {
|
||||||
ArchiveController(this.mid);
|
final ScrollController scrollController = ScrollController();
|
||||||
int? mid;
|
late int mid;
|
||||||
int pn = 1;
|
int pn = 1;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
RxMap<String, String> currentOrder = <String, String>{}.obs;
|
RxMap<String, String> currentOrder = <String, String>{}.obs;
|
||||||
@ -12,20 +14,27 @@ class ArchiveController extends GetxController {
|
|||||||
{'type': 'click', 'label': '最多播放'},
|
{'type': 'click', 'label': '最多播放'},
|
||||||
{'type': 'stow', 'label': '最多收藏'},
|
{'type': 'stow', 'label': '最多收藏'},
|
||||||
];
|
];
|
||||||
|
RxList<VListItemModel> archivesList = <VListItemModel>[].obs;
|
||||||
|
|
||||||
@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;
|
currentOrder.value = orderList.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户投稿
|
// 获取用户投稿
|
||||||
Future getMemberArchive() async {
|
Future getMemberArchive(type) async {
|
||||||
|
if (type == 'onRefresh') {
|
||||||
|
pn = 1;
|
||||||
|
}
|
||||||
var res = await MemberHttp.memberArchive(
|
var res = await MemberHttp.memberArchive(
|
||||||
mid: mid, pn: pn, order: currentOrder['type']!);
|
mid: mid,
|
||||||
|
pn: pn,
|
||||||
|
order: currentOrder['type']!,
|
||||||
|
);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
|
archivesList.addAll(res['data'].list.vlist);
|
||||||
count = res['data'].page['count'];
|
count = res['data'].page['count'];
|
||||||
pn += 1;
|
pn += 1;
|
||||||
}
|
}
|
||||||
@ -34,11 +43,16 @@ class ArchiveController extends GetxController {
|
|||||||
|
|
||||||
toggleSort() async {
|
toggleSort() async {
|
||||||
pn = 1;
|
pn = 1;
|
||||||
int index = orderList.indexOf(currentOrder.value);
|
int index = orderList.indexOf(currentOrder);
|
||||||
if (index == orderList.length - 1) {
|
if (index == orderList.length - 1) {
|
||||||
currentOrder.value = orderList.first;
|
currentOrder.value = orderList.first;
|
||||||
} else {
|
} else {
|
||||||
currentOrder.value = orderList[index + 1];
|
currentOrder.value = orderList[index + 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 上拉加载
|
||||||
|
Future onLoad() async {
|
||||||
|
getMemberArchive('onLoad');
|
||||||
|
}
|
||||||
}
|
}
|
4
lib/pages/member_archive/index.dart
Normal file
4
lib/pages/member_archive/index.dart
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
library member_archive;
|
||||||
|
|
||||||
|
export './controller.dart';
|
||||||
|
export './view.dart';
|
120
lib/pages/member_archive/view.dart
Normal file
120
lib/pages/member_archive/view.dart
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/widgets/video_card_h.dart';
|
||||||
|
import 'controller.dart';
|
||||||
|
|
||||||
|
class MemberArchivePage extends StatefulWidget {
|
||||||
|
const MemberArchivePage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MemberArchivePage> createState() => _MemberArchivePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MemberArchivePageState extends State<MemberArchivePage> {
|
||||||
|
final MemberArchiveController _memberArchivesController =
|
||||||
|
Get.put(MemberArchiveController());
|
||||||
|
late Future _futureBuilderFuture;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_futureBuilderFuture =
|
||||||
|
_memberArchivesController.getMemberArchive('onRefresh');
|
||||||
|
scrollController = _memberArchivesController.scrollController;
|
||||||
|
scrollController.addListener(
|
||||||
|
() {
|
||||||
|
if (scrollController.position.pixels >=
|
||||||
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
|
EasyThrottle.throttle(
|
||||||
|
'member_archives', const Duration(milliseconds: 500), () {
|
||||||
|
_memberArchivesController.onLoad();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('他的投稿'),
|
||||||
|
// actions: [
|
||||||
|
// Obx(
|
||||||
|
// () => PopupMenuButton<String>(
|
||||||
|
// padding: EdgeInsets.zero,
|
||||||
|
// tooltip: '投稿排序',
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons.more_vert_outlined,
|
||||||
|
// color: Theme.of(context).colorScheme.outline,
|
||||||
|
// ),
|
||||||
|
// position: PopupMenuPosition.under,
|
||||||
|
// onSelected: (String type) {},
|
||||||
|
// itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||||
|
// for (var i in _memberArchivesController.orderList) ...[
|
||||||
|
// PopupMenuItem<String>(
|
||||||
|
// onTap: () {},
|
||||||
|
// value: _memberArchivesController.currentOrder['label'],
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisSize: MainAxisSize.min,
|
||||||
|
// children: [
|
||||||
|
// Text(i['label']!),
|
||||||
|
// if (_memberArchivesController.currentOrder['label'] ==
|
||||||
|
// i['label']) ...[
|
||||||
|
// const SizedBox(width: 10),
|
||||||
|
// const Icon(Icons.done, size: 20),
|
||||||
|
// ],
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ]
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
),
|
||||||
|
body: CustomScrollView(
|
||||||
|
controller: _memberArchivesController.scrollController,
|
||||||
|
slivers: [
|
||||||
|
FutureBuilder(
|
||||||
|
future: _futureBuilderFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
if (snapshot.data != null) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
List list = _memberArchivesController.archivesList;
|
||||||
|
if (data['status']) {
|
||||||
|
return Obx(
|
||||||
|
() => list.isNotEmpty
|
||||||
|
? SliverList(
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) {
|
||||||
|
return VideoCardH(
|
||||||
|
videoItem: list[index],
|
||||||
|
showOwner: false,
|
||||||
|
showPubdate: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
childCount: list.length,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SliverToBoxAdapter(),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const SliverToBoxAdapter();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return const SliverToBoxAdapter();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return const SliverToBoxAdapter();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
3
lib/pages/member_coin/controller.dart
Normal file
3
lib/pages/member_coin/controller.dart
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class MemberCoinController extends GetxController {}
|
@ -1,4 +1,4 @@
|
|||||||
library dynamic_panel;
|
library member_coin;
|
||||||
|
|
||||||
export './controller.dart';
|
export './controller.dart';
|
||||||
export './view.dart';
|
export './view.dart';
|
15
lib/pages/member_coin/view.dart
Normal file
15
lib/pages/member_coin/view.dart
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MemberCoinPage extends StatefulWidget {
|
||||||
|
const MemberCoinPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MemberCoinPage> createState() => _MemberCoinPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MemberCoinPageState extends State<MemberCoinPage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold();
|
||||||
|
}
|
||||||
|
}
|
95
lib/pages/member_coin/widgets/item.dart
Normal file
95
lib/pages/member_coin/widgets/item.dart
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/constants.dart';
|
||||||
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
|
import 'package:pilipala/http/search.dart';
|
||||||
|
import 'package:pilipala/models/member/coin.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
|
class MemberCoinsItem extends StatelessWidget {
|
||||||
|
final MemberCoinsDataModel coinItem;
|
||||||
|
|
||||||
|
const MemberCoinsItem({
|
||||||
|
Key? key,
|
||||||
|
required this.coinItem,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
String heroTag = Utils.makeHeroTag(coinItem.aid);
|
||||||
|
return Card(
|
||||||
|
elevation: 0,
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
int cid =
|
||||||
|
await SearchHttp.ab2c(aid: coinItem.aid, bvid: coinItem.bvid);
|
||||||
|
Get.toNamed('/video?bvid=${coinItem.bvid}&cid=$cid',
|
||||||
|
arguments: {'videoItem': coinItem, 'heroTag': heroTag});
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
AspectRatio(
|
||||||
|
aspectRatio: StyleString.aspectRatio,
|
||||||
|
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||||
|
double maxWidth = boxConstraints.maxWidth;
|
||||||
|
double maxHeight = boxConstraints.maxHeight;
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
NetworkImgLayer(
|
||||||
|
src: coinItem.pic,
|
||||||
|
width: maxWidth,
|
||||||
|
height: maxHeight,
|
||||||
|
),
|
||||||
|
if (coinItem.duration != null)
|
||||||
|
PBadge(
|
||||||
|
bottom: 6,
|
||||||
|
right: 6,
|
||||||
|
type: 'gray',
|
||||||
|
text: Utils.timeFormat(coinItem.duration),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(5, 6, 0, 0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
coinItem.title!,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
StatView(
|
||||||
|
view: coinItem.view,
|
||||||
|
theme: 'gray',
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Text(
|
||||||
|
Utils.CustomStamp_str(
|
||||||
|
timestamp: coinItem.pubdate, date: 'MM-DD'),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 11,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
41
lib/pages/member_dynamics/controller.dart
Normal file
41
lib/pages/member_dynamics/controller.dart
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/http/member.dart';
|
||||||
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
|
|
||||||
|
class MemberDynamicsController extends GetxController {
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
|
late int mid;
|
||||||
|
String offset = '';
|
||||||
|
int count = 0;
|
||||||
|
bool hasMore = true;
|
||||||
|
RxList<DynamicItemModel> dynamicsList = <DynamicItemModel>[].obs;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
mid = int.parse(Get.parameters['mid']!);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future getMemberDynamic(type) async {
|
||||||
|
if (type == 'onRefresh') {
|
||||||
|
offset = '';
|
||||||
|
dynamicsList.clear();
|
||||||
|
}
|
||||||
|
var res = await MemberHttp.memberDynamic(
|
||||||
|
offset: offset,
|
||||||
|
mid: mid,
|
||||||
|
);
|
||||||
|
if (res['status']) {
|
||||||
|
dynamicsList.addAll(res['data'].items);
|
||||||
|
offset = res['data'].offset;
|
||||||
|
hasMore = res['data'].hasMore;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上拉加载
|
||||||
|
Future onLoad() async {
|
||||||
|
getMemberDynamic('onLoad');
|
||||||
|
}
|
||||||
|
}
|
4
lib/pages/member_dynamics/index.dart
Normal file
4
lib/pages/member_dynamics/index.dart
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
library member_dynamics;
|
||||||
|
|
||||||
|
export './controller.dart';
|
||||||
|
export './view.dart';
|
86
lib/pages/member_dynamics/view.dart
Normal file
86
lib/pages/member_dynamics/view.dart
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/pages/member_dynamics/index.dart';
|
||||||
|
|
||||||
|
import '../dynamics/widgets/dynamic_panel.dart';
|
||||||
|
|
||||||
|
class MemberDynamicsPage extends StatefulWidget {
|
||||||
|
const MemberDynamicsPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MemberDynamicsPage> createState() => _MemberDynamicsPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MemberDynamicsPageState extends State<MemberDynamicsPage> {
|
||||||
|
final MemberDynamicsController _memberDynamicController =
|
||||||
|
Get.put(MemberDynamicsController());
|
||||||
|
late Future _futureBuilderFuture;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_futureBuilderFuture =
|
||||||
|
_memberDynamicController.getMemberDynamic('onRefresh');
|
||||||
|
scrollController = _memberDynamicController.scrollController;
|
||||||
|
scrollController.addListener(
|
||||||
|
() {
|
||||||
|
if (scrollController.position.pixels >=
|
||||||
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
|
EasyThrottle.throttle(
|
||||||
|
'member_dynamics', const Duration(milliseconds: 500), () {
|
||||||
|
_memberDynamicController.onLoad();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_memberDynamicController.scrollController.removeListener(() {});
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('他的动态'),
|
||||||
|
),
|
||||||
|
body: CustomScrollView(
|
||||||
|
controller: _memberDynamicController.scrollController,
|
||||||
|
slivers: [
|
||||||
|
FutureBuilder(
|
||||||
|
future: _futureBuilderFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
List list = _memberDynamicController.dynamicsList;
|
||||||
|
if (data['status']) {
|
||||||
|
return Obx(
|
||||||
|
() => list.isNotEmpty
|
||||||
|
? SliverList(
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) {
|
||||||
|
return DynamicPanel(item: list[index]);
|
||||||
|
},
|
||||||
|
childCount: list.length,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SliverToBoxAdapter(),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const SliverToBoxAdapter();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return const SliverToBoxAdapter();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
3
lib/pages/member_like/controller.dart
Normal file
3
lib/pages/member_like/controller.dart
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class MemberLikeController extends GetxController {}
|
4
lib/pages/member_like/index.dart
Normal file
4
lib/pages/member_like/index.dart
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
library member_like;
|
||||||
|
|
||||||
|
export './controller.dart';
|
||||||
|
export './view.dart';
|
15
lib/pages/member_like/view.dart
Normal file
15
lib/pages/member_like/view.dart
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MemberLikePage extends StatefulWidget {
|
||||||
|
const MemberLikePage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MemberLikePage> createState() => _MemberLikePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MemberLikePageState extends State<MemberLikePage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold();
|
||||||
|
}
|
||||||
|
}
|
47
lib/pages/member_seasons/controller.dart
Normal file
47
lib/pages/member_seasons/controller.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/http/member.dart';
|
||||||
|
import 'package:pilipala/models/member/seasons.dart';
|
||||||
|
|
||||||
|
class MemberSeasonsController extends GetxController {
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
|
late int mid;
|
||||||
|
late int seasonId;
|
||||||
|
int pn = 1;
|
||||||
|
int ps = 30;
|
||||||
|
int count = 0;
|
||||||
|
RxList<MemberArchiveItem> seasonsList = <MemberArchiveItem>[].obs;
|
||||||
|
late Map page;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
mid = int.parse(Get.parameters['mid']!);
|
||||||
|
seasonId = int.parse(Get.parameters['seasonId']!);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取专栏详情
|
||||||
|
Future getSeasonDetail(type) async {
|
||||||
|
if (type == 'onRefresh') {
|
||||||
|
pn = 1;
|
||||||
|
}
|
||||||
|
var res = await MemberHttp.getSeasonDetail(
|
||||||
|
mid: mid,
|
||||||
|
seasonId: seasonId,
|
||||||
|
pn: pn,
|
||||||
|
ps: ps,
|
||||||
|
sortReverse: false,
|
||||||
|
);
|
||||||
|
if (res['status']) {
|
||||||
|
seasonsList.addAll(res['data'].archives);
|
||||||
|
page = res['data'].page;
|
||||||
|
pn += 1;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上拉加载
|
||||||
|
Future onLoad() async {
|
||||||
|
getSeasonDetail('onLoad');
|
||||||
|
}
|
||||||
|
}
|
4
lib/pages/member_seasons/index.dart
Normal file
4
lib/pages/member_seasons/index.dart
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
library member_seasons;
|
||||||
|
|
||||||
|
export 'controller.dart';
|
||||||
|
export 'view.dart';
|
103
lib/pages/member_seasons/view.dart
Normal file
103
lib/pages/member_seasons/view.dart
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/constants.dart';
|
||||||
|
import 'controller.dart';
|
||||||
|
import 'widgets/item.dart';
|
||||||
|
|
||||||
|
class MemberSeasonsPage extends StatefulWidget {
|
||||||
|
const MemberSeasonsPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MemberSeasonsPage> createState() => _MemberSeasonsPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
|
||||||
|
final MemberSeasonsController _memberSeasonsController =
|
||||||
|
Get.put(MemberSeasonsController());
|
||||||
|
late Future _futureBuilderFuture;
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_futureBuilderFuture =
|
||||||
|
_memberSeasonsController.getSeasonDetail('onRefresh');
|
||||||
|
scrollController = _memberSeasonsController.scrollController;
|
||||||
|
scrollController.addListener(
|
||||||
|
() {
|
||||||
|
if (scrollController.position.pixels >=
|
||||||
|
scrollController.position.maxScrollExtent - 200) {
|
||||||
|
EasyThrottle.throttle(
|
||||||
|
'member_archives', const Duration(milliseconds: 500), () {
|
||||||
|
_memberSeasonsController.onLoad();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('他的专栏'),
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: StyleString.safeSpace,
|
||||||
|
right: StyleString.safeSpace,
|
||||||
|
),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
controller: _memberSeasonsController.scrollController,
|
||||||
|
child: FutureBuilder(
|
||||||
|
future: _futureBuilderFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
if (snapshot.data != null) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
List list = _memberSeasonsController.seasonsList;
|
||||||
|
if (data['status']) {
|
||||||
|
return Obx(
|
||||||
|
() => list.isNotEmpty
|
||||||
|
? LayoutBuilder(
|
||||||
|
builder: (context, boxConstraints) {
|
||||||
|
return GridView.builder(
|
||||||
|
gridDelegate:
|
||||||
|
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 2,
|
||||||
|
crossAxisSpacing: StyleString.safeSpace,
|
||||||
|
mainAxisSpacing: StyleString.safeSpace,
|
||||||
|
childAspectRatio: 0.94,
|
||||||
|
),
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: _memberSeasonsController
|
||||||
|
.seasonsList.length,
|
||||||
|
itemBuilder: (context, i) {
|
||||||
|
return MemberSeasonsItem(
|
||||||
|
seasonItem: _memberSeasonsController
|
||||||
|
.seasonsList[i],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
98
lib/pages/member_seasons/widgets/item.dart
Normal file
98
lib/pages/member_seasons/widgets/item.dart
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/constants.dart';
|
||||||
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
|
import 'package:pilipala/http/search.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
|
class MemberSeasonsItem extends StatelessWidget {
|
||||||
|
final dynamic seasonItem;
|
||||||
|
|
||||||
|
const MemberSeasonsItem({
|
||||||
|
Key? key,
|
||||||
|
required this.seasonItem,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
String heroTag = Utils.makeHeroTag(seasonItem.aid);
|
||||||
|
return Card(
|
||||||
|
elevation: 0,
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
int cid =
|
||||||
|
await SearchHttp.ab2c(aid: seasonItem.aid, bvid: seasonItem.bvid);
|
||||||
|
Get.toNamed('/video?bvid=${seasonItem.bvid}&cid=$cid',
|
||||||
|
arguments: {'videoItem': seasonItem, 'heroTag': heroTag});
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
AspectRatio(
|
||||||
|
aspectRatio: StyleString.aspectRatio,
|
||||||
|
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||||
|
double maxWidth = boxConstraints.maxWidth;
|
||||||
|
double maxHeight = boxConstraints.maxHeight;
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
Hero(
|
||||||
|
tag: heroTag,
|
||||||
|
child: NetworkImgLayer(
|
||||||
|
src: seasonItem.pic,
|
||||||
|
width: maxWidth,
|
||||||
|
height: maxHeight,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (seasonItem.duration != null)
|
||||||
|
PBadge(
|
||||||
|
bottom: 6,
|
||||||
|
right: 6,
|
||||||
|
type: 'gray',
|
||||||
|
text: Utils.timeFormat(seasonItem.duration),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(5, 6, 0, 0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
seasonItem.title,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
StatView(
|
||||||
|
view: seasonItem.view,
|
||||||
|
theme: 'gray',
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Text(
|
||||||
|
Utils.CustomStamp_str(
|
||||||
|
timestamp: seasonItem.pubdate, date: 'MM-DD'),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 11,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -159,7 +159,6 @@ class _ImagePreviewState extends State<ImagePreview>
|
|||||||
_previewController.onChange(index),
|
_previewController.onChange(index),
|
||||||
canScrollPage: (GestureDetails? gestureDetails) =>
|
canScrollPage: (GestureDetails? gestureDetails) =>
|
||||||
gestureDetails!.totalScale! <= 1.0,
|
gestureDetails!.totalScale! <= 1.0,
|
||||||
preloadPagesCount: 2,
|
|
||||||
itemCount: widget.imgList!.length,
|
itemCount: widget.imgList!.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return ExtendedImage.network(
|
return ExtendedImage.network(
|
||||||
|
@ -11,6 +11,7 @@ import 'package:pilipala/common/widgets/animated_dialog.dart';
|
|||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/common/widgets/overlay_pop.dart';
|
import 'package:pilipala/common/widgets/overlay_pop.dart';
|
||||||
import 'package:pilipala/common/widgets/video_card_v.dart';
|
import 'package:pilipala/common/widgets/video_card_v.dart';
|
||||||
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
import 'package:pilipala/pages/main/index.dart';
|
import 'package:pilipala/pages/main/index.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
@ -37,6 +38,8 @@ class _RcmdPageState extends State<RcmdPage>
|
|||||||
ScrollController scrollController = _rcmdController.scrollController;
|
ScrollController scrollController = _rcmdController.scrollController;
|
||||||
StreamController<bool> mainStream =
|
StreamController<bool> mainStream =
|
||||||
Get.find<MainController>().bottomBarStream;
|
Get.find<MainController>().bottomBarStream;
|
||||||
|
StreamController<bool> searchBarStream =
|
||||||
|
Get.find<HomeController>().searchBarStream;
|
||||||
scrollController.addListener(
|
scrollController.addListener(
|
||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
@ -52,8 +55,10 @@ class _RcmdPageState extends State<RcmdPage>
|
|||||||
scrollController.position.userScrollDirection;
|
scrollController.position.userScrollDirection;
|
||||||
if (direction == ScrollDirection.forward) {
|
if (direction == ScrollDirection.forward) {
|
||||||
mainStream.add(true);
|
mainStream.add(true);
|
||||||
|
searchBarStream.add(true);
|
||||||
} else if (direction == ScrollDirection.reverse) {
|
} else if (direction == ScrollDirection.reverse) {
|
||||||
mainStream.add(false);
|
mainStream.add(false);
|
||||||
|
searchBarStream.add(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -82,6 +87,7 @@ class _RcmdPageState extends State<RcmdPage>
|
|||||||
},
|
},
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
controller: _rcmdController.scrollController,
|
controller: _rcmdController.scrollController,
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverPadding(
|
SliverPadding(
|
||||||
padding:
|
padding:
|
||||||
@ -152,11 +158,10 @@ class _RcmdPageState extends State<RcmdPage>
|
|||||||
// crossAxisCount = 1;
|
// crossAxisCount = 1;
|
||||||
// }
|
// }
|
||||||
int crossAxisCount = ctr.crossAxisCount.value;
|
int crossAxisCount = ctr.crossAxisCount.value;
|
||||||
double mainAxisExtent =
|
double mainAxisExtent = (Get.size.width /
|
||||||
(Get.size.width / crossAxisCount / StyleString.aspectRatio) +
|
crossAxisCount /
|
||||||
(crossAxisCount == 1
|
StyleString.aspectRatio) +
|
||||||
? 68
|
(crossAxisCount == 1 ? 68 : MediaQuery.textScalerOf(context).scale(86));
|
||||||
: 86 * MediaQuery.of(context).textScaleFactor);
|
|
||||||
return SliverGrid(
|
return SliverGrid(
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
// 行间距
|
// 行间距
|
||||||
@ -191,8 +196,8 @@ class _RcmdPageState extends State<RcmdPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
class LoadingMore extends StatelessWidget {
|
class LoadingMore extends StatelessWidget {
|
||||||
dynamic ctr;
|
final dynamic ctr;
|
||||||
LoadingMore({super.key, this.ctr});
|
const LoadingMore({super.key, this.ctr});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -160,25 +160,25 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _searchSuggest() {
|
Widget _searchSuggest() {
|
||||||
SSearchController _ssCtr = _searchController;
|
SSearchController ssCtr = _searchController;
|
||||||
return Obx(
|
return Obx(
|
||||||
() => _ssCtr.searchSuggestList.isNotEmpty &&
|
() => ssCtr.searchSuggestList.isNotEmpty &&
|
||||||
_ssCtr.searchSuggestList.first.term != null &&
|
ssCtr.searchSuggestList.first.term != null &&
|
||||||
_ssCtr.controller.value.text != ''
|
ssCtr.controller.value.text != ''
|
||||||
? ListView.builder(
|
? ListView.builder(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: _ssCtr.searchSuggestList.length,
|
itemCount: ssCtr.searchSuggestList.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
customBorder: RoundedRectangleBorder(
|
customBorder: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(4),
|
||||||
),
|
),
|
||||||
onTap: () => _ssCtr
|
onTap: () => ssCtr
|
||||||
.onClickKeyword(_ssCtr.searchSuggestList[index].term!),
|
.onClickKeyword(ssCtr.searchSuggestList[index].term!),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 20, top: 9, bottom: 9),
|
padding: const EdgeInsets.only(left: 20, top: 9, bottom: 9),
|
||||||
child: _ssCtr.searchSuggestList[index].textRich,
|
child: ssCtr.searchSuggestList[index].textRich,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -235,6 +235,7 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
|||||||
return Obx(
|
return Obx(
|
||||||
() => HotKeyword(
|
() => HotKeyword(
|
||||||
width: width,
|
width: width,
|
||||||
|
// ignore: invalid_use_of_protected_member
|
||||||
hotSearchList: _searchController.hotSearchList.value,
|
hotSearchList: _searchController.hotSearchList.value,
|
||||||
onClick: (keyword) async {
|
onClick: (keyword) async {
|
||||||
_searchController.searchFocusNode.unfocus();
|
_searchController.searchFocusNode.unfocus();
|
||||||
|
@ -83,6 +83,7 @@ class _SearchPanelState extends State<SearchPanel>
|
|||||||
case SearchType.video:
|
case SearchType.video:
|
||||||
return SearchVideoPanel(
|
return SearchVideoPanel(
|
||||||
ctr: _searchPanelController,
|
ctr: _searchPanelController,
|
||||||
|
// ignore: invalid_use_of_protected_member
|
||||||
list: list.value,
|
list: list.value,
|
||||||
);
|
);
|
||||||
case SearchType.media_bangumi:
|
case SearchType.media_bangumi:
|
||||||
|
@ -82,6 +82,7 @@ class _SearchResultPageState extends State<SearchResultPage>
|
|||||||
labelStyle: const TextStyle(fontSize: 13),
|
labelStyle: const TextStyle(fontSize: 13),
|
||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
unselectedLabelColor: Theme.of(context).colorScheme.outline,
|
unselectedLabelColor: Theme.of(context).colorScheme.outline,
|
||||||
|
tabAlignment: TabAlignment.start,
|
||||||
onTap: (index) {
|
onTap: (index) {
|
||||||
if (index == _searchResultController!.tabIndex) {
|
if (index == _searchResultController!.tabIndex) {
|
||||||
Get.find<SearchPanelController>(
|
Get.find<SearchPanelController>(
|
||||||
|
@ -3,6 +3,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/common/dynamics_type.dart';
|
import 'package:pilipala/models/common/dynamics_type.dart';
|
||||||
import 'package:pilipala/models/common/reply_sort_type.dart';
|
import 'package:pilipala/models/common/reply_sort_type.dart';
|
||||||
|
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
import 'widgets/switch_item.dart';
|
import 'widgets/switch_item.dart';
|
||||||
@ -169,6 +170,12 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
setKey: SettingBoxKey.enableSaveLastData,
|
setKey: SettingBoxKey.enableSaveLastData,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
|
const SetSwitchItem(
|
||||||
|
title: '启用ai总结',
|
||||||
|
subTitle: '视频详情页开启ai总结',
|
||||||
|
setKey: SettingBoxKey.enableAi,
|
||||||
|
defaultVal: true,
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text('评论展示', style: titleStyle),
|
title: Text('评论展示', style: titleStyle),
|
||||||
@ -176,23 +183,21 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
'当前优先展示「${ReplySortType.values[defaultReplySort].titles}」',
|
'当前优先展示「${ReplySortType.values[defaultReplySort].titles}」',
|
||||||
style: subTitleStyle,
|
style: subTitleStyle,
|
||||||
),
|
),
|
||||||
trailing: PopupMenuButton(
|
onTap: () async {
|
||||||
initialValue: defaultReplySort,
|
int? result = await showDialog(
|
||||||
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
context: context,
|
||||||
onSelected: (item) {
|
builder: (context) {
|
||||||
defaultReplySort = item;
|
return SelectDialog<int>(title: '评论展示', value: defaultReplySort, values: ReplySortType.values.map((e) {
|
||||||
setting.put(SettingBoxKey.replySortType, item);
|
return {'title': e.titles, 'value': e.index};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
defaultReplySort = result;
|
||||||
|
setting.put(SettingBoxKey.replySortType, result);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
}
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
},
|
||||||
for (var i in ReplySortType.values) ...[
|
|
||||||
PopupMenuItem(
|
|
||||||
value: i.index,
|
|
||||||
child: Text(i.titles),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
@ -201,23 +206,21 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
'当前优先展示「${DynamicsType.values[defaultDynamicType].labels}」',
|
'当前优先展示「${DynamicsType.values[defaultDynamicType].labels}」',
|
||||||
style: subTitleStyle,
|
style: subTitleStyle,
|
||||||
),
|
),
|
||||||
trailing: PopupMenuButton(
|
onTap: () async {
|
||||||
initialValue: defaultDynamicType,
|
int? result = await showDialog(
|
||||||
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
context: context,
|
||||||
onSelected: (item) {
|
builder: (context) {
|
||||||
defaultDynamicType = item;
|
return SelectDialog<int>(title: '动态展示', value: defaultDynamicType, values: DynamicsType.values.map((e) {
|
||||||
setting.put(SettingBoxKey.defaultDynamicType, item);
|
return {'title': e.labels, 'value': e.index};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
defaultDynamicType = result;
|
||||||
|
setting.put(SettingBoxKey.defaultDynamicType, result);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
}
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
},
|
||||||
for (var i in DynamicsType.values) ...[
|
|
||||||
PopupMenuItem(
|
|
||||||
value: i.index,
|
|
||||||
child: Text(i.labels),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
enableFeedback: true,
|
enableFeedback: true,
|
||||||
@ -225,6 +228,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
title: Text('设置代理', style: titleStyle),
|
title: Text('设置代理', style: titleStyle),
|
||||||
subtitle: Text('设置代理 host:port', style: subTitleStyle),
|
subtitle: Text('设置代理 host:port', style: subTitleStyle),
|
||||||
trailing: Transform.scale(
|
trailing: Transform.scale(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
scale: 0.8,
|
scale: 0.8,
|
||||||
child: Switch(
|
child: Switch(
|
||||||
thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
||||||
|
@ -44,12 +44,10 @@ class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
|
|||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: Center(
|
||||||
child: Center(
|
child: Text(
|
||||||
child: Text(
|
'当前字体大小:${currentSize == 1.0 ? '默认' : currentSize}',
|
||||||
'当前字体大小:${currentSize == 1.0 ? '默认' : currentSize}',
|
style: TextStyle(fontSize: 14 * currentSize),
|
||||||
style: TextStyle(fontSize: 14 * currentSize),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -2,6 +2,7 @@ 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/models/video/play/quality.dart';
|
import 'package:pilipala/models/video/play/quality.dart';
|
||||||
|
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||||
import 'package:pilipala/services/service_locator.dart';
|
import 'package:pilipala/services/service_locator.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
@ -68,7 +69,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
dense: false,
|
dense: false,
|
||||||
onTap: () => Get.toNamed('/playSpeedSet'),
|
onTap: () => Get.toNamed('/playSpeedSet'),
|
||||||
title: Text('倍速设置', style: titleStyle),
|
title: Text('倍速设置', style: titleStyle),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 17),
|
subtitle: Text('设置视频播放速度', style: subTitleStyle),
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '开启1080P',
|
title: '开启1080P',
|
||||||
@ -96,7 +97,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
),
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '自动PiP播放',
|
title: '自动PiP播放',
|
||||||
subTitle: 'app切换至后台时画中画播放',
|
subTitle: '进入后台时画中画播放',
|
||||||
setKey: SettingBoxKey.autoPiP,
|
setKey: SettingBoxKey.autoPiP,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
@ -149,23 +150,21 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
'当前画质${VideoQualityCode.fromCode(defaultVideoQa)!.description!}',
|
'当前画质${VideoQualityCode.fromCode(defaultVideoQa)!.description!}',
|
||||||
style: subTitleStyle,
|
style: subTitleStyle,
|
||||||
),
|
),
|
||||||
trailing: PopupMenuButton(
|
onTap: () async {
|
||||||
initialValue: defaultVideoQa,
|
int? result = await showDialog(
|
||||||
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
context: context,
|
||||||
onSelected: (item) {
|
builder: (context) {
|
||||||
defaultVideoQa = item;
|
return SelectDialog<int>(title: '默认画质', value: defaultVideoQa, values: VideoQuality.values.reversed.map((e) {
|
||||||
setting.put(SettingBoxKey.defaultVideoQa, item);
|
return {'title': e.description, 'value': e.code};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
defaultVideoQa = result;
|
||||||
|
setting.put(SettingBoxKey.defaultVideoQa, result);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
}
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
},
|
||||||
for (var i in VideoQuality.values.reversed) ...[
|
|
||||||
PopupMenuItem(
|
|
||||||
value: i.code,
|
|
||||||
child: Text(i.description),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
@ -174,23 +173,21 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
'当前音质${AudioQualityCode.fromCode(defaultAudioQa)!.description!}',
|
'当前音质${AudioQualityCode.fromCode(defaultAudioQa)!.description!}',
|
||||||
style: subTitleStyle,
|
style: subTitleStyle,
|
||||||
),
|
),
|
||||||
trailing: PopupMenuButton(
|
onTap: () async {
|
||||||
initialValue: defaultAudioQa,
|
int? result = await showDialog(
|
||||||
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
context: context,
|
||||||
onSelected: (item) {
|
builder: (context) {
|
||||||
defaultAudioQa = item;
|
return SelectDialog<int>(title: '默认音质', value: defaultAudioQa, values: AudioQuality.values.reversed.map((e) {
|
||||||
setting.put(SettingBoxKey.defaultAudioQa, item);
|
return {'title': e.description, 'value': e.code};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
defaultAudioQa = result;
|
||||||
|
setting.put(SettingBoxKey.defaultAudioQa, result);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
}
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
},
|
||||||
for (var i in AudioQuality.values.reversed) ...[
|
|
||||||
PopupMenuItem(
|
|
||||||
value: i.code,
|
|
||||||
child: Text(i.description),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
@ -199,23 +196,21 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
'当前解码格式${VideoDecodeFormatsCode.fromCode(defaultDecode)!.description!}',
|
'当前解码格式${VideoDecodeFormatsCode.fromCode(defaultDecode)!.description!}',
|
||||||
style: subTitleStyle,
|
style: subTitleStyle,
|
||||||
),
|
),
|
||||||
trailing: PopupMenuButton(
|
onTap: () async {
|
||||||
initialValue: defaultDecode,
|
String? result = await showDialog(
|
||||||
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
context: context,
|
||||||
onSelected: (item) {
|
builder: (context) {
|
||||||
defaultDecode = item;
|
return SelectDialog<String>(title: '默认解码格式', value: defaultDecode, values: VideoDecodeFormats.values.map((e) {
|
||||||
setting.put(SettingBoxKey.defaultDecode, item);
|
return {'title': e.description, 'value': e.code};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
defaultDecode = result;
|
||||||
|
setting.put(SettingBoxKey.defaultDecode, result);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
}
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
},
|
||||||
for (var i in VideoDecodeFormats.values) ...[
|
|
||||||
PopupMenuItem(
|
|
||||||
value: i.code,
|
|
||||||
child: Text(i.description),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
@ -224,23 +219,21 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
'当前全屏方式:${FullScreenModeCode.fromCode(defaultFullScreenMode)!.description}',
|
'当前全屏方式:${FullScreenModeCode.fromCode(defaultFullScreenMode)!.description}',
|
||||||
style: subTitleStyle,
|
style: subTitleStyle,
|
||||||
),
|
),
|
||||||
trailing: PopupMenuButton(
|
onTap: () async {
|
||||||
initialValue: defaultFullScreenMode,
|
int? result = await showDialog(
|
||||||
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
context: context,
|
||||||
onSelected: (item) {
|
builder: (context) {
|
||||||
defaultFullScreenMode = item;
|
return SelectDialog<int>(title: '默认全屏方式', value: defaultFullScreenMode, values: FullScreenMode.values.map((e) {
|
||||||
setting.put(SettingBoxKey.fullScreenMode, item);
|
return {'title': e.description, 'value': e.code};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
defaultFullScreenMode = result;
|
||||||
|
setting.put(SettingBoxKey.fullScreenMode, result);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
}
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
},
|
||||||
for (var i in FullScreenMode.values) ...[
|
|
||||||
PopupMenuItem(
|
|
||||||
value: i.code,
|
|
||||||
child: Text(i.description),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
@ -249,23 +242,21 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
'当前展示方式:${BtmProgresBehaviorCode.fromCode(defaultBtmProgressBehavior)!.description}',
|
'当前展示方式:${BtmProgresBehaviorCode.fromCode(defaultBtmProgressBehavior)!.description}',
|
||||||
style: subTitleStyle,
|
style: subTitleStyle,
|
||||||
),
|
),
|
||||||
trailing: PopupMenuButton(
|
onTap: () async {
|
||||||
initialValue: defaultBtmProgressBehavior,
|
int? result = await showDialog(
|
||||||
icon: const Icon(Icons.more_vert_outlined, size: 22),
|
context: context,
|
||||||
onSelected: (item) {
|
builder: (context) {
|
||||||
defaultBtmProgressBehavior = item;
|
return SelectDialog<int>(title: '底部进度条展示', value: defaultBtmProgressBehavior, values: BtmProgresBehavior.values.map((e) {
|
||||||
setting.put(SettingBoxKey.btmProgressBehavior, item);
|
return {'title': e.description, 'value': e.code};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
defaultBtmProgressBehavior = result;
|
||||||
|
setting.put(SettingBoxKey.btmProgressBehavior, result);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
}
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
},
|
||||||
for (var i in BtmProgresBehavior.values) ...[
|
|
||||||
PopupMenuItem(
|
|
||||||
value: i.code,
|
|
||||||
child: Text(i.description),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -2,6 +2,7 @@ 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/member.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class PrivacySetting extends StatefulWidget {
|
class PrivacySetting extends StatefulWidget {
|
||||||
@ -53,6 +54,16 @@ class _PrivacySettingState extends State<PrivacySetting> {
|
|||||||
title: Text('黑名单管理', style: titleStyle),
|
title: Text('黑名单管理', style: titleStyle),
|
||||||
subtitle: Text('已拉黑用户', style: subTitleStyle),
|
subtitle: Text('已拉黑用户', style: subTitleStyle),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () {
|
||||||
|
if (!userLogin) {
|
||||||
|
SmartDialog.showToast('请先登录');
|
||||||
|
}
|
||||||
|
MemberHttp.cookieToKey();
|
||||||
|
},
|
||||||
|
dense: false,
|
||||||
|
title: Text('刷新access_key', style: titleStyle),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -4,6 +4,8 @@ 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/models/common/theme_type.dart';
|
import 'package:pilipala/models/common/theme_type.dart';
|
||||||
|
import 'package:pilipala/pages/setting/pages/color_select.dart';
|
||||||
|
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
@ -18,6 +20,8 @@ class StyleSetting extends StatefulWidget {
|
|||||||
|
|
||||||
class _StyleSettingState extends State<StyleSetting> {
|
class _StyleSettingState extends State<StyleSetting> {
|
||||||
final SettingController settingController = Get.put(SettingController());
|
final SettingController settingController = Get.put(SettingController());
|
||||||
|
final ColorSelectController colorSelectController = Get.put(ColorSelectController());
|
||||||
|
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
late int picQuality;
|
late int picQuality;
|
||||||
late ThemeType _tempThemeValue;
|
late ThemeType _tempThemeValue;
|
||||||
@ -56,6 +60,7 @@ class _StyleSettingState extends State<StyleSetting> {
|
|||||||
title: const Text('震动反馈'),
|
title: const Text('震动反馈'),
|
||||||
subtitle: Text('请确定手机设置中已开启震动反馈', style: subTitleStyle),
|
subtitle: Text('请确定手机设置中已开启震动反馈', style: subTitleStyle),
|
||||||
trailing: Transform.scale(
|
trailing: Transform.scale(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
scale: 0.8,
|
scale: 0.8,
|
||||||
child: Switch(
|
child: Switch(
|
||||||
thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
||||||
@ -83,37 +88,42 @@ class _StyleSettingState extends State<StyleSetting> {
|
|||||||
setKey: SettingBoxKey.enableMYBar,
|
setKey: SettingBoxKey.enableMYBar,
|
||||||
defaultVal: true,
|
defaultVal: true,
|
||||||
),
|
),
|
||||||
// SetSwitchItem(
|
const SetSwitchItem(
|
||||||
// title: '首页单列',
|
title: '首页顶栏收起',
|
||||||
// subTitle: '每行展示一个内容卡片',
|
subTitle: '首页列表滑动时,收起顶栏',
|
||||||
// setKey: SettingBoxKey.enableSingleRow,
|
setKey: SettingBoxKey.hideSearchBar,
|
||||||
// defaultVal: false,
|
defaultVal: true,
|
||||||
// callFn: (val) => {SmartDialog.showToast('下次启动时生效')},
|
needReboot: true,
|
||||||
// ),
|
),
|
||||||
|
const SetSwitchItem(
|
||||||
|
title: '首页底栏收起',
|
||||||
|
subTitle: '首页列表滑动时,收起底栏',
|
||||||
|
setKey: SettingBoxKey.hideTabBar,
|
||||||
|
defaultVal: true,
|
||||||
|
needReboot: true,
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
onTap: () async {
|
||||||
|
int? result = await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return SelectDialog<int>(title: '自定义列数', value: defaultCustomRows, values: [1, 2, 3, 4, 5].map((e) {
|
||||||
|
return {'title': '$e 列', 'value': e};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
defaultCustomRows = result;
|
||||||
|
setting.put(SettingBoxKey.customRows, result);
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
},
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text('自定义列数', style: titleStyle),
|
title: Text('自定义列数', style: titleStyle),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'当前列数',
|
'当前列数 $defaultCustomRows 列',
|
||||||
style: subTitleStyle,
|
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,
|
||||||
@ -169,88 +179,58 @@ class _StyleSettingState extends State<StyleSetting> {
|
|||||||
},
|
},
|
||||||
title: Text('图片质量', style: titleStyle),
|
title: Text('图片质量', style: titleStyle),
|
||||||
subtitle: Text('选择合适的图片清晰度,上限100%', style: subTitleStyle),
|
subtitle: Text('选择合适的图片清晰度,上限100%', style: subTitleStyle),
|
||||||
trailing: Obx(
|
trailing: Padding(
|
||||||
() => Text(
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
'${settingController.picQuality.value}%',
|
child: Obx(
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
() => Text(
|
||||||
|
'${settingController.picQuality.value}%',
|
||||||
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
showDialog(
|
ThemeType? result = await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return SelectDialog<ThemeType>(title: '主题模式', value: _tempThemeValue, values: ThemeType.values.map((e) {
|
||||||
title: const Text('主题模式'),
|
return {'title': e.description, 'value': e};
|
||||||
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
|
}).toList());
|
||||||
content: StatefulBuilder(
|
|
||||||
builder: (context, StateSetter setState) {
|
|
||||||
return Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
for (var i in ThemeType.values) ...[
|
|
||||||
RadioListTile(
|
|
||||||
value: i,
|
|
||||||
title: Text(i.description, style: titleStyle),
|
|
||||||
groupValue: _tempThemeValue,
|
|
||||||
onChanged: (ThemeType? value) {
|
|
||||||
setState(() {
|
|
||||||
_tempThemeValue = i;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.pop(context),
|
|
||||||
child: Text(
|
|
||||||
'取消',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.outline),
|
|
||||||
)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
settingController.themeType.value = _tempThemeValue;
|
|
||||||
setting.put(
|
|
||||||
SettingBoxKey.themeMode, _tempThemeValue.code);
|
|
||||||
Get.forceAppUpdate();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: const Text('确定'))
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
if (result != null) {
|
||||||
|
_tempThemeValue = result;
|
||||||
|
settingController.themeType.value = result;
|
||||||
|
setting.put(
|
||||||
|
SettingBoxKey.themeMode, result.code);
|
||||||
|
Get.forceAppUpdate();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
title: Text('主题模式', style: titleStyle),
|
title: Text('主题模式', style: titleStyle),
|
||||||
subtitle: Obx(() => Text(
|
subtitle: Obx(() => Text(
|
||||||
'当前模式:${settingController.themeType.value.description}',
|
'当前模式:${settingController.themeType.value.description}',
|
||||||
style: subTitleStyle)),
|
style: subTitleStyle)),
|
||||||
trailing: const Icon(Icons.arrow_right_alt_outlined),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
onTap: () => Get.toNamed('/colorSetting'),
|
onTap: () => Get.toNamed('/colorSetting'),
|
||||||
title: Text('应用主题', style: titleStyle),
|
title: Text('应用主题', style: titleStyle),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 17),
|
subtitle: Obx(() => Text(
|
||||||
|
'当前主题:${colorSelectController.type.value == 0 ? '动态取色': '指定颜色'}',
|
||||||
|
style: subTitleStyle)),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
onTap: () => Get.toNamed('/fontSizeSetting'),
|
onTap: () => Get.toNamed('/fontSizeSetting'),
|
||||||
title: Text('字体大小', style: titleStyle),
|
title: Text('字体大小', style: titleStyle),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 17),
|
|
||||||
),
|
),
|
||||||
if (Platform.isAndroid)
|
if (Platform.isAndroid)
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
onTap: () => Get.toNamed('/displayModeSetting'),
|
onTap: () => Get.toNamed('/displayModeSetting'),
|
||||||
title: Text('屏幕帧率', style: titleStyle),
|
title: Text('屏幕帧率', style: titleStyle),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 17),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
68
lib/pages/setting/widgets/select_dialog.dart
Normal file
68
lib/pages/setting/widgets/select_dialog.dart
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pilipala/models/common/theme_type.dart';
|
||||||
|
|
||||||
|
class SelectDialog<T> extends StatefulWidget {
|
||||||
|
final T value;
|
||||||
|
final String title;
|
||||||
|
final List<dynamic> values;
|
||||||
|
const SelectDialog({super.key, required this.value, required this.values, required this.title});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SelectDialogState<T> createState() => _SelectDialogState<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectDialogState<T> extends State<SelectDialog<T>> {
|
||||||
|
|
||||||
|
late T _tempValue;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_tempValue = widget.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
TextStyle titleStyle = Theme.of(context).textTheme.titleMedium!;
|
||||||
|
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(widget.title),
|
||||||
|
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
|
||||||
|
content: StatefulBuilder(
|
||||||
|
builder: (context, StateSetter setState) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
for (var i in widget.values) ...[
|
||||||
|
RadioListTile(
|
||||||
|
value: i['value'],
|
||||||
|
title: Text(i['title'], style: titleStyle),
|
||||||
|
groupValue: _tempValue,
|
||||||
|
onChanged: (value) {
|
||||||
|
print(value);
|
||||||
|
setState(() {
|
||||||
|
_tempValue = value as T;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
child: Text(
|
||||||
|
'取消',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline),
|
||||||
|
)),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context, _tempValue),
|
||||||
|
child: const Text('确定'))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package: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';
|
||||||
@ -9,6 +10,7 @@ class SetSwitchItem extends StatefulWidget {
|
|||||||
final String? setKey;
|
final String? setKey;
|
||||||
final bool? defaultVal;
|
final bool? defaultVal;
|
||||||
final Function? callFn;
|
final Function? callFn;
|
||||||
|
final bool? needReboot;
|
||||||
|
|
||||||
const SetSwitchItem({
|
const SetSwitchItem({
|
||||||
this.title,
|
this.title,
|
||||||
@ -16,6 +18,7 @@ class SetSwitchItem extends StatefulWidget {
|
|||||||
this.setKey,
|
this.setKey,
|
||||||
this.defaultVal,
|
this.defaultVal,
|
||||||
this.callFn,
|
this.callFn,
|
||||||
|
this.needReboot,
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@ -43,6 +46,9 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
|
|||||||
if (widget.callFn != null) {
|
if (widget.callFn != null) {
|
||||||
widget.callFn!.call(val);
|
widget.callFn!.call(val);
|
||||||
}
|
}
|
||||||
|
if (widget.needReboot != null && widget.needReboot!) {
|
||||||
|
SmartDialog.showToast('重启生效');
|
||||||
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +67,7 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
|
|||||||
? Text(widget.subTitle!, style: subTitleStyle)
|
? Text(widget.subTitle!, style: subTitleStyle)
|
||||||
: null,
|
: null,
|
||||||
trailing: Transform.scale(
|
trailing: Transform.scale(
|
||||||
|
alignment: Alignment.centerRight, // 缩放Switch的大小后保持右侧对齐, 避免右侧空隙过大
|
||||||
scale: 0.8,
|
scale: 0.8,
|
||||||
child: Switch(
|
child: Switch(
|
||||||
thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
||||||
|
@ -76,6 +76,7 @@ class VideoIntroController extends GetxController {
|
|||||||
if (Get.arguments.containsKey('videoItem')) {
|
if (Get.arguments.containsKey('videoItem')) {
|
||||||
preRender = true;
|
preRender = true;
|
||||||
var args = Get.arguments['videoItem'];
|
var args = Get.arguments['videoItem'];
|
||||||
|
var keys = Get.arguments.keys.toList();
|
||||||
videoItem!['pic'] = args.pic;
|
videoItem!['pic'] = args.pic;
|
||||||
if (args.title is String) {
|
if (args.title is String) {
|
||||||
videoItem!['title'] = args.title;
|
videoItem!['title'] = args.title;
|
||||||
@ -86,11 +87,9 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
videoItem!['title'] = str;
|
videoItem!['title'] = str;
|
||||||
}
|
}
|
||||||
if (args.stat != null) {
|
videoItem!['stat'] = keys.contains('stat') && args.stat;
|
||||||
videoItem!['stat'] = args.stat;
|
videoItem!['pubdate'] = keys.contains('pubdate') && args.pubdate;
|
||||||
}
|
videoItem!['owner'] = keys.contains('owner') && args.owner;
|
||||||
videoItem!['pubdate'] = args.pubdate;
|
|
||||||
videoItem!['owner'] = args.owner;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userLogin = userInfo != null;
|
userLogin = userInfo != null;
|
||||||
@ -569,13 +568,7 @@ class VideoIntroController extends GetxController {
|
|||||||
upMid: videoDetail.value.owner!.mid!,
|
upMid: videoDetail.value.owner!.mid!,
|
||||||
);
|
);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
if (res['data'].modelResult.resultType == 0) {
|
modelResult = res['data'].modelResult;
|
||||||
SmartDialog.showToast('该视频不支持ai总结');
|
|
||||||
}
|
|
||||||
if (res['data'].modelResult.resultType == 2 ||
|
|
||||||
res['data'].modelResult.resultType == 1) {
|
|
||||||
modelResult = res['data'].modelResult;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
return res;
|
return res;
|
||||||
|
@ -12,7 +12,6 @@ import 'package:pilipala/common/widgets/stat/view.dart';
|
|||||||
import 'package:pilipala/models/video_detail_res.dart';
|
import 'package:pilipala/models/video_detail_res.dart';
|
||||||
import 'package:pilipala/pages/video/detail/introduction/controller.dart';
|
import 'package:pilipala/pages/video/detail/introduction/controller.dart';
|
||||||
import 'package:pilipala/pages/video/detail/widgets/ai_detail.dart';
|
import 'package:pilipala/pages/video/detail/widgets/ai_detail.dart';
|
||||||
import 'package:pilipala/services/service_locator.dart';
|
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.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';
|
||||||
@ -134,6 +133,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
late final dynamic followStatus;
|
late final dynamic followStatus;
|
||||||
late int mid;
|
late int mid;
|
||||||
late String memberHeroTag;
|
late String memberHeroTag;
|
||||||
|
late bool enableAi;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -150,6 +150,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
? '-'
|
? '-'
|
||||||
: Utils.numFormat(videoIntroController.userStat['follower']);
|
: Utils.numFormat(videoIntroController.userStat['follower']);
|
||||||
followStatus = videoIntroController.followStatus;
|
followStatus = videoIntroController.followStatus;
|
||||||
|
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收藏
|
// 收藏
|
||||||
@ -247,7 +248,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: StyleString.safeSpace, right: StyleString.safeSpace, top: 10),
|
left: StyleString.safeSpace, right: StyleString.safeSpace, top: 10),
|
||||||
sliver: SliverToBoxAdapter(
|
sliver: SliverToBoxAdapter(
|
||||||
child: !loadingStatus || videoItem.isNotEmpty
|
child: !loadingStatus
|
||||||
? Column(
|
? Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -277,7 +278,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
children: [
|
children: [
|
||||||
StatView(
|
StatView(
|
||||||
theme: 'gray',
|
theme: 'gray',
|
||||||
view: !widget.loadingStatus
|
view: !loadingStatus
|
||||||
? widget.videoDetail!.stat!.view
|
? widget.videoDetail!.stat!.view
|
||||||
: videoItem['stat'].view,
|
: videoItem['stat'].view,
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
@ -285,7 +286,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
StatDanMu(
|
StatDanMu(
|
||||||
theme: 'gray',
|
theme: 'gray',
|
||||||
danmu: !widget.loadingStatus
|
danmu: !loadingStatus
|
||||||
? widget.videoDetail!.stat!.danmaku
|
? widget.videoDetail!.stat!.danmaku
|
||||||
: videoItem['stat'].danmaku,
|
: videoItem['stat'].danmaku,
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
@ -293,7 +294,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(
|
Text(
|
||||||
Utils.dateFormat(
|
Utils.dateFormat(
|
||||||
!widget.loadingStatus
|
!loadingStatus
|
||||||
? widget.videoDetail!.pubdate
|
? widget.videoDetail!.pubdate
|
||||||
: videoItem['pubdate'],
|
: videoItem['pubdate'],
|
||||||
formatType: 'detail'),
|
formatType: 'detail'),
|
||||||
@ -317,23 +318,22 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
if (enableAi)
|
||||||
right: 10,
|
Positioned(
|
||||||
top: 6,
|
right: 10,
|
||||||
child: GestureDetector(
|
top: 6,
|
||||||
onTap: () async {
|
child: GestureDetector(
|
||||||
var res = await videoIntroController.aiConclusion();
|
onTap: () async {
|
||||||
if (res['status']) {
|
var res =
|
||||||
if (res['data'].modelResult.resultType == 2 ||
|
await videoIntroController.aiConclusion();
|
||||||
res['data'].modelResult.resultType == 1) {
|
if (res['status']) {
|
||||||
showAiBottomSheet();
|
showAiBottomSheet();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
child:
|
||||||
child:
|
Image.asset('assets/images/ai.png', height: 22),
|
||||||
Image.asset('assets/images/ai.png', height: 22),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// 点赞收藏转发 布局样式1
|
// 点赞收藏转发 布局样式1
|
||||||
|
@ -218,7 +218,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState lifecycleState) {
|
void didChangeAppLifecycleState(AppLifecycleState lifecycleState) {
|
||||||
if (lifecycleState == AppLifecycleState.inactive && autoPiP) {
|
var routePath = Get.currentRoute;
|
||||||
|
if (lifecycleState == AppLifecycleState.inactive &&
|
||||||
|
autoPiP &&
|
||||||
|
routePath.startsWith('/video')) {
|
||||||
floating.enable(
|
floating.enable(
|
||||||
aspectRatio: Rational(
|
aspectRatio: Rational(
|
||||||
videoDetailController.data.dash!.video!.first.width!,
|
videoDetailController.data.dash!.video!.first.width!,
|
||||||
|
@ -15,6 +15,7 @@ import 'package:pilipala/pages/video/detail/introduction/widgets/menu_row.dart';
|
|||||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
import 'package:pilipala/http/danmaku.dart';
|
||||||
|
|
||||||
class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
||||||
final PlPlayerController? controller;
|
final PlPlayerController? controller;
|
||||||
@ -179,6 +180,84 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 发送弹幕
|
||||||
|
void showShootDanmakuSheet() {
|
||||||
|
final TextEditingController textController = TextEditingController();
|
||||||
|
bool isSending = false; // 追踪是否正在发送
|
||||||
|
showDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
// TODO: 支持更多类型和颜色的弹幕
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('发送弹幕(测试)'),
|
||||||
|
content: StatefulBuilder(builder: (context, StateSetter setState) {
|
||||||
|
return TextField(
|
||||||
|
controller: textController,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Get.back(),
|
||||||
|
child: Text(
|
||||||
|
'取消',
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
StatefulBuilder(builder: (context, StateSetter setState) {
|
||||||
|
return TextButton(
|
||||||
|
onPressed: isSending
|
||||||
|
? null
|
||||||
|
: () async {
|
||||||
|
String msg = textController.text;
|
||||||
|
if (msg.isEmpty) {
|
||||||
|
SmartDialog.showToast('弹幕内容不能为空');
|
||||||
|
return;
|
||||||
|
} else if (msg.length > 100) {
|
||||||
|
SmartDialog.showToast('弹幕内容不能超过100个字符');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
isSending = true; // 开始发送,更新状态
|
||||||
|
});
|
||||||
|
//修改按钮文字
|
||||||
|
// SmartDialog.showToast('弹幕发送中,\n$msg');
|
||||||
|
dynamic res = await DanmakaHttp.shootDanmaku(
|
||||||
|
oid: widget.videoDetailCtr!.cid!.value,
|
||||||
|
msg: textController.text,
|
||||||
|
bvid: widget.videoDetailCtr!.bvid!,
|
||||||
|
progress:
|
||||||
|
widget.controller!.position.value.inMilliseconds,
|
||||||
|
type: 1,
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
isSending = false; // 发送结束,更新状态
|
||||||
|
});
|
||||||
|
if (res['status']) {
|
||||||
|
SmartDialog.showToast('发送成功');
|
||||||
|
// 发送成功,自动预览该弹幕,避免重新请求
|
||||||
|
// TODO: 暂停状态下预览弹幕仍会移动与计时,可考虑添加到dmSegList或其他方式实现
|
||||||
|
widget.controller!.danmakuController!.addItems([
|
||||||
|
DanmakuItem(
|
||||||
|
msg,
|
||||||
|
color: Colors.white,
|
||||||
|
time: widget.controller!.position.value.inMilliseconds,
|
||||||
|
type: DanmakuItemType.scroll,
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
Get.back();
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast('发送失败,错误信息为${res['msg']}');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Text(isSending ? '发送中...' : '发送'),
|
||||||
|
);
|
||||||
|
})
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// 选择倍速
|
/// 选择倍速
|
||||||
void showSetSpeedSheet() {
|
void showSetSpeedSheet() {
|
||||||
double currentSpeed = widget.controller!.playbackSpeed;
|
double currentSpeed = widget.controller!.playbackSpeed;
|
||||||
@ -825,6 +904,20 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
// ),
|
// ),
|
||||||
// fuc: () => _.screenshot(),
|
// fuc: () => _.screenshot(),
|
||||||
// ),
|
// ),
|
||||||
|
SizedBox(
|
||||||
|
width: 56,
|
||||||
|
height: 34,
|
||||||
|
child: TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
|
),
|
||||||
|
onPressed: () => showShootDanmakuSheet(),
|
||||||
|
child: const Text(
|
||||||
|
'发弹幕',
|
||||||
|
style: textStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 34,
|
width: 34,
|
||||||
height: 34,
|
height: 34,
|
||||||
|
@ -6,6 +6,7 @@ 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/init.dart';
|
import 'package:pilipala/http/init.dart';
|
||||||
|
import 'package:pilipala/http/member.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/pages/home/index.dart';
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
import 'package:pilipala/pages/media/index.dart';
|
import 'package:pilipala/pages/media/index.dart';
|
||||||
@ -102,7 +103,6 @@ class WebviewController extends GetxController {
|
|||||||
try {
|
try {
|
||||||
await SetCookie.onSet();
|
await SetCookie.onSet();
|
||||||
var result = await UserHttp.userInfo();
|
var result = await UserHttp.userInfo();
|
||||||
UserHttp.thirdLogin();
|
|
||||||
if (result['status'] && result['data'].isLogin) {
|
if (result['status'] && result['data'].isLogin) {
|
||||||
SmartDialog.showToast('登录成功');
|
SmartDialog.showToast('登录成功');
|
||||||
try {
|
try {
|
||||||
@ -115,6 +115,7 @@ class WebviewController extends GetxController {
|
|||||||
MediaController mediaCtr = Get.find<MediaController>();
|
MediaController mediaCtr = Get.find<MediaController>();
|
||||||
mediaCtr.mid = result['data'].mid;
|
mediaCtr.mid = result['data'].mid;
|
||||||
await LoginUtils.refreshLoginStatus(true);
|
await LoginUtils.refreshLoginStatus(true);
|
||||||
|
MemberHttp.cookieToKey();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
SmartDialog.show(builder: (context) {
|
SmartDialog.show(builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
// ignore_for_file: avoid_print
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
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_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
|
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
@ -337,7 +337,7 @@ class PlPlayerController {
|
|||||||
if (!_listenersInitialized) {
|
if (!_listenersInitialized) {
|
||||||
startListeners();
|
startListeners();
|
||||||
}
|
}
|
||||||
await _initializePlayer(seekTo: seekTo);
|
await _initializePlayer(seekTo: seekTo, duration: _duration.value);
|
||||||
bool autoEnterFullcreen =
|
bool autoEnterFullcreen =
|
||||||
setting.get(SettingBoxKey.enableAutoEnter, defaultValue: false);
|
setting.get(SettingBoxKey.enableAutoEnter, defaultValue: false);
|
||||||
if (autoEnterFullcreen && _isFirstTime) {
|
if (autoEnterFullcreen && _isFirstTime) {
|
||||||
@ -380,8 +380,10 @@ class PlPlayerController {
|
|||||||
// 解除倍速限制
|
// 解除倍速限制
|
||||||
await pp.setProperty("af", "scaletempo2=max-speed=8");
|
await pp.setProperty("af", "scaletempo2=max-speed=8");
|
||||||
// 音量不一致
|
// 音量不一致
|
||||||
await pp.setProperty("volume-max", "100");
|
if (Platform.isAndroid) {
|
||||||
await pp.setProperty("ao", "audiotrack,opensles");
|
await pp.setProperty("volume-max", "100");
|
||||||
|
await pp.setProperty("ao", "audiotrack,opensles");
|
||||||
|
}
|
||||||
|
|
||||||
// 音轨
|
// 音轨
|
||||||
if (dataSource.audioSource != '' && dataSource.audioSource != null) {
|
if (dataSource.audioSource != '' && dataSource.audioSource != null) {
|
||||||
@ -441,12 +443,17 @@ class PlPlayerController {
|
|||||||
// 开始播放
|
// 开始播放
|
||||||
Future _initializePlayer({
|
Future _initializePlayer({
|
||||||
Duration seekTo = Duration.zero,
|
Duration seekTo = Duration.zero,
|
||||||
|
Duration? duration,
|
||||||
}) async {
|
}) async {
|
||||||
// 设置倍速
|
// 设置倍速
|
||||||
if (_playbackSpeed.value != 1.0) {
|
if (videoType.value == 'live') {
|
||||||
await setPlaybackSpeed(_playbackSpeed.value);
|
|
||||||
} else {
|
|
||||||
await setPlaybackSpeed(1.0);
|
await setPlaybackSpeed(1.0);
|
||||||
|
} else {
|
||||||
|
if (_playbackSpeed.value != 1.0) {
|
||||||
|
await setPlaybackSpeed(_playbackSpeed.value);
|
||||||
|
} else {
|
||||||
|
await setPlaybackSpeed(1.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getVideoFit();
|
getVideoFit();
|
||||||
// if (_looping) {
|
// if (_looping) {
|
||||||
@ -460,7 +467,7 @@ class PlPlayerController {
|
|||||||
|
|
||||||
// 自动播放
|
// 自动播放
|
||||||
if (_autoPlay) {
|
if (_autoPlay) {
|
||||||
await play();
|
await play(duration: duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,6 +596,7 @@ class PlPlayerController {
|
|||||||
|
|
||||||
/// 设置倍速
|
/// 设置倍速
|
||||||
Future<void> setPlaybackSpeed(double speed) async {
|
Future<void> setPlaybackSpeed(double speed) async {
|
||||||
|
/// TODO _duration.value丢失
|
||||||
await _videoPlayerController?.setRate(speed);
|
await _videoPlayerController?.setRate(speed);
|
||||||
try {
|
try {
|
||||||
DanmakuOption currentOption = danmakuController!.option;
|
DanmakuOption currentOption = danmakuController!.option;
|
||||||
@ -624,7 +632,9 @@ class PlPlayerController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/// 播放视频
|
/// 播放视频
|
||||||
Future<void> play({bool repeat = false, bool hideControls = true}) async {
|
/// TODO _duration.value丢失
|
||||||
|
Future<void> play(
|
||||||
|
{bool repeat = false, bool hideControls = true, dynamic duration}) async {
|
||||||
// 播放时自动隐藏控制条
|
// 播放时自动隐藏控制条
|
||||||
controls = !hideControls;
|
controls = !hideControls;
|
||||||
// repeat为true,将从头播放
|
// repeat为true,将从头播放
|
||||||
@ -638,6 +648,11 @@ class PlPlayerController {
|
|||||||
|
|
||||||
playerStatus.status.value = PlayerStatus.playing;
|
playerStatus.status.value = PlayerStatus.playing;
|
||||||
// screenManager.setOverlays(false);
|
// screenManager.setOverlays(false);
|
||||||
|
|
||||||
|
/// 临时fix _duration.value丢失
|
||||||
|
if (duration != null) {
|
||||||
|
_duration.value = duration;
|
||||||
|
}
|
||||||
audioSessionHandler.setActive(true);
|
audioSessionHandler.setActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,12 @@ import 'package:pilipala/pages/later/index.dart';
|
|||||||
import 'package:pilipala/pages/liveRoom/view.dart';
|
import 'package:pilipala/pages/liveRoom/view.dart';
|
||||||
import 'package:pilipala/pages/login/index.dart';
|
import 'package:pilipala/pages/login/index.dart';
|
||||||
import 'package:pilipala/pages/member/index.dart';
|
import 'package:pilipala/pages/member/index.dart';
|
||||||
|
import 'package:pilipala/pages/member_archive/index.dart';
|
||||||
|
import 'package:pilipala/pages/member_coin/index.dart';
|
||||||
|
import 'package:pilipala/pages/member_dynamics/index.dart';
|
||||||
|
import 'package:pilipala/pages/member_like/index.dart';
|
||||||
import 'package:pilipala/pages/member_search/index.dart';
|
import 'package:pilipala/pages/member_search/index.dart';
|
||||||
import 'package:pilipala/pages/preview/index.dart';
|
import 'package:pilipala/pages/member_seasons/index.dart';
|
||||||
import 'package:pilipala/pages/search/index.dart';
|
import 'package:pilipala/pages/search/index.dart';
|
||||||
import 'package:pilipala/pages/searchResult/index.dart';
|
import 'package:pilipala/pages/searchResult/index.dart';
|
||||||
import 'package:pilipala/pages/setting/extra_setting.dart';
|
import 'package:pilipala/pages/setting/extra_setting.dart';
|
||||||
@ -132,6 +136,19 @@ class Routes {
|
|||||||
name: '/whisperDetail', page: () => const WhisperDetailPage()),
|
name: '/whisperDetail', page: () => const WhisperDetailPage()),
|
||||||
// 登录页面
|
// 登录页面
|
||||||
CustomGetPage(name: '/loginPage', page: () => const LoginPage()),
|
CustomGetPage(name: '/loginPage', page: () => const LoginPage()),
|
||||||
|
// 用户动态
|
||||||
|
CustomGetPage(
|
||||||
|
name: '/memberDynamics', page: () => const MemberDynamicsPage()),
|
||||||
|
// 用户投稿
|
||||||
|
CustomGetPage(
|
||||||
|
name: '/memberArchive', page: () => const MemberArchivePage()),
|
||||||
|
// 用户最近投币
|
||||||
|
CustomGetPage(name: '/memberCoin', page: () => const MemberCoinPage()),
|
||||||
|
// 用户最近喜欢
|
||||||
|
CustomGetPage(name: '/memberLike', page: () => const MemberLikePage()),
|
||||||
|
// 用户专栏
|
||||||
|
CustomGetPage(
|
||||||
|
name: '/memberSeasons', page: () => const MemberSeasonsPage()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@ class SettingBoxKey {
|
|||||||
static const String enableRcmdDynamic = 'enableRcmdDynamic';
|
static const String enableRcmdDynamic = 'enableRcmdDynamic';
|
||||||
static const String enableSaveLastData = 'enableSaveLastData';
|
static const String enableSaveLastData = 'enableSaveLastData';
|
||||||
static const String enableSystemProxy = 'enableSystemProxy';
|
static const String enableSystemProxy = 'enableSystemProxy';
|
||||||
|
static const String enableAi = 'enableAi';
|
||||||
|
|
||||||
/// 外观
|
/// 外观
|
||||||
static const String themeMode = 'themeMode';
|
static const String themeMode = 'themeMode';
|
||||||
@ -138,6 +139,8 @@ class SettingBoxKey {
|
|||||||
static const String displayMode = 'displayMode';
|
static const String displayMode = 'displayMode';
|
||||||
static const String customRows = 'customRows'; // 自定义列
|
static const String customRows = 'customRows'; // 自定义列
|
||||||
static const String enableMYBar = 'enableMYBar';
|
static const String enableMYBar = 'enableMYBar';
|
||||||
|
static const String hideSearchBar = 'hideSearchBar'; // 收起顶栏
|
||||||
|
static const String hideTabBar = 'hideTabBar'; // 收起底栏
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocalCacheKey {
|
class LocalCacheKey {
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
// ignore_for_file: non_constant_identifier_names
|
// ignore_for_file: non_constant_identifier_names
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
@ -146,7 +148,7 @@ class Utils {
|
|||||||
int.parse(MM) == DateTime.now().month) {
|
int.parse(MM) == DateTime.now().month) {
|
||||||
// 当天
|
// 当天
|
||||||
if (int.parse(DD) == DateTime.now().day) {
|
if (int.parse(DD) == DateTime.now().day) {
|
||||||
return date.split(' ')[1];
|
return '今天';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return date;
|
return date;
|
||||||
@ -297,4 +299,18 @@ class Utils {
|
|||||||
|
|
||||||
return '$formattedHours:$formattedMinutes';
|
return '$formattedHours:$formattedMinutes';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String appSign(
|
||||||
|
Map<String, dynamic> params, String appkey, String appsec) {
|
||||||
|
params['appkey'] = appkey;
|
||||||
|
var searchParams = Uri(queryParameters: params).query;
|
||||||
|
var sortedParams = searchParams.split('&')..sort();
|
||||||
|
var sortedQueryString = sortedParams.join('&');
|
||||||
|
|
||||||
|
var appsecString = sortedQueryString + appsec;
|
||||||
|
var md5Digest = md5.convert(utf8.encode(appsecString));
|
||||||
|
var md5String = md5Digest.toString(); // 获取MD5哈希值
|
||||||
|
|
||||||
|
return md5String;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||||||
FlutterVolumeControllerPlugin.register(with: registry.registrar(forPlugin: "FlutterVolumeControllerPlugin"))
|
FlutterVolumeControllerPlugin.register(with: registry.registrar(forPlugin: "FlutterVolumeControllerPlugin"))
|
||||||
MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin"))
|
MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin"))
|
||||||
MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin"))
|
MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin"))
|
||||||
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
|
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin"))
|
ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin"))
|
||||||
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
|
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
|
||||||
|
756
pubspec.lock
756
pubspec.lock
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.11
|
version: 1.0.12
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.19.6 <3.0.0"
|
sdk: ">=2.19.6 <3.0.0"
|
||||||
@ -49,8 +49,8 @@ dependencies:
|
|||||||
|
|
||||||
# 图片
|
# 图片
|
||||||
cached_network_image: ^3.3.0
|
cached_network_image: ^3.3.0
|
||||||
extended_image: ^8.0.2
|
extended_image: ^8.2.0
|
||||||
saver_gallery: ^2.0.1
|
saver_gallery: ^3.0.1
|
||||||
|
|
||||||
# 存储
|
# 存储
|
||||||
path_provider: ^2.1.1
|
path_provider: ^2.1.1
|
||||||
@ -94,7 +94,7 @@ dependencies:
|
|||||||
audio_session: ^0.1.16
|
audio_session: ^0.1.16
|
||||||
|
|
||||||
# 音量、亮度、屏幕控制
|
# 音量、亮度、屏幕控制
|
||||||
flutter_volume_controller: ^1.3.0
|
flutter_volume_controller: ^1.3.1
|
||||||
screen_brightness: ^0.2.2+1
|
screen_brightness: ^0.2.2+1
|
||||||
wakelock_plus: ^1.1.1
|
wakelock_plus: ^1.1.1
|
||||||
universal_platform: ^1.0.0+1
|
universal_platform: ^1.0.0+1
|
||||||
|
Reference in New Issue
Block a user