Compare commits
5 Commits
v1.0.27.04
...
feature-me
| Author | SHA1 | Date | |
|---|---|---|---|
| b689db16b5 | |||
| 76784ee664 | |||
| 2dbef3fee2 | |||
| 3a66c8c03d | |||
| 6f62837495 |
6
.github/workflows/beta_ci.yml
vendored
6
.github/workflows/beta_ci.yml
vendored
@ -4,7 +4,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "x-main"
|
- "main"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**.md"
|
- "**.md"
|
||||||
- "**.txt"
|
- "**.txt"
|
||||||
@ -95,7 +95,7 @@ jobs:
|
|||||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
flutter-version: 3.19.6
|
flutter-version: 3.16.5
|
||||||
channel: any
|
channel: any
|
||||||
|
|
||||||
- name: 下载项目依赖
|
- name: 下载项目依赖
|
||||||
@ -205,4 +205,4 @@ jobs:
|
|||||||
method: sendFile
|
method: sendFile
|
||||||
path: Pilipala-Beta/*
|
path: Pilipala-Beta/*
|
||||||
parse_mode: Markdown
|
parse_mode: Markdown
|
||||||
context: "*Beta版本: v${{ needs.update_version.outputs.new_version }}*\n更新内容: [${{ needs.update_version.outputs.last_commit }}]"
|
context: "*Beta版本: v${{ needs.update_version.outputs.new_version }}*\n更新内容: [${{ needs.update_version.outputs.last_commit }}](${{ github.event.head_commit.url }})"
|
||||||
|
|||||||
4
.github/workflows/release_ci.yml
vendored
4
.github/workflows/release_ci.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
|||||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
flutter-version: 3.19.6
|
flutter-version: 3.16.5
|
||||||
channel: any
|
channel: any
|
||||||
|
|
||||||
- name: 下载项目依赖
|
- name: 下载项目依赖
|
||||||
@ -98,7 +98,7 @@ jobs:
|
|||||||
uses: subosito/flutter-action@v2.10.0
|
uses: subosito/flutter-action@v2.10.0
|
||||||
with:
|
with:
|
||||||
cache: true
|
cache: true
|
||||||
flutter-version: 3.19.6
|
flutter-version: 3.16.5
|
||||||
|
|
||||||
- name: flutter build ipa
|
- name: flutter build ipa
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
77
README.md
77
README.md
@ -2,6 +2,8 @@
|
|||||||
<img width="200" height="200" src="https://github.com/guozhigq/pilipala/blob/main/assets/images/logo/logo_android.png">
|
<img width="200" height="200" src="https://github.com/guozhigq/pilipala/blob/main/assets/images/logo/logo_android.png">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<h1>PiliPala</h1>
|
<h1>PiliPala</h1>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
@ -9,9 +11,8 @@
|
|||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p>使用 Flutter 开发的 BiliBili 第三方客户端</p>
|
<p>使用Flutter开发的BiliBili第三方客户端</p>
|
||||||
|
|
||||||
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/screenshots/510shots_so.png" width="32%" alt="home" />
|
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/screenshots/510shots_so.png" width="32%" alt="home" />
|
||||||
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/screenshots/174shots_so.png" width="32%" alt="home" />
|
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/screenshots/174shots_so.png" width="32%" alt="home" />
|
||||||
@ -22,41 +23,46 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
## 开发环境
|
## 开发环境
|
||||||
|
Xcode 13.4 不支持**auto_orientation**,请注释相关代码
|
||||||
Xcode 13.4 不支持 ```auto_orientation```,请注释相关代码
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.1.2 23B92 darwin-arm64, locale
|
[✓] Flutter (Channel stable, 3.16.4, on macOS 14.1.2 23B92 darwin-arm64, locale
|
||||||
zh-Hans-CN)
|
zh-Hans-CN)
|
||||||
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
|
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
|
||||||
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
|
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
|
||||||
[✓] Chrome - develop for the web
|
[✓] Chrome - develop for the web
|
||||||
[✓] Android Studio (version 2022.3)
|
[✓] Android Studio (version 2022.3)
|
||||||
[✓] VS Code (version 1.87.2)
|
[✓] VS Code (version 1.85.1)
|
||||||
[✓] Connected device (3 available)
|
[✓] Connected device (3 available)
|
||||||
[✓] Network resources
|
[✓] Network resources
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
## 技术交流
|
## 技术交流
|
||||||
|
|
||||||
Telegram: [https://t.me/+1DFtqS6usUM5MDNl](https://t.me/+1DFtqS6usUM5MDNl)
|
Telegram: https://t.me/+lm_oOVmF0RJiODk1
|
||||||
|
QQ频道: https://pd.qq.com/s/365esodk3
|
||||||
|
|
||||||
Telegram Beta 版本:@PiliPala_Beta
|
|
||||||
|
|
||||||
QQ 频道: https://pd.qq.com/s/365esodk3
|
<br/>
|
||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
|
|
||||||
目前着重移动端 (Android、iOS),暂时没有适配桌面端、Pad 端、手表端等
|
目前着重移动端(Android、iOS),暂时没有适配桌面端、Pad端、手表端等
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
现有功能及[开发计划](https://github.com/users/guozhigq/projects/5)
|
现有功能及[开发计划](https://github.com/users/guozhigq/projects/5)
|
||||||
|
|
||||||
- [x] 推荐视频列表 (app 端)
|
|
||||||
|
- [x] 推荐视频列表(app端)
|
||||||
- [x] 最热视频列表
|
- [x] 最热视频列表
|
||||||
- [x] 热门直播
|
- [x] 热门直播
|
||||||
- [x] 番剧列表
|
- [x] 番剧列表
|
||||||
- [x] 屏蔽黑名单内用户视频
|
- [x] 屏蔽黑名单内用户视频
|
||||||
- [x] 排行榜
|
|
||||||
|
|
||||||
- [x] 用户相关
|
- [x] 用户相关
|
||||||
- [x] 粉丝、关注用户、拉黑用户查看
|
- [x] 粉丝、关注用户、拉黑用户查看
|
||||||
@ -66,13 +72,11 @@ QQ 频道: https://pd.qq.com/s/365esodk3
|
|||||||
- [x] 稍后再看
|
- [x] 稍后再看
|
||||||
- [x] 观看记录
|
- [x] 观看记录
|
||||||
- [x] 我的收藏
|
- [x] 我的收藏
|
||||||
- [x] 黑名单管理
|
|
||||||
|
|
||||||
- [x] 动态相关
|
- [x] 动态相关
|
||||||
- [x] 全部、投稿、番剧分类查看
|
- [x] 全部、投稿、番剧分类查看
|
||||||
- [x] 动态评论查看
|
- [x] 动态评论查看
|
||||||
- [x] 动态评论回复功能
|
- [x] 动态评论回复功能
|
||||||
- [x] 动态未读标记
|
|
||||||
|
|
||||||
- [x] 视频播放相关
|
- [x] 视频播放相关
|
||||||
- [x] 双击快进/快退
|
- [x] 双击快进/快退
|
||||||
@ -81,17 +85,15 @@ QQ 频道: https://pd.qq.com/s/365esodk3
|
|||||||
- [x] 垂直方向上滑全屏、下滑退出全屏
|
- [x] 垂直方向上滑全屏、下滑退出全屏
|
||||||
- [x] 水平方向手势快进/快退
|
- [x] 水平方向手势快进/快退
|
||||||
- [x] 全屏方向设置
|
- [x] 全屏方向设置
|
||||||
- [x] 倍速选择/长按 2 倍速
|
- [x] 倍速选择/长按2倍速
|
||||||
- [x] 硬件加速 (视机型而定)
|
- [x] 硬件加速(视机型而定)
|
||||||
- [x] 画质选择 (高清画质未解锁)
|
- [x] 画质选择(高清画质未解锁)
|
||||||
- [x] 音质选择 (视视频而定)
|
- [x] 音质选择(视视频而定)
|
||||||
- [x] 解码格式选择 (视视频而定)
|
- [x] 解码格式选择(视视频而定)
|
||||||
- [x] 弹幕
|
- [x] 弹幕
|
||||||
- [x] 字幕
|
- [ ] 字幕
|
||||||
- [x] 记忆播放
|
- [x] 记忆播放
|
||||||
- [x] 视频比例:高度/宽度适应、填充、包含等
|
- [x] 视频比例:高度/宽度适应、填充、包含等
|
||||||
- [x] 视频快照
|
|
||||||
- [x] 直播弹幕
|
|
||||||
|
|
||||||
- [x] 搜索相关
|
- [x] 搜索相关
|
||||||
- [x] 热搜
|
- [x] 热搜
|
||||||
@ -101,12 +103,12 @@ QQ 频道: https://pd.qq.com/s/365esodk3
|
|||||||
- [x] 视频搜索排序、按时长筛选
|
- [x] 视频搜索排序、按时长筛选
|
||||||
|
|
||||||
- [x] 视频详情页相关
|
- [x] 视频详情页相关
|
||||||
- [x] 视频选集 (分 p) 切换
|
- [x] 视频选集(分p)切换
|
||||||
- [x] 点赞、投币、收藏/取消收藏
|
- [x] 点赞、投币、收藏/取消收藏
|
||||||
- [x] 相关视频查看
|
- [x] 相关视频查看
|
||||||
- [x] 评论用户身份标识
|
- [x] 评论用户身份标识
|
||||||
- [x] 评论 (排序) 查看、二楼评论查看
|
- [x] 评论(排序)查看、二楼评论查看
|
||||||
- [x] 主楼、二楼评论/表情回复功能
|
- [x] 主楼、二楼评论回复功能
|
||||||
- [x] 评论点赞
|
- [x] 评论点赞
|
||||||
- [x] 评论笔记图片查看、保存
|
- [x] 评论笔记图片查看、保存
|
||||||
|
|
||||||
@ -114,30 +116,29 @@ QQ 频道: https://pd.qq.com/s/365esodk3
|
|||||||
- [x] 画质、音质、解码方式预设
|
- [x] 画质、音质、解码方式预设
|
||||||
- [x] 图片质量设定
|
- [x] 图片质量设定
|
||||||
- [x] 主题模式:亮色/暗色/跟随系统
|
- [x] 主题模式:亮色/暗色/跟随系统
|
||||||
- [x] 震动反馈 (可选)
|
- [x] 震动反馈(可选)
|
||||||
- [x] 高帧率
|
- [x] 高帧率
|
||||||
- [x] 自动全屏
|
- [x] 自动全屏
|
||||||
- [ ] 等等
|
- [ ] 等等
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
## 下载
|
## 下载
|
||||||
|
|
||||||
可以通过右侧 Releases 进行下载或拉取代码到本地进行编译
|
可以通过右侧release进行下载或拉取代码到本地进行编译
|
||||||
|
|
||||||
### 从 F-Droid 安装
|
<br/>
|
||||||
|
|
||||||
<a href="https://f-droid.org/packages/com.guozhigq.pilipala">
|
|
||||||
<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-zh-cn.png"
|
|
||||||
alt="Get it on F-Droid"
|
|
||||||
height="80">
|
|
||||||
</a>
|
|
||||||
|
|
||||||
## 声明
|
## 声明
|
||||||
|
|
||||||
此项目 (PiliPala) 是个人为了兴趣而开发, 仅用于学习和测试。
|
此项目(PiliPala)是个人为了兴趣而开发, 仅用于学习和测试。
|
||||||
所用 API 皆从官方网站收集, 不提供任何破解内容。
|
所用API皆从官方网站收集, 不提供任何破解内容。
|
||||||
|
|
||||||
感谢使用
|
感谢使用
|
||||||
|
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
## 致谢
|
## 致谢
|
||||||
|
|
||||||
- [bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect)
|
- [bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect)
|
||||||
@ -145,3 +146,7 @@ QQ 频道: https://pd.qq.com/s/365esodk3
|
|||||||
- [media-kit](https://github.com/media-kit/media-kit)
|
- [media-kit](https://github.com/media-kit/media-kit)
|
||||||
- [dio](https://pub.dev/packages/dio)
|
- [dio](https://pub.dev/packages/dio)
|
||||||
- 等等
|
- 等等
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
android:fullBackupContent="false"
|
android:fullBackupContent="false"
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
<activity
|
<activity
|
||||||
android:name="com.guozhigq.pilipala.MainActivity"
|
android:name="com.ryanheise.audioservice.AudioServiceActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
package com.guozhigq.pilipala
|
package com.guozhigq.pilipala
|
||||||
|
|
||||||
// import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
import com.ryanheise.audioservice.AudioServiceActivity;
|
|
||||||
|
|
||||||
class MainActivity: AudioServiceActivity() {
|
class MainActivity: FlutterActivity() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.9.0'
|
ext.kotlin_version = '1.7.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,27 +0,0 @@
|
|||||||
## 1.0.22
|
|
||||||
|
|
||||||
### 功能
|
|
||||||
+ 字幕
|
|
||||||
+ 全屏时选集
|
|
||||||
+ 动态转发
|
|
||||||
+ 评论视频并转发
|
|
||||||
+ 收藏夹删除
|
|
||||||
+ 合集显示封面
|
|
||||||
+ 底部导航栏编辑、排序功能
|
|
||||||
+ 历史记录进度条展示
|
|
||||||
+ 直播画质切换
|
|
||||||
+ 排行榜功能
|
|
||||||
+ 视频详情页推荐视频开关
|
|
||||||
+ 显示联合投稿up
|
|
||||||
|
|
||||||
### 修复
|
|
||||||
+ 收藏夹个数错误
|
|
||||||
+ 封面保存权限问题
|
|
||||||
+ 合集最后1p未展示
|
|
||||||
+ up主页关注按钮触发灰屏
|
|
||||||
|
|
||||||
### 优化
|
|
||||||
+ 视频简介查看逻辑
|
|
||||||
|
|
||||||
更多更新日志可在Github上查看
|
|
||||||
问题反馈、功能建议请查看「关于」页面。
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
## 1.0.23
|
|
||||||
|
|
||||||
### 功能
|
|
||||||
+ 封面下载
|
|
||||||
|
|
||||||
|
|
||||||
### 修复
|
|
||||||
+ 全屏问题
|
|
||||||
+ 视频播放器灰屏问题
|
|
||||||
+ 评论区点击区域问题
|
|
||||||
|
|
||||||
|
|
||||||
更多更新日志可在Github上查看
|
|
||||||
问题反馈、功能建议请查看「关于」页面。
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
## 1.0.23
|
|
||||||
|
|
||||||
### 功能
|
|
||||||
+ 封面下载
|
|
||||||
|
|
||||||
|
|
||||||
### 修复
|
|
||||||
+ 全屏问题
|
|
||||||
+ 视频播放器灰屏问题
|
|
||||||
+ 评论区点击区域问题
|
|
||||||
+ 动态详情跳转异常问题
|
|
||||||
|
|
||||||
|
|
||||||
更多更新日志可在Github上查看
|
|
||||||
问题反馈、功能建议请查看「关于」页面。
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
## 1.0.24
|
|
||||||
|
|
||||||
### 功能
|
|
||||||
+ 私信功能
|
|
||||||
+ 回复我的、收到的赞查看
|
|
||||||
+ 新的登录方式
|
|
||||||
+ 全屏选集
|
|
||||||
+ 一键三连
|
|
||||||
+ 按分区搜索
|
|
||||||
|
|
||||||
### 优化
|
|
||||||
+ 页面跳转动画
|
|
||||||
+ 评论区跳转
|
|
||||||
|
|
||||||
### 修复
|
|
||||||
+ 音画不同步问题
|
|
||||||
+ 分集字幕未同步
|
|
||||||
+ 多语言字幕
|
|
||||||
+ 弹幕设置未生效
|
|
||||||
|
|
||||||
|
|
||||||
更多更新日志可在Github上查看
|
|
||||||
问题反馈、功能建议请查看「关于」页面。
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
## 1.0.25
|
|
||||||
|
|
||||||
### 功能
|
|
||||||
+ 直播弹幕
|
|
||||||
+ 稍后再看、收藏夹播放全部
|
|
||||||
+ 收藏夹新建、编辑
|
|
||||||
+ 评论删除
|
|
||||||
+ 评论保存为图片
|
|
||||||
+ 动态页滑动切换up
|
|
||||||
+ up投稿筛选充电视频
|
|
||||||
+ 直播tab展示关注up
|
|
||||||
+ up主页专栏展示
|
|
||||||
|
|
||||||
### 优化
|
|
||||||
+ 视频详情页一键三连
|
|
||||||
+ 动态页标识充电视频
|
|
||||||
+ 播放器亮度、音量调整百分比展示
|
|
||||||
+ 封面预览时视频标题可复制
|
|
||||||
+ 竖屏直播布局
|
|
||||||
+ 图片预览
|
|
||||||
+ 专栏渲染优化
|
|
||||||
+ 私信图片查看
|
|
||||||
|
|
||||||
### 修复
|
|
||||||
+ 收藏夹点击异常
|
|
||||||
+ 搜索up异常
|
|
||||||
+ 系统通知已读异常
|
|
||||||
+ [赞了我的]展示错误
|
|
||||||
+ 部分up合集无法打开
|
|
||||||
+ 切换合集视频投币个数未重置
|
|
||||||
+ 搜索条件筛选面板无法滚动
|
|
||||||
+ 部分机型导航条未沉浸
|
|
||||||
+ 专栏图片渲染问题
|
|
||||||
+ 专栏浏览历史记录
|
|
||||||
+ 直播间历史记录
|
|
||||||
|
|
||||||
|
|
||||||
更多更新日志可在Github上查看
|
|
||||||
问题反馈、功能建议请查看「关于」页面。
|
|
||||||
@ -21,6 +21,6 @@
|
|||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>MinimumOSVersion</key>
|
<key>MinimumOSVersion</key>
|
||||||
<string>12.0</string>
|
<string>11.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@ -10,6 +10,7 @@ PODS:
|
|||||||
- connectivity_plus (0.0.1):
|
- connectivity_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
|
- ReachabilitySwift
|
||||||
- device_info_plus (0.0.1):
|
- device_info_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
@ -23,7 +24,7 @@ PODS:
|
|||||||
- FMDB (2.7.5):
|
- FMDB (2.7.5):
|
||||||
- FMDB/standard (= 2.7.5)
|
- FMDB/standard (= 2.7.5)
|
||||||
- FMDB/standard (2.7.5)
|
- FMDB/standard (2.7.5)
|
||||||
- gt3_flutter_plugin (0.0.9):
|
- gt3_flutter_plugin (0.0.8):
|
||||||
- Flutter
|
- Flutter
|
||||||
- GT3Captcha-iOS
|
- GT3Captcha-iOS
|
||||||
- GT3Captcha-iOS (0.15.8.3)
|
- GT3Captcha-iOS (0.15.8.3)
|
||||||
@ -40,6 +41,7 @@ PODS:
|
|||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- permission_handler_apple (9.3.0):
|
- permission_handler_apple (9.3.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- ReachabilitySwift (5.0.0)
|
||||||
- saver_gallery (0.0.1):
|
- saver_gallery (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- screen_brightness_ios (0.1.0):
|
- screen_brightness_ios (0.1.0):
|
||||||
@ -99,6 +101,7 @@ SPEC REPOS:
|
|||||||
trunk:
|
trunk:
|
||||||
- FMDB
|
- FMDB
|
||||||
- GT3Captcha-iOS
|
- GT3Captcha-iOS
|
||||||
|
- ReachabilitySwift
|
||||||
- Toast
|
- Toast
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
@ -164,21 +167,22 @@ SPEC CHECKSUMS:
|
|||||||
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
||||||
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
||||||
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||||
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
|
connectivity_plus: e2dad488011aeb593e219360e804c43cc1af5770
|
||||||
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
|
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
|
||||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
flutter_mailer: 2ef5a67087bc8c6c4cefd04a178bf1ae2c94cd83
|
flutter_mailer: 2ef5a67087bc8c6c4cefd04a178bf1ae2c94cd83
|
||||||
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
||||||
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
gt3_flutter_plugin: 5bd2c08d3c19cbb6ee3b08f4358439e54c8ab2ee
|
gt3_flutter_plugin: bfa1f26e9a09dc00401514be5ed437f964cabf23
|
||||||
GT3Captcha-iOS: 5e3b1077834d8a9d6f4d64a447a30af3e14affe6
|
GT3Captcha-iOS: 5e3b1077834d8a9d6f4d64a447a30af3e14affe6
|
||||||
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: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
||||||
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||||
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||||
|
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||||
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
||||||
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
||||||
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
|
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
|
||||||
@ -186,11 +190,11 @@ SPEC CHECKSUMS:
|
|||||||
status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446
|
status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446
|
||||||
system_proxy: bec1a5c5af67dd3e3ebf43979400a8756c04cc44
|
system_proxy: bec1a5c5af67dd3e3ebf43979400a8756c04cc44
|
||||||
Toast: ec33c32b8688982cecc6348adeae667c1b9938da
|
Toast: ec33c32b8688982cecc6348adeae667c1b9938da
|
||||||
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
|
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
|
||||||
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
|
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
|
||||||
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
|
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
|
||||||
webview_cookie_manager: eaf920722b493bd0f7611b5484771ca53fed03f7
|
webview_cookie_manager: eaf920722b493bd0f7611b5484771ca53fed03f7
|
||||||
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36
|
webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4
|
||||||
|
|
||||||
PODFILE CHECKSUM: 637cd290bed23275b5f5ffcc7eb1e73d0a5fb2be
|
PODFILE CHECKSUM: 637cd290bed23275b5f5ffcc7eb1e73d0a5fb2be
|
||||||
|
|
||||||
|
|||||||
@ -156,7 +156,7 @@
|
|||||||
97C146E61CF9000F007C117D /* Project object */ = {
|
97C146E61CF9000F007C117D /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 1510;
|
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 = "1510"
|
LastUpgradeVersion = "1430"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Flutter
|
import Flutter
|
||||||
import AVFoundation
|
|
||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
@objc class AppDelegate: FlutterAppDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
@ -9,14 +8,6 @@ import AVFoundation
|
|||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
GeneratedPluginRegistrant.register(with: self)
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
|
|
||||||
// 设置音频会话类别,确保在静音模式下播放音频
|
|
||||||
do {
|
|
||||||
try AVAudioSession.sharedInstance().setCategory(.playback, options: [.duckOthers])
|
|
||||||
} catch {
|
|
||||||
print("Failed to set audio session category: \(error)")
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,8 +49,6 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||||
<string>请允许APP保存图片到相册</string>
|
<string>请允许APP保存图片到相册</string>
|
||||||
<key>NSPhotoLibraryUsageDescription</key>
|
|
||||||
<string>请允许APP保存图片到相册</string>
|
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>App需要您的同意,才能访问相册</string>
|
<string>App需要您的同意,才能访问相册</string>
|
||||||
<key>NSAppleMusicUsageDescription</key>
|
<key>NSAppleMusicUsageDescription</key>
|
||||||
|
|||||||
@ -1,172 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
|
||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
|
||||||
import '../models/common/video_episode_type.dart';
|
|
||||||
|
|
||||||
class EpisodeBottomSheet {
|
|
||||||
final List<dynamic> episodes;
|
|
||||||
final int currentCid;
|
|
||||||
final dynamic dataType;
|
|
||||||
final BuildContext context;
|
|
||||||
final Function changeFucCall;
|
|
||||||
final int? cid;
|
|
||||||
final double? sheetHeight;
|
|
||||||
bool isFullScreen = false;
|
|
||||||
|
|
||||||
EpisodeBottomSheet({
|
|
||||||
required this.episodes,
|
|
||||||
required this.currentCid,
|
|
||||||
required this.dataType,
|
|
||||||
required this.context,
|
|
||||||
required this.changeFucCall,
|
|
||||||
this.cid,
|
|
||||||
this.sheetHeight,
|
|
||||||
this.isFullScreen = false,
|
|
||||||
});
|
|
||||||
|
|
||||||
Widget buildEpisodeListItem(
|
|
||||||
dynamic episode,
|
|
||||||
int index,
|
|
||||||
bool isCurrentIndex,
|
|
||||||
) {
|
|
||||||
Color primary = Theme.of(context).colorScheme.primary;
|
|
||||||
Color onSurface = Theme.of(context).colorScheme.onSurface;
|
|
||||||
|
|
||||||
String title = '';
|
|
||||||
switch (dataType) {
|
|
||||||
case VideoEpidoesType.videoEpisode:
|
|
||||||
title = episode.title;
|
|
||||||
break;
|
|
||||||
case VideoEpidoesType.videoPart:
|
|
||||||
title = episode.pagePart;
|
|
||||||
break;
|
|
||||||
case VideoEpidoesType.bangumiEpisode:
|
|
||||||
title = '第${episode.title}话 ${episode.longTitle!}';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return isFullScreen || episode?.cover == null || episode?.cover == ''
|
|
||||||
? ListTile(
|
|
||||||
onTap: () {
|
|
||||||
SmartDialog.showToast('切换至「$title」');
|
|
||||||
changeFucCall.call(episode, index);
|
|
||||||
},
|
|
||||||
dense: false,
|
|
||||||
leading: isCurrentIndex
|
|
||||||
? Image.asset(
|
|
||||||
'assets/images/live.gif',
|
|
||||||
color: primary,
|
|
||||||
height: 12,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
title: Text(title,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: isCurrentIndex ? primary : onSurface,
|
|
||||||
)))
|
|
||||||
: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
SmartDialog.showToast('切换至「$title」');
|
|
||||||
changeFucCall.call(episode, index);
|
|
||||||
},
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.only(left: 14, right: 14, top: 8, bottom: 8),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
NetworkImgLayer(
|
|
||||||
width: 130, height: 75, src: episode?.cover ?? ''),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
title,
|
|
||||||
maxLines: 2,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: isCurrentIndex ? primary : onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildTitle() {
|
|
||||||
return AppBar(
|
|
||||||
toolbarHeight: 45,
|
|
||||||
automaticallyImplyLeading: false,
|
|
||||||
centerTitle: false,
|
|
||||||
title: Text(
|
|
||||||
'合集(${episodes.length})',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
actions: !isFullScreen
|
|
||||||
? [
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.close, size: 20),
|
|
||||||
onPressed: () => Navigator.pop(context),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 14),
|
|
||||||
]
|
|
||||||
: null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildShowContent(BuildContext context) {
|
|
||||||
final ItemScrollController itemScrollController = ItemScrollController();
|
|
||||||
int currentIndex = episodes.indexWhere((dynamic e) => e.cid == currentCid);
|
|
||||||
return StatefulBuilder(
|
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
itemScrollController.jumpTo(index: currentIndex);
|
|
||||||
});
|
|
||||||
return Container(
|
|
||||||
height: sheetHeight,
|
|
||||||
color: Theme.of(context).colorScheme.surface,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
buildTitle(),
|
|
||||||
Expanded(
|
|
||||||
child: Material(
|
|
||||||
child: PageStorage(
|
|
||||||
bucket: PageStorageBucket(),
|
|
||||||
child: ScrollablePositionedList.builder(
|
|
||||||
itemScrollController: itemScrollController,
|
|
||||||
itemCount: episodes.length + 1,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
bool isLastItem = index == episodes.length;
|
|
||||||
bool isCurrentIndex = currentIndex == index;
|
|
||||||
return isLastItem
|
|
||||||
? SizedBox(
|
|
||||||
height:
|
|
||||||
MediaQuery.of(context).padding.bottom + 20,
|
|
||||||
)
|
|
||||||
: buildEpisodeListItem(
|
|
||||||
episodes[index],
|
|
||||||
index,
|
|
||||||
isCurrentIndex,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The [BuildContext] of the widget that calls the bottom sheet.
|
|
||||||
PersistentBottomSheetController show(BuildContext context) {
|
|
||||||
final PersistentBottomSheetController btmSheetCtr = showBottomSheet(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return buildShowContent(context);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
return btmSheetCtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -13,8 +13,8 @@ class Skeleton extends StatelessWidget {
|
|||||||
var shimmerGradient = LinearGradient(
|
var shimmerGradient = LinearGradient(
|
||||||
colors: [
|
colors: [
|
||||||
Colors.transparent,
|
Colors.transparent,
|
||||||
Theme.of(context).colorScheme.surface.withAlpha(10),
|
Theme.of(context).colorScheme.background.withAlpha(10),
|
||||||
Theme.of(context).colorScheme.surface.withAlpha(10),
|
Theme.of(context).colorScheme.background.withAlpha(10),
|
||||||
Colors.transparent,
|
Colors.transparent,
|
||||||
],
|
],
|
||||||
stops: const [
|
stops: const [
|
||||||
|
|||||||
@ -66,7 +66,7 @@ class PBadge extends StatelessWidget {
|
|||||||
border: Border.all(color: borderColor),
|
border: Border.all(color: borderColor),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
text ?? '',
|
text!,
|
||||||
style: TextStyle(fontSize: fs ?? fontSize, color: color),
|
style: TextStyle(fontSize: fs ?? fontSize, color: color),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_html/flutter_html.dart';
|
import 'package:flutter_html/flutter_html.dart';
|
||||||
import 'package:pilipala/plugin/pl_gallery/hero_dialog_route.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/plugin/pl_gallery/interactiveviewer_gallery.dart';
|
import 'network_img_layer.dart';
|
||||||
import 'package:pilipala/utils/highlight.dart';
|
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class HtmlRender extends StatelessWidget {
|
class HtmlRender extends StatelessWidget {
|
||||||
@ -24,20 +22,6 @@ class HtmlRender extends StatelessWidget {
|
|||||||
data: htmlContent,
|
data: htmlContent,
|
||||||
onLinkTap: (String? url, Map<String, String> buildContext, attributes) {},
|
onLinkTap: (String? url, Map<String, String> buildContext, attributes) {},
|
||||||
extensions: [
|
extensions: [
|
||||||
TagExtension(
|
|
||||||
tagsToExtend: <String>{'pre'},
|
|
||||||
builder: (ExtensionContext extensionContext) {
|
|
||||||
final Map<String, dynamic> attributes = extensionContext.attributes;
|
|
||||||
final String lang = attributes['data-lang'] as String;
|
|
||||||
final String code = attributes['codecontent'] as String;
|
|
||||||
List<String> selectedLanguages = [lang.split('@').first];
|
|
||||||
TextSpan? result = highlightExistingText(code, selectedLanguages);
|
|
||||||
if (result == null) {
|
|
||||||
return const Center(child: Text('代码块渲染失败'));
|
|
||||||
}
|
|
||||||
return SelectableText.rich(result);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TagExtension(
|
TagExtension(
|
||||||
tagsToExtend: <String>{'img'},
|
tagsToExtend: <String>{'img'},
|
||||||
builder: (ExtensionContext extensionContext) {
|
builder: (ExtensionContext extensionContext) {
|
||||||
@ -60,52 +44,20 @@ class HtmlRender extends StatelessWidget {
|
|||||||
if (isMall) {
|
if (isMall) {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
return InkWell(
|
// bool inTable =
|
||||||
onTap: () {
|
// extensionContext.element!.previousElementSibling == null ||
|
||||||
Navigator.of(context).push(
|
// extensionContext.element!.nextElementSibling == null;
|
||||||
HeroDialogRoute<void>(
|
// imgUrl = Utils().imageUrl(imgUrl!);
|
||||||
builder: (BuildContext context) =>
|
// return Image.network(
|
||||||
InteractiveviewerGallery(
|
// imgUrl,
|
||||||
sources: imgList ?? [imgUrl],
|
// width: isEmote ? 22 : null,
|
||||||
initIndex: imgList?.indexOf(imgUrl) ?? 0,
|
// height: isEmote ? 22 : null,
|
||||||
itemBuilder: (
|
|
||||||
BuildContext context,
|
|
||||||
int index,
|
|
||||||
bool isFocus,
|
|
||||||
bool enablePageView,
|
|
||||||
) {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onTap: () {
|
|
||||||
if (enablePageView) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Center(
|
|
||||||
child: Hero(
|
|
||||||
tag: imgList?[index] ?? imgUrl,
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
fadeInDuration:
|
|
||||||
const Duration(milliseconds: 0),
|
|
||||||
imageUrl: imgList?[index] ?? imgUrl,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onPageChanged: (int pageIndex) {},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: CachedNetworkImage(imageUrl: imgUrl),
|
|
||||||
);
|
|
||||||
// return NetworkImgLayer(
|
|
||||||
// width: isEmote ? 22 : Get.size.width - 24,
|
|
||||||
// height: isEmote ? 22 : 200,
|
|
||||||
// src: imgUrl,
|
|
||||||
// );
|
// );
|
||||||
|
return NetworkImgLayer(
|
||||||
|
width: isEmote ? 22 : Get.size.width - 24,
|
||||||
|
height: isEmote ? 22 : 200,
|
||||||
|
src: imgUrl,
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
@ -114,7 +66,7 @@ class HtmlRender extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
style: {
|
style: {
|
||||||
'html': Style(
|
'html': Style(
|
||||||
fontSize: FontSize.large,
|
fontSize: FontSize.medium,
|
||||||
lineHeight: LineHeight.percent(140),
|
lineHeight: LineHeight.percent(140),
|
||||||
),
|
),
|
||||||
'body': Style(margin: Margins.zero, padding: HtmlPaddings.zero),
|
'body': Style(margin: Margins.zero, padding: HtmlPaddings.zero),
|
||||||
@ -126,7 +78,7 @@ class HtmlRender extends StatelessWidget {
|
|||||||
margin: Margins.only(bottom: 10),
|
margin: Margins.only(bottom: 10),
|
||||||
),
|
),
|
||||||
'span': Style(
|
'span': Style(
|
||||||
fontSize: FontSize.large,
|
fontSize: FontSize.medium,
|
||||||
height: Height(1.65),
|
height: Height(1.65),
|
||||||
),
|
),
|
||||||
'div': Style(height: Height.auto()),
|
'div': Style(height: Height.auto()),
|
||||||
|
|||||||
@ -2,18 +2,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
class HttpError extends StatelessWidget {
|
class HttpError extends StatelessWidget {
|
||||||
const HttpError({
|
const HttpError(
|
||||||
required this.errMsg,
|
{required this.errMsg, required this.fn, this.btnText, super.key});
|
||||||
required this.fn,
|
|
||||||
this.btnText,
|
|
||||||
this.isShowBtn = true,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
final String? errMsg;
|
final String? errMsg;
|
||||||
final Function()? fn;
|
final Function()? fn;
|
||||||
final String? btnText;
|
final String? btnText;
|
||||||
final bool isShowBtn;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -35,22 +29,20 @@ class HttpError extends StatelessWidget {
|
|||||||
style: Theme.of(context).textTheme.titleSmall,
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
if (isShowBtn)
|
FilledButton.tonal(
|
||||||
FilledButton.tonal(
|
onPressed: () {
|
||||||
onPressed: () {
|
fn!();
|
||||||
fn!();
|
},
|
||||||
},
|
style: ButtonStyle(
|
||||||
style: ButtonStyle(
|
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
return Theme.of(context).colorScheme.primary.withAlpha(20);
|
||||||
return Theme.of(context).colorScheme.primary.withAlpha(20);
|
}),
|
||||||
}),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
btnText ?? '点击重试',
|
|
||||||
style:
|
|
||||||
TextStyle(color: Theme.of(context).colorScheme.primary),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
child: Text(
|
||||||
|
btnText ?? '点击重试',
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.primary),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/utils/extension.dart';
|
import 'package:pilipala/utils/extension.dart';
|
||||||
import 'package:pilipala/utils/global_data_cache.dart';
|
import 'package:pilipala/utils/global_data.dart';
|
||||||
import '../../utils/storage.dart';
|
import '../../utils/storage.dart';
|
||||||
import '../constants.dart';
|
import '../constants.dart';
|
||||||
|
|
||||||
@ -33,12 +33,10 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final int defaultImgQuality = GlobalDataCache().imgQuality;
|
final int defaultImgQuality = GlobalData().imgQuality;
|
||||||
if (src == '' || src == null) {
|
|
||||||
return placeholder(context);
|
|
||||||
}
|
|
||||||
final String imageUrl =
|
final String imageUrl =
|
||||||
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp';
|
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp';
|
||||||
|
print(imageUrl);
|
||||||
int? memCacheWidth, memCacheHeight;
|
int? memCacheWidth, memCacheHeight;
|
||||||
double aspectRatio = (width / height).toDouble();
|
double aspectRatio = (width / height).toDouble();
|
||||||
|
|
||||||
|
|||||||
86
lib/common/widgets/overlay_pop.dart
Normal file
86
lib/common/widgets/overlay_pop.dart
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../utils/download.dart';
|
||||||
|
import '../constants.dart';
|
||||||
|
import 'network_img_layer.dart';
|
||||||
|
|
||||||
|
class OverlayPop extends StatelessWidget {
|
||||||
|
const OverlayPop({super.key, this.videoItem, this.closeFn});
|
||||||
|
|
||||||
|
final dynamic videoItem;
|
||||||
|
final Function? closeFn;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final double imgWidth = MediaQuery.sizeOf(context).width - 8 * 2;
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.background,
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Stack(
|
||||||
|
children: [
|
||||||
|
NetworkImgLayer(
|
||||||
|
width: imgWidth,
|
||||||
|
height: imgWidth / StyleString.aspectRatio,
|
||||||
|
src: videoItem.pic! as String,
|
||||||
|
quality: 100,
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
child: Container(
|
||||||
|
width: 30,
|
||||||
|
height: 30,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.black.withOpacity(0.3),
|
||||||
|
borderRadius:
|
||||||
|
const BorderRadius.all(Radius.circular(20))),
|
||||||
|
child: IconButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
|
),
|
||||||
|
onPressed: () => closeFn!(),
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.close,
|
||||||
|
size: 18,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(12, 10, 8, 10),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
videoItem.title! as String,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
IconButton(
|
||||||
|
tooltip: '保存封面图',
|
||||||
|
onPressed: () async {
|
||||||
|
await DownloadUtils.downloadImg(
|
||||||
|
videoItem.pic != null
|
||||||
|
? videoItem.pic as String
|
||||||
|
: videoItem.cover as String,
|
||||||
|
);
|
||||||
|
// closeFn!();
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.download, size: 20),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
130
lib/common/widgets/pull_to_refresh_header.dart
Normal file
130
lib/common/widgets/pull_to_refresh_header.dart
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
// ignore_for_file: depend_on_referenced_packages
|
||||||
|
|
||||||
|
import 'dart:math';
|
||||||
|
import 'dart:ui' as ui show Image;
|
||||||
|
|
||||||
|
import 'package:extended_image/extended_image.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:pull_to_refresh_notification/pull_to_refresh_notification.dart';
|
||||||
|
|
||||||
|
double get maxDragOffset => 100;
|
||||||
|
double hideHeight = maxDragOffset / 2.3;
|
||||||
|
double refreshHeight = maxDragOffset / 1.5;
|
||||||
|
|
||||||
|
class PullToRefreshHeader extends StatelessWidget {
|
||||||
|
const PullToRefreshHeader(
|
||||||
|
this.info,
|
||||||
|
this.lastRefreshTime, {
|
||||||
|
this.color,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
final PullToRefreshScrollNotificationInfo? info;
|
||||||
|
final DateTime? lastRefreshTime;
|
||||||
|
final Color? color;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final PullToRefreshScrollNotificationInfo? infos = info;
|
||||||
|
if (infos == null) {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
String text = '';
|
||||||
|
if (infos.mode == PullToRefreshIndicatorMode.armed) {
|
||||||
|
text = 'Release to refresh';
|
||||||
|
} else if (infos.mode == PullToRefreshIndicatorMode.refresh ||
|
||||||
|
infos.mode == PullToRefreshIndicatorMode.snap) {
|
||||||
|
text = 'Loading...';
|
||||||
|
} else if (infos.mode == PullToRefreshIndicatorMode.done) {
|
||||||
|
text = 'Refresh completed.';
|
||||||
|
} else if (infos.mode == PullToRefreshIndicatorMode.drag) {
|
||||||
|
text = 'Pull to refresh';
|
||||||
|
} else if (infos.mode == PullToRefreshIndicatorMode.canceled) {
|
||||||
|
text = 'Cancel refresh';
|
||||||
|
}
|
||||||
|
|
||||||
|
final TextStyle ts = const TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
).copyWith(fontSize: 14);
|
||||||
|
|
||||||
|
final double dragOffset = info?.dragOffset ?? 0.0;
|
||||||
|
|
||||||
|
final DateTime time = lastRefreshTime ?? DateTime.now();
|
||||||
|
final double top = -hideHeight + dragOffset;
|
||||||
|
return Container(
|
||||||
|
height: dragOffset,
|
||||||
|
color: color ?? Colors.transparent,
|
||||||
|
// padding: EdgeInsets.only(top: dragOffset / 3),
|
||||||
|
// padding: EdgeInsets.only(bottom: 5.0),
|
||||||
|
child: Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
Positioned(
|
||||||
|
left: 0.0,
|
||||||
|
right: 0.0,
|
||||||
|
top: top,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
margin: const EdgeInsets.only(right: 12.0),
|
||||||
|
child: RefreshImage(top, null),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(text, style: ts),
|
||||||
|
Text(
|
||||||
|
'Last updated:${DateFormat('yyyy-MM-dd hh:mm').format(time)}',
|
||||||
|
style: ts.copyWith(fontSize: 14),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RefreshImage extends StatelessWidget {
|
||||||
|
const RefreshImage(this.top, Key? key) : super(key: key);
|
||||||
|
|
||||||
|
final double top;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
const double imageSize = 30;
|
||||||
|
return ExtendedImage.asset(
|
||||||
|
'assets/flutterCandies_grey.png',
|
||||||
|
width: imageSize,
|
||||||
|
height: imageSize,
|
||||||
|
afterPaintImage: (Canvas canvas, Rect rect, ui.Image image, Paint paint) {
|
||||||
|
final double imageHeight = image.height.toDouble();
|
||||||
|
final double imageWidth = image.width.toDouble();
|
||||||
|
final Size size = rect.size;
|
||||||
|
final double y =
|
||||||
|
(1 - min(top / (refreshHeight - hideHeight), 1)) * imageHeight;
|
||||||
|
|
||||||
|
canvas.drawImageRect(
|
||||||
|
image,
|
||||||
|
Rect.fromLTWH(0.0, y, imageWidth, imageHeight - y),
|
||||||
|
Rect.fromLTWH(rect.left, rect.top + y / imageHeight * size.height,
|
||||||
|
size.width, (imageHeight - y) / imageHeight * size.height),
|
||||||
|
Paint()
|
||||||
|
..colorFilter =
|
||||||
|
const ColorFilter.mode(Color(0xFFea5504), BlendMode.srcIn)
|
||||||
|
..isAntiAlias = false
|
||||||
|
..filterQuality = FilterQuality.low,
|
||||||
|
);
|
||||||
|
|
||||||
|
//canvas.restore();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,7 +6,7 @@ class StatDanMu extends StatelessWidget {
|
|||||||
final dynamic danmu;
|
final dynamic danmu;
|
||||||
final String? size;
|
final String? size;
|
||||||
|
|
||||||
const StatDanMu({Key? key, this.theme = 'gray', this.danmu, this.size})
|
const StatDanMu({Key? key, this.theme, this.danmu, this.size})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -14,49 +14,24 @@ class StatDanMu extends StatelessWidget {
|
|||||||
Map<String, Color> colorObject = {
|
Map<String, Color> colorObject = {
|
||||||
'white': Colors.white,
|
'white': Colors.white,
|
||||||
'gray': Theme.of(context).colorScheme.outline,
|
'gray': Theme.of(context).colorScheme.outline,
|
||||||
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
'black': Theme.of(context).colorScheme.onBackground.withOpacity(0.8),
|
||||||
};
|
};
|
||||||
Color color = colorObject[theme]!;
|
Color color = colorObject[theme]!;
|
||||||
return StatIconText(
|
|
||||||
icon: Icons.subtitles_outlined,
|
|
||||||
text: Utils.numFormat(danmu!),
|
|
||||||
color: color,
|
|
||||||
size: size,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class StatIconText extends StatelessWidget {
|
|
||||||
final IconData icon;
|
|
||||||
final String text;
|
|
||||||
final Color color;
|
|
||||||
final String? size;
|
|
||||||
|
|
||||||
const StatIconText({
|
|
||||||
Key? key,
|
|
||||||
required this.icon,
|
|
||||||
required this.text,
|
|
||||||
required this.color,
|
|
||||||
this.size,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
icon,
|
Icons.subtitles_outlined,
|
||||||
size: 14,
|
size: 14,
|
||||||
color: color,
|
color: color,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 2),
|
const SizedBox(width: 2),
|
||||||
Text(
|
Text(
|
||||||
text,
|
Utils.numFormat(danmu!),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: size == 'medium' ? 12 : 11,
|
fontSize: size == 'medium' ? 12 : 11,
|
||||||
color: color,
|
color: color,
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,56 +6,27 @@ class StatView extends StatelessWidget {
|
|||||||
final dynamic view;
|
final dynamic view;
|
||||||
final String? size;
|
final String? size;
|
||||||
|
|
||||||
const StatView({
|
const StatView({Key? key, this.theme, this.view, this.size})
|
||||||
Key? key,
|
: super(key: key);
|
||||||
this.theme = 'gray',
|
|
||||||
this.view,
|
|
||||||
this.size,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Map<String, Color> colorObject = {
|
Map<String, Color> colorObject = {
|
||||||
'white': Colors.white,
|
'white': Colors.white,
|
||||||
'gray': Theme.of(context).colorScheme.outline,
|
'gray': Theme.of(context).colorScheme.outline,
|
||||||
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
'black': Theme.of(context).colorScheme.onBackground.withOpacity(0.8),
|
||||||
};
|
};
|
||||||
Color color = colorObject[theme]!;
|
Color color = colorObject[theme]!;
|
||||||
return StatIconText(
|
|
||||||
icon: Icons.play_circle_outlined,
|
|
||||||
text: Utils.numFormat(view!),
|
|
||||||
color: color,
|
|
||||||
size: size,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class StatIconText extends StatelessWidget {
|
|
||||||
final IconData icon;
|
|
||||||
final String text;
|
|
||||||
final Color color;
|
|
||||||
final String? size;
|
|
||||||
|
|
||||||
const StatIconText({
|
|
||||||
Key? key,
|
|
||||||
required this.icon,
|
|
||||||
required this.text,
|
|
||||||
required this.color,
|
|
||||||
this.size,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
icon,
|
Icons.play_circle_outlined,
|
||||||
size: 13,
|
size: 13,
|
||||||
color: color,
|
color: color,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 2),
|
const SizedBox(width: 2),
|
||||||
Text(
|
Text(
|
||||||
text,
|
Utils.numFormat(view!),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: size == 'medium' ? 12 : 11,
|
fontSize: size == 'medium' ? 12 : 11,
|
||||||
color: color,
|
color: color,
|
||||||
|
|||||||
@ -1,11 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/http/constants.dart';
|
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
|
||||||
import 'package:pilipala/utils/image_save.dart';
|
|
||||||
import 'package:pilipala/utils/route_push.dart';
|
|
||||||
import 'package:pilipala/utils/url_utils.dart';
|
|
||||||
import '../../http/search.dart';
|
import '../../http/search.dart';
|
||||||
import '../../http/user.dart';
|
import '../../http/user.dart';
|
||||||
import '../../http/video.dart';
|
import '../../http/video.dart';
|
||||||
@ -21,24 +16,23 @@ class VideoCardH extends StatelessWidget {
|
|||||||
const VideoCardH({
|
const VideoCardH({
|
||||||
super.key,
|
super.key,
|
||||||
required this.videoItem,
|
required this.videoItem,
|
||||||
this.onPressedFn,
|
this.longPress,
|
||||||
|
this.longPressEnd,
|
||||||
this.source = 'normal',
|
this.source = 'normal',
|
||||||
this.showOwner = true,
|
this.showOwner = true,
|
||||||
this.showView = true,
|
this.showView = true,
|
||||||
this.showDanmaku = true,
|
this.showDanmaku = true,
|
||||||
this.showPubdate = false,
|
this.showPubdate = false,
|
||||||
this.showCharge = false,
|
|
||||||
});
|
});
|
||||||
// ignore: prefer_typing_uninitialized_variables
|
// ignore: prefer_typing_uninitialized_variables
|
||||||
final videoItem;
|
final videoItem;
|
||||||
final Function()? onPressedFn;
|
final Function()? longPress;
|
||||||
// normal 推荐, later 稍后再看, search 搜索
|
final Function()? longPressEnd;
|
||||||
final String source;
|
final String source;
|
||||||
final bool showOwner;
|
final bool showOwner;
|
||||||
final bool showView;
|
final bool showView;
|
||||||
final bool showDanmaku;
|
final bool showDanmaku;
|
||||||
final bool showPubdate;
|
final bool showPubdate;
|
||||||
final bool showCharge;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -49,117 +43,102 @@ class VideoCardH extends StatelessWidget {
|
|||||||
type = videoItem.type;
|
type = videoItem.type;
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
final String heroTag = Utils.makeHeroTag(aid);
|
final String heroTag = Utils.makeHeroTag(aid);
|
||||||
return InkWell(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onLongPress: () {
|
||||||
try {
|
if (longPress != null) {
|
||||||
if (type == 'ketang') {
|
longPress!();
|
||||||
SmartDialog.showToast('课堂视频暂不支持播放');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (showCharge && videoItem?.typeid == 33) {
|
|
||||||
final String redirectUrl = await UrlUtils.parseRedirectUrl(
|
|
||||||
'${HttpString.baseUrl}/video/$bvid/');
|
|
||||||
final String lastPathSegment = redirectUrl.split('/').last;
|
|
||||||
if (lastPathSegment.contains('ss')) {
|
|
||||||
RoutePush.bangumiPush(
|
|
||||||
Utils.matchNum(lastPathSegment).first, null);
|
|
||||||
}
|
|
||||||
if (lastPathSegment.contains('ep')) {
|
|
||||||
RoutePush.bangumiPush(
|
|
||||||
null, Utils.matchNum(lastPathSegment).first);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final int cid =
|
|
||||||
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
|
||||||
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
|
||||||
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
|
||||||
} catch (err) {
|
|
||||||
SmartDialog.showToast(err.toString());
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLongPress: () => imageSaveDialog(
|
// onLongPressEnd: (details) {
|
||||||
context,
|
// if (longPressEnd != null) {
|
||||||
videoItem,
|
// longPressEnd!();
|
||||||
SmartDialog.dismiss,
|
// }
|
||||||
),
|
// },
|
||||||
child: Padding(
|
child: InkWell(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
onTap: () async {
|
||||||
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
try {
|
||||||
child: LayoutBuilder(
|
if (type == 'ketang') {
|
||||||
builder: (BuildContext context, BoxConstraints boxConstraints) {
|
SmartDialog.showToast('课堂视频暂不支持播放');
|
||||||
final double width = (boxConstraints.maxWidth -
|
return;
|
||||||
StyleString.cardSpace *
|
}
|
||||||
6 /
|
final int cid =
|
||||||
MediaQuery.textScalerOf(context).scale(1.0)) /
|
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||||
2;
|
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
||||||
return Container(
|
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
||||||
constraints: const BoxConstraints(minHeight: 88),
|
} catch (err) {
|
||||||
height: width / StyleString.aspectRatio,
|
SmartDialog.showToast(err.toString());
|
||||||
child: Row(
|
}
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
},
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Padding(
|
||||||
children: <Widget>[
|
padding: const EdgeInsets.fromLTRB(
|
||||||
AspectRatio(
|
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
||||||
aspectRatio: StyleString.aspectRatio,
|
child: LayoutBuilder(
|
||||||
child: LayoutBuilder(
|
builder: (BuildContext context, BoxConstraints boxConstraints) {
|
||||||
builder: (BuildContext context,
|
final double width = (boxConstraints.maxWidth -
|
||||||
BoxConstraints boxConstraints) {
|
StyleString.cardSpace *
|
||||||
final double maxWidth = boxConstraints.maxWidth;
|
6 /
|
||||||
final double maxHeight = boxConstraints.maxHeight;
|
MediaQuery.textScalerOf(context).scale(1.0)) /
|
||||||
return Stack(
|
2;
|
||||||
children: [
|
return Container(
|
||||||
Hero(
|
constraints: const BoxConstraints(minHeight: 88),
|
||||||
tag: heroTag,
|
height: width / StyleString.aspectRatio,
|
||||||
child: NetworkImgLayer(
|
child: Row(
|
||||||
src: videoItem.pic as String,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
width: maxWidth,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
height: maxHeight,
|
children: <Widget>[
|
||||||
|
AspectRatio(
|
||||||
|
aspectRatio: StyleString.aspectRatio,
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (BuildContext context,
|
||||||
|
BoxConstraints boxConstraints) {
|
||||||
|
final double maxWidth = boxConstraints.maxWidth;
|
||||||
|
final double maxHeight = boxConstraints.maxHeight;
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
Hero(
|
||||||
|
tag: heroTag,
|
||||||
|
child: NetworkImgLayer(
|
||||||
|
src: videoItem.pic as String,
|
||||||
|
width: maxWidth,
|
||||||
|
height: maxHeight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
if (videoItem.duration != 0)
|
||||||
if (videoItem.duration != 0)
|
PBadge(
|
||||||
PBadge(
|
text: Utils.timeFormat(videoItem.duration!),
|
||||||
text: Utils.timeFormat(videoItem.duration!),
|
right: 6.0,
|
||||||
right: 6.0,
|
bottom: 6.0,
|
||||||
bottom: 6.0,
|
type: 'gray',
|
||||||
type: 'gray',
|
),
|
||||||
),
|
if (type != 'video')
|
||||||
if (type != 'video')
|
PBadge(
|
||||||
PBadge(
|
text: type,
|
||||||
text: type,
|
left: 6.0,
|
||||||
left: 6.0,
|
bottom: 6.0,
|
||||||
bottom: 6.0,
|
type: 'primary',
|
||||||
type: 'primary',
|
),
|
||||||
),
|
// if (videoItem.rcmdReason != null &&
|
||||||
// if (videoItem.rcmdReason != null &&
|
// videoItem.rcmdReason.content != '')
|
||||||
// videoItem.rcmdReason.content != '')
|
// pBadge(videoItem.rcmdReason.content, context,
|
||||||
// pBadge(videoItem.rcmdReason.content, context,
|
// 6.0, 6.0, null, null),
|
||||||
// 6.0, 6.0, null, null),
|
],
|
||||||
if (showCharge && videoItem?.isChargingSrc)
|
);
|
||||||
const PBadge(
|
},
|
||||||
text: '充电专属',
|
),
|
||||||
right: 6.0,
|
|
||||||
top: 6.0,
|
|
||||||
type: 'primary',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
VideoContent(
|
||||||
VideoContent(
|
videoItem: videoItem,
|
||||||
videoItem: videoItem,
|
source: source,
|
||||||
source: source,
|
showOwner: showOwner,
|
||||||
showOwner: showOwner,
|
showView: showView,
|
||||||
showView: showView,
|
showDanmaku: showDanmaku,
|
||||||
showDanmaku: showDanmaku,
|
showPubdate: showPubdate,
|
||||||
showPubdate: showPubdate,
|
)
|
||||||
onPressedFn: onPressedFn,
|
],
|
||||||
)
|
),
|
||||||
],
|
);
|
||||||
),
|
},
|
||||||
);
|
),
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -174,7 +153,6 @@ class VideoContent extends StatelessWidget {
|
|||||||
final bool showView;
|
final bool showView;
|
||||||
final bool showDanmaku;
|
final bool showDanmaku;
|
||||||
final bool showPubdate;
|
final bool showPubdate;
|
||||||
final Function()? onPressedFn;
|
|
||||||
|
|
||||||
const VideoContent({
|
const VideoContent({
|
||||||
super.key,
|
super.key,
|
||||||
@ -184,7 +162,6 @@ class VideoContent extends StatelessWidget {
|
|||||||
this.showView = true,
|
this.showView = true,
|
||||||
this.showDanmaku = true,
|
this.showDanmaku = true,
|
||||||
this.showPubdate = false,
|
this.showPubdate = false,
|
||||||
this.onPressedFn,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -195,7 +172,7 @@ class VideoContent extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (source == 'normal' || source == 'later') ...[
|
if (videoItem.title is String) ...[
|
||||||
Text(
|
Text(
|
||||||
videoItem.title as String,
|
videoItem.title as String,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
@ -210,7 +187,7 @@ class VideoContent extends StatelessWidget {
|
|||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
children: [
|
children: [
|
||||||
for (final i in videoItem.titleList) ...[
|
for (final i in videoItem.title) ...[
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: i['text'] as String,
|
text: i['text'] as String,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -266,49 +243,128 @@ class VideoContent extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
if (showView) ...[
|
if (showView) ...[
|
||||||
StatView(view: videoItem.stat.view as int),
|
StatView(
|
||||||
|
theme: 'gray',
|
||||||
|
view: videoItem.stat.view as int,
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
],
|
],
|
||||||
if (showDanmaku)
|
if (showDanmaku)
|
||||||
StatDanMu(danmu: videoItem.stat.danmaku as int),
|
StatDanMu(
|
||||||
|
theme: 'gray',
|
||||||
|
danmu: videoItem.stat.danmaku as int,
|
||||||
|
),
|
||||||
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
// SizedBox(
|
||||||
|
// width: 20,
|
||||||
|
// height: 20,
|
||||||
|
// child: IconButton(
|
||||||
|
// tooltip: '稍后再看',
|
||||||
|
// style: ButtonStyle(
|
||||||
|
// padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
|
// ),
|
||||||
|
// onPressed: () async {
|
||||||
|
// var res =
|
||||||
|
// await UserHttp.toViewLater(bvid: videoItem.bvid);
|
||||||
|
// SmartDialog.showToast(res['msg']);
|
||||||
|
// },
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons.more_vert_outlined,
|
||||||
|
// color: Theme.of(context).colorScheme.outline,
|
||||||
|
// size: 14,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
if (source == 'normal')
|
if (source == 'normal')
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
child: IconButton(
|
child: PopupMenuButton<String>(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
onPressed: () {
|
|
||||||
feedBack();
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
useRootNavigator: true,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (context) {
|
|
||||||
return MorePanel(videoItem: videoItem);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.more_vert_outlined,
|
Icons.more_vert_outlined,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
size: 14,
|
size: 14,
|
||||||
),
|
),
|
||||||
|
position: PopupMenuPosition.under,
|
||||||
|
// constraints: const BoxConstraints(maxHeight: 35),
|
||||||
|
onSelected: (String type) {},
|
||||||
|
itemBuilder: (BuildContext context) =>
|
||||||
|
<PopupMenuEntry<String>>[
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
onTap: () async {
|
||||||
|
var res = await UserHttp.toViewLater(
|
||||||
|
bvid: videoItem.bvid as String);
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
},
|
||||||
|
value: 'pause',
|
||||||
|
height: 40,
|
||||||
|
child: const Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.watch_later_outlined, size: 16),
|
||||||
|
SizedBox(width: 6),
|
||||||
|
Text('稍后再看', style: TextStyle(fontSize: 13))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const PopupMenuDivider(),
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
onTap: () async {
|
||||||
|
SmartDialog.show(
|
||||||
|
useSystem: true,
|
||||||
|
animationType:
|
||||||
|
SmartAnimationType.centerFade_otherSlide,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: Text(
|
||||||
|
'确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
||||||
|
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
|
child: Text(
|
||||||
|
'点错了',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var res = await VideoHttp.relationMod(
|
||||||
|
mid: videoItem.owner.mid,
|
||||||
|
act: 5,
|
||||||
|
reSrc: 11,
|
||||||
|
);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
SmartDialog.showToast(res['code'] == 0
|
||||||
|
? '成功'
|
||||||
|
: res['msg']);
|
||||||
|
},
|
||||||
|
child: const Text('确认'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
value: 'pause',
|
||||||
|
height: 40,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.block, size: 16),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text('拉黑:${videoItem.owner.name}',
|
||||||
|
style: const TextStyle(fontSize: 13))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (source == 'later') ...[
|
|
||||||
IconButton(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
||||||
),
|
|
||||||
onPressed: () => onPressedFn?.call(),
|
|
||||||
icon: Icon(
|
|
||||||
Icons.clear_outlined,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
size: 18,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -317,110 +373,3 @@ class VideoContent extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MorePanel extends StatelessWidget {
|
|
||||||
final dynamic videoItem;
|
|
||||||
const MorePanel({super.key, required this.videoItem});
|
|
||||||
|
|
||||||
Future<dynamic> menuActionHandler(String type) async {
|
|
||||||
switch (type) {
|
|
||||||
case 'block':
|
|
||||||
blockUser();
|
|
||||||
break;
|
|
||||||
case 'watchLater':
|
|
||||||
var res = await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
Get.back();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void blockUser() async {
|
|
||||||
SmartDialog.show(
|
|
||||||
useSystem: true,
|
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('提示'),
|
|
||||||
content: Text('确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
|
||||||
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => SmartDialog.dismiss(),
|
|
||||||
child: Text(
|
|
||||||
'点错了',
|
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
var res = await VideoHttp.relationMod(
|
|
||||||
mid: videoItem.owner.mid,
|
|
||||||
act: 5,
|
|
||||||
reSrc: 11,
|
|
||||||
);
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
SmartDialog.showToast(res['msg'] ?? '成功');
|
|
||||||
},
|
|
||||||
child: const Text('确认'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
InkWell(
|
|
||||||
onTap: () => Get.back(),
|
|
||||||
child: Container(
|
|
||||||
height: 35,
|
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
width: 32,
|
|
||||||
height: 3,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () async => await menuActionHandler('block'),
|
|
||||||
minLeadingWidth: 0,
|
|
||||||
leading: const Icon(Icons.block, size: 19),
|
|
||||||
title: Text(
|
|
||||||
'拉黑up主 「${videoItem.owner.name}」',
|
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () async => await menuActionHandler('watchLater'),
|
|
||||||
minLeadingWidth: 0,
|
|
||||||
leading: const Icon(Icons.watch_later_outlined, size: 19),
|
|
||||||
title:
|
|
||||||
Text('添加至稍后再看', style: Theme.of(context).textTheme.titleSmall),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () =>
|
|
||||||
imageSaveDialog(context, videoItem, SmartDialog.dismiss),
|
|
||||||
minLeadingWidth: 0,
|
|
||||||
leading: const Icon(Icons.photo_outlined, size: 19),
|
|
||||||
title:
|
|
||||||
Text('查看视频封面', style: Theme.of(context).textTheme.titleSmall),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
|
||||||
import 'package:pilipala/utils/image_save.dart';
|
|
||||||
import 'package:pilipala/utils/route_push.dart';
|
|
||||||
import '../../models/model_rec_video_item.dart';
|
import '../../models/model_rec_video_item.dart';
|
||||||
import 'stat/danmu.dart';
|
import 'stat/danmu.dart';
|
||||||
import 'stat/view.dart';
|
import 'stat/view.dart';
|
||||||
import '../../http/dynamics.dart';
|
import '../../http/dynamics.dart';
|
||||||
|
import '../../http/search.dart';
|
||||||
import '../../http/user.dart';
|
import '../../http/user.dart';
|
||||||
import '../../http/video.dart';
|
import '../../http/video.dart';
|
||||||
|
import '../../models/common/search_type.dart';
|
||||||
import '../../utils/id_utils.dart';
|
import '../../utils/id_utils.dart';
|
||||||
import '../../utils/utils.dart';
|
import '../../utils/utils.dart';
|
||||||
import '../constants.dart';
|
import '../constants.dart';
|
||||||
@ -20,13 +19,15 @@ import 'network_img_layer.dart';
|
|||||||
class VideoCardV extends StatelessWidget {
|
class VideoCardV extends StatelessWidget {
|
||||||
final dynamic videoItem;
|
final dynamic videoItem;
|
||||||
final int crossAxisCount;
|
final int crossAxisCount;
|
||||||
final Function? blockUserCb;
|
final Function()? longPress;
|
||||||
|
final Function()? longPressEnd;
|
||||||
|
|
||||||
const VideoCardV({
|
const VideoCardV({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.videoItem,
|
required this.videoItem,
|
||||||
required this.crossAxisCount,
|
required this.crossAxisCount,
|
||||||
this.blockUserCb,
|
this.longPress,
|
||||||
|
this.longPressEnd,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
bool isStringNumeric(String str) {
|
bool isStringNumeric(String str) {
|
||||||
@ -43,11 +44,23 @@ class VideoCardV extends StatelessWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int epId = videoItem.param;
|
int epId = videoItem.param;
|
||||||
RoutePush.bangumiPush(
|
SmartDialog.showLoading(msg: '资源获取中');
|
||||||
null,
|
var result = await SearchHttp.bangumiInfo(seasonId: null, epId: epId);
|
||||||
epId,
|
if (result['status']) {
|
||||||
heroTag: heroTag,
|
var bangumiDetail = result['data'];
|
||||||
);
|
int cid = bangumiDetail.episodes!.first.cid;
|
||||||
|
String bvid = IdUtils.av2bv(bangumiDetail.episodes!.first.aid);
|
||||||
|
SmartDialog.dismiss().then(
|
||||||
|
(value) => Get.toNamed(
|
||||||
|
'/video?bvid=$bvid&cid=$cid&epId=$epId',
|
||||||
|
arguments: {
|
||||||
|
'pic': videoItem.pic,
|
||||||
|
'heroTag': heroTag,
|
||||||
|
'videoType': SearchType.media_bangumi,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'av':
|
case 'av':
|
||||||
String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid);
|
String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid);
|
||||||
@ -60,13 +73,17 @@ class VideoCardV extends StatelessWidget {
|
|||||||
// 动态
|
// 动态
|
||||||
case 'picture':
|
case 'picture':
|
||||||
try {
|
try {
|
||||||
|
String dynamicType = 'picture';
|
||||||
String uri = videoItem.uri;
|
String uri = videoItem.uri;
|
||||||
|
String id = '';
|
||||||
if (videoItem.uri.startsWith('bilibili://article/')) {
|
if (videoItem.uri.startsWith('bilibili://article/')) {
|
||||||
// https://www.bilibili.com/read/cv27063554
|
// https://www.bilibili.com/read/cv27063554
|
||||||
|
dynamicType = 'read';
|
||||||
RegExp regex = RegExp(r'\d+');
|
RegExp regex = RegExp(r'\d+');
|
||||||
Match match = regex.firstMatch(videoItem.uri)!;
|
Match match = regex.firstMatch(videoItem.uri)!;
|
||||||
String matchedNumber = match.group(0)!;
|
String matchedNumber = match.group(0)!;
|
||||||
videoItem.param = int.parse(matchedNumber);
|
videoItem.param = int.parse(matchedNumber);
|
||||||
|
id = 'cv${videoItem.param}';
|
||||||
}
|
}
|
||||||
if (uri.startsWith('http')) {
|
if (uri.startsWith('http')) {
|
||||||
String path = Uri.parse(uri).path;
|
String path = Uri.parse(uri).path;
|
||||||
@ -84,10 +101,11 @@ class VideoCardV extends StatelessWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Get.toNamed('/read', parameters: {
|
Get.toNamed('/htmlRender', parameters: {
|
||||||
|
'url': uri,
|
||||||
'title': videoItem.title,
|
'title': videoItem.title,
|
||||||
'id': videoItem.param,
|
'id': id,
|
||||||
'articleType': 'read'
|
'dynamicType': dynamicType
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
SmartDialog.showToast(err.toString());
|
SmartDialog.showToast(err.toString());
|
||||||
@ -109,57 +127,64 @@ class VideoCardV extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String heroTag = Utils.makeHeroTag(videoItem.id);
|
String heroTag = Utils.makeHeroTag(videoItem.id);
|
||||||
return InkWell(
|
return Card(
|
||||||
onTap: () async => onPushDetail(heroTag),
|
elevation: 0,
|
||||||
onLongPress: () => imageSaveDialog(
|
clipBehavior: Clip.hardEdge,
|
||||||
context,
|
margin: EdgeInsets.zero,
|
||||||
videoItem,
|
child: GestureDetector(
|
||||||
SmartDialog.dismiss,
|
onLongPress: () {
|
||||||
),
|
if (longPress != null) {
|
||||||
borderRadius: BorderRadius.circular(16),
|
longPress!();
|
||||||
child: Column(
|
}
|
||||||
children: [
|
},
|
||||||
AspectRatio(
|
// onLongPressEnd: (details) {
|
||||||
aspectRatio: StyleString.aspectRatio,
|
// if (longPressEnd != null) {
|
||||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
// longPressEnd!();
|
||||||
double maxWidth = boxConstraints.maxWidth;
|
// }
|
||||||
double maxHeight = boxConstraints.maxHeight;
|
// },
|
||||||
return Stack(
|
child: InkWell(
|
||||||
children: [
|
onTap: () async => onPushDetail(heroTag),
|
||||||
Hero(
|
child: Column(
|
||||||
tag: heroTag,
|
children: [
|
||||||
child: NetworkImgLayer(
|
AspectRatio(
|
||||||
src: videoItem.pic,
|
aspectRatio: StyleString.aspectRatio,
|
||||||
width: maxWidth,
|
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||||
height: maxHeight,
|
double maxWidth = boxConstraints.maxWidth;
|
||||||
),
|
double maxHeight = boxConstraints.maxHeight;
|
||||||
),
|
return Stack(
|
||||||
if (videoItem.duration > 0)
|
children: [
|
||||||
if (crossAxisCount == 1) ...[
|
Hero(
|
||||||
PBadge(
|
tag: heroTag,
|
||||||
bottom: 10,
|
child: NetworkImgLayer(
|
||||||
right: 10,
|
src: videoItem.pic,
|
||||||
text: Utils.timeFormat(videoItem.duration),
|
width: maxWidth,
|
||||||
)
|
height: maxHeight,
|
||||||
] else ...[
|
),
|
||||||
PBadge(
|
),
|
||||||
bottom: 6,
|
if (videoItem.duration > 0)
|
||||||
right: 7,
|
if (crossAxisCount == 1) ...[
|
||||||
size: 'small',
|
PBadge(
|
||||||
type: 'gray',
|
bottom: 10,
|
||||||
text: Utils.timeFormat(videoItem.duration),
|
right: 10,
|
||||||
)
|
text: Utils.timeFormat(videoItem.duration),
|
||||||
|
)
|
||||||
|
] else ...[
|
||||||
|
PBadge(
|
||||||
|
bottom: 6,
|
||||||
|
right: 7,
|
||||||
|
size: 'small',
|
||||||
|
type: 'gray',
|
||||||
|
text: Utils.timeFormat(videoItem.duration),
|
||||||
|
)
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
);
|
||||||
);
|
}),
|
||||||
}),
|
),
|
||||||
|
VideoContent(videoItem: videoItem, crossAxisCount: crossAxisCount)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
VideoContent(
|
),
|
||||||
videoItem: videoItem,
|
|
||||||
crossAxisCount: crossAxisCount,
|
|
||||||
blockUserCb: blockUserCb,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -168,101 +193,125 @@ class VideoCardV extends StatelessWidget {
|
|||||||
class VideoContent extends StatelessWidget {
|
class VideoContent extends StatelessWidget {
|
||||||
final dynamic videoItem;
|
final dynamic videoItem;
|
||||||
final int crossAxisCount;
|
final int crossAxisCount;
|
||||||
final Function? blockUserCb;
|
const VideoContent(
|
||||||
|
{Key? key, required this.videoItem, required this.crossAxisCount})
|
||||||
const VideoContent({
|
: super(key: key);
|
||||||
Key? key,
|
|
||||||
required this.videoItem,
|
|
||||||
required this.crossAxisCount,
|
|
||||||
this.blockUserCb,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
Widget _buildBadge(String text, String type, [double fs = 12]) {
|
|
||||||
return PBadge(
|
|
||||||
text: text,
|
|
||||||
stack: 'normal',
|
|
||||||
size: 'small',
|
|
||||||
type: type,
|
|
||||||
fs: fs,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Expanded(
|
||||||
padding: crossAxisCount == 1
|
flex: crossAxisCount == 1 ? 0 : 1,
|
||||||
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
child: Padding(
|
||||||
: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
padding: crossAxisCount == 1
|
||||||
child: Column(
|
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
||||||
children: [
|
child: Column(
|
||||||
Text(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
videoItem.title,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
maxLines: 2,
|
children: [
|
||||||
overflow: TextOverflow.ellipsis,
|
Row(
|
||||||
),
|
children: [
|
||||||
if (crossAxisCount > 1) ...[
|
Expanded(
|
||||||
const SizedBox(height: 2),
|
child: Text(
|
||||||
VideoStat(videoItem: videoItem, crossAxisCount: crossAxisCount),
|
videoItem.title,
|
||||||
],
|
maxLines: 2,
|
||||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
overflow: TextOverflow.ellipsis,
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
if (videoItem.goto == 'bangumi')
|
|
||||||
_buildBadge(videoItem.bangumiBadge, 'line', 9),
|
|
||||||
if (videoItem.rcmdReason != null)
|
|
||||||
_buildBadge(videoItem.rcmdReason, 'color'),
|
|
||||||
if (videoItem.goto == 'picture') _buildBadge('动态', 'line', 9),
|
|
||||||
if (videoItem.isFollowed == 1) _buildBadge('已关注', 'color'),
|
|
||||||
Expanded(
|
|
||||||
flex: crossAxisCount == 1 ? 0 : 1,
|
|
||||||
child: Text(
|
|
||||||
videoItem.owner.name,
|
|
||||||
maxLines: 1,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
if (videoItem.goto == 'av' && crossAxisCount == 1) ...[
|
||||||
if (crossAxisCount == 1) ...[
|
const SizedBox(width: 10),
|
||||||
const SizedBox(width: 10),
|
VideoPopupMenu(
|
||||||
VideoStat(
|
size: 32,
|
||||||
videoItem: videoItem,
|
iconSize: 18,
|
||||||
crossAxisCount: crossAxisCount,
|
videoItem: videoItem,
|
||||||
),
|
),
|
||||||
const Spacer(),
|
],
|
||||||
],
|
],
|
||||||
if (videoItem.goto == 'av')
|
),
|
||||||
SizedBox(
|
if (crossAxisCount > 1) ...[
|
||||||
width: 24,
|
const SizedBox(height: 2),
|
||||||
height: 24,
|
VideoStat(
|
||||||
child: IconButton(
|
videoItem: videoItem,
|
||||||
padding: EdgeInsets.zero,
|
crossAxisCount: crossAxisCount,
|
||||||
onPressed: () {
|
),
|
||||||
feedBack();
|
],
|
||||||
showModalBottomSheet(
|
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||||
context: context,
|
Row(
|
||||||
useRootNavigator: true,
|
children: [
|
||||||
isScrollControlled: true,
|
if (videoItem.goto == 'bangumi') ...[
|
||||||
builder: (context) {
|
PBadge(
|
||||||
return MorePanel(
|
text: videoItem.bangumiBadge,
|
||||||
videoItem: videoItem,
|
stack: 'normal',
|
||||||
blockUserCb: blockUserCb,
|
size: 'small',
|
||||||
);
|
type: 'line',
|
||||||
},
|
fs: 9,
|
||||||
);
|
)
|
||||||
},
|
],
|
||||||
icon: Icon(
|
if (videoItem.rcmdReason != null &&
|
||||||
Icons.more_vert_outlined,
|
videoItem.rcmdReason.content != '') ...[
|
||||||
|
PBadge(
|
||||||
|
text: videoItem.rcmdReason.content,
|
||||||
|
stack: 'normal',
|
||||||
|
size: 'small',
|
||||||
|
type: 'color',
|
||||||
|
)
|
||||||
|
],
|
||||||
|
if (videoItem.goto == 'picture') ...[
|
||||||
|
const PBadge(
|
||||||
|
text: '动态',
|
||||||
|
stack: 'normal',
|
||||||
|
size: 'small',
|
||||||
|
type: 'line',
|
||||||
|
fs: 9,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
if (videoItem.isFollowed == 1) ...[
|
||||||
|
const PBadge(
|
||||||
|
text: '已关注',
|
||||||
|
stack: 'normal',
|
||||||
|
size: 'small',
|
||||||
|
type: 'color',
|
||||||
|
)
|
||||||
|
],
|
||||||
|
Expanded(
|
||||||
|
flex: crossAxisCount == 1 ? 0 : 1,
|
||||||
|
child: Text(
|
||||||
|
videoItem.owner.name,
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
size: 14,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
if (crossAxisCount == 1) ...[
|
||||||
),
|
Text(
|
||||||
],
|
' • ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
VideoStat(
|
||||||
|
videoItem: videoItem,
|
||||||
|
crossAxisCount: crossAxisCount,
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
],
|
||||||
|
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
|
||||||
|
VideoPopupMenu(
|
||||||
|
size: 24,
|
||||||
|
iconSize: 14,
|
||||||
|
videoItem: videoItem,
|
||||||
|
),
|
||||||
|
] else ...[
|
||||||
|
const SizedBox(height: 24)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -282,9 +331,15 @@ class VideoStat extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
StatView(view: videoItem.stat.view),
|
StatView(
|
||||||
|
theme: 'gray',
|
||||||
|
view: videoItem.stat.view,
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
StatDanMu(danmu: videoItem.stat.danmu),
|
StatDanMu(
|
||||||
|
theme: 'gray',
|
||||||
|
danmu: videoItem.stat.danmu,
|
||||||
|
),
|
||||||
if (videoItem is RecVideoItemModel) ...<Widget>[
|
if (videoItem is RecVideoItemModel) ...<Widget>[
|
||||||
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
|
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
|
||||||
RichText(
|
RichText(
|
||||||
@ -303,116 +358,99 @@ class VideoStat extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MorePanel extends StatelessWidget {
|
class VideoPopupMenu extends StatelessWidget {
|
||||||
|
final double? size;
|
||||||
|
final double? iconSize;
|
||||||
final dynamic videoItem;
|
final dynamic videoItem;
|
||||||
final Function? blockUserCb;
|
|
||||||
const MorePanel({
|
const VideoPopupMenu({
|
||||||
super.key,
|
Key? key,
|
||||||
|
required this.size,
|
||||||
|
required this.iconSize,
|
||||||
required this.videoItem,
|
required this.videoItem,
|
||||||
this.blockUserCb,
|
}) : super(key: key);
|
||||||
});
|
|
||||||
|
|
||||||
Future<dynamic> menuActionHandler(String type) async {
|
|
||||||
switch (type) {
|
|
||||||
case 'block':
|
|
||||||
Get.back();
|
|
||||||
blockUser();
|
|
||||||
break;
|
|
||||||
case 'watchLater':
|
|
||||||
var res = await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
Get.back();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void blockUser() async {
|
|
||||||
SmartDialog.show(
|
|
||||||
useSystem: true,
|
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('提示'),
|
|
||||||
content: Text('确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
|
||||||
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => SmartDialog.dismiss(),
|
|
||||||
child: Text(
|
|
||||||
'点错了',
|
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
var res = await VideoHttp.relationMod(
|
|
||||||
mid: videoItem.owner.mid,
|
|
||||||
act: 5,
|
|
||||||
reSrc: 11,
|
|
||||||
);
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
if (res['status']) {
|
|
||||||
blockUserCb?.call(videoItem.owner.mid);
|
|
||||||
}
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
},
|
|
||||||
child: const Text('确认'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return SizedBox(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
width: size,
|
||||||
child: Column(
|
height: size,
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: PopupMenuButton<String>(
|
||||||
children: [
|
padding: EdgeInsets.zero,
|
||||||
InkWell(
|
icon: Icon(
|
||||||
onTap: () => Get.back(),
|
Icons.more_vert_outlined,
|
||||||
child: Container(
|
color: Theme.of(context).colorScheme.outline,
|
||||||
height: 35,
|
size: iconSize,
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
),
|
||||||
child: Center(
|
position: PopupMenuPosition.under,
|
||||||
child: Container(
|
// constraints: const BoxConstraints(maxHeight: 35),
|
||||||
width: 32,
|
onSelected: (String type) {},
|
||||||
height: 3,
|
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||||
decoration: BoxDecoration(
|
PopupMenuItem<String>(
|
||||||
color: Theme.of(context).colorScheme.outline,
|
onTap: () async {
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
var res =
|
||||||
),
|
await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
||||||
),
|
SmartDialog.showToast(res['msg']);
|
||||||
|
},
|
||||||
|
value: 'pause',
|
||||||
|
height: 40,
|
||||||
|
child: const Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.watch_later_outlined, size: 16),
|
||||||
|
SizedBox(width: 6),
|
||||||
|
Text('稍后再看', style: TextStyle(fontSize: 13))
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
const PopupMenuDivider(),
|
||||||
onTap: () async => await menuActionHandler('block'),
|
PopupMenuItem<String>(
|
||||||
minLeadingWidth: 0,
|
onTap: () async {
|
||||||
leading: const Icon(Icons.block, size: 19),
|
SmartDialog.show(
|
||||||
title: Text(
|
useSystem: true,
|
||||||
'拉黑up主 「${videoItem.owner.name}」',
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: Text(
|
||||||
|
'确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
||||||
|
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
|
child: Text(
|
||||||
|
'点错了',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var res = await VideoHttp.relationMod(
|
||||||
|
mid: videoItem.owner.mid,
|
||||||
|
act: 5,
|
||||||
|
reSrc: 11,
|
||||||
|
);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
SmartDialog.showToast(res['msg'] ?? '成功');
|
||||||
|
},
|
||||||
|
child: const Text('确认'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
value: 'pause',
|
||||||
|
height: 40,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.block, size: 16),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text('拉黑:${videoItem.owner.name}',
|
||||||
|
style: const TextStyle(fontSize: 13))
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
|
||||||
onTap: () async => await menuActionHandler('watchLater'),
|
|
||||||
minLeadingWidth: 0,
|
|
||||||
leading: const Icon(Icons.watch_later_outlined, size: 19),
|
|
||||||
title:
|
|
||||||
Text('添加至稍后再看', style: Theme.of(context).textTheme.titleSmall),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () =>
|
|
||||||
imageSaveDialog(context, videoItem, SmartDialog.dismiss),
|
|
||||||
minLeadingWidth: 0,
|
|
||||||
leading: const Icon(Icons.photo_outlined, size: 19),
|
|
||||||
title:
|
|
||||||
Text('查看视频封面', style: Theme.of(context).textTheme.titleSmall),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -189,7 +189,7 @@ class Api {
|
|||||||
'https://s.search.bilibili.com/main/suggest';
|
'https://s.search.bilibili.com/main/suggest';
|
||||||
|
|
||||||
// 分类搜索
|
// 分类搜索
|
||||||
static const String searchByType = '/x/web-interface/wbi/search/type';
|
static const String searchByType = '/x/web-interface/search/type';
|
||||||
|
|
||||||
// 记录视频播放进度
|
// 记录视频播放进度
|
||||||
// https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/video/report.md
|
// https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/video/report.md
|
||||||
@ -400,24 +400,12 @@ class Api {
|
|||||||
'${HttpString.passBaseUrl}/x/passport-login/captcha?source=main_web';
|
'${HttpString.passBaseUrl}/x/passport-login/captcha?source=main_web';
|
||||||
|
|
||||||
// web端短信验证码
|
// web端短信验证码
|
||||||
static const String webSmsCode =
|
static const String smsCode =
|
||||||
'${HttpString.passBaseUrl}/x/passport-login/web/sms/send';
|
'${HttpString.passBaseUrl}/x/passport-login/web/sms/send';
|
||||||
|
|
||||||
// web端验证码登录
|
// web端验证码登录
|
||||||
static const String webSmsLogin =
|
|
||||||
'${HttpString.passBaseUrl}/x/passport-login/web/login/sms';
|
|
||||||
|
|
||||||
// web端密码登录
|
// web端密码登录
|
||||||
static const String loginInByWebPwd =
|
|
||||||
'${HttpString.passBaseUrl}/x/passport-login/web/login';
|
|
||||||
|
|
||||||
// web端二维码
|
|
||||||
static const String qrCodeApi =
|
|
||||||
'${HttpString.passBaseUrl}/x/passport-login/web/qrcode/generate';
|
|
||||||
|
|
||||||
// 扫码登录
|
|
||||||
static const String loginInByQrcode =
|
|
||||||
'${HttpString.passBaseUrl}/x/passport-login/web/qrcode/poll';
|
|
||||||
|
|
||||||
// app端短信验证码
|
// app端短信验证码
|
||||||
static const String appSmsCode =
|
static const String appSmsCode =
|
||||||
@ -487,8 +475,6 @@ class Api {
|
|||||||
static const getSeasonDetailApi =
|
static const getSeasonDetailApi =
|
||||||
'/x/polymer/web-space/seasons_archives_list';
|
'/x/polymer/web-space/seasons_archives_list';
|
||||||
|
|
||||||
static const getSeriesDetailApi = '/x/series/archives';
|
|
||||||
|
|
||||||
/// 获取未读动态数
|
/// 获取未读动态数
|
||||||
static const getUnreadDynamic = '/x/web-interface/dynamic/entrance';
|
static const getUnreadDynamic = '/x/web-interface/dynamic/entrance';
|
||||||
|
|
||||||
@ -504,11 +490,8 @@ class Api {
|
|||||||
/// 我的订阅
|
/// 我的订阅
|
||||||
static const userSubFolder = '/x/v3/fav/folder/collected/list';
|
static const userSubFolder = '/x/v3/fav/folder/collected/list';
|
||||||
|
|
||||||
/// 我的订阅详情 type 21
|
/// 我的订阅详情
|
||||||
static const userSeasonList = '/x/space/fav/season/list';
|
static const userSubFolderDetail = '/x/space/fav/season/list';
|
||||||
|
|
||||||
/// 我的订阅详情 type 11
|
|
||||||
static const userResourceList = '/x/v3/fav/resource/list';
|
|
||||||
|
|
||||||
/// 表情
|
/// 表情
|
||||||
static const emojiList = '/x/emote/user/panel/web';
|
static const emojiList = '/x/emote/user/panel/web';
|
||||||
@ -523,76 +506,4 @@ class Api {
|
|||||||
/// 排行榜
|
/// 排行榜
|
||||||
static const String getRankApi = "/x/web-interface/ranking/v2";
|
static const String getRankApi = "/x/web-interface/ranking/v2";
|
||||||
|
|
||||||
/// 取消订阅
|
|
||||||
static const String cancelSub = '/x/v3/fav/season/unfav';
|
|
||||||
|
|
||||||
/// 动态转发
|
|
||||||
static const String dynamicForwardUrl = '/x/dynamic/feed/create/submit_check';
|
|
||||||
|
|
||||||
/// 创建动态
|
|
||||||
static const String dynamicCreate = '/x/dynamic/feed/create/dyn';
|
|
||||||
|
|
||||||
/// 删除收藏夹
|
|
||||||
static const String delFavFolder = '/x/v3/fav/folder/del';
|
|
||||||
|
|
||||||
/// 搜索结果计数
|
|
||||||
static const String searchCount = '/x/web-interface/wbi/search/all/v2';
|
|
||||||
|
|
||||||
/// 关闭会话
|
|
||||||
static const String removeSession =
|
|
||||||
'${HttpString.tUrl}/session_svr/v1/session_svr/remove_session';
|
|
||||||
|
|
||||||
/// 消息未读数
|
|
||||||
static const String unread = '${HttpString.tUrl}/x/im/web/msgfeed/unread';
|
|
||||||
|
|
||||||
/// 回复我的
|
|
||||||
static const String messageReplyAPi = '/x/msgfeed/reply';
|
|
||||||
|
|
||||||
/// 收到的赞
|
|
||||||
static const String messageLikeAPi = '/x/msgfeed/like';
|
|
||||||
|
|
||||||
/// 系统通知
|
|
||||||
static const String messageSystemAPi =
|
|
||||||
'${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
|
|
||||||
|
|
||||||
/// 系统通知 个人
|
|
||||||
static const String userMessageSystemAPi =
|
|
||||||
'${HttpString.messageBaseUrl}/x/sys-msg/query_user_notify';
|
|
||||||
|
|
||||||
/// 系统通知标记已读
|
|
||||||
static const String systemMarkRead =
|
|
||||||
'${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
|
|
||||||
|
|
||||||
/// 编辑收藏夹
|
|
||||||
static const String editFavFolder = '/x/v3/fav/folder/edit';
|
|
||||||
|
|
||||||
/// 新建收藏夹
|
|
||||||
static const String addFavFolder = '/x/v3/fav/folder/add';
|
|
||||||
|
|
||||||
/// 直播间弹幕信息
|
|
||||||
static const String getDanmuInfo =
|
|
||||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getDanmuInfo';
|
|
||||||
|
|
||||||
/// 直播间发送弹幕
|
|
||||||
static const String sendLiveMsg = '${HttpString.liveBaseUrl}/msg/send';
|
|
||||||
|
|
||||||
/// 我的关注 - 正在直播
|
|
||||||
static const String getFollowingLive =
|
|
||||||
'${HttpString.liveBaseUrl}/xlive/web-ucenter/user/following';
|
|
||||||
|
|
||||||
/// 稍后再看&收藏夹视频列表
|
|
||||||
static const String mediaList = '/x/v2/medialist/resource/list';
|
|
||||||
|
|
||||||
/// 用户专栏
|
|
||||||
static const String opusList = '/x/polymer/web-dynamic/v1/opus/feed/space';
|
|
||||||
|
|
||||||
///
|
|
||||||
static const String getViewInfo = '/x/article/viewinfo';
|
|
||||||
|
|
||||||
/// 直播间记录
|
|
||||||
static const String liveRoomEntry =
|
|
||||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/roomEntryAction';
|
|
||||||
|
|
||||||
/// 删除评论
|
|
||||||
static const String replyDel = '/x/v2/reply/del';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class BlackHttp {
|
|||||||
static Future removeBlack({required int fid}) async {
|
static Future removeBlack({required int fid}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.removeBlack,
|
Api.removeBlack,
|
||||||
data: {
|
queryParameters: {
|
||||||
'act': 6,
|
'act': 6,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
'fid': fid,
|
'fid': fid,
|
||||||
|
|||||||
@ -5,8 +5,6 @@ class HttpString {
|
|||||||
static const String appBaseUrl = 'https://app.bilibili.com';
|
static const String appBaseUrl = 'https://app.bilibili.com';
|
||||||
static const String liveBaseUrl = 'https://api.live.bilibili.com';
|
static const String liveBaseUrl = 'https://api.live.bilibili.com';
|
||||||
static const String passBaseUrl = 'https://passport.bilibili.com';
|
static const String passBaseUrl = 'https://passport.bilibili.com';
|
||||||
static const String messageBaseUrl = 'https://message.bilibili.com';
|
|
||||||
static const String bangumiBaseUrl = 'https://bili.meark.me';
|
|
||||||
static const List<int> validateStatusCodes = [
|
static const List<int> validateStatusCodes = [
|
||||||
302,
|
302,
|
||||||
304,
|
304,
|
||||||
|
|||||||
@ -67,6 +67,9 @@ class DanmakaHttp {
|
|||||||
var response = await Request().post(
|
var response = await Request().post(
|
||||||
Api.shootDanmaku,
|
Api.shootDanmaku,
|
||||||
data: params,
|
data: params,
|
||||||
|
options: Options(
|
||||||
|
contentType: Headers.formUrlEncodedContentType,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import 'dart:math';
|
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import '../models/dynamics/result.dart';
|
import '../models/dynamics/result.dart';
|
||||||
import '../models/dynamics/up.dart';
|
import '../models/dynamics/up.dart';
|
||||||
import 'index.dart';
|
import 'index.dart';
|
||||||
@ -42,7 +40,6 @@ class DynamicsHttp {
|
|||||||
'status': false,
|
'status': false,
|
||||||
'data': [],
|
'data': [],
|
||||||
'msg': res.data['message'],
|
'msg': res.data['message'],
|
||||||
'code': res.data['code'],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +67,7 @@ class DynamicsHttp {
|
|||||||
}) async {
|
}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.likeDynamic,
|
Api.likeDynamic,
|
||||||
data: {
|
queryParameters: {
|
||||||
'dynamic_id': dynamicId,
|
'dynamic_id': dynamicId,
|
||||||
'up': up,
|
'up': up,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -120,99 +117,4 @@ class DynamicsHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future dynamicForward() async {
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.dynamicForwardUrl,
|
|
||||||
queryParameters: {
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
|
||||||
'x-bili-web-req-json': {'spm_id': '333.999'},
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
'attach_card': null,
|
|
||||||
'scene': 4,
|
|
||||||
'content': {
|
|
||||||
'conetents': [
|
|
||||||
{'raw_text': "2", 'type': 1, 'biz_id': ""}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future dynamicCreate({
|
|
||||||
required int mid,
|
|
||||||
required int scene,
|
|
||||||
int? oid,
|
|
||||||
String? dynIdStr,
|
|
||||||
String? rawText,
|
|
||||||
}) async {
|
|
||||||
DateTime now = DateTime.now();
|
|
||||||
int timestamp = now.millisecondsSinceEpoch ~/ 1000;
|
|
||||||
Random random = Random();
|
|
||||||
int randomNumber = random.nextInt(9000) + 1000;
|
|
||||||
String uploadId = '${mid}_${timestamp}_$randomNumber';
|
|
||||||
|
|
||||||
Map<String, dynamic> webRepostSrc = {
|
|
||||||
'dyn_id_str': dynIdStr ?? '',
|
|
||||||
};
|
|
||||||
|
|
||||||
/// 投稿转发
|
|
||||||
if (scene == 5) {
|
|
||||||
webRepostSrc = {
|
|
||||||
'revs_id': {'dyn_type': 8, 'rid': oid}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.dynamicCreate,
|
|
||||||
queryParameters: {
|
|
||||||
'platform': 'web',
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
|
||||||
'x-bili-web-req-json': {'spm_id': '333.999'},
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
'dyn_req': {
|
|
||||||
'content': {
|
|
||||||
'contents': [
|
|
||||||
{'raw_text': rawText ?? '', 'type': 1, 'biz_id': ''}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
'scene': scene,
|
|
||||||
'attach_card': null,
|
|
||||||
'upload_id': uploadId,
|
|
||||||
'meta': {
|
|
||||||
'app_meta': {'from': 'create.dynamic.web', 'mobi_app': 'web'}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'web_repost_src': webRepostSrc
|
|
||||||
},
|
|
||||||
options: Options(contentType: 'application/json'),
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,67 +0,0 @@
|
|||||||
import 'index.dart';
|
|
||||||
|
|
||||||
class FavHttp {
|
|
||||||
/// 编辑收藏夹
|
|
||||||
static Future editFolder({
|
|
||||||
required String title,
|
|
||||||
required String intro,
|
|
||||||
required String mediaId,
|
|
||||||
String? cover,
|
|
||||||
int? privacy,
|
|
||||||
}) async {
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.editFavFolder,
|
|
||||||
data: {
|
|
||||||
'title': title,
|
|
||||||
'intro': intro,
|
|
||||||
'media_id': mediaId,
|
|
||||||
'cover': cover ?? '',
|
|
||||||
'privacy': privacy ?? 0,
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 新建收藏夹
|
|
||||||
static Future addFolder({
|
|
||||||
required String title,
|
|
||||||
required String intro,
|
|
||||||
String? cover,
|
|
||||||
int? privacy,
|
|
||||||
}) async {
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.addFavFolder,
|
|
||||||
data: {
|
|
||||||
'title': title,
|
|
||||||
'intro': intro,
|
|
||||||
'cover': cover ?? '',
|
|
||||||
'privacy': privacy ?? 0,
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -27,14 +27,11 @@ class Request {
|
|||||||
late bool enableSystemProxy;
|
late bool enableSystemProxy;
|
||||||
late String systemProxyHost;
|
late String systemProxyHost;
|
||||||
late String systemProxyPort;
|
late String systemProxyPort;
|
||||||
static final RegExp spmPrefixExp =
|
static final RegExp spmPrefixExp = RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
|
||||||
RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
|
|
||||||
static String? buvid;
|
|
||||||
|
|
||||||
/// 设置cookie
|
/// 设置cookie
|
||||||
static setCookie() async {
|
static setCookie() async {
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
Box setting = GStrorage.setting;
|
|
||||||
final String cookiePath = await Utils.getCookiePath();
|
final String cookiePath = await Utils.getCookiePath();
|
||||||
final PersistCookieJar cookieJar = PersistCookieJar(
|
final PersistCookieJar cookieJar = PersistCookieJar(
|
||||||
ignoreExpires: true,
|
ignoreExpires: true,
|
||||||
@ -57,11 +54,7 @@ class Request {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setOptionsHeaders(userInfo, userInfo != null && userInfo.mid != null);
|
setOptionsHeaders(userInfo, userInfo != null && userInfo.mid != null);
|
||||||
String baseUrlType = 'default';
|
|
||||||
if (setting.get(SettingBoxKey.enableGATMode, defaultValue: false)) {
|
|
||||||
baseUrlType = 'bangumi';
|
|
||||||
}
|
|
||||||
setBaseUrl(type: baseUrlType);
|
|
||||||
try {
|
try {
|
||||||
await buvidActivate();
|
await buvidActivate();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -71,7 +64,6 @@ class Request {
|
|||||||
final String cookieString = cookie
|
final String cookieString = cookie
|
||||||
.map((Cookie cookie) => '${cookie.name}=${cookie.value}')
|
.map((Cookie cookie) => '${cookie.name}=${cookie.value}')
|
||||||
.join('; ');
|
.join('; ');
|
||||||
|
|
||||||
dio.options.headers['cookie'] = cookieString;
|
dio.options.headers['cookie'] = cookieString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,30 +78,6 @@ class Request {
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<String> getBuvid() async {
|
|
||||||
if (buvid != null) {
|
|
||||||
return buvid!;
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<Cookie> cookies = await cookieManager.cookieJar
|
|
||||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
|
||||||
buvid = cookies.firstWhere((cookie) => cookie.name == 'buvid3').value;
|
|
||||||
if (buvid == null) {
|
|
||||||
try {
|
|
||||||
var result = await Request().get(
|
|
||||||
"${HttpString.apiBaseUrl}/x/frontend/finger/spi",
|
|
||||||
);
|
|
||||||
buvid = result["data"]["b_3"].toString();
|
|
||||||
} catch (e) {
|
|
||||||
// 处理请求错误
|
|
||||||
buvid = '';
|
|
||||||
print("Error fetching buvid: $e");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return buvid!;
|
|
||||||
}
|
|
||||||
|
|
||||||
static setOptionsHeaders(userInfo, bool status) {
|
static setOptionsHeaders(userInfo, bool status) {
|
||||||
if (status) {
|
if (status) {
|
||||||
dio.options.headers['x-bili-mid'] = userInfo.mid.toString();
|
dio.options.headers['x-bili-mid'] = userInfo.mid.toString();
|
||||||
@ -127,10 +95,11 @@ class Request {
|
|||||||
String spmPrefix = spmPrefixExp.firstMatch(html.data)!.group(1)!;
|
String spmPrefix = spmPrefixExp.firstMatch(html.data)!.group(1)!;
|
||||||
Random rand = Random();
|
Random rand = Random();
|
||||||
String rand_png_end = base64.encode(
|
String rand_png_end = base64.encode(
|
||||||
List<int>.generate(32, (_) => rand.nextInt(256)) +
|
List<int>.generate(32, (_) => rand.nextInt(256)) +
|
||||||
List<int>.filled(4, 0) +
|
List<int>.filled(4, 0) +
|
||||||
[73, 69, 78, 68] +
|
[73, 69, 78, 68] +
|
||||||
List<int>.generate(4, (_) => rand.nextInt(256)));
|
List<int>.generate(4, (_) => rand.nextInt(256))
|
||||||
|
);
|
||||||
|
|
||||||
String jsonData = json.encode({
|
String jsonData = json.encode({
|
||||||
'3064': 1,
|
'3064': 1,
|
||||||
@ -141,9 +110,11 @@ class Request {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
await Request().post(Api.activateBuvidApi,
|
await Request().post(
|
||||||
data: {'payload': jsonData},
|
Api.activateBuvidApi,
|
||||||
options: Options(contentType: 'application/json'));
|
data: {'payload': jsonData},
|
||||||
|
options: Options(contentType: 'application/json')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -260,8 +231,7 @@ class Request {
|
|||||||
url,
|
url,
|
||||||
data: data,
|
data: data,
|
||||||
queryParameters: queryParameters,
|
queryParameters: queryParameters,
|
||||||
options:
|
options: options,
|
||||||
options ?? Options(contentType: Headers.formUrlEncodedContentType),
|
|
||||||
cancelToken: cancelToken,
|
cancelToken: cancelToken,
|
||||||
);
|
);
|
||||||
// print('post success: ${response.data}');
|
// print('post success: ${response.data}');
|
||||||
@ -324,17 +294,4 @@ class Request {
|
|||||||
}
|
}
|
||||||
return headerUa;
|
return headerUa;
|
||||||
}
|
}
|
||||||
|
|
||||||
static setBaseUrl({String type = 'default'}) {
|
|
||||||
switch (type) {
|
|
||||||
case 'default':
|
|
||||||
dio.options.baseUrl = HttpString.apiBaseUrl;
|
|
||||||
break;
|
|
||||||
case 'bangumi':
|
|
||||||
dio.options.baseUrl = HttpString.bangumiBaseUrl;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dio.options.baseUrl = HttpString.apiBaseUrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,8 +46,7 @@ class ApiInterceptor extends Interceptor {
|
|||||||
// 处理网络请求错误
|
// 处理网络请求错误
|
||||||
// handler.next(err);
|
// handler.next(err);
|
||||||
String url = err.requestOptions.uri.toString();
|
String url = err.requestOptions.uri.toString();
|
||||||
final excludedPatterns = RegExp(r'heartbeat|seg\.so|online/total');
|
if (!url.contains('heartBeat')) {
|
||||||
if (!excludedPatterns.hasMatch(url)) {
|
|
||||||
SmartDialog.showToast(
|
SmartDialog.showToast(
|
||||||
await dioError(err),
|
await dioError(err),
|
||||||
displayType: SmartToastType.onlyRefresh,
|
displayType: SmartToastType.onlyRefresh,
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import 'package:pilipala/models/live/follow.dart';
|
|
||||||
|
|
||||||
import '../models/live/item.dart';
|
import '../models/live/item.dart';
|
||||||
import '../models/live/room_info.dart';
|
import '../models/live/room_info.dart';
|
||||||
import '../models/live/room_info_h5.dart';
|
import '../models/live/room_info_h5.dart';
|
||||||
@ -67,96 +65,4 @@ class LiveHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取弹幕信息
|
|
||||||
static Future liveDanmakuInfo({roomId}) async {
|
|
||||||
var res = await Request().get(Api.getDanmuInfo, data: {
|
|
||||||
'id': roomId,
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送弹幕
|
|
||||||
static Future sendDanmaku({roomId, msg}) async {
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.sendLiveMsg,
|
|
||||||
data: {
|
|
||||||
'bubble': 0,
|
|
||||||
'msg': msg,
|
|
||||||
'color': 16777215, // 颜色
|
|
||||||
'mode': 1, // 模式
|
|
||||||
'room_type': 0,
|
|
||||||
'jumpfrom': 71001, // 直播间来源
|
|
||||||
'reply_mid': 0,
|
|
||||||
'reply_attr': 0,
|
|
||||||
'replay_dmid': '',
|
|
||||||
'statistics': {"appId": 100, "platform": 5},
|
|
||||||
'fontsize': 25, // 字体大小
|
|
||||||
'rnd': DateTime.now().millisecondsSinceEpoch ~/ 1000, // 时间戳
|
|
||||||
'roomid': roomId,
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
'csrf_token': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 我的关注 正在直播
|
|
||||||
static Future liveFollowing({int? pn, int? ps}) async {
|
|
||||||
var res = await Request().get(Api.getFollowingLive, data: {
|
|
||||||
'page': pn,
|
|
||||||
'page_size': ps,
|
|
||||||
'platform': 'web',
|
|
||||||
'ignoreRecord': 1,
|
|
||||||
'hit_ab': true,
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': LiveFollowingModel.fromJson(res.data['data'])
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 直播历史记录
|
|
||||||
static Future liveRoomEntry({required int roomId}) async {
|
|
||||||
await Request().post(
|
|
||||||
Api.liveRoomEntry,
|
|
||||||
data: {
|
|
||||||
'room_id': roomId,
|
|
||||||
'platform': 'pc',
|
|
||||||
'csrf_token': await Request.getCsrf(),
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
'visit_id': '',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'dart:math';
|
|||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:encrypt/encrypt.dart';
|
import 'package:encrypt/encrypt.dart';
|
||||||
import 'package:pilipala/http/constants.dart';
|
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
import '../models/login/index.dart';
|
import '../models/login/index.dart';
|
||||||
import '../utils/login.dart';
|
import '../utils/login.dart';
|
||||||
@ -22,32 +21,32 @@ class LoginHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static Future sendSmsCode({
|
static Future sendSmsCode({
|
||||||
// int? cid,
|
int? cid,
|
||||||
// required int tel,
|
required int tel,
|
||||||
// required String token,
|
required String token,
|
||||||
// required String challenge,
|
required String challenge,
|
||||||
// required String validate,
|
required String validate,
|
||||||
// required String seccode,
|
required String seccode,
|
||||||
// }) async {
|
}) async {
|
||||||
// var res = await Request().post(
|
var res = await Request().post(
|
||||||
// Api.appSmsCode,
|
Api.appSmsCode,
|
||||||
// data: {
|
data: {
|
||||||
// 'cid': cid,
|
'cid': cid,
|
||||||
// 'tel': tel,
|
'tel': tel,
|
||||||
// "source": "main_web",
|
"source": "main_web",
|
||||||
// 'token': token,
|
'token': token,
|
||||||
// 'challenge': challenge,
|
'challenge': challenge,
|
||||||
// 'validate': validate,
|
'validate': validate,
|
||||||
// 'seccode': seccode,
|
'seccode': seccode,
|
||||||
// },
|
},
|
||||||
// options: Options(
|
options: Options(
|
||||||
// contentType: Headers.formUrlEncodedContentType,
|
contentType: Headers.formUrlEncodedContentType,
|
||||||
// // headers: {'user-agent': ApiConstants.userAgent}
|
// headers: {'user-agent': ApiConstants.userAgent}
|
||||||
// ),
|
),
|
||||||
// );
|
);
|
||||||
// print(res);
|
print(res);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// web端验证码
|
// web端验证码
|
||||||
static Future sendWebSmsCode({
|
static Future sendWebSmsCode({
|
||||||
@ -61,7 +60,6 @@ class LoginHttp {
|
|||||||
Map data = {
|
Map data = {
|
||||||
'cid': cid,
|
'cid': cid,
|
||||||
'tel': tel,
|
'tel': tel,
|
||||||
"source": "main_web",
|
|
||||||
'token': token,
|
'token': token,
|
||||||
'challenge': challenge,
|
'challenge': challenge,
|
||||||
'validate': validate,
|
'validate': validate,
|
||||||
@ -69,50 +67,17 @@ class LoginHttp {
|
|||||||
};
|
};
|
||||||
FormData formData = FormData.fromMap({...data});
|
FormData formData = FormData.fromMap({...data});
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.webSmsCode,
|
Api.smsCode,
|
||||||
data: formData,
|
data: formData,
|
||||||
|
options: Options(
|
||||||
|
contentType: Headers.formUrlEncodedContentType,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
print(res);
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// web端验证码登录
|
// web端验证码登录
|
||||||
static Future loginInByWebSmsCode({
|
static Future loginInByWebSmsCode() async {}
|
||||||
int? cid,
|
|
||||||
required int tel,
|
|
||||||
required int code,
|
|
||||||
required String captchaKey,
|
|
||||||
}) async {
|
|
||||||
// webSmsLogin
|
|
||||||
Map data = {
|
|
||||||
"cid": cid,
|
|
||||||
"tel": tel,
|
|
||||||
"code": code,
|
|
||||||
"source": "main_mini",
|
|
||||||
"keep": 0,
|
|
||||||
"captcha_key": captchaKey,
|
|
||||||
"go_url": HttpString.baseUrl
|
|
||||||
};
|
|
||||||
FormData formData = FormData.fromMap({...data});
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.webSmsLogin,
|
|
||||||
data: formData,
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// web端密码登录
|
// web端密码登录
|
||||||
static Future liginInByWebPwd() async {}
|
static Future liginInByWebPwd() async {}
|
||||||
@ -149,6 +114,9 @@ class LoginHttp {
|
|||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.appSmsCode,
|
Api.appSmsCode,
|
||||||
data: data,
|
data: data,
|
||||||
|
options: Options(
|
||||||
|
contentType: Headers.formUrlEncodedContentType,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
print(res);
|
print(res);
|
||||||
}
|
}
|
||||||
@ -199,82 +167,10 @@ class LoginHttp {
|
|||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.loginInByPwdApi,
|
Api.loginInByPwdApi,
|
||||||
data: data,
|
data: data,
|
||||||
|
options: Options(
|
||||||
|
contentType: Headers.formUrlEncodedContentType,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
print(res);
|
print(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
// web端密码登录
|
|
||||||
static Future loginInByWebPwd({
|
|
||||||
required int username,
|
|
||||||
required String password,
|
|
||||||
required String token,
|
|
||||||
required String challenge,
|
|
||||||
required String validate,
|
|
||||||
required String seccode,
|
|
||||||
}) async {
|
|
||||||
Map data = {
|
|
||||||
'username': username,
|
|
||||||
'password': password,
|
|
||||||
'keep': 0,
|
|
||||||
'token': token,
|
|
||||||
'challenge': challenge,
|
|
||||||
'validate': validate,
|
|
||||||
'seccode': seccode,
|
|
||||||
'source': 'main-fe-header',
|
|
||||||
"go_url": HttpString.baseUrl
|
|
||||||
};
|
|
||||||
FormData formData = FormData.fromMap({...data});
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.loginInByWebPwd,
|
|
||||||
data: formData,
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
if (res.data['data']['status'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'code': 1,
|
|
||||||
'data': res.data['data'],
|
|
||||||
'msg': res.data['data']['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// web端登录二维码
|
|
||||||
static Future getWebQrcode() async {
|
|
||||||
var res = await Request().get(Api.qrCodeApi);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// web端二维码轮询登录状态
|
|
||||||
static Future queryWebQrcodeStatus(String qrcodeKey) async {
|
|
||||||
var res = await Request()
|
|
||||||
.get(Api.loginInByQrcode, data: {'qrcode_key': qrcodeKey});
|
|
||||||
if (res.data['data']['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:html/parser.dart';
|
|
||||||
import 'package:pilipala/models/member/article.dart';
|
|
||||||
import 'package:pilipala/models/member/like.dart';
|
|
||||||
import '../common/constants.dart';
|
import '../common/constants.dart';
|
||||||
import '../models/dynamics/result.dart';
|
import '../models/dynamics/result.dart';
|
||||||
import '../models/follow/result.dart';
|
import '../models/follow/result.dart';
|
||||||
@ -99,14 +95,7 @@ class MemberHttp {
|
|||||||
'dm_img_str': dmImgStr.substring(0, dmImgStr.length - 2),
|
'dm_img_str': dmImgStr.substring(0, dmImgStr.length - 2),
|
||||||
'dm_cover_img_str': dmCoverImgStr.substring(0, dmCoverImgStr.length - 2),
|
'dm_cover_img_str': dmCoverImgStr.substring(0, dmCoverImgStr.length - 2),
|
||||||
'dm_img_inter': '{"ds":[],"wh":[0,0,0],"of":[0,0,0]}',
|
'dm_img_inter': '{"ds":[],"wh":[0,0,0],"of":[0,0,0]}',
|
||||||
...order == 'charge'
|
|
||||||
? {
|
|
||||||
'order': 'pubdate',
|
|
||||||
'special_type': 'charging',
|
|
||||||
}
|
|
||||||
: {}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
Api.memberArchive,
|
Api.memberArchive,
|
||||||
data: params,
|
data: params,
|
||||||
@ -198,15 +187,13 @@ class MemberHttp {
|
|||||||
|
|
||||||
// 设置分组
|
// 设置分组
|
||||||
static Future addUsers(int? fids, String? tagids) async {
|
static Future addUsers(int? fids, String? tagids) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(Api.addUsers, queryParameters: {
|
||||||
Api.addUsers,
|
'fids': fids,
|
||||||
data: {
|
'tagids': tagids ?? '0',
|
||||||
'fids': fids,
|
'csrf': await Request.getCsrf(),
|
||||||
'tagids': tagids ?? '0',
|
}, data: {
|
||||||
'csrf': await Request.getCsrf(),
|
'cross_domain': true
|
||||||
},
|
});
|
||||||
queryParameters: {'cross_domain': true},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': [], 'msg': '操作成功'};
|
return {'status': true, 'data': [], 'msg': '操作成功'};
|
||||||
} else {
|
} else {
|
||||||
@ -341,9 +328,7 @@ class MemberHttp {
|
|||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
'data': res.data['data']['list']
|
'data': MemberSeasonsDataModel.fromJson(res.data['data']['items_lists'])
|
||||||
.map<MemberLikeDataModel>((e) => MemberLikeDataModel.fromJson(e))
|
|
||||||
.toList(),
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
@ -424,14 +409,11 @@ class MemberHttp {
|
|||||||
static Future cookieToKey() async {
|
static Future cookieToKey() async {
|
||||||
var authCodeRes = await getTVCode();
|
var authCodeRes = await getTVCode();
|
||||||
if (authCodeRes['status']) {
|
if (authCodeRes['status']) {
|
||||||
var res = await Request().post(
|
var res = await Request().post(Api.cookieToKey, queryParameters: {
|
||||||
Api.cookieToKey,
|
'auth_code': authCodeRes['data'],
|
||||||
data: {
|
'build': 708200,
|
||||||
'auth_code': authCodeRes['data'],
|
'csrf': await Request.getCsrf(),
|
||||||
'build': 708200,
|
});
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
await Future.delayed(const Duration(milliseconds: 300));
|
await Future.delayed(const Duration(milliseconds: 300));
|
||||||
await qrcodePoll(authCodeRes['data']);
|
await qrcodePoll(authCodeRes['data']);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
@ -528,96 +510,4 @@ class MemberHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future getSeriesDetail({
|
|
||||||
required int mid,
|
|
||||||
required int currentMid,
|
|
||||||
required int seriesId,
|
|
||||||
required int pn,
|
|
||||||
}) async {
|
|
||||||
var res = await Request().get(
|
|
||||||
Api.getSeriesDetailApi,
|
|
||||||
data: {
|
|
||||||
'mid': mid,
|
|
||||||
'series_id': seriesId,
|
|
||||||
'only_normal': true,
|
|
||||||
'sort': 'desc',
|
|
||||||
'pn': pn,
|
|
||||||
'ps': 30,
|
|
||||||
'current_mid': currentMid,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
try {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': MemberSeasonsDataModel.fromJson(res.data['data'])
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
print(err);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future getWWebid({required int mid}) async {
|
|
||||||
var res = await Request().get('https://space.bilibili.com/$mid/article');
|
|
||||||
String? headContent = parse(res.data).head?.outerHtml;
|
|
||||||
final regex = RegExp(
|
|
||||||
r'<script id="__RENDER_DATA__" type="application/json">(.*?)</script>');
|
|
||||||
if (headContent != null) {
|
|
||||||
final match = regex.firstMatch(headContent);
|
|
||||||
if (match != null && match.groupCount >= 1) {
|
|
||||||
final content = match.group(1);
|
|
||||||
String decodedString = Uri.decodeComponent(content!);
|
|
||||||
Map<String, dynamic> map = jsonDecode(decodedString);
|
|
||||||
return {'status': true, 'data': map['access_id']};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'data': '请检查登录状态'};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {'status': false, 'data': '请检查登录状态'};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取用户专栏
|
|
||||||
static Future getMemberArticle({
|
|
||||||
required int mid,
|
|
||||||
required int pn,
|
|
||||||
required String wWebid,
|
|
||||||
String? offset,
|
|
||||||
}) async {
|
|
||||||
Map params = await WbiSign().makSign({
|
|
||||||
'host_mid': mid,
|
|
||||||
'page': pn,
|
|
||||||
'offset': offset,
|
|
||||||
'web_location': 333.999,
|
|
||||||
'w_webid': wWebid,
|
|
||||||
});
|
|
||||||
var res = await Request().get(Api.opusList, data: {
|
|
||||||
'host_mid': mid,
|
|
||||||
'page': pn,
|
|
||||||
'offset': offset,
|
|
||||||
'web_location': 333.999,
|
|
||||||
'w_webid': wWebid,
|
|
||||||
'w_rid': params['w_rid'],
|
|
||||||
'wts': params['wts'],
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': MemberArticleDataModel.fromJson(res.data['data'])
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'] ?? '请求异常',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'package:pilipala/models/msg/like.dart';
|
|
||||||
import 'package:pilipala/models/msg/reply.dart';
|
|
||||||
import 'package:pilipala/models/msg/system.dart';
|
|
||||||
import '../models/msg/account.dart';
|
import '../models/msg/account.dart';
|
||||||
import '../models/msg/session.dart';
|
import '../models/msg/session.dart';
|
||||||
import '../utils/wbi_sign.dart';
|
import '../utils/wbi_sign.dart';
|
||||||
@ -126,45 +122,68 @@ class MsgHttp {
|
|||||||
'data': res.data['data'],
|
'data': res.data['data'],
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
return {
|
||||||
|
'status': false,
|
||||||
|
'date': [],
|
||||||
|
'msg': "message: ${res.data['message']},"
|
||||||
|
" msg: ${res.data['msg']},"
|
||||||
|
" code: ${res.data['code']}",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送私信
|
// 发送私信
|
||||||
static Future sendMsg({
|
static Future sendMsg({
|
||||||
required int senderUid,
|
int? senderUid,
|
||||||
required int receiverId,
|
int? receiverId,
|
||||||
int? receiverType,
|
int? receiverType,
|
||||||
int? msgType,
|
int? msgType,
|
||||||
dynamic content,
|
dynamic content,
|
||||||
}) async {
|
}) async {
|
||||||
String csrf = await Request.getCsrf();
|
String csrf = await Request.getCsrf();
|
||||||
var res = await Request().post(
|
Map<String, dynamic> params = await WbiSign().makSign({
|
||||||
Api.sendMsg,
|
'msg[sender_uid]': senderUid,
|
||||||
data: {
|
'msg[receiver_id]': receiverId,
|
||||||
'msg[sender_uid]': senderUid,
|
'msg[receiver_type]': receiverType ?? 1,
|
||||||
'msg[receiver_id]': receiverId,
|
'msg[msg_type]': msgType ?? 1,
|
||||||
'msg[receiver_type]': 1,
|
'msg[msg_status]': 0,
|
||||||
'msg[msg_type]': 1,
|
'msg[dev_id]': getDevId(),
|
||||||
'msg[msg_status]': 0,
|
'msg[timestamp]': DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
'msg[content]': jsonEncode(content),
|
'msg[new_face_version]': 0,
|
||||||
'msg[timestamp]': DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
'msg[content]': content,
|
||||||
'msg[new_face_version]': 1,
|
'from_firework': 0,
|
||||||
'msg[dev_id]': getDevId(),
|
'build': 0,
|
||||||
'from_firework': 0,
|
'mobi_app': 'web',
|
||||||
'build': 0,
|
'csrf_token': csrf,
|
||||||
'mobi_app': 'web',
|
'csrf': csrf,
|
||||||
'csrf_token': csrf,
|
});
|
||||||
'csrf': csrf,
|
var res =
|
||||||
},
|
await Request().post(Api.sendMsg, queryParameters: <String, dynamic>{
|
||||||
);
|
...params,
|
||||||
|
'csrf_token': csrf,
|
||||||
|
'csrf': csrf,
|
||||||
|
}, data: {
|
||||||
|
'w_sender_uid': params['msg[sender_uid]'],
|
||||||
|
'w_receiver_id': params['msg[receiver_id]'],
|
||||||
|
'w_dev_id': params['msg[dev_id]'],
|
||||||
|
'w_rid': params['w_rid'],
|
||||||
|
'wts': params['wts'],
|
||||||
|
'csrf_token': csrf,
|
||||||
|
'csrf': csrf,
|
||||||
|
});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
'data': res.data['data'],
|
'data': res.data['data'],
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
return {
|
||||||
|
'status': false,
|
||||||
|
'date': [],
|
||||||
|
'msg': "message: ${res.data['message']},"
|
||||||
|
" msg: ${res.data['msg']},"
|
||||||
|
" code: ${res.data['code']}",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,152 +220,4 @@ class MsgHttp {
|
|||||||
}
|
}
|
||||||
return s.join();
|
return s.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future removeSession({
|
|
||||||
int? talkerId,
|
|
||||||
}) async {
|
|
||||||
String csrf = await Request.getCsrf();
|
|
||||||
Map params = await WbiSign().makSign({
|
|
||||||
'talker_id': talkerId,
|
|
||||||
'session_type': 1,
|
|
||||||
'build': 0,
|
|
||||||
'mobi_app': 'web',
|
|
||||||
'csrf_token': csrf,
|
|
||||||
'csrf': csrf
|
|
||||||
});
|
|
||||||
var res = await Request().get(Api.removeSession, data: params);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future unread() async {
|
|
||||||
var res = await Request().get(Api.unread);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 回复我的
|
|
||||||
static Future messageReply({
|
|
||||||
int? id,
|
|
||||||
int? replyTime,
|
|
||||||
}) async {
|
|
||||||
var params = {
|
|
||||||
if (id != null) 'id': id,
|
|
||||||
if (replyTime != null) 'reply_time': replyTime,
|
|
||||||
};
|
|
||||||
var res = await Request().get(Api.messageReplyAPi, data: params);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
try {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': MessageReplyModel.fromJson(res.data['data']),
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 收到的赞
|
|
||||||
static Future messageLike({
|
|
||||||
int? id,
|
|
||||||
int? likeTime,
|
|
||||||
}) async {
|
|
||||||
var params = {
|
|
||||||
if (id != null) 'id': id,
|
|
||||||
if (likeTime != null) 'like_time': likeTime,
|
|
||||||
};
|
|
||||||
var res = await Request().get(Api.messageLikeAPi, data: params);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
try {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': MessageLikeModel.fromJson(res.data['data']),
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future messageSystem() async {
|
|
||||||
var res = await Request().get(Api.messageSystemAPi, data: {
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
'page_size': 20,
|
|
||||||
'build': 0,
|
|
||||||
'mobi_app': 'web',
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
try {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data']['system_notify_list']
|
|
||||||
.map<MessageSystemModel>((e) => MessageSystemModel.fromJson(e))
|
|
||||||
.toList(),
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 系统消息标记已读
|
|
||||||
static Future systemMarkRead(int cursor) async {
|
|
||||||
String csrf = await Request.getCsrf();
|
|
||||||
var res = await Request().get(Api.systemMarkRead, data: {
|
|
||||||
'csrf': csrf,
|
|
||||||
'cursor': cursor,
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future messageSystemAccount() async {
|
|
||||||
var res = await Request().get(Api.userMessageSystemAPi, data: {
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
'page_size': 20,
|
|
||||||
'build': 0,
|
|
||||||
'mobi_app': 'web',
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
try {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data']['system_notify_list']
|
|
||||||
.map<MessageSystemModel>((e) => MessageSystemModel.fromJson(e))
|
|
||||||
.toList(),
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,116 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:html/parser.dart';
|
|
||||||
import 'package:pilipala/models/read/opus.dart';
|
|
||||||
import 'package:pilipala/models/read/read.dart';
|
|
||||||
import 'package:pilipala/utils/wbi_sign.dart';
|
|
||||||
import 'index.dart';
|
|
||||||
|
|
||||||
class ReadHttp {
|
|
||||||
static List<String> extractScriptContents(String htmlContent) {
|
|
||||||
RegExp scriptRegExp = RegExp(r'<script>([\s\S]*?)<\/script>');
|
|
||||||
Iterable<Match> matches = scriptRegExp.allMatches(htmlContent);
|
|
||||||
List<String> scriptContents = [];
|
|
||||||
for (Match match in matches) {
|
|
||||||
String scriptContent = match.group(1)!;
|
|
||||||
scriptContents.add(scriptContent);
|
|
||||||
}
|
|
||||||
return scriptContents;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析专栏 opus格式
|
|
||||||
static Future parseArticleOpus({required String id}) async {
|
|
||||||
var res = await Request().get('https://www.bilibili.com/opus/$id', extra: {
|
|
||||||
'ua': 'pc',
|
|
||||||
});
|
|
||||||
String? headContent = parse(res.data).head?.outerHtml;
|
|
||||||
var document = parse(headContent);
|
|
||||||
var linkTags = document.getElementsByTagName('link');
|
|
||||||
bool isCv = false;
|
|
||||||
String cvId = '';
|
|
||||||
for (var linkTag in linkTags) {
|
|
||||||
var attributes = linkTag.attributes;
|
|
||||||
if (attributes.containsKey('rel') &&
|
|
||||||
attributes['rel'] == 'canonical' &&
|
|
||||||
attributes.containsKey('data-vue-meta') &&
|
|
||||||
attributes['data-vue-meta'] == 'true') {
|
|
||||||
final String cvHref = linkTag.attributes['href']!;
|
|
||||||
RegExp regex = RegExp(r'cv(\d+)');
|
|
||||||
RegExpMatch? match = regex.firstMatch(cvHref);
|
|
||||||
if (match != null) {
|
|
||||||
cvId = match.group(1)!;
|
|
||||||
} else {
|
|
||||||
print('No match found.');
|
|
||||||
}
|
|
||||||
isCv = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String scriptContent =
|
|
||||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
|
||||||
int startIndex = scriptContent.indexOf('{');
|
|
||||||
int endIndex = scriptContent.lastIndexOf('};');
|
|
||||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
|
||||||
// 解析JSON字符串为Map
|
|
||||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': OpusDataModel.fromJson(jsonData),
|
|
||||||
'isCv': isCv,
|
|
||||||
'cvId': cvId,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析专栏 cv格式
|
|
||||||
static Future parseArticleCv({required String id}) async {
|
|
||||||
var res = await Request().get(
|
|
||||||
'https://www.bilibili.com/read/cv$id',
|
|
||||||
extra: {'ua': 'pc'},
|
|
||||||
);
|
|
||||||
String scriptContent =
|
|
||||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
|
||||||
int startIndex = scriptContent.indexOf('{');
|
|
||||||
int endIndex = scriptContent.lastIndexOf('};');
|
|
||||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
|
||||||
// 解析JSON字符串为Map
|
|
||||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': ReadDataModel.fromJson(jsonData),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
static Future getViewInfo({required String id}) async {
|
|
||||||
Map params = await WbiSign().makSign({
|
|
||||||
'id': id,
|
|
||||||
'mobi_app': 'pc',
|
|
||||||
'from': 'web',
|
|
||||||
'gaia_source': 'main_web',
|
|
||||||
'web_location': 333.976,
|
|
||||||
});
|
|
||||||
var res = await Request().get(
|
|
||||||
Api.getViewInfo,
|
|
||||||
data: {
|
|
||||||
'id': id,
|
|
||||||
'mobi_app': 'pc',
|
|
||||||
'from': 'web',
|
|
||||||
'gaia_source': 'main_web',
|
|
||||||
'web_location': 333.976,
|
|
||||||
'w_rid': params['w_rid'],
|
|
||||||
'wts': params['wts'],
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data'],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -22,14 +22,19 @@ class ReplyHttp {
|
|||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
'data': ReplyData.fromJson(res.data['data']),
|
'data': ReplyData.fromJson(res.data['data']),
|
||||||
'code': 200,
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
Map errMap = {
|
||||||
|
-400: '请求错误',
|
||||||
|
-404: '无此项',
|
||||||
|
12002: '当前页面评论功能已关闭',
|
||||||
|
12009: '评论主体的type不合法',
|
||||||
|
12061: 'UP主已关闭评论区',
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'date': [],
|
'date': [],
|
||||||
'code': res.data['code'],
|
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||||
'msg': res.data['message'],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +83,7 @@ class ReplyHttp {
|
|||||||
}) async {
|
}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.likeReply,
|
Api.likeReply,
|
||||||
data: {
|
queryParameters: {
|
||||||
'type': type,
|
'type': type,
|
||||||
'oid': oid,
|
'oid': oid,
|
||||||
'rpid': rpid,
|
'rpid': rpid,
|
||||||
@ -115,25 +120,4 @@ class ReplyHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future replyDel({
|
|
||||||
required int type, //replyType
|
|
||||||
required int oid,
|
|
||||||
required int rpid,
|
|
||||||
}) async {
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.replyDel,
|
|
||||||
queryParameters: {
|
|
||||||
'type': type, //type.index
|
|
||||||
'oid': oid,
|
|
||||||
'rpid': rpid,
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {'status': true, 'msg': '删除成功'};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/search/all.dart';
|
|
||||||
import 'package:pilipala/utils/wbi_sign.dart';
|
|
||||||
import '../models/bangumi/info.dart';
|
import '../models/bangumi/info.dart';
|
||||||
import '../models/common/search_type.dart';
|
import '../models/common/search_type.dart';
|
||||||
import '../models/search/hot.dart';
|
import '../models/search/hot.dart';
|
||||||
@ -75,7 +73,6 @@ class SearchHttp {
|
|||||||
required page,
|
required page,
|
||||||
String? order,
|
String? order,
|
||||||
int? duration,
|
int? duration,
|
||||||
int? tids,
|
|
||||||
}) async {
|
}) async {
|
||||||
var reqData = {
|
var reqData = {
|
||||||
'search_type': searchType.type,
|
'search_type': searchType.type,
|
||||||
@ -85,14 +82,9 @@ class SearchHttp {
|
|||||||
'page': page,
|
'page': page,
|
||||||
if (order != null) 'order': order,
|
if (order != null) 'order': order,
|
||||||
if (duration != null) 'duration': duration,
|
if (duration != null) 'duration': duration,
|
||||||
if (tids != null && tids != -1) 'tids': tids,
|
|
||||||
};
|
};
|
||||||
var res = await Request().get(Api.searchByType, data: reqData);
|
var res = await Request().get(Api.searchByType, data: reqData);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0 && res.data['data']['numPages'] > 0) {
|
||||||
if (res.data['data']['numPages'] == 0) {
|
|
||||||
// 我想返回数据,使得可以通过data.list 取值,结果为[]
|
|
||||||
return {'status': true, 'data': Data()};
|
|
||||||
}
|
|
||||||
Object data;
|
Object data;
|
||||||
try {
|
try {
|
||||||
switch (searchType) {
|
switch (searchType) {
|
||||||
@ -129,7 +121,9 @@ class SearchHttp {
|
|||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': [],
|
'data': [],
|
||||||
'msg': res.data['message'],
|
'msg': res.data['data'] != null && res.data['data']['numPages'] == 0
|
||||||
|
? '没有相关数据'
|
||||||
|
: res.data['message'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,11 +137,7 @@ class SearchHttp {
|
|||||||
}
|
}
|
||||||
final dynamic res =
|
final dynamic res =
|
||||||
await Request().get(Api.ab2c, data: <String, dynamic>{...data});
|
await Request().get(Api.ab2c, data: <String, dynamic>{...data});
|
||||||
if (res.data['code'] == 0) {
|
return res.data['data'].first['cid'];
|
||||||
return res.data['data'].first['cid'];
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> bangumiInfo(
|
static Future<Map<String, dynamic>> bangumiInfo(
|
||||||
@ -173,48 +163,4 @@ class SearchHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> ab2cWithPic(
|
|
||||||
{int? aid, String? bvid}) async {
|
|
||||||
Map<String, dynamic> data = {};
|
|
||||||
if (aid != null) {
|
|
||||||
data['aid'] = aid;
|
|
||||||
} else if (bvid != null) {
|
|
||||||
data['bvid'] = bvid;
|
|
||||||
}
|
|
||||||
final dynamic res =
|
|
||||||
await Request().get(Api.ab2c, data: <String, dynamic>{...data});
|
|
||||||
return {
|
|
||||||
'cid': res.data['data'].first['cid'],
|
|
||||||
'pic': res.data['data'].first['first_frame'],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> searchCount(
|
|
||||||
{required String keyword}) async {
|
|
||||||
Map<String, dynamic> data = {
|
|
||||||
'keyword': keyword,
|
|
||||||
'web_location': 333.999,
|
|
||||||
};
|
|
||||||
Map params = await WbiSign().makSign(data);
|
|
||||||
final dynamic res = await Request().get(Api.searchCount, data: params);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': SearchAllModel.fromJson(res.data['data']),
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': '请求错误 🙅',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Data {
|
|
||||||
List<dynamic> list;
|
|
||||||
|
|
||||||
Data({this.list = const []});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:html/parser.dart';
|
|
||||||
import 'package:pilipala/models/video/later.dart';
|
|
||||||
import '../common/constants.dart';
|
import '../common/constants.dart';
|
||||||
import '../models/model_hot_video_item.dart';
|
import '../models/model_hot_video_item.dart';
|
||||||
import '../models/user/fav_detail.dart';
|
import '../models/user/fav_detail.dart';
|
||||||
@ -62,15 +57,12 @@ class UserHttp {
|
|||||||
if (res.data['data'] != null) {
|
if (res.data['data'] != null) {
|
||||||
data = FavFolderData.fromJson(res.data['data']);
|
data = FavFolderData.fromJson(res.data['data']);
|
||||||
return {'status': true, 'data': data};
|
return {'status': true, 'data': data};
|
||||||
} else {
|
|
||||||
return {'status': false, 'msg': '收藏夹为空'};
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': [],
|
'data': [],
|
||||||
'msg': res.data['message'],
|
'msg': res.data['message'] ?? '账号未登录'
|
||||||
'code': res.data['code'],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,12 +111,7 @@ class UserHttp {
|
|||||||
'data': {'list': list, 'count': res.data['data']['count']}
|
'data': {'list': list, 'count': res.data['data']['count']}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
'code': res.data['code'],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,12 +126,7 @@ class UserHttp {
|
|||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': HistoryData.fromJson(res.data['data'])};
|
return {'status': true, 'data': HistoryData.fromJson(res.data['data'])};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
'code': res.data['code'],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +135,7 @@ class UserHttp {
|
|||||||
// 暂停switchStatus传true 否则false
|
// 暂停switchStatus传true 否则false
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.pauseHistory,
|
Api.pauseHistory,
|
||||||
data: {
|
queryParameters: {
|
||||||
'switch': switchStatus,
|
'switch': switchStatus,
|
||||||
'jsonp': 'jsonp',
|
'jsonp': 'jsonp',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -172,7 +154,7 @@ class UserHttp {
|
|||||||
static Future clearHistory() async {
|
static Future clearHistory() async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.clearHistory,
|
Api.clearHistory,
|
||||||
data: {
|
queryParameters: {
|
||||||
'jsonp': 'jsonp',
|
'jsonp': 'jsonp',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
},
|
},
|
||||||
@ -190,7 +172,7 @@ class UserHttp {
|
|||||||
}
|
}
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.toViewLater,
|
Api.toViewLater,
|
||||||
data: data,
|
queryParameters: data,
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': 'yeah!稍后再看'};
|
return {'status': true, 'msg': 'yeah!稍后再看'};
|
||||||
@ -209,7 +191,7 @@ class UserHttp {
|
|||||||
params[aid != null ? 'aid' : 'viewed'] = aid ?? true;
|
params[aid != null ? 'aid' : 'viewed'] = aid ?? true;
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.toViewDel,
|
Api.toViewDel,
|
||||||
data: params,
|
queryParameters: params,
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': 'yeah!成功移除'};
|
return {'status': true, 'msg': 'yeah!成功移除'};
|
||||||
@ -241,7 +223,7 @@ class UserHttp {
|
|||||||
static Future toViewClear() async {
|
static Future toViewClear() async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.toViewClear,
|
Api.toViewClear,
|
||||||
data: {
|
queryParameters: {
|
||||||
'jsonp': 'jsonp',
|
'jsonp': 'jsonp',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
},
|
},
|
||||||
@ -257,7 +239,7 @@ class UserHttp {
|
|||||||
static Future delHistory(kid) async {
|
static Future delHistory(kid) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.delHistory,
|
Api.delHistory,
|
||||||
data: {
|
queryParameters: {
|
||||||
'kid': kid,
|
'kid': kid,
|
||||||
'jsonp': 'jsonp',
|
'jsonp': 'jsonp',
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -344,21 +326,16 @@ class UserHttp {
|
|||||||
'data': SubFolderModelData.fromJson(res.data['data'])
|
'data': SubFolderModelData.fromJson(res.data['data'])
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {'status': false, 'msg': res.data['message']};
|
||||||
'status': false,
|
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
|
||||||
'code': res.data['code'],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future userSeasonList({
|
static Future userSubFolderDetail({
|
||||||
required int seasonId,
|
required int seasonId,
|
||||||
required int pn,
|
required int pn,
|
||||||
required int ps,
|
required int ps,
|
||||||
}) async {
|
}) async {
|
||||||
var res = await Request().get(Api.userSeasonList, data: {
|
var res = await Request().get(Api.userSubFolderDetail, data: {
|
||||||
'season_id': seasonId,
|
'season_id': seasonId,
|
||||||
'ps': ps,
|
'ps': ps,
|
||||||
'pn': pn,
|
'pn': pn,
|
||||||
@ -372,169 +349,4 @@ class UserHttp {
|
|||||||
return {'status': false, 'msg': res.data['message']};
|
return {'status': false, 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future userResourceList({
|
|
||||||
required int seasonId,
|
|
||||||
required int pn,
|
|
||||||
required int ps,
|
|
||||||
}) async {
|
|
||||||
var res = await Request().get(Api.userResourceList, data: {
|
|
||||||
'media_id': seasonId,
|
|
||||||
'ps': ps,
|
|
||||||
'pn': pn,
|
|
||||||
'keyword': '',
|
|
||||||
'order': 'mtime',
|
|
||||||
'type': 0,
|
|
||||||
'tid': 0,
|
|
||||||
'platform': 'web',
|
|
||||||
});
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
try {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': SubDetailModelData.fromJson(res.data['data'])
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
return {'status': false, 'msg': err};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 取消订阅
|
|
||||||
static Future cancelSub({required int seasonId}) async {
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.cancelSub,
|
|
||||||
data: {
|
|
||||||
'platform': 'web',
|
|
||||||
'season_id': seasonId,
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {'status': true};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除文件夹
|
|
||||||
static Future delFavFolder({required int mediaIds}) async {
|
|
||||||
var res = await Request().post(
|
|
||||||
Api.delFavFolder,
|
|
||||||
data: {
|
|
||||||
'media_ids': mediaIds,
|
|
||||||
'platform': 'web',
|
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {'status': true};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 稍后再看播放全部
|
|
||||||
// static Future toViewPlayAll({required int oid, required String bvid}) async {
|
|
||||||
// var res = await Request().get(
|
|
||||||
// Api.watchLaterHtml,
|
|
||||||
// data: {
|
|
||||||
// 'oid': oid,
|
|
||||||
// 'bvid': bvid,
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// String scriptContent =
|
|
||||||
// extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
|
||||||
// int startIndex = scriptContent.indexOf('{');
|
|
||||||
// int endIndex = scriptContent.lastIndexOf('};');
|
|
||||||
// String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
|
||||||
// // 解析JSON字符串为Map
|
|
||||||
// Map<String, dynamic> jsonData = json.decode(jsonContent);
|
|
||||||
// // 输出解析后的数据
|
|
||||||
// return {
|
|
||||||
// 'status': true,
|
|
||||||
// 'data': jsonData['resourceList']
|
|
||||||
// .map((e) => MediaVideoItemModel.fromJson(e))
|
|
||||||
// .toList()
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
static List<String> extractScriptContents(String htmlContent) {
|
|
||||||
RegExp scriptRegExp = RegExp(r'<script>([\s\S]*?)<\/script>');
|
|
||||||
Iterable<Match> matches = scriptRegExp.allMatches(htmlContent);
|
|
||||||
List<String> scriptContents = [];
|
|
||||||
for (Match match in matches) {
|
|
||||||
String scriptContent = match.group(1)!;
|
|
||||||
scriptContents.add(scriptContent);
|
|
||||||
}
|
|
||||||
return scriptContents;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 稍后再看列表
|
|
||||||
static Future getMediaList({
|
|
||||||
required int type,
|
|
||||||
required int bizId,
|
|
||||||
required int ps,
|
|
||||||
int? oid,
|
|
||||||
}) async {
|
|
||||||
var res = await Request().get(
|
|
||||||
Api.mediaList,
|
|
||||||
data: {
|
|
||||||
'mobi_app': 'web',
|
|
||||||
'type': type,
|
|
||||||
'biz_id': bizId,
|
|
||||||
'oid': oid ?? '',
|
|
||||||
'otype': 2,
|
|
||||||
'ps': ps,
|
|
||||||
'direction': false,
|
|
||||||
'desc': true,
|
|
||||||
'sort_field': 1,
|
|
||||||
'tid': 0,
|
|
||||||
'with_current': false,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': res.data['data']['media_list'] != null
|
|
||||||
? res.data['data']['media_list']
|
|
||||||
.map<MediaVideoItemModel>(
|
|
||||||
(e) => MediaVideoItemModel.fromJson(e))
|
|
||||||
.toList()
|
|
||||||
: []
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {'status': false, 'msg': res.data['message']};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析收藏夹视频
|
|
||||||
static Future parseFavVideo({
|
|
||||||
required int mediaId,
|
|
||||||
required int oid,
|
|
||||||
required String bvid,
|
|
||||||
}) async {
|
|
||||||
var res = await Request().get(
|
|
||||||
'https://www.bilibili.com/list/ml$mediaId',
|
|
||||||
data: {
|
|
||||||
'oid': mediaId,
|
|
||||||
'bvid': bvid,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
String scriptContent =
|
|
||||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
|
||||||
int startIndex = scriptContent.indexOf('{');
|
|
||||||
int endIndex = scriptContent.lastIndexOf('};');
|
|
||||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
|
||||||
// 解析JSON字符串为Map
|
|
||||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
|
||||||
return {
|
|
||||||
'status': true,
|
|
||||||
'data': jsonData['resourceList']
|
|
||||||
.map<MediaVideoItemModel>((e) => MediaVideoItemModel.fromJson(e))
|
|
||||||
.toList()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class VideoHttp {
|
|||||||
Api.recommendListWeb,
|
Api.recommendListWeb,
|
||||||
data: {
|
data: {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'feed_version': 'V3',
|
'feed_version': 'V8',
|
||||||
'homepage_ver': 1,
|
'homepage_ver': 1,
|
||||||
'ps': ps,
|
'ps': ps,
|
||||||
'fresh_idx': freshIdx,
|
'fresh_idx': freshIdx,
|
||||||
@ -70,43 +70,47 @@ class VideoHttp {
|
|||||||
// 添加额外的loginState变量模拟未登录状态
|
// 添加额外的loginState变量模拟未登录状态
|
||||||
static Future rcmdVideoListApp(
|
static Future rcmdVideoListApp(
|
||||||
{bool loginStatus = true, required int freshIdx}) async {
|
{bool loginStatus = true, required int freshIdx}) async {
|
||||||
var res = await Request().get(
|
try {
|
||||||
Api.recommendListApp,
|
var res = await Request().get(
|
||||||
data: {
|
Api.recommendListApp,
|
||||||
'idx': freshIdx,
|
data: {
|
||||||
'flush': '5',
|
'idx': freshIdx,
|
||||||
'column': '4',
|
'flush': '5',
|
||||||
'device': 'pad',
|
'column': '4',
|
||||||
'device_type': 0,
|
'device': 'pad',
|
||||||
'device_name': 'vivo',
|
'device_type': 0,
|
||||||
'pull': freshIdx == 0 ? 'true' : 'false',
|
'device_name': 'vivo',
|
||||||
'appkey': Constants.appKey,
|
'pull': freshIdx == 0 ? 'true' : 'false',
|
||||||
'access_key': loginStatus
|
'appkey': Constants.appKey,
|
||||||
? (localCache
|
'access_key': loginStatus
|
||||||
.get(LocalCacheKey.accessKey, defaultValue: {})['value'] ??
|
? (localCache.get(LocalCacheKey.accessKey,
|
||||||
'')
|
defaultValue: {})['value'] ??
|
||||||
: ''
|
'')
|
||||||
},
|
: ''
|
||||||
);
|
},
|
||||||
if (res.data['code'] == 0) {
|
);
|
||||||
List<RecVideoItemAppModel> list = [];
|
if (res.data['code'] == 0) {
|
||||||
List<int> blackMidsList =
|
List<RecVideoItemAppModel> list = [];
|
||||||
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
List<int> blackMidsList =
|
||||||
for (var i in res.data['data']['items']) {
|
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
||||||
// 屏蔽推广和拉黑用户
|
for (var i in res.data['data']['items']) {
|
||||||
if (i['card_goto'] != 'ad_av' &&
|
// 屏蔽推广和拉黑用户
|
||||||
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
|
if (i['card_goto'] != 'ad_av' &&
|
||||||
(i['args'] != null &&
|
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
|
||||||
!blackMidsList.contains(i['args']['up_mid']))) {
|
(i['args'] != null &&
|
||||||
RecVideoItemAppModel videoItem = RecVideoItemAppModel.fromJson(i);
|
!blackMidsList.contains(i['args']['up_mid']))) {
|
||||||
if (!RecommendFilter.filter(videoItem)) {
|
RecVideoItemAppModel videoItem = RecVideoItemAppModel.fromJson(i);
|
||||||
list.add(videoItem);
|
if (!RecommendFilter.filter(videoItem)) {
|
||||||
|
list.add(videoItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return {'status': true, 'data': list};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
return {'status': true, 'data': list};
|
} catch (err) {
|
||||||
} else {
|
return {'status': false, 'data': [], 'msg': err.toString()};
|
||||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,15 +192,22 @@ class VideoHttp {
|
|||||||
// 视频信息 标题、简介
|
// 视频信息 标题、简介
|
||||||
static Future videoIntro({required String bvid}) async {
|
static Future videoIntro({required String bvid}) async {
|
||||||
var res = await Request().get(Api.videoIntro, data: {'bvid': bvid});
|
var res = await Request().get(Api.videoIntro, data: {'bvid': bvid});
|
||||||
if (res.data['code'] == 0) {
|
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
||||||
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
if (result.code == 0) {
|
||||||
return {'status': true, 'data': result.data!};
|
return {'status': true, 'data': result.data!};
|
||||||
} else {
|
} else {
|
||||||
|
Map errMap = {
|
||||||
|
-400: '请求错误',
|
||||||
|
-403: '权限不足',
|
||||||
|
-404: '视频资源失效',
|
||||||
|
62002: '稿件不可见',
|
||||||
|
62004: '稿件审核中',
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': null,
|
'data': null,
|
||||||
'code': res.data['code'],
|
'code': result.code,
|
||||||
'msg': res.data['message'],
|
'msg': errMap[result.code] ?? '请求异常',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,7 +254,7 @@ class VideoHttp {
|
|||||||
static Future coinVideo({required String bvid, required int multiply}) async {
|
static Future coinVideo({required String bvid, required int multiply}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.coinVideo,
|
Api.coinVideo,
|
||||||
data: {
|
queryParameters: {
|
||||||
'bvid': bvid,
|
'bvid': bvid,
|
||||||
'multiply': multiply,
|
'multiply': multiply,
|
||||||
'select_like': 0,
|
'select_like': 0,
|
||||||
@ -271,7 +282,7 @@ class VideoHttp {
|
|||||||
static Future oneThree({required String bvid}) async {
|
static Future oneThree({required String bvid}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.oneThree,
|
Api.oneThree,
|
||||||
data: {
|
queryParameters: {
|
||||||
'bvid': bvid,
|
'bvid': bvid,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
},
|
},
|
||||||
@ -287,7 +298,7 @@ class VideoHttp {
|
|||||||
static Future likeVideo({required String bvid, required bool type}) async {
|
static Future likeVideo({required String bvid, required bool type}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(
|
||||||
Api.likeVideo,
|
Api.likeVideo,
|
||||||
data: {
|
queryParameters: {
|
||||||
'bvid': bvid,
|
'bvid': bvid,
|
||||||
'like': type ? 1 : 2,
|
'like': type ? 1 : 2,
|
||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
@ -303,16 +314,13 @@ class VideoHttp {
|
|||||||
// (取消)收藏
|
// (取消)收藏
|
||||||
static Future favVideo(
|
static Future favVideo(
|
||||||
{required int aid, String? addIds, String? delIds}) async {
|
{required int aid, String? addIds, String? delIds}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(Api.favVideo, queryParameters: {
|
||||||
Api.favVideo,
|
'rid': aid,
|
||||||
data: {
|
'type': 2,
|
||||||
'rid': aid,
|
'add_media_ids': addIds ?? '',
|
||||||
'type': 2,
|
'del_media_ids': delIds ?? '',
|
||||||
'add_media_ids': addIds ?? '',
|
'csrf': await Request.getCsrf(),
|
||||||
'del_media_ids': delIds ?? '',
|
});
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
} else {
|
} else {
|
||||||
@ -350,17 +358,14 @@ class VideoHttp {
|
|||||||
if (message == '') {
|
if (message == '') {
|
||||||
return {'status': false, 'data': [], 'msg': '请输入评论内容'};
|
return {'status': false, 'data': [], 'msg': '请输入评论内容'};
|
||||||
}
|
}
|
||||||
var res = await Request().post(
|
var res = await Request().post(Api.replyAdd, queryParameters: {
|
||||||
Api.replyAdd,
|
'type': type.index,
|
||||||
data: {
|
'oid': oid,
|
||||||
'type': type.index,
|
'root': root == null || root == 0 ? '' : root,
|
||||||
'oid': oid,
|
'parent': parent == null || parent == 0 ? '' : parent,
|
||||||
'root': root == null || root == 0 ? '' : root,
|
'message': message,
|
||||||
'parent': parent == null || parent == 0 ? '' : parent,
|
'csrf': await Request.getCsrf(),
|
||||||
'message': message,
|
});
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
log(res.toString());
|
log(res.toString());
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
@ -382,57 +387,42 @@ class VideoHttp {
|
|||||||
// 操作用户关系
|
// 操作用户关系
|
||||||
static Future relationMod(
|
static Future relationMod(
|
||||||
{required int mid, required int act, required int reSrc}) async {
|
{required int mid, required int act, required int reSrc}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(Api.relationMod, queryParameters: {
|
||||||
Api.relationMod,
|
'fid': mid,
|
||||||
data: {
|
'act': act,
|
||||||
'fid': mid,
|
're_src': reSrc,
|
||||||
'act': act,
|
'csrf': await Request.getCsrf(),
|
||||||
're_src': reSrc,
|
});
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
if (act == 5) {
|
return {'status': true, 'data': res.data['data']};
|
||||||
List<int> blackMidsList =
|
|
||||||
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
|
||||||
blackMidsList.add(mid);
|
|
||||||
setting.put(SettingBoxKey.blackMidsList, blackMidsList);
|
|
||||||
}
|
|
||||||
return {'status': true, 'data': res.data['data'], 'msg': '成功'};
|
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
return {'status': false, 'data': []};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 视频播放进度
|
// 视频播放进度
|
||||||
static Future heartBeat({bvid, cid, progress, realtime}) async {
|
static Future heartBeat({bvid, cid, progress, realtime}) async {
|
||||||
await Request().post(
|
await Request().post(Api.heartBeat, queryParameters: {
|
||||||
Api.heartBeat,
|
// 'aid': aid,
|
||||||
data: {
|
'bvid': bvid,
|
||||||
// 'aid': aid,
|
'cid': cid,
|
||||||
'bvid': bvid,
|
// 'epid': '',
|
||||||
'cid': cid,
|
// 'sid': '',
|
||||||
// 'epid': '',
|
// 'mid': '',
|
||||||
// 'sid': '',
|
'played_time': progress,
|
||||||
// 'mid': '',
|
// 'realtime': realtime,
|
||||||
'played_time': progress,
|
// 'type': '',
|
||||||
// 'realtime': realtime,
|
// 'sub_type': '',
|
||||||
// 'type': '',
|
'csrf': await Request.getCsrf(),
|
||||||
// 'sub_type': '',
|
});
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加追番
|
// 添加追番
|
||||||
static Future bangumiAdd({int? seasonId}) async {
|
static Future bangumiAdd({int? seasonId}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(Api.bangumiAdd, queryParameters: {
|
||||||
Api.bangumiAdd,
|
'season_id': seasonId,
|
||||||
data: {
|
'csrf': await Request.getCsrf(),
|
||||||
'season_id': seasonId,
|
});
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': res.data['result']['toast']};
|
return {'status': true, 'msg': res.data['result']['toast']};
|
||||||
} else {
|
} else {
|
||||||
@ -442,13 +432,10 @@ class VideoHttp {
|
|||||||
|
|
||||||
// 取消追番
|
// 取消追番
|
||||||
static Future bangumiDel({int? seasonId}) async {
|
static Future bangumiDel({int? seasonId}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(Api.bangumiDel, queryParameters: {
|
||||||
Api.bangumiDel,
|
'season_id': seasonId,
|
||||||
data: {
|
'csrf': await Request.getCsrf(),
|
||||||
'season_id': seasonId,
|
});
|
||||||
'csrf': await Request.getCsrf(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': res.data['result']['toast']};
|
return {'status': true, 'msg': res.data['result']['toast']};
|
||||||
} else {
|
} else {
|
||||||
@ -506,7 +493,7 @@ class VideoHttp {
|
|||||||
return {'status': false, 'data': [], 'msg': res.data['msg']};
|
return {'status': false, 'data': [], 'msg': res.data['msg']};
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return {'status': false, 'data': [], 'msg': res.data['msg']};
|
print(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,8 +523,7 @@ class VideoHttp {
|
|||||||
// 获取字幕内容
|
// 获取字幕内容
|
||||||
static Future<Map<String, dynamic>> getSubtitleContent(url) async {
|
static Future<Map<String, dynamic>> getSubtitleContent(url) async {
|
||||||
var res = await Request().get('https:$url');
|
var res = await Request().get('https:$url');
|
||||||
final String content =
|
final String content = SubTitleUtils.convertToWebVTT(res.data['body']);
|
||||||
await SubTitleUtils.convertToWebVTT(res.data['body']);
|
|
||||||
final List body = res.data['body'];
|
final List body = res.data['body'];
|
||||||
return {'content': content, 'body': body};
|
return {'content': content, 'body': body};
|
||||||
}
|
}
|
||||||
|
|||||||
277
lib/main.dart
277
lib/main.dart
@ -1,6 +1,5 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
@ -17,12 +16,12 @@ import 'package:pilipala/pages/search/index.dart';
|
|||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/router/app_pages.dart';
|
import 'package:pilipala/router/app_pages.dart';
|
||||||
import 'package:pilipala/pages/main/view.dart';
|
import 'package:pilipala/pages/main/view.dart';
|
||||||
|
import 'package:pilipala/services/disable_battery_opt.dart';
|
||||||
import 'package:pilipala/services/service_locator.dart';
|
import 'package:pilipala/services/service_locator.dart';
|
||||||
import 'package:pilipala/utils/app_scheme.dart';
|
import 'package:pilipala/utils/app_scheme.dart';
|
||||||
import 'package:pilipala/utils/data.dart';
|
import 'package:pilipala/utils/data.dart';
|
||||||
import 'package:pilipala/utils/global_data_cache.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:media_kit/media_kit.dart';
|
import 'package:media_kit/media_kit.dart'; // Provides [Player], [Media], [Playlist] etc.
|
||||||
import 'package:pilipala/utils/recommend_filter.dart';
|
import 'package:pilipala/utils/recommend_filter.dart';
|
||||||
import 'package:catcher_2/catcher_2.dart';
|
import 'package:catcher_2/catcher_2.dart';
|
||||||
import './services/loggeer.dart';
|
import './services/loggeer.dart';
|
||||||
@ -30,41 +29,51 @@ import './services/loggeer.dart';
|
|||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
MediaKit.ensureInitialized();
|
MediaKit.ensureInitialized();
|
||||||
await SystemChrome.setPreferredOrientations(
|
SystemChrome.setPreferredOrientations(
|
||||||
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
|
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown])
|
||||||
await GStrorage.init();
|
.then((_) async {
|
||||||
clearLogs();
|
await GStrorage.init();
|
||||||
Request();
|
await setupServiceLocator();
|
||||||
await Request.setCookie();
|
Request();
|
||||||
|
await Request.setCookie();
|
||||||
|
RecommendFilter();
|
||||||
|
|
||||||
// 异常捕获 logo记录
|
// 异常捕获 logo记录
|
||||||
final Catcher2Options releaseConfig = Catcher2Options(
|
final Catcher2Options debugConfig = Catcher2Options(
|
||||||
SilentReportMode(),
|
SilentReportMode(),
|
||||||
[FileHandler(await getLogsPath())],
|
[
|
||||||
);
|
FileHandler(await getLogsPath()),
|
||||||
|
ConsoleHandler(
|
||||||
|
enableDeviceParameters: false,
|
||||||
|
enableApplicationParameters: false,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
Catcher2(
|
final Catcher2Options releaseConfig = Catcher2Options(
|
||||||
releaseConfig: releaseConfig,
|
SilentReportMode(),
|
||||||
runAppFunction: () {
|
[FileHandler(await getLogsPath())],
|
||||||
runApp(const MyApp());
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// 小白条、导航栏沉浸
|
Catcher2(
|
||||||
if (Platform.isAndroid) {
|
debugConfig: debugConfig,
|
||||||
final androidInfo = await DeviceInfoPlugin().androidInfo;
|
releaseConfig: releaseConfig,
|
||||||
if (androidInfo.version.sdkInt >= 29) {
|
runAppFunction: () {
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
runApp(const MyApp());
|
||||||
}
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
// 小白条、导航栏沉浸
|
||||||
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||||
systemNavigationBarColor: Colors.transparent,
|
systemNavigationBarColor: Colors.transparent,
|
||||||
systemNavigationBarDividerColor: Colors.transparent,
|
systemNavigationBarDividerColor: Colors.transparent,
|
||||||
statusBarColor: Colors.transparent,
|
statusBarColor: Colors.transparent,
|
||||||
));
|
));
|
||||||
}
|
Data.init();
|
||||||
|
PiliSchame.init();
|
||||||
PiliSchame.init();
|
DisableBatteryOpt();
|
||||||
await GlobalDataCache().initialize();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
@ -105,39 +114,6 @@ class MyApp extends StatelessWidget {
|
|||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Platform.isAndroid) {
|
|
||||||
return AndroidApp(
|
|
||||||
brandColor: brandColor,
|
|
||||||
isDynamicColor: isDynamicColor,
|
|
||||||
currentThemeValue: currentThemeValue,
|
|
||||||
textScale: textScale,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return OtherApp(
|
|
||||||
brandColor: brandColor,
|
|
||||||
currentThemeValue: currentThemeValue,
|
|
||||||
textScale: textScale,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AndroidApp extends StatelessWidget {
|
|
||||||
const AndroidApp({
|
|
||||||
super.key,
|
|
||||||
required this.brandColor,
|
|
||||||
required this.isDynamicColor,
|
|
||||||
required this.currentThemeValue,
|
|
||||||
required this.textScale,
|
|
||||||
});
|
|
||||||
|
|
||||||
final Color brandColor;
|
|
||||||
final bool isDynamicColor;
|
|
||||||
final ThemeType currentThemeValue;
|
|
||||||
final double textScale;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return DynamicColorBuilder(
|
return DynamicColorBuilder(
|
||||||
builder: ((ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
|
builder: ((ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
|
||||||
ColorScheme? lightColorScheme;
|
ColorScheme? lightColorScheme;
|
||||||
@ -157,120 +133,71 @@ class AndroidApp extends StatelessWidget {
|
|||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return BuildMainApp(
|
// 图片缓存
|
||||||
lightColorScheme: lightColorScheme,
|
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
|
||||||
darkColorScheme: darkColorScheme,
|
return GetMaterialApp(
|
||||||
currentThemeValue: currentThemeValue,
|
title: 'PiLiPaLa',
|
||||||
textScale: textScale,
|
theme: ThemeData(
|
||||||
|
// fontFamily: 'HarmonyOS',
|
||||||
|
colorScheme: currentThemeValue == ThemeType.dark
|
||||||
|
? darkColorScheme
|
||||||
|
: lightColorScheme,
|
||||||
|
useMaterial3: true,
|
||||||
|
snackBarTheme: SnackBarThemeData(
|
||||||
|
actionTextColor: lightColorScheme.primary,
|
||||||
|
backgroundColor: lightColorScheme.secondaryContainer,
|
||||||
|
closeIconColor: lightColorScheme.secondary,
|
||||||
|
contentTextStyle: TextStyle(color: lightColorScheme.secondary),
|
||||||
|
elevation: 20,
|
||||||
|
),
|
||||||
|
pageTransitionsTheme: const PageTransitionsTheme(
|
||||||
|
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||||
|
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
||||||
|
allowEnterRouteSnapshotting: false,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
darkTheme: ThemeData(
|
||||||
|
// fontFamily: 'HarmonyOS',
|
||||||
|
colorScheme: currentThemeValue == ThemeType.light
|
||||||
|
? lightColorScheme
|
||||||
|
: darkColorScheme,
|
||||||
|
useMaterial3: true,
|
||||||
|
snackBarTheme: SnackBarThemeData(
|
||||||
|
actionTextColor: darkColorScheme.primary,
|
||||||
|
backgroundColor: darkColorScheme.secondaryContainer,
|
||||||
|
closeIconColor: darkColorScheme.secondary,
|
||||||
|
contentTextStyle: TextStyle(color: darkColorScheme.secondary),
|
||||||
|
elevation: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
localizationsDelegates: const [
|
||||||
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
],
|
||||||
|
locale: const Locale("zh", "CN"),
|
||||||
|
supportedLocales: const [Locale("zh", "CN"), Locale("en", "US")],
|
||||||
|
fallbackLocale: const Locale("zh", "CN"),
|
||||||
|
getPages: Routes.getPages,
|
||||||
|
home: const MainApp(),
|
||||||
|
builder: (BuildContext context, Widget? child) {
|
||||||
|
return FlutterSmartDialog(
|
||||||
|
toastBuilder: (String msg) => CustomToast(msg: msg),
|
||||||
|
child: MediaQuery(
|
||||||
|
data: MediaQuery.of(context)
|
||||||
|
.copyWith(textScaler: TextScaler.linear(textScale)),
|
||||||
|
child: child!,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
navigatorObservers: [
|
||||||
|
VideoDetailPage.routeObserver,
|
||||||
|
SearchPage.routeObserver,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OtherApp extends StatelessWidget {
|
|
||||||
const OtherApp({
|
|
||||||
super.key,
|
|
||||||
required this.brandColor,
|
|
||||||
required this.currentThemeValue,
|
|
||||||
required this.textScale,
|
|
||||||
});
|
|
||||||
|
|
||||||
final Color brandColor;
|
|
||||||
final ThemeType currentThemeValue;
|
|
||||||
final double textScale;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BuildMainApp(
|
|
||||||
lightColorScheme: ColorScheme.fromSeed(
|
|
||||||
seedColor: brandColor,
|
|
||||||
brightness: Brightness.light,
|
|
||||||
),
|
|
||||||
darkColorScheme: ColorScheme.fromSeed(
|
|
||||||
seedColor: brandColor,
|
|
||||||
brightness: Brightness.dark,
|
|
||||||
),
|
|
||||||
currentThemeValue: currentThemeValue,
|
|
||||||
textScale: textScale,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class BuildMainApp extends StatelessWidget {
|
|
||||||
const BuildMainApp({
|
|
||||||
super.key,
|
|
||||||
required this.lightColorScheme,
|
|
||||||
required this.darkColorScheme,
|
|
||||||
required this.currentThemeValue,
|
|
||||||
required this.textScale,
|
|
||||||
});
|
|
||||||
|
|
||||||
final ColorScheme lightColorScheme;
|
|
||||||
final ColorScheme darkColorScheme;
|
|
||||||
final ThemeType currentThemeValue;
|
|
||||||
final double textScale;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final SnackBarThemeData snackBarTheme = SnackBarThemeData(
|
|
||||||
actionTextColor: lightColorScheme.primary,
|
|
||||||
backgroundColor: lightColorScheme.secondaryContainer,
|
|
||||||
closeIconColor: lightColorScheme.secondary,
|
|
||||||
contentTextStyle: TextStyle(color: lightColorScheme.secondary),
|
|
||||||
elevation: 20,
|
|
||||||
);
|
|
||||||
|
|
||||||
return GetMaterialApp(
|
|
||||||
title: 'PiliPala',
|
|
||||||
theme: ThemeData(
|
|
||||||
colorScheme: currentThemeValue == ThemeType.dark
|
|
||||||
? darkColorScheme
|
|
||||||
: lightColorScheme,
|
|
||||||
snackBarTheme: snackBarTheme,
|
|
||||||
pageTransitionsTheme: const PageTransitionsTheme(
|
|
||||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
|
||||||
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
|
||||||
allowEnterRouteSnapshotting: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
darkTheme: ThemeData(
|
|
||||||
colorScheme: currentThemeValue == ThemeType.light
|
|
||||||
? lightColorScheme
|
|
||||||
: darkColorScheme,
|
|
||||||
snackBarTheme: snackBarTheme,
|
|
||||||
),
|
|
||||||
localizationsDelegates: const [
|
|
||||||
GlobalCupertinoLocalizations.delegate,
|
|
||||||
GlobalMaterialLocalizations.delegate,
|
|
||||||
GlobalWidgetsLocalizations.delegate,
|
|
||||||
],
|
|
||||||
locale: const Locale("zh", "CN"),
|
|
||||||
supportedLocales: const [Locale("zh", "CN"), Locale("en", "US")],
|
|
||||||
fallbackLocale: const Locale("zh", "CN"),
|
|
||||||
getPages: Routes.getPages,
|
|
||||||
home: const MainApp(),
|
|
||||||
builder: (BuildContext context, Widget? child) {
|
|
||||||
return FlutterSmartDialog(
|
|
||||||
toastBuilder: (String msg) => CustomToast(msg: msg),
|
|
||||||
child: MediaQuery(
|
|
||||||
data: MediaQuery.of(context)
|
|
||||||
.copyWith(textScaler: TextScaler.linear(textScale)),
|
|
||||||
child: child!,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
navigatorObservers: [
|
|
||||||
VideoDetailPage.routeObserver,
|
|
||||||
SearchPage.routeObserver,
|
|
||||||
],
|
|
||||||
onReady: () async {
|
|
||||||
RecommendFilter();
|
|
||||||
Data.init();
|
|
||||||
setupServiceLocator();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -30,7 +30,6 @@ class BangumiListItemModel {
|
|||||||
BangumiListItemModel({
|
BangumiListItemModel({
|
||||||
this.badge,
|
this.badge,
|
||||||
this.badgeType,
|
this.badgeType,
|
||||||
this.pic,
|
|
||||||
this.cover,
|
this.cover,
|
||||||
// this.firstEp,
|
// this.firstEp,
|
||||||
this.indexShow,
|
this.indexShow,
|
||||||
@ -51,7 +50,6 @@ class BangumiListItemModel {
|
|||||||
|
|
||||||
String? badge;
|
String? badge;
|
||||||
int? badgeType;
|
int? badgeType;
|
||||||
String? pic;
|
|
||||||
String? cover;
|
String? cover;
|
||||||
String? indexShow;
|
String? indexShow;
|
||||||
int? isFinish;
|
int? isFinish;
|
||||||
@ -72,7 +70,6 @@ class BangumiListItemModel {
|
|||||||
BangumiListItemModel.fromJson(Map<String, dynamic> json) {
|
BangumiListItemModel.fromJson(Map<String, dynamic> json) {
|
||||||
badge = json['badge'] == '' ? null : json['badge'];
|
badge = json['badge'] == '' ? null : json['badge'];
|
||||||
badgeType = json['badge_type'];
|
badgeType = json['badge_type'];
|
||||||
pic = json['cover'];
|
|
||||||
cover = json['cover'];
|
cover = json['cover'];
|
||||||
indexShow = json['index_show'];
|
indexShow = json['index_show'];
|
||||||
isFinish = json['is_finish'];
|
isFinish = json['is_finish'];
|
||||||
|
|||||||
@ -1,93 +0,0 @@
|
|||||||
// 操作类型的枚举值:点赞 不喜欢 收藏 投币 稍后再看 下载封面 后台播放 听视频 分享 下载视频
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
enum ActionType {
|
|
||||||
like,
|
|
||||||
coin,
|
|
||||||
collect,
|
|
||||||
watchLater,
|
|
||||||
share,
|
|
||||||
dislike,
|
|
||||||
downloadCover,
|
|
||||||
copyLink,
|
|
||||||
// backgroundPlay,
|
|
||||||
// listenVideo,
|
|
||||||
// downloadVideo,
|
|
||||||
}
|
|
||||||
|
|
||||||
extension ActionTypeExtension on ActionType {
|
|
||||||
String get value => [
|
|
||||||
'like',
|
|
||||||
'coin',
|
|
||||||
'collect',
|
|
||||||
'watchLater',
|
|
||||||
'share',
|
|
||||||
'dislike',
|
|
||||||
'downloadCover',
|
|
||||||
'copyLink',
|
|
||||||
// 'backgroundPlay',
|
|
||||||
// 'listenVideo',
|
|
||||||
// 'downloadVideo',
|
|
||||||
][index];
|
|
||||||
String get label => [
|
|
||||||
'点赞视频',
|
|
||||||
'投币',
|
|
||||||
'收藏视频',
|
|
||||||
'稍后再看',
|
|
||||||
'视频分享',
|
|
||||||
'不喜欢',
|
|
||||||
'下载封面',
|
|
||||||
'复制链接',
|
|
||||||
// '后台播放',
|
|
||||||
// '听视频',
|
|
||||||
// '下载视频',
|
|
||||||
][index];
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Map> actionMenuConfig = [
|
|
||||||
{
|
|
||||||
'icon': const Icon(Icons.thumb_up_alt_outlined),
|
|
||||||
'label': '点赞视频',
|
|
||||||
'value': ActionType.like,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'icon': Image.asset(
|
|
||||||
'assets/images/coin.png',
|
|
||||||
width: 26,
|
|
||||||
color: IconTheme.of(Get.context!).color!.withOpacity(0.65),
|
|
||||||
),
|
|
||||||
'label': '投币',
|
|
||||||
'value': ActionType.coin,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'icon': const Icon(Icons.star_border),
|
|
||||||
'label': '收藏视频',
|
|
||||||
'value': ActionType.collect,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'icon': const Icon(Icons.watch_later_outlined),
|
|
||||||
'label': '稍后再看',
|
|
||||||
'value': ActionType.watchLater,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'icon': const Icon(Icons.share),
|
|
||||||
'label': '视频分享',
|
|
||||||
'value': ActionType.share,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'icon': const Icon(Icons.thumb_down_alt_outlined),
|
|
||||||
'label': '不喜欢',
|
|
||||||
'value': ActionType.dislike,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'icon': const Icon(Icons.image_outlined),
|
|
||||||
'label': '下载封面',
|
|
||||||
'value': ActionType.downloadCover,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'icon': const Icon(Icons.link_outlined),
|
|
||||||
'label': '复制链接',
|
|
||||||
'value': ActionType.copyLink,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,10 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../pages/dynamics/index.dart';
|
|
||||||
import '../../pages/home/index.dart';
|
|
||||||
import '../../pages/media/index.dart';
|
|
||||||
import '../../pages/rank/index.dart';
|
|
||||||
|
|
||||||
List defaultNavigationBars = [
|
List defaultNavigationBars = [
|
||||||
{
|
{
|
||||||
'id': 0,
|
'id': 0,
|
||||||
@ -18,7 +13,6 @@ List defaultNavigationBars = [
|
|||||||
),
|
),
|
||||||
'label': "首页",
|
'label': "首页",
|
||||||
'count': 0,
|
'count': 0,
|
||||||
'page': const HomePage(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': 1,
|
'id': 1,
|
||||||
@ -32,7 +26,6 @@ List defaultNavigationBars = [
|
|||||||
),
|
),
|
||||||
'label': "排行榜",
|
'label': "排行榜",
|
||||||
'count': 0,
|
'count': 0,
|
||||||
'page': const RankPage(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': 2,
|
'id': 2,
|
||||||
@ -46,7 +39,6 @@ List defaultNavigationBars = [
|
|||||||
),
|
),
|
||||||
'label': "动态",
|
'label': "动态",
|
||||||
'count': 0,
|
'count': 0,
|
||||||
'page': const DynamicsPage(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': 3,
|
'id': 3,
|
||||||
@ -60,6 +52,5 @@ List defaultNavigationBars = [
|
|||||||
),
|
),
|
||||||
'label': "媒体库",
|
'label': "媒体库",
|
||||||
'count': 0,
|
'count': 0,
|
||||||
'page': const MediaPage(),
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/pages/rank/zone/index.dart';
|
import 'package:pilipala/pages/rank/zone/index.dart';
|
||||||
|
|
||||||
enum RandType {
|
enum RandType {
|
||||||
@ -73,6 +74,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '全站',
|
'label': '全站',
|
||||||
'type': RandType.all,
|
'type': RandType.all,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 0),
|
'page': const ZonePage(rid: 0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -82,6 +84,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '国创相关',
|
'label': '国创相关',
|
||||||
'type': RandType.creation,
|
'type': RandType.creation,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 168),
|
'page': const ZonePage(rid: 168),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -91,6 +94,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '动画',
|
'label': '动画',
|
||||||
'type': RandType.animation,
|
'type': RandType.animation,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 1),
|
'page': const ZonePage(rid: 1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -100,6 +104,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '音乐',
|
'label': '音乐',
|
||||||
'type': RandType.music,
|
'type': RandType.music,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 3),
|
'page': const ZonePage(rid: 3),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -109,6 +114,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '舞蹈',
|
'label': '舞蹈',
|
||||||
'type': RandType.dance,
|
'type': RandType.dance,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 129),
|
'page': const ZonePage(rid: 129),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -118,6 +124,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '游戏',
|
'label': '游戏',
|
||||||
'type': RandType.game,
|
'type': RandType.game,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 4),
|
'page': const ZonePage(rid: 4),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -127,6 +134,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '知识',
|
'label': '知识',
|
||||||
'type': RandType.knowledge,
|
'type': RandType.knowledge,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 36),
|
'page': const ZonePage(rid: 36),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -136,6 +144,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '科技',
|
'label': '科技',
|
||||||
'type': RandType.technology,
|
'type': RandType.technology,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 188),
|
'page': const ZonePage(rid: 188),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -145,6 +154,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '运动',
|
'label': '运动',
|
||||||
'type': RandType.sport,
|
'type': RandType.sport,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 234),
|
'page': const ZonePage(rid: 234),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -154,6 +164,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '汽车',
|
'label': '汽车',
|
||||||
'type': RandType.car,
|
'type': RandType.car,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 223),
|
'page': const ZonePage(rid: 223),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -163,6 +174,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '生活',
|
'label': '生活',
|
||||||
'type': RandType.life,
|
'type': RandType.life,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 160),
|
'page': const ZonePage(rid: 160),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -172,6 +184,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '美食',
|
'label': '美食',
|
||||||
'type': RandType.food,
|
'type': RandType.food,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 211),
|
'page': const ZonePage(rid: 211),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -181,6 +194,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '动物圈',
|
'label': '动物圈',
|
||||||
'type': RandType.animal,
|
'type': RandType.animal,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 217),
|
'page': const ZonePage(rid: 217),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -190,6 +204,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '鬼畜',
|
'label': '鬼畜',
|
||||||
'type': RandType.madness,
|
'type': RandType.madness,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 119),
|
'page': const ZonePage(rid: 119),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -199,6 +214,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '时尚',
|
'label': '时尚',
|
||||||
'type': RandType.fashion,
|
'type': RandType.fashion,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 155),
|
'page': const ZonePage(rid: 155),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -208,6 +224,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '娱乐',
|
'label': '娱乐',
|
||||||
'type': RandType.entertainment,
|
'type': RandType.entertainment,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 5),
|
'page': const ZonePage(rid: 5),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -217,6 +234,7 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '影视',
|
'label': '影视',
|
||||||
'type': RandType.film,
|
'type': RandType.film,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
'page': const ZonePage(rid: 181),
|
'page': const ZonePage(rid: 181),
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@ -28,7 +28,7 @@ extension SearchTypeExtension on SearchType {
|
|||||||
String get label => ['视频', '番剧', '直播间', '用户', '专栏'][index];
|
String get label => ['视频', '番剧', '直播间', '用户', '专栏'][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索类型为视频时
|
// 搜索类型为视频、专栏及相簿时
|
||||||
enum ArchiveFilterType {
|
enum ArchiveFilterType {
|
||||||
totalrank,
|
totalrank,
|
||||||
click,
|
click,
|
||||||
@ -44,21 +44,3 @@ extension ArchiveFilterTypeExtension on ArchiveFilterType {
|
|||||||
String get description =>
|
String get description =>
|
||||||
['默认排序', '播放多', '新发布', '弹幕多', '收藏多', '评论多', '最多喜欢'][index];
|
['默认排序', '播放多', '新发布', '弹幕多', '收藏多', '评论多', '最多喜欢'][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索类型为专栏时
|
|
||||||
enum ArticleFilterType {
|
|
||||||
// 综合排序
|
|
||||||
totalrank,
|
|
||||||
// 最新发布
|
|
||||||
pubdate,
|
|
||||||
// 最多点击
|
|
||||||
click,
|
|
||||||
// 最多喜欢
|
|
||||||
attention,
|
|
||||||
// 最多评论
|
|
||||||
scores,
|
|
||||||
}
|
|
||||||
|
|
||||||
extension ArticleFilterTypeExtension on ArticleFilterType {
|
|
||||||
String get description => ['综合排序', '最新发布', '最多点击', '最多喜欢', '最多评论'][index];
|
|
||||||
}
|
|
||||||
|
|||||||
47
lib/models/common/subtitle_type.dart
Normal file
47
lib/models/common/subtitle_type.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
enum SubtitleType {
|
||||||
|
// 中文(中国)
|
||||||
|
zhCN,
|
||||||
|
// 中文(自动翻译)
|
||||||
|
aizh,
|
||||||
|
// 英语(自动生成)
|
||||||
|
aien,
|
||||||
|
}
|
||||||
|
|
||||||
|
extension SubtitleTypeExtension on SubtitleType {
|
||||||
|
String get description {
|
||||||
|
switch (this) {
|
||||||
|
case SubtitleType.zhCN:
|
||||||
|
return '中文(中国)';
|
||||||
|
case SubtitleType.aizh:
|
||||||
|
return '中文(自动翻译)';
|
||||||
|
case SubtitleType.aien:
|
||||||
|
return '英语(自动生成)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension SubtitleIdExtension on SubtitleType {
|
||||||
|
String get id {
|
||||||
|
switch (this) {
|
||||||
|
case SubtitleType.zhCN:
|
||||||
|
return 'zh-CN';
|
||||||
|
case SubtitleType.aizh:
|
||||||
|
return 'ai-zh';
|
||||||
|
case SubtitleType.aien:
|
||||||
|
return 'ai-en';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension SubtitleCodeExtension on SubtitleType {
|
||||||
|
int get code {
|
||||||
|
switch (this) {
|
||||||
|
case SubtitleType.zhCN:
|
||||||
|
return 1;
|
||||||
|
case SubtitleType.aizh:
|
||||||
|
return 2;
|
||||||
|
case SubtitleType.aien:
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +0,0 @@
|
|||||||
enum VideoEpidoesType {
|
|
||||||
videoEpisode,
|
|
||||||
videoPart,
|
|
||||||
bangumiEpisode,
|
|
||||||
}
|
|
||||||
@ -414,8 +414,6 @@ class DynamicMajorModel {
|
|||||||
this.none,
|
this.none,
|
||||||
this.type,
|
this.type,
|
||||||
this.courses,
|
this.courses,
|
||||||
this.common,
|
|
||||||
this.music,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
DynamicArchiveModel? archive;
|
DynamicArchiveModel? archive;
|
||||||
@ -431,8 +429,6 @@ class DynamicMajorModel {
|
|||||||
// MAJOR_TYPE_OPUS 图文/文章
|
// MAJOR_TYPE_OPUS 图文/文章
|
||||||
String? type;
|
String? type;
|
||||||
Map? courses;
|
Map? courses;
|
||||||
Map? common;
|
|
||||||
Map? music;
|
|
||||||
|
|
||||||
DynamicMajorModel.fromJson(Map<String, dynamic> json) {
|
DynamicMajorModel.fromJson(Map<String, dynamic> json) {
|
||||||
archive = json['archive'] != null
|
archive = json['archive'] != null
|
||||||
@ -456,8 +452,6 @@ class DynamicMajorModel {
|
|||||||
json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null;
|
json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null;
|
||||||
type = json['type'];
|
type = json['type'];
|
||||||
courses = json['courses'] ?? {};
|
courses = json['courses'] ?? {};
|
||||||
common = json['common'] ?? {};
|
|
||||||
music = json['music'] ?? {};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class RecVideoItemAppModel {
|
|||||||
String? title;
|
String? title;
|
||||||
int? isFollowed;
|
int? isFollowed;
|
||||||
RcmdOwner? owner;
|
RcmdOwner? owner;
|
||||||
String? rcmdReason;
|
RcmdReason? rcmdReason;
|
||||||
String? goto;
|
String? goto;
|
||||||
int? param;
|
int? param;
|
||||||
String? uri;
|
String? uri;
|
||||||
@ -62,19 +62,24 @@ class RecVideoItemAppModel {
|
|||||||
duration =
|
duration =
|
||||||
json['player_args'] != null ? json['player_args']['duration'] : -1;
|
json['player_args'] != null ? json['player_args']['duration'] : -1;
|
||||||
//duration = json['cover_right_text'];
|
//duration = json['cover_right_text'];
|
||||||
title = json['title'] ?? '获取标题失败';
|
title = json['title'];
|
||||||
owner = RcmdOwner.fromJson(json);
|
owner = RcmdOwner.fromJson(json);
|
||||||
rcmdReason = json['bottom_rcmd_reason'] ?? json['top_rcmd_reason'];
|
rcmdReason = json['rcmd_reason_style'] != null
|
||||||
|
? RcmdReason.fromJson(json['rcmd_reason_style'])
|
||||||
|
: null;
|
||||||
// 由于app端api并不会直接返回与owner的关注状态
|
// 由于app端api并不会直接返回与owner的关注状态
|
||||||
// 所以借用推荐原因是否为“已关注”、“新关注”等判别关注状态,从而与web端接口等效
|
// 所以借用推荐原因是否为“已关注”、“新关注”等判别关注状态,从而与web端接口等效
|
||||||
RegExp regex = RegExp(r'已关注|新关注');
|
isFollowed = rcmdReason != null &&
|
||||||
isFollowed = regex.hasMatch(rcmdReason ?? '') ? 1 : 0;
|
rcmdReason!.content != null &&
|
||||||
|
rcmdReason!.content!.contains('关注')
|
||||||
|
? 1
|
||||||
|
: 0;
|
||||||
// 如果是,就无需再显示推荐原因,交由view统一处理即可
|
// 如果是,就无需再显示推荐原因,交由view统一处理即可
|
||||||
if (isFollowed == 1) {
|
if (isFollowed == 1) {
|
||||||
rcmdReason = null;
|
rcmdReason = null;
|
||||||
}
|
}
|
||||||
goto = json['goto'];
|
goto = json['goto'];
|
||||||
param = int.parse(json['param'] ?? '-1');
|
param = int.parse(json['param']);
|
||||||
uri = json['uri'];
|
uri = json['uri'];
|
||||||
talkBack = json['talk_back'];
|
talkBack = json['talk_back'];
|
||||||
|
|
||||||
|
|||||||
@ -1,126 +0,0 @@
|
|||||||
class LiveFollowingModel {
|
|
||||||
int? count;
|
|
||||||
List<LiveFollowingItemModel>? list;
|
|
||||||
int? liveCount;
|
|
||||||
int? neverLivedCount;
|
|
||||||
List? neverLivedFaces;
|
|
||||||
int? pageSize;
|
|
||||||
String? title;
|
|
||||||
int? totalPage;
|
|
||||||
|
|
||||||
LiveFollowingModel({
|
|
||||||
this.count,
|
|
||||||
this.list,
|
|
||||||
this.liveCount,
|
|
||||||
this.neverLivedCount,
|
|
||||||
this.neverLivedFaces,
|
|
||||||
this.pageSize,
|
|
||||||
this.title,
|
|
||||||
this.totalPage,
|
|
||||||
});
|
|
||||||
|
|
||||||
LiveFollowingModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
count = json['count'];
|
|
||||||
if (json['list'] != null) {
|
|
||||||
list = <LiveFollowingItemModel>[];
|
|
||||||
json['list'].forEach((v) {
|
|
||||||
list!.add(LiveFollowingItemModel.fromJson(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
liveCount = json['live_count'];
|
|
||||||
neverLivedCount = json['never_lived_count'];
|
|
||||||
if (json['never_lived_faces'] != null) {
|
|
||||||
neverLivedFaces = <dynamic>[];
|
|
||||||
json['never_lived_faces'].forEach((v) {
|
|
||||||
neverLivedFaces!.add(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
pageSize = json['pageSize'];
|
|
||||||
title = json['title'];
|
|
||||||
totalPage = json['totalPage'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LiveFollowingItemModel {
|
|
||||||
int? roomId;
|
|
||||||
int? uid;
|
|
||||||
String? uname;
|
|
||||||
String? title;
|
|
||||||
String? face;
|
|
||||||
int? liveStatus;
|
|
||||||
int? recordNum;
|
|
||||||
String? recentRecordId;
|
|
||||||
int? isAttention;
|
|
||||||
int? clipNum;
|
|
||||||
int? fansNum;
|
|
||||||
String? areaName;
|
|
||||||
String? areaValue;
|
|
||||||
String? tags;
|
|
||||||
String? recentRecordIdV2;
|
|
||||||
int? recordNumV2;
|
|
||||||
int? recordLiveTime;
|
|
||||||
String? areaNameV2;
|
|
||||||
String? roomNews;
|
|
||||||
String? watchIcon;
|
|
||||||
String? textSmall;
|
|
||||||
String? roomCover;
|
|
||||||
String? pic;
|
|
||||||
int? parentAreaId;
|
|
||||||
int? areaId;
|
|
||||||
|
|
||||||
LiveFollowingItemModel({
|
|
||||||
this.roomId,
|
|
||||||
this.uid,
|
|
||||||
this.uname,
|
|
||||||
this.title,
|
|
||||||
this.face,
|
|
||||||
this.liveStatus,
|
|
||||||
this.recordNum,
|
|
||||||
this.recentRecordId,
|
|
||||||
this.isAttention,
|
|
||||||
this.clipNum,
|
|
||||||
this.fansNum,
|
|
||||||
this.areaName,
|
|
||||||
this.areaValue,
|
|
||||||
this.tags,
|
|
||||||
this.recentRecordIdV2,
|
|
||||||
this.recordNumV2,
|
|
||||||
this.recordLiveTime,
|
|
||||||
this.areaNameV2,
|
|
||||||
this.roomNews,
|
|
||||||
this.watchIcon,
|
|
||||||
this.textSmall,
|
|
||||||
this.roomCover,
|
|
||||||
this.pic,
|
|
||||||
this.parentAreaId,
|
|
||||||
this.areaId,
|
|
||||||
});
|
|
||||||
|
|
||||||
LiveFollowingItemModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
roomId = json['roomid'];
|
|
||||||
uid = json['uid'];
|
|
||||||
uname = json['uname'];
|
|
||||||
title = json['title'];
|
|
||||||
face = json['face'];
|
|
||||||
liveStatus = json['live_status'];
|
|
||||||
recordNum = json['record_num'];
|
|
||||||
recentRecordId = json['recent_record_id'];
|
|
||||||
isAttention = json['is_attention'];
|
|
||||||
clipNum = json['clipnum'];
|
|
||||||
fansNum = json['fans_num'];
|
|
||||||
areaName = json['area_name'];
|
|
||||||
areaValue = json['area_value'];
|
|
||||||
tags = json['tags'];
|
|
||||||
recentRecordIdV2 = json['recent_record_id_v2'];
|
|
||||||
recordNumV2 = json['record_num_v2'];
|
|
||||||
recordLiveTime = json['record_live_time'];
|
|
||||||
areaNameV2 = json['area_name_v2'];
|
|
||||||
roomNews = json['room_news'];
|
|
||||||
watchIcon = json['watch_icon'];
|
|
||||||
textSmall = json['text_small'];
|
|
||||||
roomCover = json['room_cover'];
|
|
||||||
pic = json['room_cover'];
|
|
||||||
parentAreaId = json['parent_area_id'];
|
|
||||||
areaId = json['area_id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
class LiveMessageModel {
|
|
||||||
// 消息类型
|
|
||||||
final LiveMessageType type;
|
|
||||||
|
|
||||||
// 用户名
|
|
||||||
final String userName;
|
|
||||||
|
|
||||||
// 信息
|
|
||||||
final String? message;
|
|
||||||
|
|
||||||
// 数据
|
|
||||||
final dynamic data;
|
|
||||||
|
|
||||||
final String? face;
|
|
||||||
final int? uid;
|
|
||||||
final Map<String, dynamic>? emots;
|
|
||||||
|
|
||||||
// 颜色
|
|
||||||
final LiveMessageColor color;
|
|
||||||
|
|
||||||
LiveMessageModel({
|
|
||||||
required this.type,
|
|
||||||
required this.userName,
|
|
||||||
required this.message,
|
|
||||||
required this.color,
|
|
||||||
this.data,
|
|
||||||
this.face,
|
|
||||||
this.uid,
|
|
||||||
this.emots,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class LiveSuperChatMessage {
|
|
||||||
final String backgroundBottomColor;
|
|
||||||
final String backgroundColor;
|
|
||||||
final DateTime endTime;
|
|
||||||
final String face;
|
|
||||||
final String message;
|
|
||||||
final String price;
|
|
||||||
final DateTime startTime;
|
|
||||||
final String userName;
|
|
||||||
|
|
||||||
LiveSuperChatMessage({
|
|
||||||
required this.backgroundBottomColor,
|
|
||||||
required this.backgroundColor,
|
|
||||||
required this.endTime,
|
|
||||||
required this.face,
|
|
||||||
required this.message,
|
|
||||||
required this.price,
|
|
||||||
required this.startTime,
|
|
||||||
required this.userName,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
enum LiveMessageType {
|
|
||||||
// 普通留言
|
|
||||||
chat,
|
|
||||||
// 醒目留言
|
|
||||||
superChat,
|
|
||||||
//
|
|
||||||
online,
|
|
||||||
// 加入
|
|
||||||
join,
|
|
||||||
// 关注
|
|
||||||
follow,
|
|
||||||
}
|
|
||||||
|
|
||||||
class LiveMessageColor {
|
|
||||||
final int r, g, b;
|
|
||||||
LiveMessageColor(this.r, this.g, this.b);
|
|
||||||
static LiveMessageColor get white => LiveMessageColor(255, 255, 255);
|
|
||||||
static LiveMessageColor numberToColor(int intColor) {
|
|
||||||
var obj = intColor.toRadixString(16);
|
|
||||||
|
|
||||||
LiveMessageColor color = LiveMessageColor.white;
|
|
||||||
if (obj.length == 4) {
|
|
||||||
obj = "00$obj";
|
|
||||||
}
|
|
||||||
if (obj.length == 6) {
|
|
||||||
var R = int.parse(obj.substring(0, 2), radix: 16);
|
|
||||||
var G = int.parse(obj.substring(2, 4), radix: 16);
|
|
||||||
var B = int.parse(obj.substring(4, 6), radix: 16);
|
|
||||||
|
|
||||||
color = LiveMessageColor(R, G, B);
|
|
||||||
}
|
|
||||||
if (obj.length == 8) {
|
|
||||||
var R = int.parse(obj.substring(2, 4), radix: 16);
|
|
||||||
var G = int.parse(obj.substring(4, 6), radix: 16);
|
|
||||||
var B = int.parse(obj.substring(6, 8), radix: 16);
|
|
||||||
//var A = int.parse(obj.substring(0, 2), radix: 16);
|
|
||||||
color = LiveMessageColor(R, G, B);
|
|
||||||
}
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return "#${r.toRadixString(16).padLeft(2, '0')}${g.toRadixString(16).padLeft(2, '0')}${b.toRadixString(16).padLeft(2, '0')}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +1,11 @@
|
|||||||
class RoomInfoModel {
|
class RoomInfoModel {
|
||||||
RoomInfoModel({
|
RoomInfoModel({
|
||||||
this.roomId,
|
this.roomId,
|
||||||
this.isPortrait,
|
|
||||||
this.liveStatus,
|
this.liveStatus,
|
||||||
this.liveTime,
|
this.liveTime,
|
||||||
this.playurlInfo,
|
this.playurlInfo,
|
||||||
});
|
});
|
||||||
int? roomId;
|
int? roomId;
|
||||||
bool? isPortrait;
|
|
||||||
int? liveStatus;
|
int? liveStatus;
|
||||||
int? liveTime;
|
int? liveTime;
|
||||||
PlayurlInfo? playurlInfo;
|
PlayurlInfo? playurlInfo;
|
||||||
@ -15,7 +13,6 @@ class RoomInfoModel {
|
|||||||
RoomInfoModel.fromJson(Map<String, dynamic> json) {
|
RoomInfoModel.fromJson(Map<String, dynamic> json) {
|
||||||
roomId = json['room_id'];
|
roomId = json['room_id'];
|
||||||
liveStatus = json['live_status'];
|
liveStatus = json['live_status'];
|
||||||
isPortrait = json['is_portrait'];
|
|
||||||
liveTime = json['live_time'];
|
liveTime = json['live_time'];
|
||||||
playurlInfo = PlayurlInfo.fromJson(json['playurl_info']);
|
playurlInfo = PlayurlInfo.fromJson(json['playurl_info']);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,46 +0,0 @@
|
|||||||
class MemberArticleDataModel {
|
|
||||||
MemberArticleDataModel({
|
|
||||||
this.hasMore,
|
|
||||||
this.items,
|
|
||||||
this.offset,
|
|
||||||
this.updateNum,
|
|
||||||
});
|
|
||||||
|
|
||||||
bool? hasMore;
|
|
||||||
List<MemberArticleItemModel>? items;
|
|
||||||
String? offset;
|
|
||||||
int? updateNum;
|
|
||||||
|
|
||||||
MemberArticleDataModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
hasMore = json['has_more'];
|
|
||||||
items = json['items']
|
|
||||||
.map<MemberArticleItemModel>((e) => MemberArticleItemModel.fromJson(e))
|
|
||||||
.toList();
|
|
||||||
offset = json['offset'];
|
|
||||||
updateNum = json['update_num'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MemberArticleItemModel {
|
|
||||||
MemberArticleItemModel({
|
|
||||||
this.content,
|
|
||||||
this.cover,
|
|
||||||
this.jumpUrl,
|
|
||||||
this.opusId,
|
|
||||||
this.stat,
|
|
||||||
});
|
|
||||||
|
|
||||||
String? content;
|
|
||||||
Map? cover;
|
|
||||||
String? jumpUrl;
|
|
||||||
String? opusId;
|
|
||||||
Map? stat;
|
|
||||||
|
|
||||||
MemberArticleItemModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
content = json['content'];
|
|
||||||
cover = json['cover'];
|
|
||||||
jumpUrl = json['jump_url'];
|
|
||||||
opusId = json['opus_id'];
|
|
||||||
stat = json['stat'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -47,23 +47,18 @@ class Vip {
|
|||||||
this.status,
|
this.status,
|
||||||
this.dueDate,
|
this.dueDate,
|
||||||
this.label,
|
this.label,
|
||||||
this.nicknameColor,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
int? type;
|
int? type;
|
||||||
int? status;
|
int? status;
|
||||||
int? dueDate;
|
int? dueDate;
|
||||||
Map? label;
|
Map? label;
|
||||||
int? nicknameColor;
|
|
||||||
|
|
||||||
Vip.fromJson(Map<String, dynamic> json) {
|
Vip.fromJson(Map<String, dynamic> json) {
|
||||||
type = json['type'];
|
type = json['type'];
|
||||||
status = json['status'];
|
status = json['status'];
|
||||||
dueDate = json['due_date'];
|
dueDate = json['due_date'];
|
||||||
label = json['label'];
|
label = json['label'];
|
||||||
nicknameColor = json['nickname_color'] == ''
|
|
||||||
? null
|
|
||||||
: int.parse("0xFF${json['nickname_color'].replaceAll('#', '')}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,210 +0,0 @@
|
|||||||
class MemberLikeDataModel {
|
|
||||||
MemberLikeDataModel({
|
|
||||||
this.aid,
|
|
||||||
this.videos,
|
|
||||||
this.tid,
|
|
||||||
this.tname,
|
|
||||||
this.pic,
|
|
||||||
this.title,
|
|
||||||
this.pubdate,
|
|
||||||
this.ctime,
|
|
||||||
this.desc,
|
|
||||||
this.state,
|
|
||||||
this.duration,
|
|
||||||
this.redirectUrl,
|
|
||||||
this.rights,
|
|
||||||
this.owner,
|
|
||||||
this.stat,
|
|
||||||
this.dimension,
|
|
||||||
this.cover43,
|
|
||||||
this.bvid,
|
|
||||||
this.interVideo,
|
|
||||||
this.resourceType,
|
|
||||||
this.subtitle,
|
|
||||||
this.enableVt,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int? aid;
|
|
||||||
final int? videos;
|
|
||||||
final int? tid;
|
|
||||||
final String? tname;
|
|
||||||
final String? pic;
|
|
||||||
final String? title;
|
|
||||||
final int? pubdate;
|
|
||||||
final int? ctime;
|
|
||||||
final String? desc;
|
|
||||||
final int? state;
|
|
||||||
final int? duration;
|
|
||||||
final String? redirectUrl;
|
|
||||||
final Rights? rights;
|
|
||||||
final Owner? owner;
|
|
||||||
final Stat? stat;
|
|
||||||
final Dimension? dimension;
|
|
||||||
final String? cover43;
|
|
||||||
final String? bvid;
|
|
||||||
final bool? interVideo;
|
|
||||||
final String? resourceType;
|
|
||||||
final String? subtitle;
|
|
||||||
final int? enableVt;
|
|
||||||
|
|
||||||
factory MemberLikeDataModel.fromJson(Map<String, dynamic> json) =>
|
|
||||||
MemberLikeDataModel(
|
|
||||||
aid: json["aid"],
|
|
||||||
videos: json["videos"],
|
|
||||||
tid: json["tid"],
|
|
||||||
tname: json["tname"],
|
|
||||||
pic: json["pic"],
|
|
||||||
title: json["title"],
|
|
||||||
pubdate: json["pubdate"],
|
|
||||||
ctime: json["ctime"],
|
|
||||||
desc: json["desc"],
|
|
||||||
state: json["state"],
|
|
||||||
duration: json["duration"],
|
|
||||||
redirectUrl: json["redirect_url"],
|
|
||||||
rights: Rights.fromJson(json["rights"]),
|
|
||||||
owner: Owner.fromJson(json["owner"]),
|
|
||||||
stat: Stat.fromJson(json["stat"]),
|
|
||||||
dimension: Dimension.fromJson(json["dimension"]),
|
|
||||||
cover43: json["cover43"],
|
|
||||||
bvid: json["bvid"],
|
|
||||||
interVideo: json["inter_video"],
|
|
||||||
resourceType: json["resource_type"],
|
|
||||||
subtitle: json["subtitle"],
|
|
||||||
enableVt: json["enable_vt"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Dimension {
|
|
||||||
Dimension({
|
|
||||||
required this.width,
|
|
||||||
required this.height,
|
|
||||||
required this.rotate,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int width;
|
|
||||||
final int height;
|
|
||||||
final int rotate;
|
|
||||||
|
|
||||||
factory Dimension.fromJson(Map<String, dynamic> json) => Dimension(
|
|
||||||
width: json["width"],
|
|
||||||
height: json["height"],
|
|
||||||
rotate: json["rotate"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Owner {
|
|
||||||
Owner({
|
|
||||||
required this.mid,
|
|
||||||
required this.name,
|
|
||||||
required this.face,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int mid;
|
|
||||||
final String name;
|
|
||||||
final String face;
|
|
||||||
|
|
||||||
factory Owner.fromJson(Map<String, dynamic> json) => Owner(
|
|
||||||
mid: json["mid"],
|
|
||||||
name: json["name"],
|
|
||||||
face: json["face"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Rights {
|
|
||||||
Rights({
|
|
||||||
required this.bp,
|
|
||||||
required this.elec,
|
|
||||||
required this.download,
|
|
||||||
required this.movie,
|
|
||||||
required this.pay,
|
|
||||||
required this.hd5,
|
|
||||||
required this.noReprint,
|
|
||||||
required this.autoplay,
|
|
||||||
required this.ugcPay,
|
|
||||||
required this.isCooperation,
|
|
||||||
required this.ugcPayPreview,
|
|
||||||
required this.noBackground,
|
|
||||||
required this.arcPay,
|
|
||||||
required this.payFreeWatch,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int bp;
|
|
||||||
final int elec;
|
|
||||||
final int download;
|
|
||||||
final int movie;
|
|
||||||
final int pay;
|
|
||||||
final int hd5;
|
|
||||||
final int noReprint;
|
|
||||||
final int autoplay;
|
|
||||||
final int ugcPay;
|
|
||||||
final int isCooperation;
|
|
||||||
final int ugcPayPreview;
|
|
||||||
final int noBackground;
|
|
||||||
final int arcPay;
|
|
||||||
final int payFreeWatch;
|
|
||||||
|
|
||||||
factory Rights.fromJson(Map<String, dynamic> json) => Rights(
|
|
||||||
bp: json["bp"],
|
|
||||||
elec: json["elec"],
|
|
||||||
download: json["download"],
|
|
||||||
movie: json["movie"],
|
|
||||||
pay: json["pay"],
|
|
||||||
hd5: json["hd5"],
|
|
||||||
noReprint: json["no_reprint"],
|
|
||||||
autoplay: json["autoplay"],
|
|
||||||
ugcPay: json["ugc_pay"],
|
|
||||||
isCooperation: json["is_cooperation"],
|
|
||||||
ugcPayPreview: json["ugc_pay_preview"],
|
|
||||||
noBackground: json["no_background"],
|
|
||||||
arcPay: json["arc_pay"],
|
|
||||||
payFreeWatch: json["pay_free_watch"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Stat {
|
|
||||||
Stat({
|
|
||||||
required this.aid,
|
|
||||||
required this.view,
|
|
||||||
required this.danmaku,
|
|
||||||
required this.reply,
|
|
||||||
required this.favorite,
|
|
||||||
required this.coin,
|
|
||||||
required this.share,
|
|
||||||
required this.nowRank,
|
|
||||||
required this.hisRank,
|
|
||||||
required this.like,
|
|
||||||
required this.dislike,
|
|
||||||
required this.vt,
|
|
||||||
required this.vv,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int aid;
|
|
||||||
final int view;
|
|
||||||
final int danmaku;
|
|
||||||
final int reply;
|
|
||||||
final int favorite;
|
|
||||||
final int coin;
|
|
||||||
final int share;
|
|
||||||
final int nowRank;
|
|
||||||
final int hisRank;
|
|
||||||
final int like;
|
|
||||||
final int dislike;
|
|
||||||
final int vt;
|
|
||||||
final int vv;
|
|
||||||
|
|
||||||
factory Stat.fromJson(Map<String, dynamic> json) => Stat(
|
|
||||||
aid: json["aid"],
|
|
||||||
view: json["view"],
|
|
||||||
danmaku: json["danmaku"],
|
|
||||||
reply: json["reply"],
|
|
||||||
favorite: json["favorite"],
|
|
||||||
coin: json["coin"],
|
|
||||||
share: json["share"],
|
|
||||||
nowRank: json["now_rank"],
|
|
||||||
hisRank: json["his_rank"],
|
|
||||||
like: json["like"],
|
|
||||||
dislike: json["dislike"],
|
|
||||||
vt: json["vt"],
|
|
||||||
vv: json["vv"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -2,32 +2,18 @@ class MemberSeasonsDataModel {
|
|||||||
MemberSeasonsDataModel({
|
MemberSeasonsDataModel({
|
||||||
this.page,
|
this.page,
|
||||||
this.seasonsList,
|
this.seasonsList,
|
||||||
this.seriesList,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Map? page;
|
Map? page;
|
||||||
List<MemberSeasonsList>? seasonsList;
|
List<MemberSeasonsList>? seasonsList;
|
||||||
List<MemberArchiveItem>? seriesList;
|
|
||||||
|
|
||||||
MemberSeasonsDataModel.fromJson(Map<String, dynamic> json) {
|
MemberSeasonsDataModel.fromJson(Map<String, dynamic> json) {
|
||||||
page = json['page'];
|
page = json['page'];
|
||||||
var tempList1 = json['seasons_list'] != null
|
seasonsList = json['seasons_list'] != null
|
||||||
? json['seasons_list']
|
? json['seasons_list']
|
||||||
.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
|
.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
|
||||||
.toList()
|
.toList()
|
||||||
: [];
|
: [];
|
||||||
var tempList2 = json['series_list'] != null
|
|
||||||
? json['series_list']
|
|
||||||
.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
|
|
||||||
.toList()
|
|
||||||
: [];
|
|
||||||
seriesList = json['archives'] != null
|
|
||||||
? json['archives']
|
|
||||||
.map<MemberArchiveItem>((e) => MemberArchiveItem.fromJson(e))
|
|
||||||
.toList()
|
|
||||||
: [];
|
|
||||||
|
|
||||||
seasonsList = [...tempList1, ...tempList2];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,8 +86,6 @@ class MamberMeta {
|
|||||||
this.ptime,
|
this.ptime,
|
||||||
this.seasonId,
|
this.seasonId,
|
||||||
this.total,
|
this.total,
|
||||||
this.seriesId,
|
|
||||||
this.category,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
String? cover;
|
String? cover;
|
||||||
@ -111,8 +95,6 @@ class MamberMeta {
|
|||||||
int? ptime;
|
int? ptime;
|
||||||
int? seasonId;
|
int? seasonId;
|
||||||
int? total;
|
int? total;
|
||||||
int? seriesId;
|
|
||||||
int? category;
|
|
||||||
|
|
||||||
MamberMeta.fromJson(Map<String, dynamic> json) {
|
MamberMeta.fromJson(Map<String, dynamic> json) {
|
||||||
cover = json['cover'];
|
cover = json['cover'];
|
||||||
@ -122,7 +104,5 @@ class MamberMeta {
|
|||||||
ptime = json['ptime'];
|
ptime = json['ptime'];
|
||||||
seasonId = json['season_id'];
|
seasonId = json['season_id'];
|
||||||
total = json['total'];
|
total = json['total'];
|
||||||
seriesId = json['series_id'];
|
|
||||||
category = json['category'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,6 @@ class HotVideoItemModel {
|
|||||||
this.dimension,
|
this.dimension,
|
||||||
this.shortLinkV2,
|
this.shortLinkV2,
|
||||||
this.firstFrame,
|
this.firstFrame,
|
||||||
this.cover,
|
|
||||||
this.pubLocation,
|
this.pubLocation,
|
||||||
this.seasontype,
|
this.seasontype,
|
||||||
this.isOgv,
|
this.isOgv,
|
||||||
@ -51,7 +50,6 @@ class HotVideoItemModel {
|
|||||||
Dimension? dimension;
|
Dimension? dimension;
|
||||||
String? shortLinkV2;
|
String? shortLinkV2;
|
||||||
String? firstFrame;
|
String? firstFrame;
|
||||||
String? cover;
|
|
||||||
String? pubLocation;
|
String? pubLocation;
|
||||||
int? seasontype;
|
int? seasontype;
|
||||||
bool? isOgv;
|
bool? isOgv;
|
||||||
@ -79,7 +77,6 @@ class HotVideoItemModel {
|
|||||||
dimension = Dimension.fromMap(json['dimension']);
|
dimension = Dimension.fromMap(json['dimension']);
|
||||||
shortLinkV2 = json["short_link_v2"];
|
shortLinkV2 = json["short_link_v2"];
|
||||||
firstFrame = json["first_frame"];
|
firstFrame = json["first_frame"];
|
||||||
cover = json["first_frame"];
|
|
||||||
pubLocation = json["pub_location"];
|
pubLocation = json["pub_location"];
|
||||||
seasontype = json["seasontype"];
|
seasontype = json["seasontype"];
|
||||||
isOgv = json["isOgv"];
|
isOgv = json["isOgv"];
|
||||||
|
|||||||
@ -1,12 +1,19 @@
|
|||||||
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
|
part 'model_owner.g.dart';
|
||||||
|
|
||||||
|
@HiveType(typeId: 3)
|
||||||
class Owner {
|
class Owner {
|
||||||
Owner({
|
Owner({
|
||||||
this.mid,
|
this.mid,
|
||||||
this.name,
|
this.name,
|
||||||
this.face,
|
this.face,
|
||||||
});
|
});
|
||||||
|
@HiveField(0)
|
||||||
int? mid;
|
int? mid;
|
||||||
|
@HiveField(1)
|
||||||
String? name;
|
String? name;
|
||||||
|
@HiveField(2)
|
||||||
String? face;
|
String? face;
|
||||||
|
|
||||||
Owner.fromJson(Map<String, dynamic> json) {
|
Owner.fromJson(Map<String, dynamic> json) {
|
||||||
|
|||||||
47
lib/models/model_owner.g.dart
Normal file
47
lib/models/model_owner.g.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'model_owner.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class OwnerAdapter extends TypeAdapter<Owner> {
|
||||||
|
@override
|
||||||
|
final int typeId = 3;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Owner read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return Owner(
|
||||||
|
mid: fields[0] as int?,
|
||||||
|
name: fields[1] as String?,
|
||||||
|
face: fields[2] as String?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, Owner obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(3)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.mid)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.name)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.face);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is OwnerAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
@ -1,5 +1,9 @@
|
|||||||
import './model_owner.dart';
|
import './model_owner.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
|
part 'model_rec_video_item.g.dart';
|
||||||
|
|
||||||
|
@HiveType(typeId: 0)
|
||||||
class RecVideoItemModel {
|
class RecVideoItemModel {
|
||||||
RecVideoItemModel({
|
RecVideoItemModel({
|
||||||
this.id,
|
this.id,
|
||||||
@ -17,19 +21,32 @@ class RecVideoItemModel {
|
|||||||
this.rcmdReason,
|
this.rcmdReason,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@HiveField(0)
|
||||||
int? id = -1;
|
int? id = -1;
|
||||||
|
@HiveField(1)
|
||||||
String? bvid = '';
|
String? bvid = '';
|
||||||
|
@HiveField(2)
|
||||||
int? cid = -1;
|
int? cid = -1;
|
||||||
|
@HiveField(3)
|
||||||
String? goto = '';
|
String? goto = '';
|
||||||
|
@HiveField(4)
|
||||||
String? uri = '';
|
String? uri = '';
|
||||||
|
@HiveField(5)
|
||||||
String? pic = '';
|
String? pic = '';
|
||||||
|
@HiveField(6)
|
||||||
String? title = '';
|
String? title = '';
|
||||||
|
@HiveField(7)
|
||||||
int? duration = -1;
|
int? duration = -1;
|
||||||
|
@HiveField(8)
|
||||||
int? pubdate = -1;
|
int? pubdate = -1;
|
||||||
|
@HiveField(9)
|
||||||
Owner? owner;
|
Owner? owner;
|
||||||
|
@HiveField(10)
|
||||||
Stat? stat;
|
Stat? stat;
|
||||||
|
@HiveField(11)
|
||||||
int? isFollowed;
|
int? isFollowed;
|
||||||
String? rcmdReason;
|
@HiveField(12)
|
||||||
|
RcmdReason? rcmdReason;
|
||||||
|
|
||||||
RecVideoItemModel.fromJson(Map<String, dynamic> json) {
|
RecVideoItemModel.fromJson(Map<String, dynamic> json) {
|
||||||
id = json["id"];
|
id = json["id"];
|
||||||
@ -44,20 +61,26 @@ class RecVideoItemModel {
|
|||||||
owner = Owner.fromJson(json["owner"]);
|
owner = Owner.fromJson(json["owner"]);
|
||||||
stat = Stat.fromJson(json["stat"]);
|
stat = Stat.fromJson(json["stat"]);
|
||||||
isFollowed = json["is_followed"] ?? 0;
|
isFollowed = json["is_followed"] ?? 0;
|
||||||
rcmdReason = json["rcmd_reason"]?['content'];
|
rcmdReason = json["rcmd_reason"] != null
|
||||||
|
? RcmdReason.fromJson(json["rcmd_reason"])
|
||||||
|
: RcmdReason(content: '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HiveType(typeId: 1)
|
||||||
class Stat {
|
class Stat {
|
||||||
Stat({
|
Stat({
|
||||||
this.view,
|
this.view,
|
||||||
this.like,
|
this.like,
|
||||||
this.danmu,
|
this.danmu,
|
||||||
});
|
});
|
||||||
|
@HiveField(0)
|
||||||
int? view;
|
int? view;
|
||||||
|
@HiveField(1)
|
||||||
int? like;
|
int? like;
|
||||||
|
@HiveField(2)
|
||||||
int? danmu;
|
int? danmu;
|
||||||
|
|
||||||
Stat.fromJson(Map<String, dynamic> json) {
|
Stat.fromJson(Map<String, dynamic> json) {
|
||||||
// 无需在model中转换以保留原始数据,在view层处理即可
|
// 无需在model中转换以保留原始数据,在view层处理即可
|
||||||
view = json["view"];
|
view = json["view"];
|
||||||
@ -65,3 +88,20 @@ class Stat {
|
|||||||
danmu = json['danmaku'];
|
danmu = json['danmaku'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HiveType(typeId: 2)
|
||||||
|
class RcmdReason {
|
||||||
|
RcmdReason({
|
||||||
|
this.reasonType,
|
||||||
|
this.content,
|
||||||
|
});
|
||||||
|
@HiveField(0)
|
||||||
|
int? reasonType;
|
||||||
|
@HiveField(1)
|
||||||
|
String? content = '';
|
||||||
|
|
||||||
|
RcmdReason.fromJson(Map<String, dynamic> json) {
|
||||||
|
reasonType = json["reason_type"];
|
||||||
|
content = json["content"] ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
154
lib/models/model_rec_video_item.g.dart
Normal file
154
lib/models/model_rec_video_item.g.dart
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'model_rec_video_item.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class RecVideoItemModelAdapter extends TypeAdapter<RecVideoItemModel> {
|
||||||
|
@override
|
||||||
|
final int typeId = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
RecVideoItemModel read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return RecVideoItemModel(
|
||||||
|
id: fields[0] as int?,
|
||||||
|
bvid: fields[1] as String?,
|
||||||
|
cid: fields[2] as int?,
|
||||||
|
goto: fields[3] as String?,
|
||||||
|
uri: fields[4] as String?,
|
||||||
|
pic: fields[5] as String?,
|
||||||
|
title: fields[6] as String?,
|
||||||
|
duration: fields[7] as int?,
|
||||||
|
pubdate: fields[8] as int?,
|
||||||
|
owner: fields[9] as Owner?,
|
||||||
|
stat: fields[10] as Stat?,
|
||||||
|
isFollowed: fields[11] as int?,
|
||||||
|
rcmdReason: fields[12] as RcmdReason?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, RecVideoItemModel obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(13)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.id)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.bvid)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.cid)
|
||||||
|
..writeByte(3)
|
||||||
|
..write(obj.goto)
|
||||||
|
..writeByte(4)
|
||||||
|
..write(obj.uri)
|
||||||
|
..writeByte(5)
|
||||||
|
..write(obj.pic)
|
||||||
|
..writeByte(6)
|
||||||
|
..write(obj.title)
|
||||||
|
..writeByte(7)
|
||||||
|
..write(obj.duration)
|
||||||
|
..writeByte(8)
|
||||||
|
..write(obj.pubdate)
|
||||||
|
..writeByte(9)
|
||||||
|
..write(obj.owner)
|
||||||
|
..writeByte(10)
|
||||||
|
..write(obj.stat)
|
||||||
|
..writeByte(11)
|
||||||
|
..write(obj.isFollowed)
|
||||||
|
..writeByte(12)
|
||||||
|
..write(obj.rcmdReason);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is RecVideoItemModelAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
class StatAdapter extends TypeAdapter<Stat> {
|
||||||
|
@override
|
||||||
|
final int typeId = 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Stat read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return Stat(
|
||||||
|
view: fields[0] as int?,
|
||||||
|
like: fields[1] as int?,
|
||||||
|
danmu: fields[2] as int?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, Stat obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(3)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.view)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.like)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.danmu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is StatAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RcmdReasonAdapter extends TypeAdapter<RcmdReason> {
|
||||||
|
@override
|
||||||
|
final int typeId = 2;
|
||||||
|
|
||||||
|
@override
|
||||||
|
RcmdReason read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return RcmdReason(
|
||||||
|
reasonType: fields[0] as int?,
|
||||||
|
content: fields[1] as String?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, RcmdReason obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(2)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.reasonType)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.content);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is RcmdReasonAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
@ -1,183 +0,0 @@
|
|||||||
class MessageLikeModel {
|
|
||||||
MessageLikeModel({
|
|
||||||
this.latest,
|
|
||||||
this.total,
|
|
||||||
});
|
|
||||||
|
|
||||||
Latest? latest;
|
|
||||||
Total? total;
|
|
||||||
|
|
||||||
factory MessageLikeModel.fromJson(Map<String, dynamic> json) =>
|
|
||||||
MessageLikeModel(
|
|
||||||
latest: json["latest"] == null ? null : Latest.fromJson(json["latest"]),
|
|
||||||
total: json["total"] == null ? null : Total.fromJson(json["total"]),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Latest {
|
|
||||||
Latest({
|
|
||||||
this.items,
|
|
||||||
this.lastViewAt,
|
|
||||||
});
|
|
||||||
|
|
||||||
List? items;
|
|
||||||
int? lastViewAt;
|
|
||||||
|
|
||||||
factory Latest.fromJson(Map<String, dynamic> json) => Latest(
|
|
||||||
items: json["items"],
|
|
||||||
lastViewAt: json["last_view_at"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Total {
|
|
||||||
Total({
|
|
||||||
this.cursor,
|
|
||||||
this.items,
|
|
||||||
});
|
|
||||||
|
|
||||||
Cursor? cursor;
|
|
||||||
List<MessageLikeItem>? items;
|
|
||||||
|
|
||||||
factory Total.fromJson(Map<String, dynamic> json) => Total(
|
|
||||||
cursor: Cursor.fromJson(json['cursor']),
|
|
||||||
items: json["items"] == null
|
|
||||||
? []
|
|
||||||
: json["items"].map<MessageLikeItem>((e) {
|
|
||||||
return MessageLikeItem.fromJson(e);
|
|
||||||
}).toList(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Cursor {
|
|
||||||
Cursor({
|
|
||||||
this.id,
|
|
||||||
this.isEnd,
|
|
||||||
this.time,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? id;
|
|
||||||
bool? isEnd;
|
|
||||||
int? time;
|
|
||||||
|
|
||||||
factory Cursor.fromJson(Map<String, dynamic> json) => Cursor(
|
|
||||||
id: json['id'],
|
|
||||||
isEnd: json['is_end'],
|
|
||||||
time: json['time'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class MessageLikeItem {
|
|
||||||
MessageLikeItem({
|
|
||||||
this.id,
|
|
||||||
this.users,
|
|
||||||
this.item,
|
|
||||||
this.counts,
|
|
||||||
this.likeTime,
|
|
||||||
this.noticeState,
|
|
||||||
this.isExpand = false,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? id;
|
|
||||||
List<MessageLikeUser>? users;
|
|
||||||
MessageLikeItemItem? item;
|
|
||||||
int? counts;
|
|
||||||
int? likeTime;
|
|
||||||
int? noticeState;
|
|
||||||
bool isExpand;
|
|
||||||
|
|
||||||
factory MessageLikeItem.fromJson(Map<String, dynamic> json) =>
|
|
||||||
MessageLikeItem(
|
|
||||||
id: json["id"],
|
|
||||||
users: json["users"] == null
|
|
||||||
? []
|
|
||||||
: json["users"].map<MessageLikeUser>((e) {
|
|
||||||
return MessageLikeUser.fromJson(e);
|
|
||||||
}).toList(),
|
|
||||||
item: json["item"] == null
|
|
||||||
? null
|
|
||||||
: MessageLikeItemItem.fromJson(json["item"]),
|
|
||||||
counts: json["counts"],
|
|
||||||
likeTime: json["like_time"],
|
|
||||||
noticeState: json["notice_state"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class MessageLikeUser {
|
|
||||||
MessageLikeUser({
|
|
||||||
this.mid,
|
|
||||||
this.fans,
|
|
||||||
this.nickname,
|
|
||||||
this.avatar,
|
|
||||||
this.midLink,
|
|
||||||
this.follow,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? mid;
|
|
||||||
int? fans;
|
|
||||||
String? nickname;
|
|
||||||
String? avatar;
|
|
||||||
String? midLink;
|
|
||||||
bool? follow;
|
|
||||||
|
|
||||||
factory MessageLikeUser.fromJson(Map<String, dynamic> json) =>
|
|
||||||
MessageLikeUser(
|
|
||||||
mid: json["mid"],
|
|
||||||
fans: json["fans"],
|
|
||||||
nickname: json["nickname"],
|
|
||||||
avatar: json["avatar"],
|
|
||||||
midLink: json["mid_link"],
|
|
||||||
follow: json["follow"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class MessageLikeItemItem {
|
|
||||||
MessageLikeItemItem({
|
|
||||||
this.itemId,
|
|
||||||
this.pid,
|
|
||||||
this.type,
|
|
||||||
this.business,
|
|
||||||
this.businessId,
|
|
||||||
this.replyBusinessId,
|
|
||||||
this.likeBusinessId,
|
|
||||||
this.title,
|
|
||||||
this.desc,
|
|
||||||
this.image,
|
|
||||||
this.uri,
|
|
||||||
this.detailName,
|
|
||||||
this.nativeUri,
|
|
||||||
this.ctime,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? itemId;
|
|
||||||
int? pid;
|
|
||||||
String? type;
|
|
||||||
String? business;
|
|
||||||
int? businessId;
|
|
||||||
int? replyBusinessId;
|
|
||||||
int? likeBusinessId;
|
|
||||||
String? title;
|
|
||||||
String? desc;
|
|
||||||
String? image;
|
|
||||||
String? uri;
|
|
||||||
String? detailName;
|
|
||||||
String? nativeUri;
|
|
||||||
int? ctime;
|
|
||||||
|
|
||||||
factory MessageLikeItemItem.fromJson(Map<String, dynamic> json) =>
|
|
||||||
MessageLikeItemItem(
|
|
||||||
itemId: json["item_id"],
|
|
||||||
pid: json["pid"],
|
|
||||||
type: json["type"],
|
|
||||||
business: json["business"],
|
|
||||||
businessId: json["business_id"],
|
|
||||||
replyBusinessId: json["reply_business_id"],
|
|
||||||
likeBusinessId: json["like_business_id"],
|
|
||||||
title: json["title"],
|
|
||||||
desc: json["desc"],
|
|
||||||
image: json["image"],
|
|
||||||
uri: json["uri"],
|
|
||||||
detailName: json["detail_name"],
|
|
||||||
nativeUri: json["native_uri"],
|
|
||||||
ctime: json["ctime"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,168 +0,0 @@
|
|||||||
class MessageReplyModel {
|
|
||||||
MessageReplyModel({
|
|
||||||
this.cursor,
|
|
||||||
this.items,
|
|
||||||
});
|
|
||||||
|
|
||||||
Cursor? cursor;
|
|
||||||
List<MessageReplyItem>? items;
|
|
||||||
|
|
||||||
MessageReplyModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
cursor = Cursor.fromJson(json['cursor']);
|
|
||||||
items = json["items"] != null
|
|
||||||
? json["items"].map<MessageReplyItem>((e) {
|
|
||||||
return MessageReplyItem.fromJson(e);
|
|
||||||
}).toList()
|
|
||||||
: [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Cursor {
|
|
||||||
Cursor({
|
|
||||||
this.id,
|
|
||||||
this.isEnd,
|
|
||||||
this.time,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? id;
|
|
||||||
bool? isEnd;
|
|
||||||
int? time;
|
|
||||||
|
|
||||||
Cursor.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
isEnd = json['is_end'];
|
|
||||||
time = json['time'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MessageReplyItem {
|
|
||||||
MessageReplyItem({
|
|
||||||
this.count,
|
|
||||||
this.id,
|
|
||||||
this.isMulti,
|
|
||||||
this.item,
|
|
||||||
this.replyTime,
|
|
||||||
this.user,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? count;
|
|
||||||
int? id;
|
|
||||||
int? isMulti;
|
|
||||||
ReplyContentItem? item;
|
|
||||||
int? replyTime;
|
|
||||||
ReplyUser? user;
|
|
||||||
|
|
||||||
MessageReplyItem.fromJson(Map<String, dynamic> json) {
|
|
||||||
count = json['count'];
|
|
||||||
id = json['id'];
|
|
||||||
isMulti = json['is_multi'];
|
|
||||||
item = ReplyContentItem.fromJson(json["item"]);
|
|
||||||
replyTime = json['reply_time'];
|
|
||||||
user = ReplyUser.fromJson(json['user']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ReplyContentItem {
|
|
||||||
ReplyContentItem({
|
|
||||||
this.subjectId,
|
|
||||||
this.rootId,
|
|
||||||
this.sourceId,
|
|
||||||
this.targetId,
|
|
||||||
this.type,
|
|
||||||
this.businessId,
|
|
||||||
this.business,
|
|
||||||
this.title,
|
|
||||||
this.desc,
|
|
||||||
this.image,
|
|
||||||
this.uri,
|
|
||||||
this.nativeUri,
|
|
||||||
this.detailTitle,
|
|
||||||
this.rootReplyContent,
|
|
||||||
this.sourceContent,
|
|
||||||
this.targetReplyContent,
|
|
||||||
this.atDetails,
|
|
||||||
this.topicDetails,
|
|
||||||
this.hideReplyButton,
|
|
||||||
this.hideLikeButton,
|
|
||||||
this.likeState,
|
|
||||||
this.danmu,
|
|
||||||
this.message,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? subjectId;
|
|
||||||
int? rootId;
|
|
||||||
int? sourceId;
|
|
||||||
int? targetId;
|
|
||||||
String? type;
|
|
||||||
int? businessId;
|
|
||||||
String? business;
|
|
||||||
String? title;
|
|
||||||
String? desc;
|
|
||||||
String? image;
|
|
||||||
String? uri;
|
|
||||||
String? nativeUri;
|
|
||||||
String? detailTitle;
|
|
||||||
String? rootReplyContent;
|
|
||||||
String? sourceContent;
|
|
||||||
String? targetReplyContent;
|
|
||||||
List? atDetails;
|
|
||||||
List? topicDetails;
|
|
||||||
bool? hideReplyButton;
|
|
||||||
bool? hideLikeButton;
|
|
||||||
int? likeState;
|
|
||||||
String? danmu;
|
|
||||||
String? message;
|
|
||||||
|
|
||||||
ReplyContentItem.fromJson(Map<String, dynamic> json) {
|
|
||||||
subjectId = json['subject_id'];
|
|
||||||
rootId = json['root_id'];
|
|
||||||
sourceId = json['source_id'];
|
|
||||||
targetId = json['target_id'];
|
|
||||||
type = json['type'];
|
|
||||||
businessId = json['business_id'];
|
|
||||||
business = json['business'];
|
|
||||||
title = json['title'];
|
|
||||||
desc = json['desc'];
|
|
||||||
image = json['image'];
|
|
||||||
uri = json['uri'];
|
|
||||||
nativeUri = json['native_uri'];
|
|
||||||
detailTitle = json['detail_title'];
|
|
||||||
rootReplyContent = json['root_reply_content'];
|
|
||||||
sourceContent = json['source_content'];
|
|
||||||
targetReplyContent = json['target_reply_content'];
|
|
||||||
atDetails = json['at_details'];
|
|
||||||
topicDetails = json['topic_details'];
|
|
||||||
hideReplyButton = json['hide_reply_button'];
|
|
||||||
hideLikeButton = json['hide_like_button'];
|
|
||||||
likeState = json['like_state'];
|
|
||||||
danmu = json['danmu'];
|
|
||||||
message = json['message'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ReplyUser {
|
|
||||||
ReplyUser({
|
|
||||||
this.mid,
|
|
||||||
this.fans,
|
|
||||||
this.nickname,
|
|
||||||
this.avatar,
|
|
||||||
this.midLink,
|
|
||||||
this.follow,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? mid;
|
|
||||||
int? fans;
|
|
||||||
String? nickname;
|
|
||||||
String? avatar;
|
|
||||||
String? midLink;
|
|
||||||
bool? follow;
|
|
||||||
|
|
||||||
ReplyUser.fromJson(Map<String, dynamic> json) {
|
|
||||||
mid = json['mid'];
|
|
||||||
fans = json['fans'];
|
|
||||||
nickname = json['nickname'];
|
|
||||||
avatar = json['avatar'];
|
|
||||||
midLink = json['mid_link'];
|
|
||||||
follow = json['follow'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
class MessageSystemModel {
|
|
||||||
int? id;
|
|
||||||
int? cursor;
|
|
||||||
int? type;
|
|
||||||
String? title;
|
|
||||||
dynamic content;
|
|
||||||
Source? source;
|
|
||||||
String? timeAt;
|
|
||||||
int? cardType;
|
|
||||||
String? cardBrief;
|
|
||||||
String? cardMsgBrief;
|
|
||||||
String? cardCover;
|
|
||||||
String? cardStoryTitle;
|
|
||||||
String? cardLink;
|
|
||||||
String? mc;
|
|
||||||
int? isStation;
|
|
||||||
int? isSend;
|
|
||||||
int? notifyCursor;
|
|
||||||
|
|
||||||
MessageSystemModel({
|
|
||||||
this.id,
|
|
||||||
this.cursor,
|
|
||||||
this.type,
|
|
||||||
this.title,
|
|
||||||
this.content,
|
|
||||||
this.source,
|
|
||||||
this.timeAt,
|
|
||||||
this.cardType,
|
|
||||||
this.cardBrief,
|
|
||||||
this.cardMsgBrief,
|
|
||||||
this.cardCover,
|
|
||||||
this.cardStoryTitle,
|
|
||||||
this.cardLink,
|
|
||||||
this.mc,
|
|
||||||
this.isStation,
|
|
||||||
this.isSend,
|
|
||||||
this.notifyCursor,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory MessageSystemModel.fromJson(Map<String, dynamic> jsons) =>
|
|
||||||
MessageSystemModel(
|
|
||||||
id: jsons["id"],
|
|
||||||
cursor: jsons["cursor"],
|
|
||||||
type: jsons["type"],
|
|
||||||
title: jsons["title"],
|
|
||||||
content: isValidJson(jsons["content"])
|
|
||||||
? json.decode(jsons["content"])
|
|
||||||
: jsons["content"],
|
|
||||||
source: Source.fromJson(jsons["source"]),
|
|
||||||
timeAt: jsons["time_at"],
|
|
||||||
cardType: jsons["card_type"],
|
|
||||||
cardBrief: jsons["card_brief"],
|
|
||||||
cardMsgBrief: jsons["card_msg_brief"],
|
|
||||||
cardCover: jsons["card_cover"],
|
|
||||||
cardStoryTitle: jsons["card_story_title"],
|
|
||||||
cardLink: jsons["card_link"],
|
|
||||||
mc: jsons["mc"],
|
|
||||||
isStation: jsons["is_station"],
|
|
||||||
isSend: jsons["is_send"],
|
|
||||||
notifyCursor: jsons["notify_cursor"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Source {
|
|
||||||
String? name;
|
|
||||||
String? logo;
|
|
||||||
|
|
||||||
Source({
|
|
||||||
this.name,
|
|
||||||
this.logo,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Source.fromJson(Map<String, dynamic> json) => Source(
|
|
||||||
name: json["name"],
|
|
||||||
logo: json["logo"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isValidJson(String str) {
|
|
||||||
try {
|
|
||||||
json.decode(str);
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@ -1,485 +0,0 @@
|
|||||||
class OpusDataModel {
|
|
||||||
OpusDataModel({
|
|
||||||
this.id,
|
|
||||||
this.detail,
|
|
||||||
this.type,
|
|
||||||
this.theme,
|
|
||||||
this.themeMode,
|
|
||||||
});
|
|
||||||
|
|
||||||
String? id;
|
|
||||||
OpusDetailDataModel? detail;
|
|
||||||
int? type;
|
|
||||||
String? theme;
|
|
||||||
String? themeMode;
|
|
||||||
|
|
||||||
OpusDataModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
detail = json['detail'] != null
|
|
||||||
? OpusDetailDataModel.fromJson(json['detail'])
|
|
||||||
: null;
|
|
||||||
type = json['type'];
|
|
||||||
theme = json['theme'];
|
|
||||||
themeMode = json['themeMode'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class OpusDetailDataModel {
|
|
||||||
OpusDetailDataModel({
|
|
||||||
this.basic,
|
|
||||||
this.idStr,
|
|
||||||
this.modules,
|
|
||||||
this.type,
|
|
||||||
});
|
|
||||||
|
|
||||||
Basic? basic;
|
|
||||||
String? idStr;
|
|
||||||
List<OpusModuleDataModel>? modules;
|
|
||||||
int? type;
|
|
||||||
|
|
||||||
OpusDetailDataModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
basic = json['basic'] != null ? Basic.fromJson(json['basic']) : null;
|
|
||||||
idStr = json['id_str'];
|
|
||||||
if (json['modules'] != null) {
|
|
||||||
modules = <OpusModuleDataModel>[];
|
|
||||||
json['modules'].forEach((v) {
|
|
||||||
modules!.add(OpusModuleDataModel.fromJson(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
type = json['type'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Basic {
|
|
||||||
Basic({
|
|
||||||
this.commentIdStr,
|
|
||||||
this.commentType,
|
|
||||||
this.ridStr,
|
|
||||||
this.title,
|
|
||||||
this.uid,
|
|
||||||
});
|
|
||||||
|
|
||||||
String? commentIdStr;
|
|
||||||
int? commentType;
|
|
||||||
String? ridStr;
|
|
||||||
String? title;
|
|
||||||
int? uid;
|
|
||||||
|
|
||||||
Basic.fromJson(Map<String, dynamic> json) {
|
|
||||||
commentIdStr = json['comment_id_str'];
|
|
||||||
commentType = json['comment_type'];
|
|
||||||
ridStr = json['rid_str'];
|
|
||||||
title = json['title'];
|
|
||||||
uid = json['uid'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class OpusModuleDataModel {
|
|
||||||
OpusModuleDataModel({
|
|
||||||
this.moduleTitle,
|
|
||||||
this.moduleAuthor,
|
|
||||||
this.moduleContent,
|
|
||||||
this.moduleExtend,
|
|
||||||
this.moduleBottom,
|
|
||||||
this.moduleStat,
|
|
||||||
});
|
|
||||||
|
|
||||||
ModuleTop? moduleTop;
|
|
||||||
ModuleTitle? moduleTitle;
|
|
||||||
ModuleAuthor? moduleAuthor;
|
|
||||||
ModuleContent? moduleContent;
|
|
||||||
ModuleExtend? moduleExtend;
|
|
||||||
ModuleBottom? moduleBottom;
|
|
||||||
ModuleStat? moduleStat;
|
|
||||||
|
|
||||||
OpusModuleDataModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
moduleTop = json['module_top'] != null
|
|
||||||
? ModuleTop.fromJson(json['module_top'])
|
|
||||||
: null;
|
|
||||||
moduleTitle = json['module_title'] != null
|
|
||||||
? ModuleTitle.fromJson(json['module_title'])
|
|
||||||
: null;
|
|
||||||
moduleAuthor = json['module_author'] != null
|
|
||||||
? ModuleAuthor.fromJson(json['module_author'])
|
|
||||||
: null;
|
|
||||||
moduleContent = json['module_content'] != null
|
|
||||||
? ModuleContent.fromJson(json['module_content'])
|
|
||||||
: null;
|
|
||||||
moduleExtend = json['module_extend'] != null
|
|
||||||
? ModuleExtend.fromJson(json['module_extend'])
|
|
||||||
: null;
|
|
||||||
moduleBottom = json['module_bottom'] != null
|
|
||||||
? ModuleBottom.fromJson(json['module_bottom'])
|
|
||||||
: null;
|
|
||||||
moduleStat = json['module_stat'] != null
|
|
||||||
? ModuleStat.fromJson(json['module_stat'])
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleTop {
|
|
||||||
ModuleTop({
|
|
||||||
this.type,
|
|
||||||
this.video,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? type;
|
|
||||||
Map? video;
|
|
||||||
|
|
||||||
ModuleTop.fromJson(Map<String, dynamic> json) {
|
|
||||||
type = json['type'];
|
|
||||||
video = json['video'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleTitle {
|
|
||||||
ModuleTitle({
|
|
||||||
this.text,
|
|
||||||
});
|
|
||||||
|
|
||||||
String? text;
|
|
||||||
|
|
||||||
ModuleTitle.fromJson(Map<String, dynamic> json) {
|
|
||||||
text = json['text'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleAuthor {
|
|
||||||
ModuleAuthor({
|
|
||||||
this.face,
|
|
||||||
this.mid,
|
|
||||||
this.name,
|
|
||||||
this.pubTime,
|
|
||||||
});
|
|
||||||
|
|
||||||
String? face;
|
|
||||||
int? mid;
|
|
||||||
String? name;
|
|
||||||
String? pubTime;
|
|
||||||
|
|
||||||
ModuleAuthor.fromJson(Map<String, dynamic> json) {
|
|
||||||
face = json['face'];
|
|
||||||
mid = json['mid'];
|
|
||||||
name = json['name'];
|
|
||||||
pubTime = json['pub_time'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleContent {
|
|
||||||
ModuleContent({
|
|
||||||
this.paragraphs,
|
|
||||||
this.moduleType,
|
|
||||||
});
|
|
||||||
|
|
||||||
List<ModuleParagraph>? paragraphs;
|
|
||||||
String? moduleType;
|
|
||||||
|
|
||||||
ModuleContent.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json['paragraphs'] != null) {
|
|
||||||
paragraphs = <ModuleParagraph>[];
|
|
||||||
json['paragraphs'].forEach((v) {
|
|
||||||
paragraphs!.add(ModuleParagraph.fromJson(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
moduleType = json['module_type'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleParagraph {
|
|
||||||
ModuleParagraph({
|
|
||||||
this.align,
|
|
||||||
this.paraType,
|
|
||||||
this.pic,
|
|
||||||
this.text,
|
|
||||||
});
|
|
||||||
|
|
||||||
// 0 左对齐 1 居中 2 右对齐
|
|
||||||
int? align;
|
|
||||||
int? paraType;
|
|
||||||
Pics? pic;
|
|
||||||
ModuleParagraphText? text;
|
|
||||||
LinkCard? linkCard;
|
|
||||||
|
|
||||||
ModuleParagraph.fromJson(Map<String, dynamic> json) {
|
|
||||||
align = json['align'];
|
|
||||||
paraType = json['para_type'] == null && json['link_card'] != null
|
|
||||||
? 3
|
|
||||||
: json['para_type'];
|
|
||||||
pic = json['pic'] != null ? Pics.fromJson(json['pic']) : null;
|
|
||||||
text = json['text'] != null
|
|
||||||
? ModuleParagraphText.fromJson(json['text'])
|
|
||||||
: null;
|
|
||||||
linkCard =
|
|
||||||
json['link_card'] != null ? LinkCard.fromJson(json['link_card']) : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Pics {
|
|
||||||
Pics({
|
|
||||||
this.pics,
|
|
||||||
this.style,
|
|
||||||
});
|
|
||||||
|
|
||||||
List<Pic>? pics;
|
|
||||||
int? style;
|
|
||||||
|
|
||||||
Pics.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json['pics'] != null) {
|
|
||||||
pics = <Pic>[];
|
|
||||||
json['pics'].forEach((v) {
|
|
||||||
pics!.add(Pic.fromJson(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
style = json['style'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Pic {
|
|
||||||
Pic({
|
|
||||||
this.height,
|
|
||||||
this.size,
|
|
||||||
this.url,
|
|
||||||
this.width,
|
|
||||||
this.aspectRatio,
|
|
||||||
this.scale,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? height;
|
|
||||||
double? size;
|
|
||||||
String? url;
|
|
||||||
int? width;
|
|
||||||
double? aspectRatio;
|
|
||||||
double? scale;
|
|
||||||
|
|
||||||
Pic.fromJson(Map<String, dynamic> json) {
|
|
||||||
height = json['height'];
|
|
||||||
size = json['size'];
|
|
||||||
url = json['url'];
|
|
||||||
width = json['width'];
|
|
||||||
aspectRatio = json['width'] / json['height'];
|
|
||||||
scale = customDivision(json['width'], 600);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LinkCard {
|
|
||||||
LinkCard({
|
|
||||||
this.cover,
|
|
||||||
this.descSecond,
|
|
||||||
this.duration,
|
|
||||||
this.jumpUrl,
|
|
||||||
this.title,
|
|
||||||
});
|
|
||||||
|
|
||||||
String? cover;
|
|
||||||
String? descSecond;
|
|
||||||
String? duration;
|
|
||||||
String? jumpUrl;
|
|
||||||
String? title;
|
|
||||||
|
|
||||||
LinkCard.fromJson(Map<String, dynamic> json) {
|
|
||||||
cover = json['card']['cover'];
|
|
||||||
descSecond = json['card']['desc_second'];
|
|
||||||
duration = json['card']['duration'];
|
|
||||||
jumpUrl = json['card']['jump_url'];
|
|
||||||
title = json['card']['title'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleParagraphText {
|
|
||||||
ModuleParagraphText({
|
|
||||||
this.nodes,
|
|
||||||
});
|
|
||||||
|
|
||||||
List<ModuleParagraphTextNode>? nodes;
|
|
||||||
|
|
||||||
ModuleParagraphText.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json['nodes'] != null) {
|
|
||||||
nodes = <ModuleParagraphTextNode>[];
|
|
||||||
json['nodes'].forEach((v) {
|
|
||||||
nodes!.add(ModuleParagraphTextNode.fromJson(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleParagraphTextNode {
|
|
||||||
ModuleParagraphTextNode({
|
|
||||||
this.type,
|
|
||||||
this.nodeType,
|
|
||||||
this.word,
|
|
||||||
});
|
|
||||||
|
|
||||||
String? type;
|
|
||||||
int? nodeType;
|
|
||||||
ModuleParagraphTextNodeWord? word;
|
|
||||||
|
|
||||||
ModuleParagraphTextNode.fromJson(Map<String, dynamic> json) {
|
|
||||||
type = json['type'];
|
|
||||||
nodeType = json['node_type'];
|
|
||||||
word = json['word'] != null
|
|
||||||
? ModuleParagraphTextNodeWord.fromJson(json['word'])
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleParagraphTextNodeWord {
|
|
||||||
ModuleParagraphTextNodeWord({
|
|
||||||
this.color,
|
|
||||||
this.fontSize,
|
|
||||||
this.style,
|
|
||||||
this.words,
|
|
||||||
});
|
|
||||||
|
|
||||||
String? color;
|
|
||||||
int? fontSize;
|
|
||||||
ModuleParagraphTextNodeWordStyle? style;
|
|
||||||
String? words;
|
|
||||||
|
|
||||||
ModuleParagraphTextNodeWord.fromJson(Map<String, dynamic> json) {
|
|
||||||
color = json['color'];
|
|
||||||
fontSize = json['font_size'];
|
|
||||||
style = json['style'] != null
|
|
||||||
? ModuleParagraphTextNodeWordStyle.fromJson(json['style'])
|
|
||||||
: null;
|
|
||||||
words = json['words'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleParagraphTextNodeWordStyle {
|
|
||||||
ModuleParagraphTextNodeWordStyle({
|
|
||||||
this.bold,
|
|
||||||
});
|
|
||||||
|
|
||||||
bool? bold;
|
|
||||||
|
|
||||||
ModuleParagraphTextNodeWordStyle.fromJson(Map<String, dynamic> json) {
|
|
||||||
bold = json['bold'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleExtend {
|
|
||||||
ModuleExtend({
|
|
||||||
this.items,
|
|
||||||
});
|
|
||||||
|
|
||||||
List<ModuleExtendItem>? items;
|
|
||||||
|
|
||||||
ModuleExtend.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json['items'] != null) {
|
|
||||||
items = <ModuleExtendItem>[];
|
|
||||||
json['items'].forEach((v) {
|
|
||||||
items!.add(ModuleExtendItem.fromJson(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleExtendItem {
|
|
||||||
ModuleExtendItem({
|
|
||||||
this.bizId,
|
|
||||||
this.bizType,
|
|
||||||
this.icon,
|
|
||||||
this.jumpUrl,
|
|
||||||
this.text,
|
|
||||||
});
|
|
||||||
|
|
||||||
dynamic bizId;
|
|
||||||
int? bizType;
|
|
||||||
dynamic icon;
|
|
||||||
String? jumpUrl;
|
|
||||||
String? text;
|
|
||||||
|
|
||||||
ModuleExtendItem.fromJson(Map<String, dynamic> json) {
|
|
||||||
bizId = json['biz_id'];
|
|
||||||
bizType = json['biz_type'];
|
|
||||||
icon = json['icon'];
|
|
||||||
jumpUrl = json['jump_url'];
|
|
||||||
text = json['text'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleBottom {
|
|
||||||
ModuleBottom({
|
|
||||||
this.shareInfo,
|
|
||||||
});
|
|
||||||
|
|
||||||
ShareInfo? shareInfo;
|
|
||||||
|
|
||||||
ModuleBottom.fromJson(Map<String, dynamic> json) {
|
|
||||||
shareInfo = json['share_info'] != null
|
|
||||||
? ShareInfo.fromJson(json['share_info'])
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ShareInfo {
|
|
||||||
ShareInfo({
|
|
||||||
this.pic,
|
|
||||||
this.summary,
|
|
||||||
this.title,
|
|
||||||
});
|
|
||||||
|
|
||||||
String? pic;
|
|
||||||
String? summary;
|
|
||||||
String? title;
|
|
||||||
|
|
||||||
ShareInfo.fromJson(Map<String, dynamic> json) {
|
|
||||||
pic = json['pic'];
|
|
||||||
summary = json['summary'];
|
|
||||||
title = json['title'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleStat {
|
|
||||||
ModuleStat({
|
|
||||||
this.coin,
|
|
||||||
this.comment,
|
|
||||||
this.favorite,
|
|
||||||
this.forward,
|
|
||||||
this.like,
|
|
||||||
});
|
|
||||||
|
|
||||||
StatItem? coin;
|
|
||||||
StatItem? comment;
|
|
||||||
StatItem? favorite;
|
|
||||||
StatItem? forward;
|
|
||||||
StatItem? like;
|
|
||||||
|
|
||||||
ModuleStat.fromJson(Map<String, dynamic> json) {
|
|
||||||
coin = json['coin'] != null ? StatItem.fromJson(json['coin']) : null;
|
|
||||||
comment =
|
|
||||||
json['comment'] != null ? StatItem.fromJson(json['comment']) : null;
|
|
||||||
favorite =
|
|
||||||
json['favorite'] != null ? StatItem.fromJson(json['favorite']) : null;
|
|
||||||
forward =
|
|
||||||
json['forward'] != null ? StatItem.fromJson(json['forward']) : null;
|
|
||||||
like = json['like'] != null ? StatItem.fromJson(json['like']) : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class StatItem {
|
|
||||||
StatItem({
|
|
||||||
this.count,
|
|
||||||
this.forbidden,
|
|
||||||
this.status,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? count;
|
|
||||||
bool? forbidden;
|
|
||||||
bool? status;
|
|
||||||
|
|
||||||
StatItem.fromJson(Map<String, dynamic> json) {
|
|
||||||
count = json['count'];
|
|
||||||
forbidden = json['forbidden'];
|
|
||||||
status = json['status'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double customDivision(int a, int b) {
|
|
||||||
double result = a / b;
|
|
||||||
if (result < 1) {
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
return 1.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,286 +0,0 @@
|
|||||||
import 'package:pilipala/models/member/info.dart';
|
|
||||||
|
|
||||||
import 'opus.dart';
|
|
||||||
|
|
||||||
class ReadDataModel {
|
|
||||||
ReadDataModel({
|
|
||||||
this.cvid,
|
|
||||||
this.readInfo,
|
|
||||||
this.readViewInfo,
|
|
||||||
this.upInfo,
|
|
||||||
this.catalogList,
|
|
||||||
this.recommendInfoList,
|
|
||||||
this.hiddenInteraction,
|
|
||||||
this.isModern,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? cvid;
|
|
||||||
ReadInfo? readInfo;
|
|
||||||
Map? readViewInfo;
|
|
||||||
Map? upInfo;
|
|
||||||
List<dynamic>? catalogList;
|
|
||||||
List<dynamic>? recommendInfoList;
|
|
||||||
bool? hiddenInteraction;
|
|
||||||
bool? isModern;
|
|
||||||
|
|
||||||
ReadDataModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
cvid = json['cvid'];
|
|
||||||
readInfo =
|
|
||||||
json['readInfo'] != null ? ReadInfo.fromJson(json['readInfo']) : null;
|
|
||||||
readViewInfo = json['readViewInfo'];
|
|
||||||
upInfo = json['upInfo'];
|
|
||||||
if (json['catalogList'] != null) {
|
|
||||||
catalogList = <dynamic>[];
|
|
||||||
json['catalogList'].forEach((v) {
|
|
||||||
catalogList!.add(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (json['recommendInfoList'] != null) {
|
|
||||||
recommendInfoList = <dynamic>[];
|
|
||||||
json['recommendInfoList'].forEach((v) {
|
|
||||||
recommendInfoList!.add(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
hiddenInteraction = json['hiddenInteraction'];
|
|
||||||
isModern = json['isModern'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ReadInfo {
|
|
||||||
ReadInfo({
|
|
||||||
this.id,
|
|
||||||
this.category,
|
|
||||||
this.title,
|
|
||||||
this.summary,
|
|
||||||
this.bannerUrl,
|
|
||||||
this.author,
|
|
||||||
this.publishTime,
|
|
||||||
this.ctime,
|
|
||||||
this.mtime,
|
|
||||||
this.stats,
|
|
||||||
this.attributes,
|
|
||||||
this.words,
|
|
||||||
this.originImageUrls,
|
|
||||||
this.content,
|
|
||||||
this.opus,
|
|
||||||
this.dynIdStr,
|
|
||||||
this.totalArtNum,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? id;
|
|
||||||
Map? category;
|
|
||||||
String? title;
|
|
||||||
String? summary;
|
|
||||||
String? bannerUrl;
|
|
||||||
Author? author;
|
|
||||||
int? publishTime;
|
|
||||||
int? ctime;
|
|
||||||
int? mtime;
|
|
||||||
Map? stats;
|
|
||||||
int? attributes;
|
|
||||||
int? words;
|
|
||||||
List<String>? originImageUrls;
|
|
||||||
String? content;
|
|
||||||
Opus? opus;
|
|
||||||
String? dynIdStr;
|
|
||||||
int? totalArtNum;
|
|
||||||
|
|
||||||
ReadInfo.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
category = json['category'];
|
|
||||||
title = json['title'];
|
|
||||||
summary = json['summary'];
|
|
||||||
bannerUrl = json['banner_url'];
|
|
||||||
author = Author.fromJson(json['author']);
|
|
||||||
publishTime = json['publish_time'];
|
|
||||||
ctime = json['ctime'];
|
|
||||||
mtime = json['mtime'];
|
|
||||||
stats = json['stats'];
|
|
||||||
attributes = json['attributes'];
|
|
||||||
words = json['words'];
|
|
||||||
if (json['origin_image_urls'] != null) {
|
|
||||||
originImageUrls = <String>[];
|
|
||||||
json['origin_image_urls'].forEach((v) {
|
|
||||||
originImageUrls!.add(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
content = json['content'];
|
|
||||||
opus = json['opus'] != null ? Opus.fromJson(json['opus']) : null;
|
|
||||||
dynIdStr = json['dyn_id_str'];
|
|
||||||
totalArtNum = json['total_art_num'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Author {
|
|
||||||
Author({
|
|
||||||
this.mid,
|
|
||||||
this.name,
|
|
||||||
this.face,
|
|
||||||
this.vip,
|
|
||||||
this.fans,
|
|
||||||
this.level,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? mid;
|
|
||||||
String? name;
|
|
||||||
String? face;
|
|
||||||
Vip? vip;
|
|
||||||
int? fans;
|
|
||||||
int? level;
|
|
||||||
|
|
||||||
Author.fromJson(Map<String, dynamic> json) {
|
|
||||||
mid = json['mid'];
|
|
||||||
name = json['name'];
|
|
||||||
face = json['face'];
|
|
||||||
vip = json['vip'] != null ? Vip.fromJson(json['vip']) : null;
|
|
||||||
fans = json['fans'];
|
|
||||||
level = json['level'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Opus {
|
|
||||||
// "opus_id": 976625853207150600,
|
|
||||||
// "opus_source": 2,
|
|
||||||
// "title": "真的很想骂人 但又没什么好骂的",
|
|
||||||
// "content": {
|
|
||||||
// "paragraphs": [{
|
|
||||||
// "para_type": 1,
|
|
||||||
// "text": {
|
|
||||||
// "nodes": [{
|
|
||||||
// "node_type": 1,
|
|
||||||
// "word": {
|
|
||||||
// "words": "21年玩到今年4月的号没了 ow1的时候45的号 玩了三年 后面第9赛季一个英杰5的号(虽然是偷的 但我任何违规行为都没有还是给我封了) 最近玩的号叫velleity 只和队友打天梯以及训练赛 又没了 连带着我一个一把没玩过只玩过一场训练赛的小号也没了 实在是无话可说了...",
|
|
||||||
// "font_size": 17,
|
|
||||||
// "style": {},
|
|
||||||
// "font_level": "regular"
|
|
||||||
// }
|
|
||||||
// }]
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
// "para_type": 2,
|
|
||||||
// "pic": {
|
|
||||||
// "pics": [{
|
|
||||||
// "url": "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fnew_dyn\u002Fba4e57459451fe74dcb70fd20bde9823316082117.jpg",
|
|
||||||
// "width": 1600,
|
|
||||||
// "height": 1000,
|
|
||||||
// "size": 588.482421875
|
|
||||||
// }],
|
|
||||||
// "style": 1
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
// "para_type": 1,
|
|
||||||
// "text": {
|
|
||||||
// "nodes": [{
|
|
||||||
// "node_type": 1,
|
|
||||||
// "word": {
|
|
||||||
// "words": "\n",
|
|
||||||
// "font_size": 17,
|
|
||||||
// "style": {},
|
|
||||||
// "font_level": "regular"
|
|
||||||
// }
|
|
||||||
// }]
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
// "para_type": 2,
|
|
||||||
// "pic": {
|
|
||||||
// "pics": [{
|
|
||||||
// "url": "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fnew_dyn\u002F0945be6b621091ddb8189482a87a36fb316082117.jpg",
|
|
||||||
// "width": 1600,
|
|
||||||
// "height": 1002,
|
|
||||||
// "size": 665.7861328125
|
|
||||||
// }],
|
|
||||||
// "style": 1
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
// "para_type": 1,
|
|
||||||
// "text": {
|
|
||||||
// "nodes": [{
|
|
||||||
// "node_type": 1,
|
|
||||||
// "word": {
|
|
||||||
// "words": "\n",
|
|
||||||
// "font_size": 17,
|
|
||||||
// "style": {},
|
|
||||||
// "font_level": "regular"
|
|
||||||
// }
|
|
||||||
// }]
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
// "para_type": 2,
|
|
||||||
// "pic": {
|
|
||||||
// "pics": [{
|
|
||||||
// "url": "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fnew_dyn\u002Ffa60649f8786578a764a1e68a2c5d23f316082117.jpg",
|
|
||||||
// "width": 1600,
|
|
||||||
// "height": 999,
|
|
||||||
// "size": 332.970703125
|
|
||||||
// }],
|
|
||||||
// "style": 1
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
// "para_type": 1,
|
|
||||||
// "text": {
|
|
||||||
// "nodes": [{
|
|
||||||
// "node_type": 1,
|
|
||||||
// "word": {
|
|
||||||
// "words": "\n",
|
|
||||||
// "font_size": 17,
|
|
||||||
// "style": {},
|
|
||||||
// "font_level": "regular"
|
|
||||||
// }
|
|
||||||
// }]
|
|
||||||
// }
|
|
||||||
// }]
|
|
||||||
// },
|
|
||||||
// "pub_info": {
|
|
||||||
// "uid": 316082117,
|
|
||||||
// "pub_time": 1726226826
|
|
||||||
// },
|
|
||||||
// "article": {
|
|
||||||
// "category_id": 15,
|
|
||||||
// "cover": [{
|
|
||||||
// "url": "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fnew_dyn\u002Fbanner\u002Feb10074186a62f98c18e1b5b9deb38be316082117.png",
|
|
||||||
// "width": 1071,
|
|
||||||
// "height": 315,
|
|
||||||
// "size": 225.625
|
|
||||||
// }]
|
|
||||||
// },
|
|
||||||
// "version": {
|
|
||||||
// "cvid": 38660379,
|
|
||||||
// "version_id": 101683514411343360
|
|
||||||
// }
|
|
||||||
Opus({
|
|
||||||
this.opusId,
|
|
||||||
this.opusSource,
|
|
||||||
this.title,
|
|
||||||
this.content,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? opusId;
|
|
||||||
int? opusSource;
|
|
||||||
String? title;
|
|
||||||
Content? content;
|
|
||||||
|
|
||||||
Opus.fromJson(Map<String, dynamic> json) {
|
|
||||||
opusId = json['opus_id'];
|
|
||||||
opusSource = json['opus_source'];
|
|
||||||
title = json['title'];
|
|
||||||
content =
|
|
||||||
json['content'] != null ? Content.fromJson(json['content']) : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Content {
|
|
||||||
Content({
|
|
||||||
this.paragraphs,
|
|
||||||
});
|
|
||||||
|
|
||||||
List<ModuleParagraph>? paragraphs;
|
|
||||||
|
|
||||||
Content.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json['paragraphs'] != null) {
|
|
||||||
paragraphs = <ModuleParagraph>[];
|
|
||||||
json['paragraphs'].forEach((v) {
|
|
||||||
paragraphs!.add(ModuleParagraph.fromJson(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
class SearchAllModel {
|
|
||||||
SearchAllModel({this.topTList});
|
|
||||||
|
|
||||||
Map? topTList;
|
|
||||||
|
|
||||||
SearchAllModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
topTList = json['top_tlist'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +1,14 @@
|
|||||||
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
|
part 'hot.g.dart';
|
||||||
|
|
||||||
|
@HiveType(typeId: 6)
|
||||||
class HotSearchModel {
|
class HotSearchModel {
|
||||||
HotSearchModel({
|
HotSearchModel({
|
||||||
this.list,
|
this.list,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@HiveField(0)
|
||||||
List<HotSearchItem>? list;
|
List<HotSearchItem>? list;
|
||||||
|
|
||||||
HotSearchModel.fromJson(Map<String, dynamic> json) {
|
HotSearchModel.fromJson(Map<String, dynamic> json) {
|
||||||
@ -12,6 +18,7 @@ class HotSearchModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HiveType(typeId: 7)
|
||||||
class HotSearchItem {
|
class HotSearchItem {
|
||||||
HotSearchItem({
|
HotSearchItem({
|
||||||
this.keyword,
|
this.keyword,
|
||||||
@ -20,10 +27,14 @@ class HotSearchItem {
|
|||||||
this.icon,
|
this.icon,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@HiveField(0)
|
||||||
String? keyword;
|
String? keyword;
|
||||||
|
@HiveField(1)
|
||||||
String? showName;
|
String? showName;
|
||||||
// 4/5热 11话题 8普通 7直播
|
// 4/5热 11话题 8普通 7直播
|
||||||
|
@HiveField(2)
|
||||||
int? wordType;
|
int? wordType;
|
||||||
|
@HiveField(3)
|
||||||
String? icon;
|
String? icon;
|
||||||
|
|
||||||
HotSearchItem.fromJson(Map<String, dynamic> json) {
|
HotSearchItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
|||||||
84
lib/models/search/hot.g.dart
Normal file
84
lib/models/search/hot.g.dart
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'hot.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class HotSearchModelAdapter extends TypeAdapter<HotSearchModel> {
|
||||||
|
@override
|
||||||
|
final int typeId = 6;
|
||||||
|
|
||||||
|
@override
|
||||||
|
HotSearchModel read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return HotSearchModel(
|
||||||
|
list: (fields[0] as List?)?.cast<HotSearchItem>(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, HotSearchModel obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(1)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is HotSearchModelAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
class HotSearchItemAdapter extends TypeAdapter<HotSearchItem> {
|
||||||
|
@override
|
||||||
|
final int typeId = 7;
|
||||||
|
|
||||||
|
@override
|
||||||
|
HotSearchItem read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return HotSearchItem(
|
||||||
|
keyword: fields[0] as String?,
|
||||||
|
showName: fields[1] as String?,
|
||||||
|
wordType: fields[2] as int?,
|
||||||
|
icon: fields[3] as String?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, HotSearchItem obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(4)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.keyword)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.showName)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.wordType)
|
||||||
|
..writeByte(3)
|
||||||
|
..write(obj.icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is HotSearchItemAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
@ -5,12 +5,10 @@ class SearchVideoModel {
|
|||||||
SearchVideoModel({this.list});
|
SearchVideoModel({this.list});
|
||||||
List<SearchVideoItemModel>? list;
|
List<SearchVideoItemModel>? list;
|
||||||
SearchVideoModel.fromJson(Map<String, dynamic> json) {
|
SearchVideoModel.fromJson(Map<String, dynamic> json) {
|
||||||
list = json['result'] == null
|
list = json['result']
|
||||||
? []
|
.where((e) => e['available'] == true)
|
||||||
: json['result']
|
.map<SearchVideoItemModel>((e) => SearchVideoItemModel.fromJson(e))
|
||||||
.where((e) => e['available'] == true)
|
.toList();
|
||||||
.map<SearchVideoItemModel>((e) => SearchVideoItemModel.fromJson(e))
|
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +25,6 @@ class SearchVideoItemModel {
|
|||||||
this.aid,
|
this.aid,
|
||||||
this.bvid,
|
this.bvid,
|
||||||
this.title,
|
this.title,
|
||||||
this.titleList,
|
|
||||||
this.description,
|
this.description,
|
||||||
this.pic,
|
this.pic,
|
||||||
// this.play,
|
// this.play,
|
||||||
@ -57,8 +54,8 @@ class SearchVideoItemModel {
|
|||||||
String? arcurl;
|
String? arcurl;
|
||||||
int? aid;
|
int? aid;
|
||||||
String? bvid;
|
String? bvid;
|
||||||
String? title;
|
List? title;
|
||||||
List? titleList;
|
// List? titleList;
|
||||||
String? description;
|
String? description;
|
||||||
String? pic;
|
String? pic;
|
||||||
// String? play;
|
// String? play;
|
||||||
@ -85,9 +82,8 @@ class SearchVideoItemModel {
|
|||||||
aid = json['aid'];
|
aid = json['aid'];
|
||||||
bvid = json['bvid'];
|
bvid = json['bvid'];
|
||||||
mid = json['mid'];
|
mid = json['mid'];
|
||||||
title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
// title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
||||||
// title = Em.regTitle(json['title']);
|
title = Em.regTitle(json['title']);
|
||||||
titleList = Em.regTitle(json['title']);
|
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
pic = json['pic'] != null && json['pic'].startsWith('//')
|
pic = json['pic'] != null && json['pic'].startsWith('//')
|
||||||
? 'https:${json['pic']}'
|
? 'https:${json['pic']}'
|
||||||
@ -236,7 +232,6 @@ class SearchLiveItemModel {
|
|||||||
this.userCover,
|
this.userCover,
|
||||||
this.type,
|
this.type,
|
||||||
this.title,
|
this.title,
|
||||||
this.titleList,
|
|
||||||
this.cover,
|
this.cover,
|
||||||
this.pic,
|
this.pic,
|
||||||
this.online,
|
this.online,
|
||||||
@ -256,8 +251,7 @@ class SearchLiveItemModel {
|
|||||||
String? face;
|
String? face;
|
||||||
String? userCover;
|
String? userCover;
|
||||||
String? type;
|
String? type;
|
||||||
String? title;
|
List? title;
|
||||||
List? titleList;
|
|
||||||
String? cover;
|
String? cover;
|
||||||
String? pic;
|
String? pic;
|
||||||
int? online;
|
int? online;
|
||||||
@ -278,8 +272,7 @@ class SearchLiveItemModel {
|
|||||||
face = json['uface'];
|
face = json['uface'];
|
||||||
userCover = json['user_cover'];
|
userCover = json['user_cover'];
|
||||||
type = json['type'];
|
type = json['type'];
|
||||||
title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
title = Em.regTitle(json['title']);
|
||||||
titleList = Em.regTitle(json['title']);
|
|
||||||
cover = json['cover'];
|
cover = json['cover'];
|
||||||
pic = json['cover'];
|
pic = json['cover'];
|
||||||
online = json['online'];
|
online = json['online'];
|
||||||
@ -309,7 +302,6 @@ class SearchMBangumiItemModel {
|
|||||||
this.type,
|
this.type,
|
||||||
this.mediaId,
|
this.mediaId,
|
||||||
this.title,
|
this.title,
|
||||||
this.titleList,
|
|
||||||
this.orgTitle,
|
this.orgTitle,
|
||||||
this.mediaType,
|
this.mediaType,
|
||||||
this.cv,
|
this.cv,
|
||||||
@ -336,8 +328,7 @@ class SearchMBangumiItemModel {
|
|||||||
|
|
||||||
String? type;
|
String? type;
|
||||||
int? mediaId;
|
int? mediaId;
|
||||||
String? title;
|
List? title;
|
||||||
List? titleList;
|
|
||||||
String? orgTitle;
|
String? orgTitle;
|
||||||
int? mediaType;
|
int? mediaType;
|
||||||
String? cv;
|
String? cv;
|
||||||
@ -364,8 +355,7 @@ class SearchMBangumiItemModel {
|
|||||||
SearchMBangumiItemModel.fromJson(Map<String, dynamic> json) {
|
SearchMBangumiItemModel.fromJson(Map<String, dynamic> json) {
|
||||||
type = json['type'];
|
type = json['type'];
|
||||||
mediaId = json['media_id'];
|
mediaId = json['media_id'];
|
||||||
title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
title = Em.regTitle(json['title']);
|
||||||
titleList = Em.regTitle(json['title']);
|
|
||||||
orgTitle = json['org_title'];
|
orgTitle = json['org_title'];
|
||||||
mediaType = json['media_type'];
|
mediaType = json['media_type'];
|
||||||
cv = json['cv'];
|
cv = json['cv'];
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
|
part 'stat.g.dart';
|
||||||
|
|
||||||
|
@HiveType(typeId: 1)
|
||||||
class UserStat {
|
class UserStat {
|
||||||
UserStat({
|
UserStat({
|
||||||
this.following,
|
this.following,
|
||||||
@ -5,8 +10,11 @@ class UserStat {
|
|||||||
this.dynamicCount,
|
this.dynamicCount,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@HiveField(0)
|
||||||
int? following;
|
int? following;
|
||||||
|
@HiveField(1)
|
||||||
int? follower;
|
int? follower;
|
||||||
|
@HiveField(2)
|
||||||
int? dynamicCount;
|
int? dynamicCount;
|
||||||
|
|
||||||
UserStat.fromJson(Map<String, dynamic> json) {
|
UserStat.fromJson(Map<String, dynamic> json) {
|
||||||
|
|||||||
47
lib/models/user/stat.g.dart
Normal file
47
lib/models/user/stat.g.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'stat.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class UserStatAdapter extends TypeAdapter<UserStat> {
|
||||||
|
@override
|
||||||
|
final int typeId = 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
UserStat read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return UserStat(
|
||||||
|
following: fields[0] as int?,
|
||||||
|
follower: fields[1] as int?,
|
||||||
|
dynamicCount: fields[2] as int?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, UserStat obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(3)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.following)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.follower)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.dynamicCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is UserStatAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
@ -39,11 +39,11 @@ class ModelResult {
|
|||||||
ModelResult.fromJson(Map<String, dynamic> json) {
|
ModelResult.fromJson(Map<String, dynamic> json) {
|
||||||
resultType = json['result_type'];
|
resultType = json['result_type'];
|
||||||
summary = json['summary'];
|
summary = json['summary'];
|
||||||
outline = json['result_type'] == 0
|
outline = json['result_type'] == 2
|
||||||
? <OutlineItem>[]
|
? json['outline']
|
||||||
: json['outline']
|
|
||||||
.map<OutlineItem>((e) => OutlineItem.fromJson(e))
|
.map<OutlineItem>((e) => OutlineItem.fromJson(e))
|
||||||
.toList();
|
.toList()
|
||||||
|
: <OutlineItem>[];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,276 +0,0 @@
|
|||||||
class MediaVideoItemModel {
|
|
||||||
MediaVideoItemModel({
|
|
||||||
this.id,
|
|
||||||
this.aid,
|
|
||||||
this.offset,
|
|
||||||
this.index,
|
|
||||||
this.intro,
|
|
||||||
this.attr,
|
|
||||||
this.tid,
|
|
||||||
this.copyRight,
|
|
||||||
this.cntInfo,
|
|
||||||
this.cover,
|
|
||||||
this.duration,
|
|
||||||
this.pubtime,
|
|
||||||
this.likeState,
|
|
||||||
this.favState,
|
|
||||||
this.page,
|
|
||||||
this.cid,
|
|
||||||
this.pages,
|
|
||||||
this.title,
|
|
||||||
this.type,
|
|
||||||
this.upper,
|
|
||||||
this.link,
|
|
||||||
this.bvid,
|
|
||||||
this.shortLink,
|
|
||||||
this.rights,
|
|
||||||
this.elecInfo,
|
|
||||||
this.coin,
|
|
||||||
this.progressPercent,
|
|
||||||
this.badge,
|
|
||||||
this.forbidFav,
|
|
||||||
this.moreType,
|
|
||||||
this.businessOid,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? id;
|
|
||||||
int? aid;
|
|
||||||
int? offset;
|
|
||||||
int? index;
|
|
||||||
String? intro;
|
|
||||||
int? attr;
|
|
||||||
int? tid;
|
|
||||||
int? copyRight;
|
|
||||||
Map? cntInfo;
|
|
||||||
String? cover;
|
|
||||||
int? duration;
|
|
||||||
int? pubtime;
|
|
||||||
int? likeState;
|
|
||||||
int? favState;
|
|
||||||
int? page;
|
|
||||||
int? cid;
|
|
||||||
List<Page>? pages;
|
|
||||||
String? title;
|
|
||||||
int? type;
|
|
||||||
Upper? upper;
|
|
||||||
String? link;
|
|
||||||
String? bvid;
|
|
||||||
String? shortLink;
|
|
||||||
Rights? rights;
|
|
||||||
dynamic elecInfo;
|
|
||||||
Coin? coin;
|
|
||||||
double? progressPercent;
|
|
||||||
dynamic badge;
|
|
||||||
bool? forbidFav;
|
|
||||||
int? moreType;
|
|
||||||
int? businessOid;
|
|
||||||
|
|
||||||
factory MediaVideoItemModel.fromJson(Map<String, dynamic> json) =>
|
|
||||||
MediaVideoItemModel(
|
|
||||||
id: json["id"],
|
|
||||||
aid: json["id"],
|
|
||||||
offset: json["offset"],
|
|
||||||
index: json["index"],
|
|
||||||
intro: json["intro"],
|
|
||||||
attr: json["attr"],
|
|
||||||
tid: json["tid"],
|
|
||||||
copyRight: json["copy_right"],
|
|
||||||
cntInfo: json["cnt_info"],
|
|
||||||
cover: json["cover"],
|
|
||||||
duration: json["duration"],
|
|
||||||
pubtime: json["pubtime"],
|
|
||||||
likeState: json["like_state"],
|
|
||||||
favState: json["fav_state"],
|
|
||||||
page: json["page"],
|
|
||||||
cid: json["pages"] == null ? -1 : json["pages"].first['id'],
|
|
||||||
// json["pages"] 可能为null
|
|
||||||
pages: json["pages"] == null
|
|
||||||
? []
|
|
||||||
: List<Page>.from(json["pages"].map((x) => Page.fromJson(x))),
|
|
||||||
title: json["title"],
|
|
||||||
type: json["type"],
|
|
||||||
upper: Upper.fromJson(json["upper"]),
|
|
||||||
link: json["link"],
|
|
||||||
bvid: json["bv_id"],
|
|
||||||
shortLink: json["short_link"],
|
|
||||||
rights: Rights.fromJson(json["rights"]),
|
|
||||||
elecInfo: json["elec_info"],
|
|
||||||
coin: Coin.fromJson(json["coin"]),
|
|
||||||
progressPercent: json["progress_percent"].toDouble(),
|
|
||||||
badge: json["badge"],
|
|
||||||
forbidFav: json["forbid_fav"],
|
|
||||||
moreType: json["more_type"],
|
|
||||||
businessOid: json["business_oid"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Coin {
|
|
||||||
Coin({
|
|
||||||
this.maxNum,
|
|
||||||
this.coinNumber,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? maxNum;
|
|
||||||
int? coinNumber;
|
|
||||||
|
|
||||||
factory Coin.fromJson(Map<String, dynamic> json) => Coin(
|
|
||||||
maxNum: json["max_num"],
|
|
||||||
coinNumber: json["coin_number"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Page {
|
|
||||||
Page({
|
|
||||||
this.id,
|
|
||||||
this.title,
|
|
||||||
this.intro,
|
|
||||||
this.duration,
|
|
||||||
this.link,
|
|
||||||
this.page,
|
|
||||||
this.metas,
|
|
||||||
this.from,
|
|
||||||
this.dimension,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? id;
|
|
||||||
String? title;
|
|
||||||
String? intro;
|
|
||||||
int? duration;
|
|
||||||
String? link;
|
|
||||||
int? page;
|
|
||||||
List<Meta>? metas;
|
|
||||||
String? from;
|
|
||||||
Dimension? dimension;
|
|
||||||
|
|
||||||
factory Page.fromJson(Map<String, dynamic> json) => Page(
|
|
||||||
id: json["id"],
|
|
||||||
title: json["title"],
|
|
||||||
intro: json["intro"],
|
|
||||||
duration: json["duration"],
|
|
||||||
link: json["link"],
|
|
||||||
page: json["page"],
|
|
||||||
metas: List<Meta>.from(json["metas"].map((x) => Meta.fromJson(x))),
|
|
||||||
from: json["from"],
|
|
||||||
dimension: Dimension.fromJson(json["dimension"]),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Dimension {
|
|
||||||
Dimension({
|
|
||||||
this.width,
|
|
||||||
this.height,
|
|
||||||
this.rotate,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? width;
|
|
||||||
int? height;
|
|
||||||
int? rotate;
|
|
||||||
|
|
||||||
factory Dimension.fromJson(Map<String, dynamic> json) => Dimension(
|
|
||||||
width: json["width"],
|
|
||||||
height: json["height"],
|
|
||||||
rotate: json["rotate"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Meta {
|
|
||||||
Meta({
|
|
||||||
this.quality,
|
|
||||||
this.size,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? quality;
|
|
||||||
int? size;
|
|
||||||
|
|
||||||
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
|
|
||||||
quality: json["quality"],
|
|
||||||
size: json["size"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Rights {
|
|
||||||
Rights({
|
|
||||||
this.bp,
|
|
||||||
this.elec,
|
|
||||||
this.download,
|
|
||||||
this.movie,
|
|
||||||
this.pay,
|
|
||||||
this.ugcPay,
|
|
||||||
this.hd5,
|
|
||||||
this.noReprint,
|
|
||||||
this.autoplay,
|
|
||||||
this.noBackground,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? bp;
|
|
||||||
int? elec;
|
|
||||||
int? download;
|
|
||||||
int? movie;
|
|
||||||
int? pay;
|
|
||||||
int? ugcPay;
|
|
||||||
int? hd5;
|
|
||||||
int? noReprint;
|
|
||||||
int? autoplay;
|
|
||||||
int? noBackground;
|
|
||||||
|
|
||||||
factory Rights.fromJson(Map<String, dynamic> json) => Rights(
|
|
||||||
bp: json["bp"],
|
|
||||||
elec: json["elec"],
|
|
||||||
download: json["download"],
|
|
||||||
movie: json["movie"],
|
|
||||||
pay: json["pay"],
|
|
||||||
ugcPay: json["ugc_pay"],
|
|
||||||
hd5: json["hd5"],
|
|
||||||
noReprint: json["no_reprint"],
|
|
||||||
autoplay: json["autoplay"],
|
|
||||||
noBackground: json["no_background"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Upper {
|
|
||||||
Upper({
|
|
||||||
this.mid,
|
|
||||||
this.name,
|
|
||||||
this.face,
|
|
||||||
this.followed,
|
|
||||||
this.fans,
|
|
||||||
this.vipType,
|
|
||||||
this.vipStatue,
|
|
||||||
this.vipDueDate,
|
|
||||||
this.vipPayType,
|
|
||||||
this.officialRole,
|
|
||||||
this.officialTitle,
|
|
||||||
this.officialDesc,
|
|
||||||
this.displayName,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? mid;
|
|
||||||
String? name;
|
|
||||||
String? face;
|
|
||||||
int? followed;
|
|
||||||
int? fans;
|
|
||||||
int? vipType;
|
|
||||||
int? vipStatue;
|
|
||||||
int? vipDueDate;
|
|
||||||
int? vipPayType;
|
|
||||||
int? officialRole;
|
|
||||||
String? officialTitle;
|
|
||||||
String? officialDesc;
|
|
||||||
String? displayName;
|
|
||||||
|
|
||||||
factory Upper.fromJson(Map<String, dynamic> json) => Upper(
|
|
||||||
mid: json["mid"],
|
|
||||||
name: json["name"],
|
|
||||||
face: json["face"],
|
|
||||||
followed: json["followed"],
|
|
||||||
fans: json["fans"],
|
|
||||||
vipType: json["vip_type"],
|
|
||||||
vipStatue: json["vip_statue"],
|
|
||||||
vipDueDate: json["vip_due_date"],
|
|
||||||
vipPayType: json["vip_pay_type"],
|
|
||||||
officialRole: json["official_role"],
|
|
||||||
officialTitle: json["official_title"],
|
|
||||||
officialDesc: json["official_desc"],
|
|
||||||
displayName: json["display_name"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
final List aoOutputList = [
|
|
||||||
{'title': 'audiotrack,opensles', 'value': '0'},
|
|
||||||
{'title': 'opensles,audiotrack', 'value': '1'},
|
|
||||||
{'title': 'audiotrack', 'value': '2'},
|
|
||||||
{'title': 'opensles', 'value': '3'},
|
|
||||||
];
|
|
||||||
@ -39,14 +39,6 @@ extension VideoQualityCode on VideoQuality {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int? toCode(VideoQuality quality) {
|
|
||||||
final index = VideoQuality.values.indexOf(quality);
|
|
||||||
if (index != -1 && index < _codeList.length) {
|
|
||||||
return _codeList[index];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension VideoQualityDesc on VideoQuality {
|
extension VideoQualityDesc on VideoQuality {
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import '../../common/subtitle_type.dart';
|
||||||
|
|
||||||
class SubTitlteModel {
|
class SubTitlteModel {
|
||||||
SubTitlteModel({
|
SubTitlteModel({
|
||||||
this.aid,
|
this.aid,
|
||||||
@ -75,6 +78,11 @@ class SubTitlteItemModel {
|
|||||||
aiType: json["ai_type"],
|
aiType: json["ai_type"],
|
||||||
aiStatus: json["ai_status"],
|
aiStatus: json["ai_status"],
|
||||||
title: json["lan_doc"],
|
title: json["lan_doc"],
|
||||||
|
code: SubtitleType.values
|
||||||
|
.firstWhereOrNull(
|
||||||
|
(element) => element.id.toString() == json["lan"])
|
||||||
|
?.index ??
|
||||||
|
-1,
|
||||||
content: '',
|
content: '',
|
||||||
body: [],
|
body: [],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -67,7 +67,6 @@ class VideoDetailData {
|
|||||||
String? likeIcon;
|
String? likeIcon;
|
||||||
bool? needJumpBv;
|
bool? needJumpBv;
|
||||||
String? epId;
|
String? epId;
|
||||||
List<Staff>? staff;
|
|
||||||
|
|
||||||
VideoDetailData({
|
VideoDetailData({
|
||||||
this.bvid,
|
this.bvid,
|
||||||
@ -104,7 +103,6 @@ class VideoDetailData {
|
|||||||
this.likeIcon,
|
this.likeIcon,
|
||||||
this.needJumpBv,
|
this.needJumpBv,
|
||||||
this.epId,
|
this.epId,
|
||||||
this.staff,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
VideoDetailData.fromJson(Map<String, dynamic> json) {
|
VideoDetailData.fromJson(Map<String, dynamic> json) {
|
||||||
@ -157,9 +155,6 @@ class VideoDetailData {
|
|||||||
if (json['redirect_url'] != null) {
|
if (json['redirect_url'] != null) {
|
||||||
epId = resolveEpId(json['redirect_url']);
|
epId = resolveEpId(json['redirect_url']);
|
||||||
}
|
}
|
||||||
staff = json["staff"] != null
|
|
||||||
? List<Staff>.from(json["staff"]!.map((e) => Staff.fromJson(e)))
|
|
||||||
: null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String resolveEpId(url) {
|
String resolveEpId(url) {
|
||||||
@ -382,7 +377,6 @@ class Part {
|
|||||||
String? weblink;
|
String? weblink;
|
||||||
Dimension? dimension;
|
Dimension? dimension;
|
||||||
String? firstFrame;
|
String? firstFrame;
|
||||||
String? cover;
|
|
||||||
|
|
||||||
Part({
|
Part({
|
||||||
this.cid,
|
this.cid,
|
||||||
@ -394,7 +388,6 @@ class Part {
|
|||||||
this.weblink,
|
this.weblink,
|
||||||
this.dimension,
|
this.dimension,
|
||||||
this.firstFrame,
|
this.firstFrame,
|
||||||
this.cover,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fromRawJson(String str) => Part.fromJson(json.decode(str));
|
fromRawJson(String str) => Part.fromJson(json.decode(str));
|
||||||
@ -412,8 +405,7 @@ class Part {
|
|||||||
dimension = json["dimension"] == null
|
dimension = json["dimension"] == null
|
||||||
? null
|
? null
|
||||||
: Dimension.fromJson(json["dimension"]);
|
: Dimension.fromJson(json["dimension"]);
|
||||||
firstFrame = json["first_frame"] ?? '';
|
firstFrame = json["first_frame"];
|
||||||
cover = json["first_frame"] ?? '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -637,7 +629,6 @@ class EpisodeItem {
|
|||||||
this.attribute,
|
this.attribute,
|
||||||
this.page,
|
this.page,
|
||||||
this.bvid,
|
this.bvid,
|
||||||
this.cover,
|
|
||||||
});
|
});
|
||||||
int? seasonId;
|
int? seasonId;
|
||||||
int? sectionId;
|
int? sectionId;
|
||||||
@ -648,7 +639,6 @@ class EpisodeItem {
|
|||||||
int? attribute;
|
int? attribute;
|
||||||
Part? page;
|
Part? page;
|
||||||
String? bvid;
|
String? bvid;
|
||||||
String? cover;
|
|
||||||
|
|
||||||
EpisodeItem.fromJson(Map<String, dynamic> json) {
|
EpisodeItem.fromJson(Map<String, dynamic> json) {
|
||||||
seasonId = json['season_id'];
|
seasonId = json['season_id'];
|
||||||
@ -660,46 +650,5 @@ class EpisodeItem {
|
|||||||
attribute = json['attribute'];
|
attribute = json['attribute'];
|
||||||
page = Part.fromJson(json['page']);
|
page = Part.fromJson(json['page']);
|
||||||
bvid = json['bvid'];
|
bvid = json['bvid'];
|
||||||
cover = json['arc']['pic'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Staff {
|
|
||||||
Staff({
|
|
||||||
this.mid,
|
|
||||||
this.title,
|
|
||||||
this.name,
|
|
||||||
this.face,
|
|
||||||
this.vip,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? mid;
|
|
||||||
String? title;
|
|
||||||
String? name;
|
|
||||||
String? face;
|
|
||||||
int? status;
|
|
||||||
Vip? vip;
|
|
||||||
|
|
||||||
Staff.fromJson(Map<String, dynamic> json) {
|
|
||||||
mid = json['mid'];
|
|
||||||
title = json['title'];
|
|
||||||
name = json['name'];
|
|
||||||
face = json['face'];
|
|
||||||
vip = Vip.fromJson(json['vip']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Vip {
|
|
||||||
Vip({
|
|
||||||
this.type,
|
|
||||||
this.status,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? type;
|
|
||||||
int? status;
|
|
||||||
|
|
||||||
Vip.fromJson(Map<String, dynamic> json) {
|
|
||||||
type = json['type'];
|
|
||||||
status = json['status'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -218,7 +218,7 @@ class AboutController extends GetxController {
|
|||||||
RxString currentVersion = ''.obs;
|
RxString currentVersion = ''.obs;
|
||||||
RxString remoteVersion = ''.obs;
|
RxString remoteVersion = ''.obs;
|
||||||
late LatestDataModel remoteAppInfo;
|
late LatestDataModel remoteAppInfo;
|
||||||
RxBool isUpdate = false.obs;
|
RxBool isUpdate = true.obs;
|
||||||
RxBool isLoading = true.obs;
|
RxBool isLoading = true.obs;
|
||||||
late LatestDataModel data;
|
late LatestDataModel data;
|
||||||
|
|
||||||
|
|||||||
@ -15,10 +15,6 @@ import 'package:pilipala/utils/id_utils.dart';
|
|||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
import '../../../common/pages_bottom_sheet.dart';
|
|
||||||
import '../../../models/common/video_episode_type.dart';
|
|
||||||
import '../../../utils/drawer.dart';
|
|
||||||
|
|
||||||
class BangumiIntroController extends GetxController {
|
class BangumiIntroController extends GetxController {
|
||||||
// 视频bvid
|
// 视频bvid
|
||||||
String bvid = Get.parameters['bvid']!;
|
String bvid = Get.parameters['bvid']!;
|
||||||
@ -56,7 +52,6 @@ class BangumiIntroController extends GetxController {
|
|||||||
RxMap followStatus = {}.obs;
|
RxMap followStatus = {}.obs;
|
||||||
int _tempThemeValue = -1;
|
int _tempThemeValue = -1;
|
||||||
var userInfo;
|
var userInfo;
|
||||||
PersistentBottomSheetController? bottomSheetController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -131,37 +126,51 @@ class BangumiIntroController extends GetxController {
|
|||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('选择投币个数'),
|
title: const Text('选择投币个数'),
|
||||||
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 24),
|
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
|
||||||
content: StatefulBuilder(builder: (context, StateSetter setState) {
|
content: StatefulBuilder(builder: (context, StateSetter setState) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [1, 2]
|
children: [
|
||||||
.map(
|
RadioListTile(
|
||||||
(e) => RadioListTile(
|
value: 1,
|
||||||
value: e,
|
title: const Text('1枚'),
|
||||||
title: Text('$e枚'),
|
groupValue: _tempThemeValue,
|
||||||
groupValue: _tempThemeValue,
|
onChanged: (value) {
|
||||||
onChanged: (value) async {
|
_tempThemeValue = value!;
|
||||||
_tempThemeValue = value!;
|
Get.appUpdate();
|
||||||
setState(() {});
|
},
|
||||||
var res = await VideoHttp.coinVideo(
|
),
|
||||||
bvid: bvid, multiply: _tempThemeValue);
|
RadioListTile(
|
||||||
if (res['status']) {
|
value: 2,
|
||||||
SmartDialog.showToast('投币成功 👏');
|
title: const Text('2枚'),
|
||||||
hasCoin.value = true;
|
groupValue: _tempThemeValue,
|
||||||
bangumiDetail.value.stat!['coins'] =
|
onChanged: (value) {
|
||||||
bangumiDetail.value.stat!['coins'] +
|
_tempThemeValue = value!;
|
||||||
_tempThemeValue;
|
Get.appUpdate();
|
||||||
} else {
|
},
|
||||||
SmartDialog.showToast(res['msg']);
|
),
|
||||||
}
|
],
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
actions: [
|
||||||
|
TextButton(onPressed: () => Get.back(), child: const Text('取消')),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var res = await VideoHttp.coinVideo(
|
||||||
|
bvid: bvid, multiply: _tempThemeValue);
|
||||||
|
if (res['status']) {
|
||||||
|
SmartDialog.showToast('投币成功 👏');
|
||||||
|
hasCoin.value = true;
|
||||||
|
bangumiDetail.value.stat!['coins'] =
|
||||||
|
bangumiDetail.value.stat!['coins'] + _tempThemeValue;
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
}
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: const Text('确定'),
|
||||||
|
)
|
||||||
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -215,18 +224,14 @@ class BangumiIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 修改分P或番剧分集
|
// 修改分P或番剧分集
|
||||||
Future changeSeasonOrbangu(bvid, cid, aid, cover) async {
|
Future changeSeasonOrbangu(bvid, cid, aid) async {
|
||||||
// 重新获取视频资源
|
// 重新获取视频资源
|
||||||
VideoDetailController videoDetailCtr =
|
VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
||||||
videoDetailCtr.bvid = bvid;
|
videoDetailCtr.bvid = bvid;
|
||||||
videoDetailCtr.cid.value = cid;
|
videoDetailCtr.cid.value = cid;
|
||||||
videoDetailCtr.danmakuCid.value = cid;
|
videoDetailCtr.danmakuCid.value = cid;
|
||||||
videoDetailCtr.oid.value = aid;
|
|
||||||
videoDetailCtr.cover.value = cover;
|
|
||||||
videoDetailCtr.queryVideoUrl();
|
videoDetailCtr.queryVideoUrl();
|
||||||
videoDetailCtr.getSubtitle();
|
|
||||||
videoDetailCtr.setSubtitleContent();
|
|
||||||
// 重新请求评论
|
// 重新请求评论
|
||||||
try {
|
try {
|
||||||
/// 未渲染回复组件时可能异常
|
/// 未渲染回复组件时可能异常
|
||||||
@ -284,36 +289,6 @@ class BangumiIntroController extends GetxController {
|
|||||||
int cid = episodes[nextIndex].cid!;
|
int cid = episodes[nextIndex].cid!;
|
||||||
String bvid = episodes[nextIndex].bvid!;
|
String bvid = episodes[nextIndex].bvid!;
|
||||||
int aid = episodes[nextIndex].aid!;
|
int aid = episodes[nextIndex].aid!;
|
||||||
String cover = episodes[nextIndex].cover!;
|
changeSeasonOrbangu(bvid, cid, aid);
|
||||||
changeSeasonOrbangu(bvid, cid, aid, cover);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 播放器底栏 选集 回调
|
|
||||||
void showEposideHandler() {
|
|
||||||
late List episodes = bangumiDetail.value.episodes!;
|
|
||||||
VideoEpidoesType dataType = VideoEpidoesType.bangumiEpisode;
|
|
||||||
if (episodes.isEmpty) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
VideoDetailController videoDetailCtr =
|
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
|
||||||
DrawerUtils.showRightDialog(
|
|
||||||
child: EpisodeBottomSheet(
|
|
||||||
episodes: episodes,
|
|
||||||
currentCid: videoDetailCtr.cid.value,
|
|
||||||
dataType: dataType,
|
|
||||||
context: Get.context!,
|
|
||||||
sheetHeight: Get.size.height,
|
|
||||||
isFullScreen: true,
|
|
||||||
changeFucCall: (item, index) {
|
|
||||||
changeSeasonOrbangu(item.bvid, item.cid, item.aid, item.cover);
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
},
|
|
||||||
).buildShowContent(Get.context!),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
hiddenEpisodeBottomSheet() {
|
|
||||||
bottomSheetController?.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,9 +138,6 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
cid = widget.cid!;
|
cid = widget.cid!;
|
||||||
videoDetailCtr.cid.listen((p0) {
|
videoDetailCtr.cid.listen((p0) {
|
||||||
cid = p0;
|
cid = p0;
|
||||||
if (!mounted) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -189,13 +186,12 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
Stack(
|
Stack(
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
width: 115,
|
width: 105,
|
||||||
height: 115 / 0.75,
|
height: 160,
|
||||||
src: widget.bangumiDetail!.cover!,
|
src: widget.bangumiDetail!.cover!,
|
||||||
),
|
),
|
||||||
PBadge(
|
PBadge(
|
||||||
text:
|
text: '评分 ${widget.bangumiDetail!.rating!['score']!}',
|
||||||
'评分 ${widget.bangumiDetail?.rating?['score']! ?? '暂无'}',
|
|
||||||
top: null,
|
top: null,
|
||||||
right: 6,
|
right: 6,
|
||||||
bottom: 6,
|
bottom: 6,
|
||||||
@ -208,7 +204,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => showIntroDetail(),
|
onTap: () => showIntroDetail(),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 115 / 0.75,
|
height: 158,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -255,11 +251,13 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
StatView(
|
StatView(
|
||||||
|
theme: 'gray',
|
||||||
view: widget.bangumiDetail!.stat!['views'],
|
view: widget.bangumiDetail!.stat!['views'],
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
StatDanMu(
|
StatDanMu(
|
||||||
|
theme: 'gray',
|
||||||
danmu: widget.bangumiDetail!.stat!['danmakus'],
|
danmu: widget.bangumiDetail!.stat!['danmakus'],
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
),
|
),
|
||||||
@ -319,12 +317,11 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
if (widget.bangumiDetail!.episodes!.isNotEmpty) ...[
|
if (widget.bangumiDetail!.episodes!.isNotEmpty) ...[
|
||||||
BangumiPanel(
|
BangumiPanel(
|
||||||
pages: widget.bangumiDetail!.episodes!,
|
pages: widget.bangumiDetail!.episodes!,
|
||||||
cid: cid! ?? widget.bangumiDetail!.episodes!.first.cid!,
|
cid: cid ?? widget.bangumiDetail!.episodes!.first.cid,
|
||||||
sheetHeight: sheetHeight,
|
sheetHeight: sheetHeight,
|
||||||
changeFuc: (bvid, cid, aid, cover) => bangumiIntroController
|
changeFuc: (bvid, cid, aid) =>
|
||||||
.changeSeasonOrbangu(bvid, cid, aid, cover),
|
bangumiIntroController.changeSeasonOrbangu(bvid, cid, aid),
|
||||||
bangumiDetail: bangumiIntroController.bangumiDetail.value,
|
bangumiDetail: bangumiIntroController.bangumiDetail.value,
|
||||||
bangumiIntroController: bangumiIntroController,
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -20,10 +20,10 @@ class IntroDetail extends StatelessWidget {
|
|||||||
sheetHeight = localCache.get('sheetHeight');
|
sheetHeight = localCache.get('sheetHeight');
|
||||||
TextStyle smallTitle = TextStyle(
|
TextStyle smallTitle = TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onBackground,
|
||||||
);
|
);
|
||||||
return Container(
|
return Container(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.background,
|
||||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
padding: const EdgeInsets.only(left: 14, right: 14),
|
||||||
height: sheetHeight,
|
height: sheetHeight,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -60,11 +60,13 @@ class IntroDetail extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
StatView(
|
StatView(
|
||||||
|
theme: 'gray',
|
||||||
view: bangumiDetail!.stat!['views'],
|
view: bangumiDetail!.stat!['views'],
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
StatDanMu(
|
StatDanMu(
|
||||||
|
theme: 'gray',
|
||||||
danmu: bangumiDetail!.stat!['danmakus'],
|
danmu: bangumiDetail!.stat!['danmakus'],
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
),
|
),
|
||||||
|
|||||||
@ -2,10 +2,13 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:easy_debounce/easy_throttle.dart';
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:nil/nil.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/utils/main_stream.dart';
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
|
import 'package:pilipala/pages/main/index.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'widgets/bangumu_card_v.dart';
|
import 'widgets/bangumu_card_v.dart';
|
||||||
@ -31,6 +34,10 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
scrollController = _bangumidController.scrollController;
|
scrollController = _bangumidController.scrollController;
|
||||||
|
StreamController<bool> mainStream =
|
||||||
|
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(
|
||||||
@ -42,7 +49,16 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
_bangumidController.onLoad();
|
_bangumidController.onLoad();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
handleScrollEvent(scrollController);
|
|
||||||
|
final ScrollDirection direction =
|
||||||
|
scrollController.position.userScrollDirection;
|
||||||
|
if (direction == ScrollDirection.forward) {
|
||||||
|
mainStream.add(true);
|
||||||
|
searchBarStream.add(true);
|
||||||
|
} else if (direction == ScrollDirection.reverse) {
|
||||||
|
mainStream.add(false);
|
||||||
|
searchBarStream.add(false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -96,8 +112,7 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Get.size.width / 3 / 0.75 +
|
height: 268,
|
||||||
MediaQuery.textScalerOf(context).scale(50.0),
|
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _futureBuilderFutureFollow,
|
future: _futureBuilderFutureFollow,
|
||||||
builder:
|
builder:
|
||||||
@ -118,6 +133,7 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return Container(
|
return Container(
|
||||||
width: Get.size.width / 3,
|
width: Get.size.width / 3,
|
||||||
|
height: 254,
|
||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
left: StyleString.safeSpace,
|
left: StyleString.safeSpace,
|
||||||
right: index ==
|
right: index ==
|
||||||
@ -141,10 +157,10 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox();
|
return nil;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox();
|
return nil;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -208,14 +224,14 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
crossAxisSpacing: StyleString.cardSpace,
|
crossAxisSpacing: StyleString.cardSpace,
|
||||||
// 列数
|
// 列数
|
||||||
crossAxisCount: 3,
|
crossAxisCount: 3,
|
||||||
mainAxisExtent: Get.size.width / 3 / 0.75 +
|
mainAxisExtent: Get.size.width / 3 / 0.65 +
|
||||||
MediaQuery.textScalerOf(context).scale(42.0),
|
MediaQuery.textScalerOf(context).scale(32.0),
|
||||||
),
|
),
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
return bangumiList!.isNotEmpty
|
return bangumiList!.isNotEmpty
|
||||||
? BangumiCardV(bangumiItem: bangumiList[index])
|
? BangumiCardV(bangumiItem: bangumiList[index])
|
||||||
: const SizedBox();
|
: nil;
|
||||||
},
|
},
|
||||||
childCount: bangumiList!.isNotEmpty ? bangumiList!.length : 10,
|
childCount: bangumiList!.isNotEmpty ? bangumiList!.length : 10,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -8,35 +6,31 @@ import 'package:pilipala/models/bangumi/info.dart';
|
|||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||||
import '../../../common/pages_bottom_sheet.dart';
|
|
||||||
import '../../../models/common/video_episode_type.dart';
|
|
||||||
import '../introduction/controller.dart';
|
|
||||||
|
|
||||||
class BangumiPanel extends StatefulWidget {
|
class BangumiPanel extends StatefulWidget {
|
||||||
const BangumiPanel({
|
const BangumiPanel({
|
||||||
super.key,
|
super.key,
|
||||||
required this.pages,
|
required this.pages,
|
||||||
required this.cid,
|
this.cid,
|
||||||
this.sheetHeight,
|
this.sheetHeight,
|
||||||
this.changeFuc,
|
this.changeFuc,
|
||||||
this.bangumiDetail,
|
this.bangumiDetail,
|
||||||
this.bangumiIntroController,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final List<EpisodeItem> pages;
|
final List<EpisodeItem> pages;
|
||||||
final int cid;
|
final int? cid;
|
||||||
final double? sheetHeight;
|
final double? sheetHeight;
|
||||||
final Function? changeFuc;
|
final Function? changeFuc;
|
||||||
final BangumiInfoModel? bangumiDetail;
|
final BangumiInfoModel? bangumiDetail;
|
||||||
final BangumiIntroController? bangumiIntroController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<BangumiPanel> createState() => _BangumiPanelState();
|
State<BangumiPanel> createState() => _BangumiPanelState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _BangumiPanelState extends State<BangumiPanel> {
|
class _BangumiPanelState extends State<BangumiPanel> {
|
||||||
late RxInt currentIndex = (-1).obs;
|
late int currentIndex;
|
||||||
final ScrollController listViewScrollCtr = ScrollController();
|
final ScrollController listViewScrollCtr = ScrollController();
|
||||||
|
final ScrollController listViewScrollCtr_2 = ScrollController();
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
dynamic userInfo;
|
dynamic userInfo;
|
||||||
// 默认未开通
|
// 默认未开通
|
||||||
@ -45,77 +39,169 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
String heroTag = Get.arguments['heroTag'];
|
String heroTag = Get.arguments['heroTag'];
|
||||||
late final VideoDetailController videoDetailCtr;
|
late final VideoDetailController videoDetailCtr;
|
||||||
final ItemScrollController itemScrollController = ItemScrollController();
|
final ItemScrollController itemScrollController = ItemScrollController();
|
||||||
late PersistentBottomSheetController? _bottomSheetController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
cid = widget.cid;
|
cid = widget.cid!;
|
||||||
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
currentIndex = widget.pages.indexWhere((e) => e.cid == cid);
|
||||||
currentIndex.value =
|
|
||||||
widget.pages.indexWhere((EpisodeItem e) => e.cid == cid);
|
|
||||||
scrollToIndex();
|
scrollToIndex();
|
||||||
videoDetailCtr.cid.listen((int p0) {
|
|
||||||
cid = p0;
|
|
||||||
currentIndex.value =
|
|
||||||
widget.pages.indexWhere((EpisodeItem e) => e.cid == cid);
|
|
||||||
scrollToIndex();
|
|
||||||
});
|
|
||||||
|
|
||||||
/// 获取大会员状态
|
|
||||||
userInfo = userInfoCache.get('userInfoCache');
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
if (userInfo != null) {
|
if (userInfo != null) {
|
||||||
vipStatus = userInfo.vipStatus;
|
vipStatus = userInfo.vipStatus;
|
||||||
}
|
}
|
||||||
|
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
||||||
|
|
||||||
|
videoDetailCtr.cid.listen((int p0) {
|
||||||
|
cid = p0;
|
||||||
|
setState(() {});
|
||||||
|
currentIndex = widget.pages.indexWhere((EpisodeItem e) => e.cid == cid);
|
||||||
|
scrollToIndex();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
listViewScrollCtr.dispose();
|
listViewScrollCtr.dispose();
|
||||||
|
listViewScrollCtr_2.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget buildPageListItem(
|
||||||
|
EpisodeItem page,
|
||||||
|
int index,
|
||||||
|
bool isCurrentIndex,
|
||||||
|
) {
|
||||||
|
Color primary = Theme.of(context).colorScheme.primary;
|
||||||
|
return ListTile(
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
setState(() {
|
||||||
|
changeFucCall(page, index);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
dense: false,
|
||||||
|
leading: isCurrentIndex
|
||||||
|
? Image.asset(
|
||||||
|
'assets/images/live.gif',
|
||||||
|
color: primary,
|
||||||
|
height: 12,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
title: Text(
|
||||||
|
'第${page.title}话 ${page.longTitle!}',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: isCurrentIndex
|
||||||
|
? primary
|
||||||
|
: Theme.of(context).colorScheme.onSurface,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: page.badge != null
|
||||||
|
? Text(
|
||||||
|
page.badge!,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showBangumiPanel() {
|
||||||
|
showBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return StatefulBuilder(
|
||||||
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
|
// await Future.delayed(const Duration(milliseconds: 200));
|
||||||
|
// listViewScrollCtr_2.animateTo(currentIndex * 56,
|
||||||
|
// duration: const Duration(milliseconds: 500),
|
||||||
|
// curve: Curves.easeInOut);
|
||||||
|
itemScrollController.jumpTo(index: currentIndex);
|
||||||
|
});
|
||||||
|
// 在这里使用 setState 更新状态
|
||||||
|
return Container(
|
||||||
|
height: widget.sheetHeight,
|
||||||
|
color: Theme.of(context).colorScheme.background,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
AppBar(
|
||||||
|
toolbarHeight: 45,
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
title: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'合集(${widget.pages.length})',
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
titleSpacing: 10,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Material(
|
||||||
|
child: ScrollablePositionedList.builder(
|
||||||
|
itemCount: widget.pages.length + 1,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
bool isLastItem = index == widget.pages.length;
|
||||||
|
bool isCurrentIndex = currentIndex == index;
|
||||||
|
return isLastItem
|
||||||
|
? SizedBox(
|
||||||
|
height:
|
||||||
|
MediaQuery.of(context).padding.bottom +
|
||||||
|
20,
|
||||||
|
)
|
||||||
|
: buildPageListItem(
|
||||||
|
widget.pages[index],
|
||||||
|
index,
|
||||||
|
isCurrentIndex,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemScrollController: itemScrollController,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void changeFucCall(item, i) async {
|
void changeFucCall(item, i) async {
|
||||||
if (item.badge != null && item.badge == '会员' && vipStatus != 1) {
|
if (item.badge != null && item.badge == '会员' && vipStatus != 1) {
|
||||||
SmartDialog.showToast('需要大会员');
|
SmartDialog.showToast('需要大会员');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
widget.changeFuc?.call(
|
await widget.changeFuc!(
|
||||||
item.bvid,
|
item.bvid,
|
||||||
item.cid,
|
item.cid,
|
||||||
item.aid,
|
item.aid,
|
||||||
item.cover,
|
|
||||||
);
|
);
|
||||||
try {
|
currentIndex = i;
|
||||||
if (_bottomSheetController != null) {
|
setState(() {});
|
||||||
_bottomSheetController?.close();
|
|
||||||
}
|
|
||||||
} catch (_) {}
|
|
||||||
currentIndex.value = i;
|
|
||||||
scrollToIndex();
|
scrollToIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollToIndex() {
|
void scrollToIndex() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
// 在回调函数中获取更新后的状态
|
// 在回调函数中获取更新后的状态
|
||||||
final double offset = min((currentIndex * 150) - 75,
|
listViewScrollCtr.animateTo(currentIndex * 150,
|
||||||
listViewScrollCtr.position.maxScrollExtent);
|
duration: const Duration(milliseconds: 500), curve: Curves.easeInOut);
|
||||||
if (currentIndex.value == 0) {
|
|
||||||
listViewScrollCtr.jumpTo(0);
|
|
||||||
} else {
|
|
||||||
listViewScrollCtr.animateTo(
|
|
||||||
offset,
|
|
||||||
duration: const Duration(milliseconds: 300),
|
|
||||||
curve: Curves.easeInOut,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Color primary = Theme.of(context).colorScheme.primary;
|
|
||||||
Color onSurface = Theme.of(context).colorScheme.onSurface;
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
@ -125,14 +211,12 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
children: [
|
children: [
|
||||||
const Text('选集 '),
|
const Text('选集 '),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Obx(
|
child: Text(
|
||||||
() => Text(
|
' 正在播放:${widget.pages[currentIndex].longTitle}',
|
||||||
' 正在播放:${widget.pages[currentIndex.value].longTitle}',
|
overflow: TextOverflow.ellipsis,
|
||||||
overflow: TextOverflow.ellipsis,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 12,
|
||||||
fontSize: 12,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -143,17 +227,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () => showBangumiPanel(),
|
||||||
widget.bangumiIntroController?.bottomSheetController =
|
|
||||||
_bottomSheetController = EpisodeBottomSheet(
|
|
||||||
currentCid: cid,
|
|
||||||
episodes: widget.pages,
|
|
||||||
changeFucCall: changeFucCall,
|
|
||||||
sheetHeight: widget.sheetHeight,
|
|
||||||
dataType: VideoEpidoesType.bangumiEpisode,
|
|
||||||
context: context,
|
|
||||||
).show(context);
|
|
||||||
},
|
|
||||||
child: Text(
|
child: Text(
|
||||||
'${widget.bangumiDetail!.newEp!['desc']}',
|
'${widget.bangumiDetail!.newEp!['desc']}',
|
||||||
style: const TextStyle(fontSize: 13),
|
style: const TextStyle(fontSize: 13),
|
||||||
@ -171,8 +245,6 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
itemCount: widget.pages.length,
|
itemCount: widget.pages.length,
|
||||||
itemExtent: 150,
|
itemExtent: 150,
|
||||||
itemBuilder: (BuildContext context, int i) {
|
itemBuilder: (BuildContext context, int i) {
|
||||||
var page = widget.pages[i];
|
|
||||||
bool isSelected = i == currentIndex.value;
|
|
||||||
return Container(
|
return Container(
|
||||||
width: 150,
|
width: 150,
|
||||||
margin: const EdgeInsets.only(right: 10),
|
margin: const EdgeInsets.only(right: 10),
|
||||||
@ -181,37 +253,42 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => changeFucCall(page, i),
|
onTap: () => changeFucCall(widget.pages[i], i),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 8,
|
vertical: 8, horizontal: 10),
|
||||||
horizontal: 10,
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
if (isSelected) ...<Widget>[
|
if (i == currentIndex) ...<Widget>[
|
||||||
Image.asset('assets/images/live.png',
|
Image.asset(
|
||||||
color: primary, height: 12),
|
'assets/images/live.png',
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
const SizedBox(width: 6)
|
const SizedBox(width: 6)
|
||||||
],
|
],
|
||||||
Text(
|
Text(
|
||||||
'第${i + 1}话',
|
'第${i + 1}话',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
color: isSelected ? primary : onSurface,
|
color: i == currentIndex
|
||||||
),
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSurface),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 2),
|
const SizedBox(width: 2),
|
||||||
if (page.badge != null) ...[
|
if (widget.pages[i].badge != null) ...[
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Text(
|
Text(
|
||||||
page.badge!,
|
widget.pages[i].badge!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: primary,
|
color:
|
||||||
|
Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@ -219,12 +296,13 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 3),
|
const SizedBox(height: 3),
|
||||||
Text(
|
Text(
|
||||||
page.longTitle!,
|
widget.pages[i].longTitle!,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
color: isSelected ? primary : onSurface,
|
color: i == currentIndex
|
||||||
),
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Theme.of(context).colorScheme.onSurface),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package: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/models/bangumi/list.dart';
|
import 'package:pilipala/http/search.dart';
|
||||||
import 'package:pilipala/utils/image_save.dart';
|
import 'package:pilipala/models/bangumi/info.dart';
|
||||||
import 'package:pilipala/utils/route_push.dart';
|
import 'package:pilipala/models/common/search_type.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
|
||||||
@ -13,67 +14,109 @@ class BangumiCardV extends StatelessWidget {
|
|||||||
const BangumiCardV({
|
const BangumiCardV({
|
||||||
super.key,
|
super.key,
|
||||||
required this.bangumiItem,
|
required this.bangumiItem,
|
||||||
|
this.longPress,
|
||||||
|
this.longPressEnd,
|
||||||
});
|
});
|
||||||
|
|
||||||
final BangumiListItemModel bangumiItem;
|
final bangumiItem;
|
||||||
|
final Function()? longPress;
|
||||||
|
final Function()? longPressEnd;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String heroTag = Utils.makeHeroTag(bangumiItem.mediaId);
|
String heroTag = Utils.makeHeroTag(bangumiItem.mediaId);
|
||||||
return InkWell(
|
return Card(
|
||||||
onTap: () {
|
elevation: 0,
|
||||||
RoutePush.bangumiPush(
|
clipBehavior: Clip.hardEdge,
|
||||||
bangumiItem.seasonId,
|
margin: EdgeInsets.zero,
|
||||||
null,
|
child: GestureDetector(
|
||||||
heroTag: heroTag,
|
// onLongPress: () {
|
||||||
);
|
// if (longPress != null) {
|
||||||
},
|
// longPress!();
|
||||||
onLongPress: () =>
|
// }
|
||||||
imageSaveDialog(context, bangumiItem, SmartDialog.dismiss),
|
// },
|
||||||
child: Column(
|
// onLongPressEnd: (details) {
|
||||||
children: [
|
// if (longPressEnd != null) {
|
||||||
ClipRRect(
|
// longPressEnd!();
|
||||||
borderRadius: const BorderRadius.all(
|
// }
|
||||||
StyleString.imgRadius,
|
// },
|
||||||
),
|
child: InkWell(
|
||||||
child: AspectRatio(
|
onTap: () async {
|
||||||
aspectRatio: 0.75,
|
final int seasonId = bangumiItem.seasonId;
|
||||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
SmartDialog.showLoading(msg: '获取中...');
|
||||||
final double maxWidth = boxConstraints.maxWidth;
|
final res = await SearchHttp.bangumiInfo(seasonId: seasonId);
|
||||||
final double maxHeight = boxConstraints.maxHeight;
|
SmartDialog.dismiss().then((value) {
|
||||||
return Stack(
|
if (res['status']) {
|
||||||
children: [
|
if (res['data'].episodes.isEmpty) {
|
||||||
Hero(
|
SmartDialog.showToast('资源加载失败');
|
||||||
tag: heroTag,
|
return;
|
||||||
child: NetworkImgLayer(
|
}
|
||||||
src: bangumiItem.cover,
|
EpisodeItem episode = res['data'].episodes.first;
|
||||||
width: maxWidth,
|
String bvid = episode.bvid!;
|
||||||
height: maxHeight,
|
int cid = episode.cid!;
|
||||||
),
|
String pic = episode.cover!;
|
||||||
),
|
String heroTag = Utils.makeHeroTag(cid);
|
||||||
if (bangumiItem.badge != null)
|
Get.toNamed(
|
||||||
PBadge(
|
'/video?bvid=$bvid&cid=$cid&seasonId=$seasonId',
|
||||||
text: bangumiItem.badge,
|
arguments: {
|
||||||
top: 6,
|
'pic': pic,
|
||||||
right: 6,
|
'heroTag': heroTag,
|
||||||
bottom: null,
|
'videoType': SearchType.media_bangumi,
|
||||||
left: null),
|
'bangumiItem': res['data'],
|
||||||
if (bangumiItem.order != null)
|
},
|
||||||
PBadge(
|
|
||||||
text: bangumiItem.order,
|
|
||||||
top: null,
|
|
||||||
right: null,
|
|
||||||
bottom: 6,
|
|
||||||
left: 6,
|
|
||||||
type: 'gray',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}),
|
}
|
||||||
),
|
});
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
topLeft: StyleString.imgRadius,
|
||||||
|
topRight: StyleString.imgRadius,
|
||||||
|
bottomLeft: StyleString.imgRadius,
|
||||||
|
bottomRight: StyleString.imgRadius,
|
||||||
|
),
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: 0.65,
|
||||||
|
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||||
|
final double maxWidth = boxConstraints.maxWidth;
|
||||||
|
final double maxHeight = boxConstraints.maxHeight;
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
Hero(
|
||||||
|
tag: heroTag,
|
||||||
|
child: NetworkImgLayer(
|
||||||
|
src: bangumiItem.cover,
|
||||||
|
width: maxWidth,
|
||||||
|
height: maxHeight,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (bangumiItem.badge != null)
|
||||||
|
PBadge(
|
||||||
|
text: bangumiItem.badge,
|
||||||
|
top: 6,
|
||||||
|
right: 6,
|
||||||
|
bottom: null,
|
||||||
|
left: null),
|
||||||
|
if (bangumiItem.order != null)
|
||||||
|
PBadge(
|
||||||
|
text: bangumiItem.order,
|
||||||
|
top: null,
|
||||||
|
right: null,
|
||||||
|
bottom: 6,
|
||||||
|
left: 6,
|
||||||
|
type: 'gray',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
BangumiContent(bangumiItem: bangumiItem)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
BangumiContent(bangumiItem: bangumiItem)
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class _BlackListPageState extends State<BlackListPage> {
|
|||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
title: Obx(
|
title: Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
'黑名单管理 ${_blackListController.total.value == 0 ? '' : '- ${_blackListController.total.value}'}',
|
'黑名单管理 - ${_blackListController.total.value}',
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -76,12 +76,8 @@ class _BlackListPageState extends State<BlackListPage> {
|
|||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
List<BlackListItem> list = _blackListController.blackList;
|
List<BlackListItem> list = _blackListController.blackList;
|
||||||
return Obx(
|
return Obx(
|
||||||
() => list.isEmpty
|
() => list.length == 1
|
||||||
? CustomScrollView(
|
? const SizedBox()
|
||||||
slivers: [
|
|
||||||
HttpError(errMsg: '你没有拉黑任何人哦~_~', fn: () => {})
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
itemCount: list.length,
|
itemCount: list.length,
|
||||||
|
|||||||
@ -2,9 +2,8 @@ import 'package:pilipala/http/danmaku.dart';
|
|||||||
import 'package:pilipala/models/danmaku/dm.pb.dart';
|
import 'package:pilipala/models/danmaku/dm.pb.dart';
|
||||||
|
|
||||||
class PlDanmakuController {
|
class PlDanmakuController {
|
||||||
PlDanmakuController(this.cid, this.type);
|
PlDanmakuController(this.cid);
|
||||||
final int cid;
|
final int cid;
|
||||||
final String type;
|
|
||||||
Map<int, List<DanmakuElem>> dmSegMap = {};
|
Map<int, List<DanmakuElem>> dmSegMap = {};
|
||||||
// 已请求的段落标记
|
// 已请求的段落标记
|
||||||
List<bool> requestedSeg = [];
|
List<bool> requestedSeg = [];
|
||||||
@ -18,11 +17,7 @@ class PlDanmakuController {
|
|||||||
int segCount = (videoDuration / segmentLength).ceil();
|
int segCount = (videoDuration / segmentLength).ceil();
|
||||||
requestedSeg = List<bool>.generate(segCount, (index) => false);
|
requestedSeg = List<bool>.generate(segCount, (index) => false);
|
||||||
}
|
}
|
||||||
try {
|
queryDanmaku(calcSegment(progress));
|
||||||
queryDanmaku(calcSegment(progress));
|
|
||||||
} catch (e) {
|
|
||||||
print(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
@ -36,18 +31,16 @@ class PlDanmakuController {
|
|||||||
|
|
||||||
void queryDanmaku(int segmentIndex) async {
|
void queryDanmaku(int segmentIndex) async {
|
||||||
assert(requestedSeg[segmentIndex] == false);
|
assert(requestedSeg[segmentIndex] == false);
|
||||||
if (requestedSeg.length > segmentIndex) {
|
requestedSeg[segmentIndex] = true;
|
||||||
requestedSeg[segmentIndex] = true;
|
final DmSegMobileReply result = await DanmakaHttp.queryDanmaku(
|
||||||
final DmSegMobileReply result = await DanmakaHttp.queryDanmaku(
|
cid: cid, segmentIndex: segmentIndex + 1);
|
||||||
cid: cid, segmentIndex: segmentIndex + 1);
|
if (result.elems.isNotEmpty) {
|
||||||
if (result.elems.isNotEmpty) {
|
for (var element in result.elems) {
|
||||||
for (var element in result.elems) {
|
int pos = element.progress ~/ 100; //每0.1秒存储一次
|
||||||
int pos = element.progress ~/ 100; //每0.1秒存储一次
|
if (dmSegMap[pos] == null) {
|
||||||
if (dmSegMap[pos] == null) {
|
dmSegMap[pos] = [];
|
||||||
dmSegMap[pos] = [];
|
|
||||||
}
|
|
||||||
dmSegMap[pos]!.add(element);
|
|
||||||
}
|
}
|
||||||
|
dmSegMap[pos]!.add(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,15 +12,11 @@ import 'package:pilipala/utils/storage.dart';
|
|||||||
class PlDanmaku extends StatefulWidget {
|
class PlDanmaku extends StatefulWidget {
|
||||||
final int cid;
|
final int cid;
|
||||||
final PlPlayerController playerController;
|
final PlPlayerController playerController;
|
||||||
final String type;
|
|
||||||
final Function(DanmakuController)? createdController;
|
|
||||||
|
|
||||||
const PlDanmaku({
|
const PlDanmaku({
|
||||||
super.key,
|
super.key,
|
||||||
required this.cid,
|
required this.cid,
|
||||||
required this.playerController,
|
required this.playerController,
|
||||||
this.type = 'video',
|
|
||||||
this.createdController,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -47,9 +43,9 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
enableShowDanmaku =
|
enableShowDanmaku =
|
||||||
setting.get(SettingBoxKey.enableShowDanmaku, defaultValue: false);
|
setting.get(SettingBoxKey.enableShowDanmaku, defaultValue: false);
|
||||||
_plDanmakuController = PlDanmakuController(widget.cid, widget.type);
|
_plDanmakuController = PlDanmakuController(widget.cid);
|
||||||
playerController = widget.playerController;
|
if (mounted) {
|
||||||
if (mounted && widget.type == 'video') {
|
playerController = widget.playerController;
|
||||||
if (enableShowDanmaku || playerController.isOpenDanmu.value) {
|
if (enableShowDanmaku || playerController.isOpenDanmu.value) {
|
||||||
_plDanmakuController.initiate(
|
_plDanmakuController.initiate(
|
||||||
playerController.duration.value.inMilliseconds,
|
playerController.duration.value.inMilliseconds,
|
||||||
@ -59,15 +55,13 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
..addStatusLister(playerListener)
|
..addStatusLister(playerListener)
|
||||||
..addPositionListener(videoPositionListen);
|
..addPositionListener(videoPositionListen);
|
||||||
}
|
}
|
||||||
if (widget.type == 'video') {
|
playerController.isOpenDanmu.listen((p0) {
|
||||||
playerController.isOpenDanmu.listen((p0) {
|
if (p0 && !_plDanmakuController.initiated) {
|
||||||
if (p0 && !_plDanmakuController.initiated) {
|
_plDanmakuController.initiate(
|
||||||
_plDanmakuController.initiate(
|
playerController.duration.value.inMilliseconds,
|
||||||
playerController.duration.value.inMilliseconds,
|
playerController.position.value.inMilliseconds);
|
||||||
playerController.position.value.inMilliseconds);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
blockTypes = playerController.blockTypes;
|
blockTypes = playerController.blockTypes;
|
||||||
showArea = playerController.showArea;
|
showArea = playerController.showArea;
|
||||||
opacityVal = playerController.opacityVal;
|
opacityVal = playerController.opacityVal;
|
||||||
@ -134,7 +128,6 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
child: DanmakuView(
|
child: DanmakuView(
|
||||||
createdController: (DanmakuController e) async {
|
createdController: (DanmakuController e) async {
|
||||||
playerController.danmakuController = _controller = e;
|
playerController.danmakuController = _controller = e;
|
||||||
widget.createdController?.call(e);
|
|
||||||
},
|
},
|
||||||
option: DanmakuOption(
|
option: DanmakuOption(
|
||||||
fontSize: 15 * fontSizeVal,
|
fontSize: 15 * fontSizeVal,
|
||||||
@ -143,7 +136,8 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
hideTop: blockTypes.contains(5),
|
hideTop: blockTypes.contains(5),
|
||||||
hideScroll: blockTypes.contains(2),
|
hideScroll: blockTypes.contains(2),
|
||||||
hideBottom: blockTypes.contains(4),
|
hideBottom: blockTypes.contains(4),
|
||||||
duration: danmakuDurationVal / playerController.playbackSpeed,
|
duration:
|
||||||
|
danmakuDurationVal / playerController.playbackSpeed,
|
||||||
strokeWidth: strokeWidth,
|
strokeWidth: strokeWidth,
|
||||||
// initDuration /
|
// initDuration /
|
||||||
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
|
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
|
||||||
|
|||||||
@ -1,111 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:dlna_dart/dlna.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class LiveDlnaPage extends StatefulWidget {
|
|
||||||
final String datasource;
|
|
||||||
|
|
||||||
const LiveDlnaPage({Key? key, required this.datasource}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<LiveDlnaPage> createState() => _LiveDlnaPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _LiveDlnaPageState extends State<LiveDlnaPage> {
|
|
||||||
final Map<String, DLNADevice> _deviceList = {};
|
|
||||||
final DLNAManager searcher = DLNAManager();
|
|
||||||
late final Timer stopSearchTimer;
|
|
||||||
String selectDeviceKey = '';
|
|
||||||
bool isSearching = true;
|
|
||||||
|
|
||||||
DLNADevice? get device => _deviceList[selectDeviceKey];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
stopSearchTimer = Timer(const Duration(seconds: 20), () {
|
|
||||||
setState(() => isSearching = false);
|
|
||||||
searcher.stop();
|
|
||||||
});
|
|
||||||
searcher.stop();
|
|
||||||
startSearch();
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
searcher.stop();
|
|
||||||
stopSearchTimer.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
void startSearch() async {
|
|
||||||
// clear old devices
|
|
||||||
isSearching = true;
|
|
||||||
selectDeviceKey = '';
|
|
||||||
_deviceList.clear();
|
|
||||||
setState(() {});
|
|
||||||
// start search server
|
|
||||||
final m = await searcher.start();
|
|
||||||
m.devices.stream.listen((deviceList) {
|
|
||||||
deviceList.forEach((key, value) {
|
|
||||||
_deviceList[key] = value;
|
|
||||||
});
|
|
||||||
setState(() {});
|
|
||||||
});
|
|
||||||
// close the server, the closed server can be start by call searcher.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectDevice(String key) {
|
|
||||||
if (selectDeviceKey.isNotEmpty) device?.pause();
|
|
||||||
|
|
||||||
selectDeviceKey = key;
|
|
||||||
device?.setUrl(widget.datasource);
|
|
||||||
device?.play();
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Widget cur;
|
|
||||||
if (isSearching && _deviceList.isEmpty) {
|
|
||||||
cur = const Center(child: CircularProgressIndicator());
|
|
||||||
} else if (_deviceList.isEmpty) {
|
|
||||||
cur = Center(
|
|
||||||
child: Text(
|
|
||||||
'没有找到设备',
|
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
cur = ListView(
|
|
||||||
children: _deviceList.keys
|
|
||||||
.map<Widget>((key) => ListTile(
|
|
||||||
contentPadding: const EdgeInsets.all(2),
|
|
||||||
title: Text(_deviceList[key]!.info.friendlyName),
|
|
||||||
subtitle: Text(key),
|
|
||||||
onTap: () => selectDevice(key),
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return AlertDialog(
|
|
||||||
title: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text('查找设备'),
|
|
||||||
IconButton(
|
|
||||||
onPressed: startSearch,
|
|
||||||
icon: const Icon(Icons.refresh_rounded),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
content: SizedBox(
|
|
||||||
height: 200,
|
|
||||||
width: 200,
|
|
||||||
child: cur,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -6,14 +6,16 @@ import 'package:get/get.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/dynamics.dart';
|
import 'package:pilipala/http/dynamics.dart';
|
||||||
import 'package:pilipala/http/search.dart';
|
import 'package:pilipala/http/search.dart';
|
||||||
|
import 'package:pilipala/models/bangumi/info.dart';
|
||||||
import 'package:pilipala/models/common/dynamics_type.dart';
|
import 'package:pilipala/models/common/dynamics_type.dart';
|
||||||
|
import 'package:pilipala/models/common/search_type.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/models/dynamics/up.dart';
|
import 'package:pilipala/models/dynamics/up.dart';
|
||||||
import 'package:pilipala/models/live/item.dart';
|
import 'package:pilipala/models/live/item.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';
|
||||||
import 'package:pilipala/utils/route_push.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class DynamicsController extends GetxController {
|
class DynamicsController extends GetxController {
|
||||||
int page = 1;
|
int page = 1;
|
||||||
@ -68,7 +70,7 @@ class DynamicsController extends GetxController {
|
|||||||
|
|
||||||
Future queryFollowDynamic({type = 'init'}) async {
|
Future queryFollowDynamic({type = 'init'}) async {
|
||||||
if (!userLogin.value) {
|
if (!userLogin.value) {
|
||||||
return {'status': false, 'msg': '账号未登录', 'code': -101};
|
return {'status': false, 'msg': '账号未登录'};
|
||||||
}
|
}
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
dynamicsList.clear();
|
dynamicsList.clear();
|
||||||
@ -146,26 +148,20 @@ class DynamicsController extends GetxController {
|
|||||||
/// 专栏文章查看
|
/// 专栏文章查看
|
||||||
case 'DYNAMIC_TYPE_ARTICLE':
|
case 'DYNAMIC_TYPE_ARTICLE':
|
||||||
String title = item.modules.moduleDynamic.major.opus.title;
|
String title = item.modules.moduleDynamic.major.opus.title;
|
||||||
String jumpUrl = item.modules.moduleDynamic.major.opus.jumpUrl;
|
String url = item.modules.moduleDynamic.major.opus.jumpUrl;
|
||||||
String url =
|
if (url.contains('opus') || url.contains('read')) {
|
||||||
jumpUrl.startsWith('//') ? jumpUrl.split('//').last : jumpUrl;
|
|
||||||
if (jumpUrl.contains('opus') || jumpUrl.contains('read')) {
|
|
||||||
RegExp digitRegExp = RegExp(r'\d+');
|
RegExp digitRegExp = RegExp(r'\d+');
|
||||||
Iterable<Match> matches = digitRegExp.allMatches(jumpUrl);
|
Iterable<Match> matches = digitRegExp.allMatches(url);
|
||||||
String number = matches.first.group(0)!;
|
String number = matches.first.group(0)!;
|
||||||
if (jumpUrl.contains('read')) {
|
if (url.contains('read')) {
|
||||||
Get.toNamed('/read', parameters: {
|
number = 'cv$number';
|
||||||
'title': title,
|
|
||||||
'id': number,
|
|
||||||
'articleType': url.split('/')[1]
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Get.toNamed('/opus', parameters: {
|
|
||||||
'title': title,
|
|
||||||
'id': number,
|
|
||||||
'articleType': 'opus'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
Get.toNamed('/htmlRender', parameters: {
|
||||||
|
'url': url.startsWith('//') ? url.split('//').last : url,
|
||||||
|
'title': title,
|
||||||
|
'id': number,
|
||||||
|
'dynamicType': url.split('//').last.split('/')[1]
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/webview',
|
'/webview',
|
||||||
@ -224,7 +220,25 @@ class DynamicsController extends GetxController {
|
|||||||
print('DYNAMIC_TYPE_PGC_UNION 番剧');
|
print('DYNAMIC_TYPE_PGC_UNION 番剧');
|
||||||
DynamicArchiveModel pgc = item.modules.moduleDynamic.major.pgc;
|
DynamicArchiveModel pgc = item.modules.moduleDynamic.major.pgc;
|
||||||
if (pgc.epid != null) {
|
if (pgc.epid != null) {
|
||||||
RoutePush.bangumiPush(null, pgc.epid);
|
SmartDialog.showLoading(msg: '获取中...');
|
||||||
|
var res = await SearchHttp.bangumiInfo(epId: pgc.epid);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
if (res['status']) {
|
||||||
|
EpisodeItem episode = res['data'].episodes.first;
|
||||||
|
String bvid = episode.bvid!;
|
||||||
|
int cid = episode.cid!;
|
||||||
|
String pic = episode.cover!;
|
||||||
|
String heroTag = Utils.makeHeroTag(cid);
|
||||||
|
Get.toNamed(
|
||||||
|
'/video?bvid=$bvid&cid=$cid&seasonId=${res['data'].seasonId}',
|
||||||
|
arguments: {
|
||||||
|
'pic': pic,
|
||||||
|
'heroTag': heroTag,
|
||||||
|
'videoType': SearchType.media_bangumi,
|
||||||
|
'bangumiItem': res['data'],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -232,7 +246,7 @@ class DynamicsController extends GetxController {
|
|||||||
|
|
||||||
Future queryFollowUp({type = 'init'}) async {
|
Future queryFollowUp({type = 'init'}) async {
|
||||||
if (!userLogin.value) {
|
if (!userLogin.value) {
|
||||||
return {'status': false, 'msg': '账号未登录', 'code': -101};
|
return {'status': false, 'msg': '账号未登录'};
|
||||||
}
|
}
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
upData.value.upList = <UpItem>[];
|
upData.value.upList = <UpItem>[];
|
||||||
@ -285,11 +299,4 @@ class DynamicsController extends GetxController {
|
|||||||
dynamicsList.value = <DynamicItemModel>[];
|
dynamicsList.value = <DynamicItemModel>[];
|
||||||
queryFollowDynamic();
|
queryFollowDynamic();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击up主
|
|
||||||
void onTapUp(data) {
|
|
||||||
mid.value = data.mid;
|
|
||||||
upInfo.value = data;
|
|
||||||
onSelectUp(data.mid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user