Compare commits
404 Commits
feature-ca
...
feature-hi
Author | SHA1 | Date | |
---|---|---|---|
af1163f6e0 | |||
fb3be848b4 | |||
7d7df17317 | |||
aae08d0688 | |||
9fe5b78cfa | |||
6b028c36af | |||
92c385ff58 | |||
463ee1d5b5 | |||
0a416c95bc | |||
3d09d80007 | |||
fffa15faa3 | |||
d6b972a8ab | |||
d6fd299395 | |||
1953653044 | |||
9faa625d52 | |||
955d8f5401 | |||
1f75a7e781 | |||
2cd8ab7d27 | |||
7e7bb1f43a | |||
a925ef63eb | |||
f8326e7cb5 | |||
02d2598d01 | |||
862ccea879 | |||
031d57e1fd | |||
77b509fd17 | |||
4db5a950f3 | |||
c9327c97e5 | |||
8ff387d54a | |||
11e907d74b | |||
6298711528 | |||
72f1a82650 | |||
b5a46d1be0 | |||
7b15f19895 | |||
14338dc33d | |||
c216c9bd65 | |||
3701fdef97 | |||
59641f0216 | |||
4dbcd2e0ec | |||
6d276fce4c | |||
0f0546ae59 | |||
710361caea | |||
00b81b194f | |||
734db176bf | |||
c23fe9c2bf | |||
79fcd017ab | |||
64292d523f | |||
42ed67e03f | |||
af96d16062 | |||
12c299685b | |||
1182a58cb4 | |||
e04a7e5702 | |||
e9dc6f7fdb | |||
25d1ccc87a | |||
33d28f51d1 | |||
a37f3b8b5b | |||
a57f5e8b2f | |||
beb640ac83 | |||
1b54f07bc3 | |||
fca0588377 | |||
4865948609 | |||
09eb180fc7 | |||
3fab47780b | |||
453cbd7b1c | |||
0bf2326c73 | |||
2985c624ab | |||
32cbc2759e | |||
13c77957fe | |||
f382c8f377 | |||
491bc87251 | |||
b13d7b475b | |||
5e8d9b524b | |||
606f1b5c64 | |||
c4fec14517 | |||
f368ef83ee | |||
357133fa97 | |||
337cdafef3 | |||
bc74e32c10 | |||
a5558de872 | |||
73693c5bbb | |||
2ad9c3c993 | |||
cab74cff17 | |||
a161df2c7b | |||
4def3ffb80 | |||
da2bbeedff | |||
70317f92e2 | |||
bc9ea43cd2 | |||
882957e2f8 | |||
d3766ae31b | |||
641cf4ebb3 | |||
99e6abdad9 | |||
1eb2d23fb9 | |||
98aaca286b | |||
dc1edf7e73 | |||
31405750e6 | |||
6fdfcb888d | |||
3ece2bb173 | |||
b7b75e956f | |||
bf37c33291 | |||
06fb3e8d2f | |||
504be6fbda | |||
df4539a035 | |||
a3e1fd4e91 | |||
f41bb02bae | |||
105a29f311 | |||
3bf6136bc6 | |||
ab24da5f55 | |||
ed0b43eff1 | |||
ab9ae3a481 | |||
d728b1fb6d | |||
12e947ef84 | |||
3fad86e7e3 | |||
fea70011cb | |||
32cdb27f7c | |||
eb4435045b | |||
f1b829cec1 | |||
b248158e62 | |||
83b0ff02e4 | |||
8109314aaf | |||
c4b3446956 | |||
d804d95d78 | |||
234dfe9d64 | |||
c20df8fd81 | |||
19f0b1b28f | |||
481fa0d934 | |||
caca16a957 | |||
602d795909 | |||
800f714f4a | |||
75f569cb79 | |||
0e888537e8 | |||
a3ce15bd9e | |||
40f94e7ace | |||
370dcaf419 | |||
f81f348a3e | |||
4191cafe78 | |||
ae33cbf7ca | |||
fca7c36203 | |||
5fc783ebc2 | |||
98122aeaae | |||
f0d8e2a122 | |||
f815affff9 | |||
fce701090a | |||
d6da2a8a47 | |||
b3e162c8d3 | |||
e5eae93a78 | |||
962dcca6d4 | |||
be56fb721f | |||
ce1c80fd86 | |||
33ef18ef1d | |||
ba61e38c9b | |||
0b0db1a2b1 | |||
a9d73a9f1b | |||
0b5397ec00 | |||
466214b26a | |||
699be4125b | |||
45cc46d6d6 | |||
3f9fcabc2d | |||
65d2bfd844 | |||
4642c2a847 | |||
04186cdd5b | |||
40cc4e0dd1 | |||
95bc4a9f46 | |||
3bf3fd9a46 | |||
83ad11402f | |||
cfeb0588c1 | |||
381e832f3c | |||
6c20a434ed | |||
fc2da3ce57 | |||
a3abed0a03 | |||
db03cdd442 | |||
542975d0ec | |||
ee368d348d | |||
835ea0a9ff | |||
89501d3daa | |||
90c0256766 | |||
c2767486f5 | |||
e2489ef0e3 | |||
b2a4c54565 | |||
bf071ea9e1 | |||
f8a8c0967a | |||
078e4716b4 | |||
4da6667b81 | |||
e2befb11ff | |||
cb0ff334b3 | |||
e536f58ff4 | |||
d9992663d8 | |||
b1a05c5c27 | |||
02cc164635 | |||
35dc94014c | |||
5746b85b27 | |||
740d5f1ddd | |||
a0f92df5b5 | |||
fce96d4976 | |||
dd6c537135 | |||
bcf94e287a | |||
841d0f25f5 | |||
4811dc5ba5 | |||
41af6c799b | |||
e8f63f6114 | |||
d1e8068e51 | |||
6de9b1977c | |||
3c0f54bfd7 | |||
3d2c6a122a | |||
8950658f08 | |||
7a78729a44 | |||
03e5e22fef | |||
aa93ce0b89 | |||
0c365ad049 | |||
3d5c578fef | |||
0a22f0f543 | |||
5bf7b69d79 | |||
d57f84a1d7 | |||
32b2f0ceff | |||
bae871cfa1 | |||
d95fe9fe14 | |||
eb006e4c55 | |||
cb88d0c9ae | |||
3efad736ae | |||
42ad959155 | |||
cdf800c49f | |||
569277572a | |||
19b84571c1 | |||
0812b8339e | |||
b817a0c807 | |||
3da70d7e27 | |||
5e59db85be | |||
77477ff4dd | |||
89026e671c | |||
1c8e7e53a5 | |||
b264427be6 | |||
d5134f972d | |||
e2fd01a6d5 | |||
289cc99bc2 | |||
3d5ebe7e99 | |||
d9964d37a4 | |||
5da39a9c52 | |||
44a162762c | |||
d0f036ec35 | |||
10b928474b | |||
94f3b7c1e4 | |||
fb8b2de115 | |||
0d5d33a365 | |||
c39e91073b | |||
d258474a5a | |||
b0c56feef5 | |||
191472d0c4 | |||
40c666e3d1 | |||
63d600070b | |||
ebdeec6730 | |||
ee2a273d8b | |||
083739e562 | |||
71ccb9c0e5 | |||
4a5f4ca2ca | |||
78ade4a193 | |||
ae14653e72 | |||
01ac2c13e1 | |||
9e471b83d9 | |||
a560d66567 | |||
80b39daaff | |||
fb32388536 | |||
5f92a0c293 | |||
3de009ac43 | |||
b29256f598 | |||
e7cf472a0f | |||
03c59d23b8 | |||
b6f805f0e4 | |||
e23c2469ed | |||
387c799de1 | |||
230dd81342 | |||
47bdfec8c2 | |||
6a844da259 | |||
18bb58d293 | |||
045186b3c8 | |||
b531599893 | |||
1da84508d8 | |||
4c44fab217 | |||
5c3d438a7e | |||
92a8efdee1 | |||
eb1e2ca5f4 | |||
5b1022628c | |||
33f61ac0fa | |||
0b349e102e | |||
81371c5a31 | |||
85a59e11b9 | |||
e24ccc16fa | |||
89a43b1285 | |||
ea8af28828 | |||
8a2c023343 | |||
a86fe76e59 | |||
d703e38c3f | |||
9e93b50860 | |||
9907967a0a | |||
331969cc8d | |||
7157f89245 | |||
163bb3c8da | |||
33f71c62df | |||
365c367cc7 | |||
7ea95e550b | |||
699361e04c | |||
e835821f3c | |||
76d5f6333e | |||
91899a9537 | |||
5591bb3dbf | |||
1adbdf127f | |||
8169f5739c | |||
127c6734f8 | |||
a78ce4f6d4 | |||
22a2628513 | |||
e972d17f1c | |||
e603942b5f | |||
0c4bad406e | |||
791047753d | |||
3784f1f87b | |||
c0162892ef | |||
10d2995429 | |||
b0d8f5d0b6 | |||
a64a49df22 | |||
349de75dfd | |||
1014c26d29 | |||
d1bacf8950 | |||
0595648f4c | |||
23c8b34189 | |||
932be48125 | |||
791eed8a01 | |||
e791210039 | |||
01fa3c1cb3 | |||
9663278916 | |||
1b03f3f31f | |||
a73f2974e1 | |||
bf8ae0f317 | |||
545def36e6 | |||
aaeecc9e53 | |||
16895b5c32 | |||
a68c04001b | |||
1dd70f482f | |||
103423abf7 | |||
569184a507 | |||
e052c6eafe | |||
dad4a28eb8 | |||
7428cde108 | |||
9e40e162ac | |||
27c954ec95 | |||
ec98e5c73c | |||
538b3d88aa | |||
aa4e251295 | |||
32f84dc703 | |||
c8e157b2d6 | |||
9122dd7f3a | |||
41ddeab41a | |||
5ca841de4e | |||
ca6091b90d | |||
5169bc360c | |||
4673f6dc5b | |||
5da6f2b021 | |||
53ce81673b | |||
e991f36853 | |||
211b7812de | |||
70cf27789f | |||
931a513ac5 | |||
c4bf7d3a3b | |||
b9cfcf9c9e | |||
a418f457f5 | |||
83e68c8ee3 | |||
d26066ff84 | |||
4000e1b9dc | |||
02bdb46625 | |||
96737ded5b | |||
6654094480 | |||
0cc25203b1 | |||
9294c8bcdf | |||
8f661337f5 | |||
db6662c980 | |||
2dc7cf28c9 | |||
c9fd6304fd | |||
4d1e4511a3 | |||
449aa69033 | |||
5fa32f1e2b | |||
71bb4b30d2 | |||
8b0cb4c909 | |||
79729e4b30 | |||
7cf9e66a5b | |||
917cff6311 | |||
7c120aa0cc | |||
2c7ce60f42 | |||
e4ebe6e145 | |||
5d0ca3f84c | |||
49dfb2605c | |||
cfddcd79bd | |||
a07a1697c2 | |||
21259e260d | |||
438b392cfc | |||
ac69896f9d | |||
f5263b090a | |||
bde7e35623 | |||
a0488f2c75 | |||
e8f7995b32 | |||
042a0a848d | |||
a98d8537c7 | |||
8ebb4cc70e | |||
fa8fd42e9a | |||
aa94bf27ff | |||
a2524e0a60 | |||
9a9644c3eb | |||
d0f8d55c9f | |||
367d8b844a |
208
.github/workflows/beta_ci.yml
vendored
Normal file
208
.github/workflows/beta_ci.yml
vendored
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
name: Pilipala Beta
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
paths-ignore:
|
||||||
|
- "**.md"
|
||||||
|
- "**.txt"
|
||||||
|
- ".github/**"
|
||||||
|
- ".idea/**"
|
||||||
|
- "!.github/workflows/**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update_version:
|
||||||
|
name: Read and update version
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
# 定义输出变量 version,以便在其他job中引用
|
||||||
|
new_version: ${{ steps.version.outputs.new_version }}
|
||||||
|
last_commit: ${{ steps.get-last-commit.outputs.last_commit }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.ref_name }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: 获取first parent commit次数
|
||||||
|
id: get-first-parent-commit-count
|
||||||
|
run: |
|
||||||
|
version=$(yq e .version pubspec.yaml | cut -d "+" -f 1)
|
||||||
|
recent_release_tag=$(git tag -l | grep $version | egrep -v "[-|+]" || true)
|
||||||
|
if [[ "x$recent_release_tag" == "x" ]]; then
|
||||||
|
echo "当前版本tag不存在,请手动生成tag."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
git log --oneline --first-parent $recent_release_tag..HEAD
|
||||||
|
first_parent_commit_count=$(git rev-list --first-parent --count $recent_release_tag..HEAD)
|
||||||
|
echo "count=$first_parent_commit_count" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: 获取最后一次提交
|
||||||
|
id: get-last-commit
|
||||||
|
run: |
|
||||||
|
last_commit=$(git log -1 --pretty="%h %s" --first-parent)
|
||||||
|
echo "last_commit=$last_commit" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: 更新版本号
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
# 读取版本号
|
||||||
|
VERSION=$(yq e .version pubspec.yaml | cut -d "+" -f 1)
|
||||||
|
|
||||||
|
# 获取GitHub Actions的run_number
|
||||||
|
#RUN_NUMBER=${{ github.run_number }}
|
||||||
|
|
||||||
|
# 构建新版本号
|
||||||
|
NEW_VERSION=$VERSION-beta.${{ steps.get-first-parent-commit-count.outputs.count }}
|
||||||
|
|
||||||
|
# 输出新版本号
|
||||||
|
echo "New version: $NEW_VERSION"
|
||||||
|
|
||||||
|
# 设置新版本号为输出变量
|
||||||
|
echo "new_version=$NEW_VERSION" >>$GITHUB_OUTPUT
|
||||||
|
|
||||||
|
android:
|
||||||
|
name: Build CI (Android)
|
||||||
|
needs: update_version
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.ref_name }}
|
||||||
|
|
||||||
|
- name: 构建Java环境
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: "zulu"
|
||||||
|
java-version: "17"
|
||||||
|
token: ${{secrets.GIT_TOKEN}}
|
||||||
|
|
||||||
|
- name: 检查缓存
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: cache-flutter
|
||||||
|
with:
|
||||||
|
path: /root/flutter-sdk
|
||||||
|
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
|
||||||
|
|
||||||
|
- name: 安装Flutter
|
||||||
|
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||||
|
uses: subosito/flutter-action@v2
|
||||||
|
with:
|
||||||
|
flutter-version: 3.16.5
|
||||||
|
channel: any
|
||||||
|
|
||||||
|
- name: 下载项目依赖
|
||||||
|
run: flutter pub get
|
||||||
|
|
||||||
|
- name: 解码生成 jks
|
||||||
|
run: echo $KEYSTORE_BASE64 | base64 -di > android/app/vvex.jks
|
||||||
|
env:
|
||||||
|
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||||
|
|
||||||
|
- name: 更新版本号
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
# 更新pubspec.yaml文件中的版本号
|
||||||
|
sed -i "s/version: .*+/version: ${{ needs.update_version.outputs.new_version }}+/g" pubspec.yaml
|
||||||
|
|
||||||
|
- name: flutter build apk
|
||||||
|
run: flutter build apk --release --split-per-abi
|
||||||
|
env:
|
||||||
|
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||||
|
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||||
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
|
||||||
|
|
||||||
|
- name: 重命名应用
|
||||||
|
run: |
|
||||||
|
for file in build/app/outputs/flutter-apk/app-*.apk; do
|
||||||
|
if [[ $file =~ app-(.?*)release.apk ]]; then
|
||||||
|
new_file_name="build/app/outputs/flutter-apk/Pili-${BASH_REMATCH[1]}v${{ needs.update_version.outputs.new_version }}.apk"
|
||||||
|
mv "$file" "$new_file_name"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: 上传
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: Pilipala-Beta
|
||||||
|
path: |
|
||||||
|
build/app/outputs/flutter-apk/Pili-*.apk
|
||||||
|
|
||||||
|
iOS:
|
||||||
|
name: Build CI (iOS)
|
||||||
|
needs: update_version
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.ref_name }}
|
||||||
|
|
||||||
|
- name: 安装Flutter
|
||||||
|
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||||
|
uses: subosito/flutter-action@v2.10.0
|
||||||
|
with:
|
||||||
|
cache: true
|
||||||
|
flutter-version: 3.16.5
|
||||||
|
|
||||||
|
- name: 更新版本号
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
# 更新pubspec.yaml文件中的版本号
|
||||||
|
sed -i "" "s/version: .*+/version: ${{ needs.update_version.outputs.new_version }}+/g" pubspec.yaml
|
||||||
|
|
||||||
|
- name: flutter build ipa
|
||||||
|
run: |
|
||||||
|
flutter build ios --release --no-codesign
|
||||||
|
ln -sf ./build/ios/iphoneos Payload
|
||||||
|
zip -r9 app.ipa Payload/runner.app
|
||||||
|
|
||||||
|
- name: 重命名应用
|
||||||
|
run: |
|
||||||
|
DATE=${{ steps.date.outputs.date }}
|
||||||
|
for file in app.ipa; do
|
||||||
|
new_file_name="build/Pili-v${{ needs.update_version.outputs.new_version }}.ipa"
|
||||||
|
mv "$file" "$new_file_name"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: 上传
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
if-no-files-found: error
|
||||||
|
name: Pilipala-Beta
|
||||||
|
path: |
|
||||||
|
build/Pili-*.ipa
|
||||||
|
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs:
|
||||||
|
- update_version
|
||||||
|
- android
|
||||||
|
- iOS
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: Pilipala-Beta
|
||||||
|
path: ./Pilipala-Beta
|
||||||
|
|
||||||
|
- name: 发送到Telegram频道
|
||||||
|
uses: xireiki/channel-post@v1.0.7
|
||||||
|
with:
|
||||||
|
bot_token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
chat_id: ${{ secrets.CHAT_ID }}
|
||||||
|
large_file: true
|
||||||
|
api_id: ${{ secrets.TELEGRAM_API_ID }}
|
||||||
|
api_hash: ${{ secrets.TELEGRAM_API_HASH }}
|
||||||
|
method: sendFile
|
||||||
|
path: Pilipala-Beta/*
|
||||||
|
parse_mode: Markdown
|
||||||
|
context: "*Beta版本: v${{ needs.update_version.outputs.new_version }}*\n更新内容: [${{ needs.update_version.outputs.last_commit }}](${{ github.event.head_commit.url }})"
|
84
.github/workflows/main.yml
vendored
84
.github/workflows/main.yml
vendored
@ -1,84 +0,0 @@
|
|||||||
name: build_apk
|
|
||||||
|
|
||||||
# action事件触发
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
# push tag时触发
|
|
||||||
tags:
|
|
||||||
- 'v*.*.*'
|
|
||||||
|
|
||||||
# 可以有多个jobs
|
|
||||||
jobs:
|
|
||||||
build_apk:
|
|
||||||
# 运行环境 ubuntu-latest window-latest mac-latest
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
# 每个jobs中可以有多个steps
|
|
||||||
steps:
|
|
||||||
- name: 代码迁出
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: 构建Java环境
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: "zulu"
|
|
||||||
java-version: "17"
|
|
||||||
token: ${{secrets.GIT_TOKEN}}
|
|
||||||
|
|
||||||
- name: 检查缓存
|
|
||||||
uses: actions/cache@v2
|
|
||||||
id: cache-flutter
|
|
||||||
with:
|
|
||||||
path: /root/flutter-sdk # Flutter SDK 的路径
|
|
||||||
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
|
|
||||||
|
|
||||||
- name: 安装Flutter
|
|
||||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
|
||||||
uses: subosito/flutter-action@v2
|
|
||||||
with:
|
|
||||||
flutter-version: 3.16.4
|
|
||||||
channel: any
|
|
||||||
|
|
||||||
- name: 下载项目依赖
|
|
||||||
run: flutter pub get
|
|
||||||
|
|
||||||
- name: 解码生成 jks
|
|
||||||
run: echo $KEYSTORE_BASE64 | base64 -di > android/app/vvex.jks
|
|
||||||
env:
|
|
||||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
|
||||||
|
|
||||||
- name: flutter build apk
|
|
||||||
# 对应 android/app/build.gradle signingConfigs中的配置项
|
|
||||||
run: flutter build apk --release --split-per-abi
|
|
||||||
env:
|
|
||||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
|
||||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
|
||||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
|
|
||||||
|
|
||||||
- name: 获取版本号
|
|
||||||
id: version
|
|
||||||
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# - name: 获取当前日期
|
|
||||||
# id: date
|
|
||||||
# run: echo "date=$(date +'%m%d')" >>$GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: 重命名应用 Pili-arm64-v8a-*.*.*.0101.apk
|
|
||||||
run: |
|
|
||||||
# DATE=${{ steps.date.outputs.date }}
|
|
||||||
for file in build/app/outputs/flutter-apk/app-*-release.apk; do
|
|
||||||
if [[ $file =~ app-(.*)-release.apk ]]; then
|
|
||||||
new_file_name="build/app/outputs/flutter-apk/Pili-${BASH_REMATCH[1]}-${{ steps.version.outputs.version }}.apk"
|
|
||||||
mv "$file" "$new_file_name"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: 构建和发布release
|
|
||||||
uses: ncipollo/release-action@v1
|
|
||||||
with:
|
|
||||||
# release title
|
|
||||||
name: v${{ steps.version.outputs.version }}
|
|
||||||
artifacts: "build/app/outputs/flutter-apk/Pili-*.apk"
|
|
||||||
bodyFile: "change_log/${{steps.version.outputs.version}}.md"
|
|
||||||
token: ${{ secrets.GIT_TOKEN }}
|
|
||||||
allowUpdates: true
|
|
157
.github/workflows/release_ci.yml
vendored
Normal file
157
.github/workflows/release_ci.yml
vendored
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
name: Pilipala Release
|
||||||
|
|
||||||
|
# action事件触发
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# push tag时触发
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
|
||||||
|
# 可以有多个jobs
|
||||||
|
jobs:
|
||||||
|
android:
|
||||||
|
# 运行环境 ubuntu-latest window-latest mac-latest
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# 每个jobs中可以有多个steps
|
||||||
|
steps:
|
||||||
|
- name: 代码迁出
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: 构建Java环境
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: "zulu"
|
||||||
|
java-version: "17"
|
||||||
|
token: ${{secrets.GIT_TOKEN}}
|
||||||
|
|
||||||
|
- name: 检查缓存
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: cache-flutter
|
||||||
|
with:
|
||||||
|
path: /root/flutter-sdk # Flutter SDK 的路径
|
||||||
|
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
|
||||||
|
|
||||||
|
- name: 安装Flutter
|
||||||
|
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||||
|
uses: subosito/flutter-action@v2
|
||||||
|
with:
|
||||||
|
flutter-version: 3.16.5
|
||||||
|
channel: any
|
||||||
|
|
||||||
|
- name: 下载项目依赖
|
||||||
|
run: flutter pub get
|
||||||
|
|
||||||
|
- name: 解码生成 jks
|
||||||
|
run: echo $KEYSTORE_BASE64 | base64 -di > android/app/vvex.jks
|
||||||
|
env:
|
||||||
|
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||||
|
|
||||||
|
- name: flutter build apk
|
||||||
|
run: flutter build apk --release --split-per-abi
|
||||||
|
env:
|
||||||
|
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||||
|
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||||
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
|
||||||
|
|
||||||
|
- name: flutter build apk
|
||||||
|
run: flutter build apk --release
|
||||||
|
env:
|
||||||
|
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||||
|
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||||
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
|
||||||
|
|
||||||
|
- name: 获取版本号
|
||||||
|
id: version
|
||||||
|
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# - name: 获取当前日期
|
||||||
|
# id: date
|
||||||
|
# run: echo "date=$(date +'%m%d')" >>$GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: 重命名应用
|
||||||
|
run: |
|
||||||
|
# DATE=${{ steps.date.outputs.date }}
|
||||||
|
for file in build/app/outputs/flutter-apk/app-*.apk; do
|
||||||
|
if [[ $file =~ app-(.?*)release.apk ]]; then
|
||||||
|
new_file_name="build/app/outputs/flutter-apk/Pili-${BASH_REMATCH[1]}${{ steps.version.outputs.version }}.apk"
|
||||||
|
mv "$file" "$new_file_name"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: 上传
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: Pilipala-Release
|
||||||
|
path: |
|
||||||
|
build/app/outputs/flutter-apk/Pili-*.apk
|
||||||
|
|
||||||
|
iOS:
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 代码迁出
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 安装Flutter
|
||||||
|
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||||
|
uses: subosito/flutter-action@v2.10.0
|
||||||
|
with:
|
||||||
|
cache: true
|
||||||
|
flutter-version: 3.16.5
|
||||||
|
|
||||||
|
- name: flutter build ipa
|
||||||
|
run: |
|
||||||
|
flutter build ios --release --no-codesign
|
||||||
|
ln -sf ./build/ios/iphoneos Payload
|
||||||
|
zip -r9 app.ipa Payload/runner.app
|
||||||
|
|
||||||
|
- name: 获取版本号
|
||||||
|
id: version
|
||||||
|
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: 重命名应用
|
||||||
|
run: |
|
||||||
|
DATE=${{ steps.date.outputs.date }}
|
||||||
|
for file in app.ipa; do
|
||||||
|
new_file_name="build/Pili-${{ steps.version.outputs.version }}.ipa"
|
||||||
|
mv "$file" "$new_file_name"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: 上传
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
if-no-files-found: error
|
||||||
|
name: Pilipala-Release
|
||||||
|
path: |
|
||||||
|
build/Pili-*.ipa
|
||||||
|
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs:
|
||||||
|
- android
|
||||||
|
- iOS
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: Pilipala-Release
|
||||||
|
path: ./Pilipala-Release
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: sudo apt-get install tree -y
|
||||||
|
|
||||||
|
- name: Get version
|
||||||
|
id: version
|
||||||
|
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Upload Release
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
|
with:
|
||||||
|
name: v${{ steps.version.outputs.version }}
|
||||||
|
token: ${{ secrets.GIT_TOKEN }}
|
||||||
|
omitBodyDuringUpdate: true
|
||||||
|
omitNameDuringUpdate: true
|
||||||
|
omitPrereleaseDuringUpdate: true
|
||||||
|
allowUpdates: true
|
||||||
|
artifacts: Pilipala-Release/*
|
106
.gitignore
vendored
106
.gitignore
vendored
@ -21,6 +21,29 @@ migrate_working_dir/
|
|||||||
# is commented out by default.
|
# is commented out by default.
|
||||||
#.vscode/
|
#.vscode/
|
||||||
|
|
||||||
|
# Flutter repo-specific
|
||||||
|
/bin/cache/
|
||||||
|
/bin/internal/bootstrap.bat
|
||||||
|
/bin/internal/bootstrap.sh
|
||||||
|
/bin/mingit/
|
||||||
|
/dev/benchmarks/mega_gallery/
|
||||||
|
/dev/bots/.recipe_deps
|
||||||
|
/dev/bots/android_tools/
|
||||||
|
/dev/devicelab/ABresults*.json
|
||||||
|
/dev/docs/doc/
|
||||||
|
/dev/docs/api_docs.zip
|
||||||
|
/dev/docs/flutter.docs.zip
|
||||||
|
/dev/docs/lib/
|
||||||
|
/dev/docs/pubspec.yaml
|
||||||
|
/dev/integration_tests/**/xcuserdata
|
||||||
|
/dev/integration_tests/**/Pods
|
||||||
|
/packages/flutter/coverage/
|
||||||
|
version
|
||||||
|
analysis_benchmark.json
|
||||||
|
|
||||||
|
# packages file containing multi-root paths
|
||||||
|
.packages.generated
|
||||||
|
|
||||||
# Flutter/Dart/Pub related
|
# Flutter/Dart/Pub related
|
||||||
**/doc/api/
|
**/doc/api/
|
||||||
**/ios/Flutter/.last_build_id
|
**/ios/Flutter/.last_build_id
|
||||||
@ -31,14 +54,83 @@ migrate_working_dir/
|
|||||||
.pub-cache/
|
.pub-cache/
|
||||||
.pub/
|
.pub/
|
||||||
/build/
|
/build/
|
||||||
|
flutter_*.png
|
||||||
# Symbolication related
|
linked_*.ds
|
||||||
app.*.symbols
|
unlinked.ds
|
||||||
|
unlinked_spec.ds
|
||||||
|
|
||||||
# Obfuscation related
|
# Obfuscation related
|
||||||
app.*.map.json
|
app.*.map.json
|
||||||
|
|
||||||
# Android Studio will place build artifacts here
|
# Android related
|
||||||
/android/app/debug
|
**/android/**/gradle-wrapper.jar
|
||||||
/android/app/profile
|
.gradle/
|
||||||
/android/app/release
|
**/android/captures/
|
||||||
|
**/android/gradlew
|
||||||
|
**/android/gradlew.bat
|
||||||
|
**/android/local.properties
|
||||||
|
**/android/**/GeneratedPluginRegistrant.java
|
||||||
|
**/android/key.properties
|
||||||
|
*.jks
|
||||||
|
|
||||||
|
# iOS/XCode related
|
||||||
|
**/ios/**/*.mode1v3
|
||||||
|
**/ios/**/*.mode2v3
|
||||||
|
**/ios/**/*.moved-aside
|
||||||
|
**/ios/**/*.pbxuser
|
||||||
|
**/ios/**/*.perspectivev3
|
||||||
|
**/ios/**/*sync/
|
||||||
|
**/ios/**/.sconsign.dblite
|
||||||
|
**/ios/**/.tags*
|
||||||
|
**/ios/**/.vagrant/
|
||||||
|
**/ios/**/DerivedData/
|
||||||
|
**/ios/**/Icon?
|
||||||
|
**/ios/**/Pods/
|
||||||
|
**/ios/**/.symlinks/
|
||||||
|
**/ios/**/profile
|
||||||
|
**/ios/**/xcuserdata
|
||||||
|
**/ios/.generated/
|
||||||
|
**/ios/Flutter/.last_build_id
|
||||||
|
**/ios/Flutter/App.framework
|
||||||
|
**/ios/Flutter/Flutter.framework
|
||||||
|
**/ios/Flutter/Flutter.podspec
|
||||||
|
**/ios/Flutter/Generated.xcconfig
|
||||||
|
**/ios/Flutter/ephemeral
|
||||||
|
**/ios/Flutter/app.flx
|
||||||
|
**/ios/Flutter/app.zip
|
||||||
|
**/ios/Flutter/flutter_assets/
|
||||||
|
**/ios/Flutter/flutter_export_environment.sh
|
||||||
|
**/ios/ServiceDefinitions.json
|
||||||
|
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
**/Flutter/ephemeral/
|
||||||
|
**/Pods/
|
||||||
|
**/macos/Flutter/GeneratedPluginRegistrant.swift
|
||||||
|
**/macos/Flutter/ephemeral
|
||||||
|
**/xcuserdata/
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
**/windows/flutter/generated_plugin_registrant.cc
|
||||||
|
**/windows/flutter/generated_plugin_registrant.h
|
||||||
|
**/windows/flutter/generated_plugins.cmake
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
**/linux/flutter/generated_plugin_registrant.cc
|
||||||
|
**/linux/flutter/generated_plugin_registrant.h
|
||||||
|
**/linux/flutter/generated_plugins.cmake
|
||||||
|
|
||||||
|
# Coverage
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# Symbols
|
||||||
|
app.*.symbols
|
||||||
|
|
||||||
|
# Exceptions to above rules.
|
||||||
|
!**/ios/**/default.mode1v3
|
||||||
|
!**/ios/**/default.mode2v3
|
||||||
|
!**/ios/**/default.pbxuser
|
||||||
|
!**/ios/**/default.perspectivev3
|
||||||
|
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||||
|
!/dev/ci/**/Gemfile.lock
|
||||||
|
!.vscode/settings.json
|
@ -58,11 +58,10 @@ android {
|
|||||||
applicationId "com.guozhigq.pilipala"
|
applicationId "com.guozhigq.pilipala"
|
||||||
// You can update the following values to match your application needs.
|
// You can update the following values to match your application needs.
|
||||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||||
// minSdkVersion flutter.minSdkVersion
|
|
||||||
targetSdkVersion flutter.targetSdkVersion
|
targetSdkVersion flutter.targetSdkVersion
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
minSdkVersion 19
|
minSdkVersion 21
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,3 +94,14 @@ flutter {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3]
|
||||||
|
import com.android.build.OutputFile
|
||||||
|
android.applicationVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
def abiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
|
||||||
|
if (abiVersionCode != null) {
|
||||||
|
output.versionCodeOverride = variant.versionCode * 10 + abiVersionCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -65,11 +65,13 @@
|
|||||||
/>
|
/>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<action android:name="android.intent.action.SEARCH" />
|
<action android:name="android.intent.action.SEARCH" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
|
||||||
<data android:scheme="bilibili" android:host="forward" />
|
<data android:scheme="bilibili" android:host="forward" />
|
||||||
<data android:scheme="bilibili" android:host="comment"
|
<data android:scheme="bilibili" android:host="comment"
|
||||||
android:pathPattern="/detail/.*/.*/.*" />
|
android:pathPattern="/detail/.*/.*/.*" />
|
||||||
@ -221,6 +223,10 @@
|
|||||||
android:pathPattern="/mobile/video/.*" />
|
android:pathPattern="/mobile/video/.*" />
|
||||||
<data android:scheme="https" android:host="www.bilibili.com"
|
<data android:scheme="https" android:host="www.bilibili.com"
|
||||||
android:pathPattern="/mobile/video/.*" />
|
android:pathPattern="/mobile/video/.*" />
|
||||||
|
<data android:scheme="https" android:host="b23.tv"
|
||||||
|
android:pathPattern="/*" />
|
||||||
|
<data android:scheme="https" android:host="space.bilibili.com"
|
||||||
|
android:pathPattern="/*" />
|
||||||
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
BIN
assets/images/live/default_bg.webp
Normal file
BIN
assets/images/live/default_bg.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
1
assets/images/video/danmu_close.svg
Normal file
1
assets/images/video/danmu_close.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" data-pointer="none" viewBox="0 0 24 24"><path fill-rule="evenodd" d="m8.085 4.891-.999-1.499a1.008 1.008 0 0 1 1.679-1.118l1.709 2.566c.54-.008 1.045-.012 1.515-.012h.13c.345 0 .707.003 1.088.007l1.862-2.59a1.008 1.008 0 0 1 1.637 1.177l-1.049 1.46c.788.02 1.631.046 2.53.078 1.958.069 3.468 1.6 3.74 3.507.088.613.13 2.158.16 3.276l.001.027c.01.333.017.63.025.856a.987.987 0 0 1-1.974.069c-.008-.23-.016-.539-.025-.881v-.002c-.028-1.103-.066-2.541-.142-3.065-.143-1.004-.895-1.78-1.854-1.813-2.444-.087-4.466-.13-6.064-.131-1.598 0-3.619.044-6.063.13a2.037 2.037 0 0 0-1.945 1.748c-.15 1.04-.225 2.341-.225 3.904 0 1.874.11 3.474.325 4.798.154.949.95 1.66 1.91 1.708a97.58 97.58 0 0 0 5.416.139.988.988 0 0 1 0 1.975c-2.196 0-3.61-.047-5.513-.141A4.012 4.012 0 0 1 2.197 17.7c-.236-1.446-.351-3.151-.351-5.116 0-1.64.08-3.035.245-4.184A4.013 4.013 0 0 1 5.92 4.96c.761-.027 1.483-.05 2.164-.069Zm4.436 4.707h-1.32v4.63h2.222v.848h-2.618v1.078h2.431a5.01 5.01 0 0 1 3.575-3.115V9.598h-1.276a8.59 8.59 0 0 0 .748-1.42l-1.089-.384a14.232 14.232 0 0 1-.814 1.804h-1.518l.693-.308a8.862 8.862 0 0 0-.814-1.408l-1.045.352c.297.396.572.847.825 1.364Zm-4.18 3.564.154-1.485h1.98V8.289h-3.2v.979h2.067v1.43H7.483l-.308 3.454h2.277c0 1.166-.044 1.925-.12 2.277-.078.352-.386.528-.936.528-.308 0-.616-.022-.902-.055l.297 1.067.062.004c.285.02.551.04.818.04 1.001-.066 1.562-.418 1.694-1.056.11-.638.176-1.903.176-3.795h-2.2Zm7.458.11v-.858h-1.254v.858H15.8Zm-2.376-.858v.858h-1.199v-.858h1.2Zm-1.199-.946h1.2v-.902h-1.2v.902Zm2.321 0v-.902H15.8v.902h-1.254Zm3.517 10.594a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm-.002-1.502a2.5 2.5 0 0 1-2.217-3.657l3.326 3.398a2.49 2.49 0 0 1-1.109.259Zm2.5-2.5c0 .42-.103.815-.286 1.162l-3.328-3.401a2.5 2.5 0 0 1 3.614 2.239Z" clip-rule="evenodd"></path></svg>
|
After Width: | Height: | Size: 1.8 KiB |
1
assets/images/video/danmu_open.svg
Normal file
1
assets/images/video/danmu_open.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" data-pointer="none" viewBox="0 0 24 24" id="svgcontent" overflow="visible" width="24" height="24" x="597" y="286"><g class="layer" style="pointer-events:all"><title style="pointer-events:inherit">Layer 1</title><path fill-rule="evenodd" d="M11.99,4.83C11.52,4.83 11.01,4.83 10.47,4.84L8.76,2.27A1.01,1.01 0 0 0 7.09,3.39L8.08,4.89C7.4,4.91 6.68,4.93 5.92,4.96A4.01,4.01 0 0 0 2.09,8.4C1.93,9.55 1.85,10.94 1.85,12.58C1.85,14.55 1.96,16.25 2.2,17.7A4.01,4.01 0 0 0 5.96,21.06L6.86,21.11C8.07,21.17 8.67,21.2 10.47,21.2A0.99,0.99 0 0 0 10.47,19.23C8.71,19.23 8.13,19.2 6.97,19.14L6.06,19.09A2.04,2.04 0 0 1 4.15,17.38C3.93,16.06 3.82,14.46 3.82,12.58C3.82,11.02 3.9,9.72 4.05,8.68C4.19,7.7 5.01,6.97 5.99,6.93C8.43,6.85 10.46,6.8 12.05,6.8C13.65,6.8 15.67,6.85 18.12,6.93C19.08,6.97 19.83,7.74 19.97,8.75C20.05,9.27 20.09,10.71 20.11,11.81L20.11,11.81C20.12,12.16 20.13,12.46 20.14,12.69A0.99,0.99 0 1 0 22.11,12.63C22.1,12.4 22.1,12.1 22.09,11.77L22.09,11.74C22.06,10.62 22.01,9.08 21.93,8.47C21.65,6.56 20.14,5.03 18.19,4.96C17.29,4.93 16.44,4.9 15.66,4.88L16.71,3.42A1.01,1.01 0 0 0 15.07,2.24L13.21,4.83C12.83,4.83 12.46,4.83 12.12,4.83L11.99,4.83zM12.51,9.6L11.19,9.6L11.19,14.23L13.41,14.23L13.41,15.08L10.79,15.08L10.79,16.16L13.41,16.16L13.42,16.84C13.78,16.86 14.13,17 14.43,17.24L14.54,17.24L14.54,16.16L17.23,16.16L17.23,15.08L14.53,15.08L14.53,14.23L16.8,14.23L16.8,9.6L15.52,9.6A8.59,8.59 0 0 0 16.27,8.18L15.18,7.8A14.23,14.23 0 0 1 14.37,9.6L12.85,9.6L13.54,9.3A8.86,8.86 0 0 0 12.73,7.89L11.68,8.24C11.98,8.64 12.26,9.09 12.51,9.6zM8.33,13.17L8.48,11.68L10.46,11.68L10.46,8.29L7.26,8.29L7.26,9.27L9.33,9.27L9.33,10.7L7.47,10.7L7.16,14.16L9.44,14.16C9.44,15.32 9.4,16.08 9.32,16.43C9.24,16.79 8.94,16.96 8.39,16.96C8.08,16.96 7.77,16.94 7.48,16.91L7.78,17.97L7.84,17.98C8.13,18 8.39,18.02 8.66,18.02C9.66,17.95 10.22,17.6 10.35,16.96C10.46,16.32 10.53,15.06 10.53,13.17L8.33,13.17zM15.79,13.28L15.79,12.42L14.53,12.42L14.53,13.28L15.79,13.28zM13.41,12.42L13.41,13.28L12.21,13.28L12.21,12.42L13.41,12.42zM12.21,11.47L13.41,11.47L13.41,10.57L12.21,10.57L12.21,11.47zM14.53,11.47L14.53,10.57L15.79,10.57L15.79,11.47L14.53,11.47z" clip-rule="evenodd" id="svg_1"></path><path fill="#000000" fill-rule="evenodd" d="M22.85,14.63A1,1 0 0 0 21.43,14.7L16.34,20.41L14.13,18.13L14.03,18.04L14.02,18.04A1,1 0 0 0 12.7,19.53L15.66,22.57L15.76,22.66L15.76,22.66C16.17,22.98 16.76,22.93 17.12,22.54L22.93,16.03L23.01,15.93L23.01,15.92A1,1 0 0 0 22.85,14.63z" clip-rule="evenodd" id="svg_2"></path></g></svg>
|
After Width: | Height: | Size: 2.5 KiB |
39
change_log/1.0.17.0125.md
Normal file
39
change_log/1.0.17.0125.md
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
## 1.0.17
|
||||||
|
|
||||||
|
|
||||||
|
### 功能
|
||||||
|
+ 视频全屏时隐藏进度条
|
||||||
|
+ 动态内容增加投稿跳转
|
||||||
|
+ 未开启自动播放时点击封面播放
|
||||||
|
+ 弹幕发送标识
|
||||||
|
+ 定时关闭
|
||||||
|
+ 推荐视频卡片拉黑up功能
|
||||||
|
+ 首页tabbar编辑排序
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
+ 连续跳转搜索页未刷新
|
||||||
|
+ 搜索结果为空时页面异常
|
||||||
|
+ 评论区链接解析
|
||||||
|
+ 视频全屏状态栏背景色
|
||||||
|
+ 私信对话气泡位置
|
||||||
|
+ 设置up关注分组样式
|
||||||
|
+ 每次推荐请求数据相同
|
||||||
|
+ iOS代理网络异常
|
||||||
|
+ 双击切换播放状态无声
|
||||||
|
+ 设置自定义倍速白屏
|
||||||
|
+ 免登录查看1080p
|
||||||
|
|
||||||
|
### 优化
|
||||||
|
+ 首页web端推荐观看数展示
|
||||||
|
+ 首页web端推荐接口更新
|
||||||
|
+ 首页样式
|
||||||
|
+ 搜索页跳转
|
||||||
|
+ 弹幕资源优化
|
||||||
|
+ 图片渲染占用内存优化(部分)
|
||||||
|
+ 两次返回退出应用
|
||||||
|
+ schame 补充
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
更多更新日志可在Github上查看
|
||||||
|
问题反馈、功能建议请查看「关于」页面。
|
16
change_log/1.0.18.0130.md
Normal file
16
change_log/1.0.18.0130.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
## 1.0.18
|
||||||
|
|
||||||
|
|
||||||
|
### 功能
|
||||||
|
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
|
||||||
|
|
||||||
|
### 优化
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
更多更新日志可在Github上查看
|
||||||
|
问题反馈、功能建议请查看「关于」页面。
|
15
change_log/1.0.19.0131.md
Normal file
15
change_log/1.0.19.0131.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
## 1.0.19
|
||||||
|
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
+ 视频404、评论加载错误
|
||||||
|
+ bvav转换
|
||||||
|
|
||||||
|
### 优化
|
||||||
|
+ 视频详情页内存占用
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
更多更新日志可在Github上查看
|
||||||
|
问题反馈、功能建议请查看「关于」页面。
|
31
change_log/1.0.20.0303.md
Normal file
31
change_log/1.0.20.0303.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
## 1.0.20
|
||||||
|
|
||||||
|
|
||||||
|
### 功能
|
||||||
|
+ 评论区增加表情
|
||||||
|
+ 首页渐变背景开关
|
||||||
|
+ 媒体库显示「我的订阅」
|
||||||
|
+ 评论区链接解析
|
||||||
|
+ 默认启动页设置
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
+ 评论区内容重复
|
||||||
|
+ pip相关问题
|
||||||
|
+ 播放多p视频评论不刷新
|
||||||
|
+ 视频评论翻页重复
|
||||||
|
|
||||||
|
### 优化
|
||||||
|
+ url scheme优化
|
||||||
|
+ 图片预览放大
|
||||||
|
+ 图片加载速度
|
||||||
|
+ 视频评论区复制
|
||||||
|
+ 全屏显示视频标题
|
||||||
|
+ 网络异常处理
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
更多更新日志可在Github上查看
|
||||||
|
问题反馈、功能建议请查看「关于」页面。
|
9
change_log/1.0.21.0306.md
Normal file
9
change_log/1.0.21.0306.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
## 1.0.21
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
+ 推荐视频全屏问题
|
||||||
|
+ 番剧全屏播放时灰屏问题
|
||||||
|
+ 评论回调导致页面卡死问题
|
||||||
|
|
||||||
|
更多更新日志可在Github上查看
|
||||||
|
问题反馈、功能建议请查看「关于」页面。
|
@ -9,12 +9,18 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- connectivity_plus (0.0.1):
|
- connectivity_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
- ReachabilitySwift
|
- ReachabilitySwift
|
||||||
- device_info_plus (0.0.1):
|
- device_info_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
|
- flutter_mailer (0.0.1):
|
||||||
|
- Flutter
|
||||||
- flutter_volume_controller (0.0.1):
|
- flutter_volume_controller (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- fluttertoast (0.0.2):
|
||||||
|
- Flutter
|
||||||
|
- Toast
|
||||||
- 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)
|
||||||
@ -33,7 +39,7 @@ PODS:
|
|||||||
- path_provider_foundation (0.0.1):
|
- path_provider_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- permission_handler_apple (9.1.1):
|
- permission_handler_apple (9.3.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- ReachabilitySwift (5.0.0)
|
- ReachabilitySwift (5.0.0)
|
||||||
- saver_gallery (0.0.1):
|
- saver_gallery (0.0.1):
|
||||||
@ -49,6 +55,7 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- system_proxy (0.0.1):
|
- system_proxy (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- Toast (4.1.0)
|
||||||
- url_launcher_ios (0.0.1):
|
- url_launcher_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- volume_controller (0.0.1):
|
- volume_controller (0.0.1):
|
||||||
@ -65,10 +72,12 @@ DEPENDENCIES:
|
|||||||
- audio_service (from `.symlinks/plugins/audio_service/ios`)
|
- audio_service (from `.symlinks/plugins/audio_service/ios`)
|
||||||
- audio_session (from `.symlinks/plugins/audio_session/ios`)
|
- audio_session (from `.symlinks/plugins/audio_session/ios`)
|
||||||
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
|
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
|
||||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
|
||||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
|
- flutter_mailer (from `.symlinks/plugins/flutter_mailer/ios`)
|
||||||
- flutter_volume_controller (from `.symlinks/plugins/flutter_volume_controller/ios`)
|
- flutter_volume_controller (from `.symlinks/plugins/flutter_volume_controller/ios`)
|
||||||
|
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||||
- gt3_flutter_plugin (from `.symlinks/plugins/gt3_flutter_plugin/ios`)
|
- gt3_flutter_plugin (from `.symlinks/plugins/gt3_flutter_plugin/ios`)
|
||||||
- media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`)
|
- media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`)
|
||||||
- media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`)
|
- media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`)
|
||||||
@ -93,6 +102,7 @@ SPEC REPOS:
|
|||||||
- FMDB
|
- FMDB
|
||||||
- GT3Captcha-iOS
|
- GT3Captcha-iOS
|
||||||
- ReachabilitySwift
|
- ReachabilitySwift
|
||||||
|
- Toast
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
appscheme:
|
appscheme:
|
||||||
@ -104,13 +114,17 @@ EXTERNAL SOURCES:
|
|||||||
auto_orientation:
|
auto_orientation:
|
||||||
:path: ".symlinks/plugins/auto_orientation/ios"
|
:path: ".symlinks/plugins/auto_orientation/ios"
|
||||||
connectivity_plus:
|
connectivity_plus:
|
||||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
:path: ".symlinks/plugins/connectivity_plus/darwin"
|
||||||
device_info_plus:
|
device_info_plus:
|
||||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
|
flutter_mailer:
|
||||||
|
:path: ".symlinks/plugins/flutter_mailer/ios"
|
||||||
flutter_volume_controller:
|
flutter_volume_controller:
|
||||||
:path: ".symlinks/plugins/flutter_volume_controller/ios"
|
:path: ".symlinks/plugins/flutter_volume_controller/ios"
|
||||||
|
fluttertoast:
|
||||||
|
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||||
gt3_flutter_plugin:
|
gt3_flutter_plugin:
|
||||||
:path: ".symlinks/plugins/gt3_flutter_plugin/ios"
|
:path: ".symlinks/plugins/gt3_flutter_plugin/ios"
|
||||||
media_kit_libs_ios_video:
|
media_kit_libs_ios_video:
|
||||||
@ -153,10 +167,12 @@ SPEC CHECKSUMS:
|
|||||||
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
||||||
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
||||||
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||||
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
connectivity_plus: e2dad488011aeb593e219360e804c43cc1af5770
|
||||||
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
|
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
|
flutter_mailer: 2ef5a67087bc8c6c4cefd04a178bf1ae2c94cd83
|
||||||
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
||||||
|
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
gt3_flutter_plugin: bfa1f26e9a09dc00401514be5ed437f964cabf23
|
gt3_flutter_plugin: bfa1f26e9a09dc00401514be5ed437f964cabf23
|
||||||
GT3Captcha-iOS: 5e3b1077834d8a9d6f4d64a447a30af3e14affe6
|
GT3Captcha-iOS: 5e3b1077834d8a9d6f4d64a447a30af3e14affe6
|
||||||
@ -165,7 +181,7 @@ SPEC CHECKSUMS:
|
|||||||
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
||||||
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
||||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||||
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||||
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
||||||
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
||||||
@ -173,11 +189,12 @@ SPEC CHECKSUMS:
|
|||||||
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
||||||
status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446
|
status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446
|
||||||
system_proxy: bec1a5c5af67dd3e3ebf43979400a8756c04cc44
|
system_proxy: bec1a5c5af67dd3e3ebf43979400a8756c04cc44
|
||||||
|
Toast: ec33c32b8688982cecc6348adeae667c1b9938da
|
||||||
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
|
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
|
||||||
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
|
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
|
||||||
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
|
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
|
||||||
webview_cookie_manager: eaf920722b493bd0f7611b5484771ca53fed03f7
|
webview_cookie_manager: eaf920722b493bd0f7611b5484771ca53fed03f7
|
||||||
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
|
webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4
|
||||||
|
|
||||||
PODFILE CHECKSUM: 637cd290bed23275b5f5ffcc7eb1e73d0a5fb2be
|
PODFILE CHECKSUM: 637cd290bed23275b5f5ffcc7eb1e73d0a5fb2be
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class ContentContainer extends StatelessWidget {
|
|||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
clipBehavior: childClipBehavior ?? Clip.hardEdge,
|
clipBehavior: childClipBehavior ?? Clip.hardEdge,
|
||||||
physics: isScrollable ? null : NeverScrollableScrollPhysics(),
|
physics: isScrollable ? null : const NeverScrollableScrollPhysics(),
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: constraints.copyWith(
|
constraints: constraints.copyWith(
|
||||||
minHeight: constraints.maxHeight,
|
minHeight: constraints.maxHeight,
|
||||||
@ -34,7 +34,7 @@ class ContentContainer extends StatelessWidget {
|
|||||||
child: contentWidget!,
|
child: contentWidget!,
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Spacer(),
|
const Spacer(),
|
||||||
if (bottomWidget != null) bottomWidget!,
|
if (bottomWidget != null) bottomWidget!,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -2,16 +2,17 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
Box setting = GStrorage.setting;
|
Box<dynamic> setting = GStrorage.setting;
|
||||||
|
|
||||||
class CustomToast extends StatelessWidget {
|
class CustomToast extends StatelessWidget {
|
||||||
|
const CustomToast({super.key, required this.msg});
|
||||||
|
|
||||||
final String msg;
|
final String msg;
|
||||||
const CustomToast({Key? key, required this.msg}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
double toastOpacity =
|
final double toastOpacity =
|
||||||
setting.get(SettingBoxKey.defaultToastOp, defaultValue: 1.0);
|
setting.get(SettingBoxKey.defaultToastOp, defaultValue: 1.0) as double;
|
||||||
return Container(
|
return Container(
|
||||||
margin:
|
margin:
|
||||||
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 30),
|
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 30),
|
||||||
|
@ -1,45 +1,46 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_html/flutter_html.dart';
|
import 'package:flutter_html/flutter_html.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'network_img_layer.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class HtmlRender extends StatelessWidget {
|
class HtmlRender extends StatelessWidget {
|
||||||
String? htmlContent;
|
const HtmlRender({
|
||||||
final int? imgCount;
|
|
||||||
final List? imgList;
|
|
||||||
|
|
||||||
HtmlRender({
|
|
||||||
this.htmlContent,
|
this.htmlContent,
|
||||||
this.imgCount,
|
this.imgCount,
|
||||||
this.imgList,
|
this.imgList,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final String? htmlContent;
|
||||||
|
final int? imgCount;
|
||||||
|
final List<String>? imgList;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Html(
|
return Html(
|
||||||
data: htmlContent,
|
data: htmlContent,
|
||||||
onLinkTap: (url, buildContext, attributes) => {},
|
onLinkTap: (String? url, Map<String, String> buildContext, attributes) {},
|
||||||
extensions: [
|
extensions: [
|
||||||
TagExtension(
|
TagExtension(
|
||||||
tagsToExtend: {"img"},
|
tagsToExtend: <String>{'img'},
|
||||||
builder: (extensionContext) {
|
builder: (ExtensionContext extensionContext) {
|
||||||
try {
|
try {
|
||||||
Map attributes = extensionContext.attributes;
|
final Map<String, dynamic> attributes =
|
||||||
List key = attributes.keys.toList();
|
extensionContext.attributes;
|
||||||
String? imgUrl = key.contains('src')
|
final List<dynamic> key = attributes.keys.toList();
|
||||||
? attributes['src']
|
String imgUrl = key.contains('src')
|
||||||
: attributes['data-src'];
|
? attributes['src'] as String
|
||||||
if (imgUrl!.startsWith('//')) {
|
: attributes['data-src'] as String;
|
||||||
|
if (imgUrl.startsWith('//')) {
|
||||||
imgUrl = 'https:$imgUrl';
|
imgUrl = 'https:$imgUrl';
|
||||||
}
|
}
|
||||||
if (imgUrl.startsWith('http://')) {
|
if (imgUrl.startsWith('http://')) {
|
||||||
imgUrl = imgUrl.replaceAll('http://', 'https://');
|
imgUrl = imgUrl.replaceAll('http://', 'https://');
|
||||||
}
|
}
|
||||||
imgUrl = imgUrl.contains('@') ? imgUrl.split('@').first : imgUrl;
|
imgUrl = imgUrl.contains('@') ? imgUrl.split('@').first : imgUrl;
|
||||||
bool isEmote = imgUrl.contains('/emote/');
|
final bool isEmote = imgUrl.contains('/emote/');
|
||||||
bool isMall = imgUrl.contains('/mall/');
|
final bool isMall = imgUrl.contains('/mall/');
|
||||||
if (isMall) {
|
if (isMall) {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
@ -58,38 +59,37 @@ class HtmlRender extends StatelessWidget {
|
|||||||
src: imgUrl,
|
src: imgUrl,
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
print(err);
|
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
style: {
|
style: {
|
||||||
"html": Style(
|
'html': Style(
|
||||||
fontSize: FontSize.medium,
|
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),
|
||||||
"a": Style(
|
'a': Style(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
textDecoration: TextDecoration.none,
|
textDecoration: TextDecoration.none,
|
||||||
),
|
),
|
||||||
"p": Style(
|
'p': Style(
|
||||||
margin: Margins.only(bottom: 10),
|
margin: Margins.only(bottom: 10),
|
||||||
),
|
),
|
||||||
"span": Style(
|
'span': Style(
|
||||||
fontSize: FontSize.medium,
|
fontSize: FontSize.medium,
|
||||||
height: Height(1.65),
|
height: Height(1.65),
|
||||||
),
|
),
|
||||||
"div": Style(height: Height.auto()),
|
'div': Style(height: Height.auto()),
|
||||||
"li > p": Style(
|
'li > p': Style(
|
||||||
display: Display.inline,
|
display: Display.inline,
|
||||||
),
|
),
|
||||||
"li": Style(
|
'li': Style(
|
||||||
padding: HtmlPaddings.only(bottom: 4),
|
padding: HtmlPaddings.only(bottom: 4),
|
||||||
textAlign: TextAlign.justify,
|
textAlign: TextAlign.justify,
|
||||||
),
|
),
|
||||||
"img": Style(margin: Margins.only(top: 4, bottom: 4)),
|
'img': Style(margin: Margins.only(top: 4, bottom: 4)),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -22,20 +22,27 @@ class HttpError extends StatelessWidget {
|
|||||||
"assets/images/error.svg",
|
"assets/images/error.svg",
|
||||||
height: 200,
|
height: 200,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 30),
|
||||||
Text(
|
Text(
|
||||||
errMsg ?? '请求异常',
|
errMsg ?? '请求异常',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 20),
|
||||||
OutlinedButton.icon(
|
FilledButton.tonal(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
fn!();
|
fn!();
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.arrow_forward_outlined, size: 20),
|
style: ButtonStyle(
|
||||||
label: Text(btnText ?? '点击重试'),
|
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||||
)
|
return Theme.of(context).colorScheme.primary.withAlpha(20);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
btnText ?? '点击重试',
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.primary),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import '../../utils/utils.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import '../constants.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'network_img_layer.dart';
|
||||||
|
|
||||||
class LiveCard extends StatelessWidget {
|
class LiveCard extends StatelessWidget {
|
||||||
// ignore: prefer_typing_uninitialized_variables
|
// ignore: prefer_typing_uninitialized_variables
|
||||||
final liveItem;
|
final dynamic liveItem;
|
||||||
|
|
||||||
const LiveCard({
|
const LiveCard({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -14,7 +14,7 @@ class LiveCard extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String heroTag = Utils.makeHeroTag(liveItem.roomid);
|
final String heroTag = Utils.makeHeroTag(liveItem.roomid);
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
@ -23,7 +23,6 @@ class LiveCard extends StatelessWidget {
|
|||||||
borderRadius: BorderRadius.circular(0),
|
borderRadius: BorderRadius.circular(0),
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
color: Theme.of(context).dividerColor.withOpacity(0.08),
|
color: Theme.of(context).dividerColor.withOpacity(0.08),
|
||||||
width: 1,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
@ -33,15 +32,16 @@ class LiveCard extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
AspectRatio(
|
AspectRatio(
|
||||||
aspectRatio: StyleString.aspectRatio,
|
aspectRatio: StyleString.aspectRatio,
|
||||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
child: LayoutBuilder(builder:
|
||||||
double maxWidth = boxConstraints.maxWidth;
|
(BuildContext context, BoxConstraints boxConstraints) {
|
||||||
double maxHeight = boxConstraints.maxHeight;
|
final double maxWidth = boxConstraints.maxWidth;
|
||||||
|
final double maxHeight = boxConstraints.maxHeight;
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Hero(
|
Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: liveItem.cover,
|
src: liveItem.cover as String,
|
||||||
type: 'emote',
|
type: 'emote',
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
@ -58,7 +58,7 @@ class LiveCard extends StatelessWidget {
|
|||||||
// view: liveItem.stat.view,
|
// view: liveItem.stat.view,
|
||||||
// danmaku: liveItem.stat.danmaku,
|
// danmaku: liveItem.stat.danmaku,
|
||||||
// duration: liveItem.duration,
|
// duration: liveItem.duration,
|
||||||
online: liveItem.online,
|
online: liveItem.online as int,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -90,7 +90,7 @@ class LiveContent extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
liveItem.title,
|
liveItem.title as String,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500),
|
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
@ -99,7 +99,7 @@ class LiveContent extends StatelessWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Text(
|
child: Text(
|
||||||
liveItem.uname,
|
liveItem.uname as String,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
@ -114,9 +114,9 @@ class LiveContent extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class LiveStat extends StatelessWidget {
|
class LiveStat extends StatelessWidget {
|
||||||
final int? online;
|
const LiveStat({super.key, required this.online});
|
||||||
|
|
||||||
const LiveStat({Key? key, required this.online}) : super(key: key);
|
final int? online;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -136,7 +136,7 @@ class LiveStat extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: <Widget>[
|
||||||
// Row(
|
// Row(
|
||||||
// children: [
|
// children: [
|
||||||
// StatView(
|
// StatView(
|
||||||
|
@ -1,78 +1,104 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/utils/extension.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/global_data.dart';
|
||||||
|
import '../../utils/storage.dart';
|
||||||
|
import '../constants.dart';
|
||||||
|
|
||||||
Box setting = GStrorage.setting;
|
Box<dynamic> setting = GStrorage.setting;
|
||||||
|
|
||||||
class NetworkImgLayer extends StatelessWidget {
|
class NetworkImgLayer extends StatelessWidget {
|
||||||
final String? src;
|
|
||||||
final double? width;
|
|
||||||
final double? height;
|
|
||||||
final double? cacheW;
|
|
||||||
final double? cacheH;
|
|
||||||
final String? type;
|
|
||||||
final Duration? fadeOutDuration;
|
|
||||||
final Duration? fadeInDuration;
|
|
||||||
final int? quality;
|
|
||||||
|
|
||||||
const NetworkImgLayer({
|
const NetworkImgLayer({
|
||||||
Key? key,
|
super.key,
|
||||||
this.src,
|
this.src,
|
||||||
required this.width,
|
required this.width,
|
||||||
required this.height,
|
required this.height,
|
||||||
this.cacheW,
|
|
||||||
this.cacheH,
|
|
||||||
this.type,
|
this.type,
|
||||||
this.fadeOutDuration,
|
this.fadeOutDuration,
|
||||||
this.fadeInDuration,
|
this.fadeInDuration,
|
||||||
// 图片质量 默认1%
|
// 图片质量 默认1%
|
||||||
this.quality,
|
this.quality,
|
||||||
}) : super(key: key);
|
this.origAspectRatio,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String? src;
|
||||||
|
final double width;
|
||||||
|
final double height;
|
||||||
|
final String? type;
|
||||||
|
final Duration? fadeOutDuration;
|
||||||
|
final Duration? fadeInDuration;
|
||||||
|
final int? quality;
|
||||||
|
final double? origAspectRatio;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
double pr = MediaQuery.of(context).devicePixelRatio;
|
final int defaultImgQuality = GlobalData().imgQuality;
|
||||||
int picQuality = setting.get(SettingBoxKey.defaultPicQa, defaultValue: 10);
|
final String imageUrl =
|
||||||
|
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp';
|
||||||
|
print(imageUrl);
|
||||||
|
int? memCacheWidth, memCacheHeight;
|
||||||
|
double aspectRatio = (width / height).toDouble();
|
||||||
|
|
||||||
// double pr = 2;
|
void setMemCacheSizes() {
|
||||||
return src != ''
|
if (aspectRatio > 1) {
|
||||||
|
memCacheHeight = height.cacheSize(context);
|
||||||
|
} else if (aspectRatio < 1) {
|
||||||
|
memCacheWidth = width.cacheSize(context);
|
||||||
|
} else {
|
||||||
|
if (origAspectRatio != null && origAspectRatio! > 1) {
|
||||||
|
memCacheWidth = width.cacheSize(context);
|
||||||
|
} else if (origAspectRatio != null && origAspectRatio! < 1) {
|
||||||
|
memCacheHeight = height.cacheSize(context);
|
||||||
|
} else {
|
||||||
|
memCacheWidth = width.cacheSize(context);
|
||||||
|
memCacheHeight = height.cacheSize(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setMemCacheSizes();
|
||||||
|
|
||||||
|
if (memCacheWidth == null && memCacheHeight == null) {
|
||||||
|
memCacheWidth = width.toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
return src != '' && src != null
|
||||||
? ClipRRect(
|
? ClipRRect(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.antiAlias,
|
||||||
borderRadius: BorderRadius.circular(type == 'avatar'
|
borderRadius: BorderRadius.circular(
|
||||||
? 50
|
type == 'avatar'
|
||||||
: type == 'emote'
|
? 50
|
||||||
? 0
|
: type == 'emote'
|
||||||
: StyleString.imgRadius.x),
|
? 0
|
||||||
|
: StyleString.imgRadius.x,
|
||||||
|
),
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
imageUrl:
|
imageUrl: imageUrl,
|
||||||
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? picQuality}q.webp',
|
width: width,
|
||||||
width: width ?? double.infinity,
|
height: height,
|
||||||
height: height ?? double.infinity,
|
memCacheWidth: memCacheWidth,
|
||||||
alignment: Alignment.center,
|
memCacheHeight: memCacheHeight,
|
||||||
maxWidthDiskCache: ((cacheW ?? width!) * pr).toInt(),
|
|
||||||
// maxHeightDiskCache: (cacheH ?? height!).toInt(),
|
|
||||||
memCacheWidth: ((cacheW ?? width!) * pr).toInt(),
|
|
||||||
// memCacheHeight: (cacheH ?? height!).toInt(),
|
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
fadeOutDuration:
|
fadeOutDuration:
|
||||||
fadeOutDuration ?? const Duration(milliseconds: 200),
|
fadeOutDuration ?? const Duration(milliseconds: 120),
|
||||||
fadeInDuration:
|
fadeInDuration:
|
||||||
fadeInDuration ?? const Duration(milliseconds: 200),
|
fadeInDuration ?? const Duration(milliseconds: 120),
|
||||||
// filterQuality: FilterQuality.high,
|
filterQuality: FilterQuality.low,
|
||||||
errorWidget: (context, url, error) => placeholder(context),
|
errorWidget: (BuildContext context, String url, Object error) =>
|
||||||
placeholder: (context, url) => placeholder(context),
|
placeholder(context),
|
||||||
|
placeholder: (BuildContext context, String url) =>
|
||||||
|
placeholder(context),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: placeholder(context);
|
: placeholder(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget placeholder(context) {
|
Widget placeholder(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
width: width ?? double.infinity,
|
width: width,
|
||||||
height: height ?? double.infinity,
|
height: height,
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.antiAlias,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.4),
|
color: Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.4),
|
||||||
borderRadius: BorderRadius.circular(type == 'avatar'
|
borderRadius: BorderRadius.circular(type == 'avatar'
|
||||||
@ -81,14 +107,19 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
? 0
|
? 0
|
||||||
: StyleString.imgRadius.x),
|
: StyleString.imgRadius.x),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: type == 'bg'
|
||||||
child: Image.asset(
|
? const SizedBox()
|
||||||
type == 'avatar'
|
: Center(
|
||||||
? 'assets/images/noface.jpeg'
|
child: Image.asset(
|
||||||
: 'assets/images/loading.png',
|
type == 'avatar'
|
||||||
width: 300,
|
? 'assets/images/noface.jpeg'
|
||||||
height: 300,
|
: 'assets/images/loading.png',
|
||||||
)),
|
width: width,
|
||||||
|
height: height,
|
||||||
|
cacheWidth: width.cacheSize(context),
|
||||||
|
cacheHeight: height.cacheSize(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import '../../utils/download.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import '../constants.dart';
|
||||||
import 'package:pilipala/utils/download.dart';
|
import 'network_img_layer.dart';
|
||||||
|
|
||||||
class OverlayPop extends StatelessWidget {
|
class OverlayPop extends StatelessWidget {
|
||||||
|
const OverlayPop({super.key, this.videoItem, this.closeFn});
|
||||||
|
|
||||||
final dynamic videoItem;
|
final dynamic videoItem;
|
||||||
final Function? closeFn;
|
final Function? closeFn;
|
||||||
const OverlayPop({super.key, this.videoItem, this.closeFn});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
double imgWidth = MediaQuery.of(context).size.width - 8 * 2;
|
final double imgWidth = MediaQuery.sizeOf(context).width - 8 * 2;
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -19,7 +20,6 @@ class OverlayPop extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Stack(
|
Stack(
|
||||||
@ -27,7 +27,7 @@ class OverlayPop extends StatelessWidget {
|
|||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
width: imgWidth,
|
width: imgWidth,
|
||||||
height: imgWidth / StyleString.aspectRatio,
|
height: imgWidth / StyleString.aspectRatio,
|
||||||
src: videoItem.pic!,
|
src: videoItem.pic! as String,
|
||||||
quality: 100,
|
quality: 100,
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -61,7 +61,7 @@ class OverlayPop extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
videoItem.title!,
|
videoItem.title! as String,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
@ -69,7 +69,10 @@ class OverlayPop extends StatelessWidget {
|
|||||||
tooltip: '保存封面图',
|
tooltip: '保存封面图',
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await DownloadUtils.downloadImg(
|
await DownloadUtils.downloadImg(
|
||||||
videoItem.pic ?? videoItem.cover);
|
videoItem.pic != null
|
||||||
|
? videoItem.pic as String
|
||||||
|
: videoItem.cover as String,
|
||||||
|
);
|
||||||
// closeFn!();
|
// closeFn!();
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.download, size: 20),
|
icon: const Icon(Icons.download, size: 20),
|
||||||
|
@ -17,8 +17,8 @@ class PullToRefreshHeader extends StatelessWidget {
|
|||||||
this.info,
|
this.info,
|
||||||
this.lastRefreshTime, {
|
this.lastRefreshTime, {
|
||||||
this.color,
|
this.color,
|
||||||
Key? key,
|
super.key,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final PullToRefreshScrollNotificationInfo? info;
|
final PullToRefreshScrollNotificationInfo? info;
|
||||||
final DateTime? lastRefreshTime;
|
final DateTime? lastRefreshTime;
|
||||||
@ -28,7 +28,7 @@ class PullToRefreshHeader extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final PullToRefreshScrollNotificationInfo? infos = info;
|
final PullToRefreshScrollNotificationInfo? infos = info;
|
||||||
if (infos == null) {
|
if (infos == null) {
|
||||||
return Container();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
String text = '';
|
String text = '';
|
||||||
if (infos.mode == PullToRefreshIndicatorMode.armed) {
|
if (infos.mode == PullToRefreshIndicatorMode.armed) {
|
||||||
@ -65,7 +65,6 @@ class PullToRefreshHeader extends StatelessWidget {
|
|||||||
top: top,
|
top: top,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -3,7 +3,7 @@ import 'package:pilipala/utils/utils.dart';
|
|||||||
|
|
||||||
class StatDanMu extends StatelessWidget {
|
class StatDanMu extends StatelessWidget {
|
||||||
final String? theme;
|
final String? theme;
|
||||||
final int? danmu;
|
final dynamic danmu;
|
||||||
final String? size;
|
final String? size;
|
||||||
|
|
||||||
const StatDanMu({Key? key, this.theme, this.danmu, this.size})
|
const StatDanMu({Key? key, this.theme, this.danmu, this.size})
|
||||||
|
@ -3,7 +3,7 @@ import 'package:pilipala/utils/utils.dart';
|
|||||||
|
|
||||||
class StatView extends StatelessWidget {
|
class StatView extends StatelessWidget {
|
||||||
final String? theme;
|
final String? theme;
|
||||||
final int? view;
|
final dynamic view;
|
||||||
final String? size;
|
final String? size;
|
||||||
|
|
||||||
const StatView({Key? key, this.theme, this.view, this.size})
|
const StatView({Key? key, this.theme, this.view, this.size})
|
||||||
|
@ -1,17 +1,29 @@
|
|||||||
|
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:flutter/material.dart';
|
import '../../http/search.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import '../../http/user.dart';
|
||||||
import 'package:pilipala/common/widgets/badge.dart';
|
import '../../http/video.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import '../../utils/utils.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import '../constants.dart';
|
||||||
import 'package:pilipala/http/search.dart';
|
import 'badge.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'network_img_layer.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'stat/danmu.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'stat/view.dart';
|
||||||
|
|
||||||
// 视频卡片 - 水平布局
|
// 视频卡片 - 水平布局
|
||||||
class VideoCardH extends StatelessWidget {
|
class VideoCardH extends StatelessWidget {
|
||||||
|
const VideoCardH({
|
||||||
|
super.key,
|
||||||
|
required this.videoItem,
|
||||||
|
this.longPress,
|
||||||
|
this.longPressEnd,
|
||||||
|
this.source = 'normal',
|
||||||
|
this.showOwner = true,
|
||||||
|
this.showView = true,
|
||||||
|
this.showDanmaku = true,
|
||||||
|
this.showPubdate = false,
|
||||||
|
});
|
||||||
// ignore: prefer_typing_uninitialized_variables
|
// ignore: prefer_typing_uninitialized_variables
|
||||||
final videoItem;
|
final videoItem;
|
||||||
final Function()? longPress;
|
final Function()? longPress;
|
||||||
@ -22,23 +34,15 @@ class VideoCardH extends StatelessWidget {
|
|||||||
final bool showDanmaku;
|
final bool showDanmaku;
|
||||||
final bool showPubdate;
|
final bool showPubdate;
|
||||||
|
|
||||||
const VideoCardH({
|
|
||||||
Key? key,
|
|
||||||
required this.videoItem,
|
|
||||||
this.longPress,
|
|
||||||
this.longPressEnd,
|
|
||||||
this.source = 'normal',
|
|
||||||
this.showOwner = true,
|
|
||||||
this.showView = true,
|
|
||||||
this.showDanmaku = true,
|
|
||||||
this.showPubdate = false,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
int aid = videoItem.aid;
|
final int aid = videoItem.aid;
|
||||||
String bvid = videoItem.bvid;
|
final String bvid = videoItem.bvid;
|
||||||
String heroTag = Utils.makeHeroTag(aid);
|
String type = 'video';
|
||||||
|
try {
|
||||||
|
type = videoItem.type;
|
||||||
|
} catch (_) {}
|
||||||
|
final String heroTag = Utils.makeHeroTag(aid);
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
if (longPress != null) {
|
if (longPress != null) {
|
||||||
@ -53,7 +57,11 @@ class VideoCardH extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
try {
|
try {
|
||||||
int cid =
|
if (type == 'ketang') {
|
||||||
|
SmartDialog.showToast('课堂视频暂不支持播放');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final int cid =
|
||||||
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||||
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
||||||
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
||||||
@ -65,11 +73,11 @@ class VideoCardH extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, boxConstraints) {
|
builder: (BuildContext context, BoxConstraints boxConstraints) {
|
||||||
double width = (boxConstraints.maxWidth -
|
final double width = (boxConstraints.maxWidth -
|
||||||
StyleString.cardSpace *
|
StyleString.cardSpace *
|
||||||
6 /
|
6 /
|
||||||
MediaQuery.of(context).textScaleFactor) /
|
MediaQuery.textScalerOf(context).scale(1.0)) /
|
||||||
2;
|
2;
|
||||||
return Container(
|
return Container(
|
||||||
constraints: const BoxConstraints(minHeight: 88),
|
constraints: const BoxConstraints(minHeight: 88),
|
||||||
@ -77,31 +85,38 @@ class VideoCardH extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
AspectRatio(
|
AspectRatio(
|
||||||
aspectRatio: StyleString.aspectRatio,
|
aspectRatio: StyleString.aspectRatio,
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, boxConstraints) {
|
builder: (BuildContext context,
|
||||||
double maxWidth = boxConstraints.maxWidth;
|
BoxConstraints boxConstraints) {
|
||||||
double maxHeight = boxConstraints.maxHeight;
|
final double maxWidth = boxConstraints.maxWidth;
|
||||||
|
final double maxHeight = boxConstraints.maxHeight;
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Hero(
|
Hero(
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: videoItem.pic,
|
src: videoItem.pic as String,
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PBadge(
|
if (videoItem.duration != 0)
|
||||||
text: Utils.timeFormat(videoItem.duration!),
|
PBadge(
|
||||||
top: null,
|
text: Utils.timeFormat(videoItem.duration!),
|
||||||
right: 6.0,
|
right: 6.0,
|
||||||
bottom: 6.0,
|
bottom: 6.0,
|
||||||
left: null,
|
type: 'gray',
|
||||||
type: 'gray',
|
),
|
||||||
),
|
if (type != 'video')
|
||||||
|
PBadge(
|
||||||
|
text: type,
|
||||||
|
left: 6.0,
|
||||||
|
bottom: 6.0,
|
||||||
|
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,
|
||||||
@ -159,7 +174,7 @@ class VideoContent extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (videoItem.title is String) ...[
|
if (videoItem.title is String) ...[
|
||||||
Text(
|
Text(
|
||||||
videoItem.title,
|
videoItem.title as String,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
@ -172,9 +187,9 @@ class VideoContent extends StatelessWidget {
|
|||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
children: [
|
children: [
|
||||||
for (var i in videoItem.title) ...[
|
for (final i in videoItem.title) ...[
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: i['text'],
|
text: i['text'] as String,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
letterSpacing: 0.3,
|
letterSpacing: 0.3,
|
||||||
@ -216,7 +231,7 @@ class VideoContent extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
videoItem.owner.name,
|
videoItem.owner.name as String,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize:
|
fontSize:
|
||||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
@ -230,14 +245,14 @@ class VideoContent extends StatelessWidget {
|
|||||||
if (showView) ...[
|
if (showView) ...[
|
||||||
StatView(
|
StatView(
|
||||||
theme: 'gray',
|
theme: 'gray',
|
||||||
view: videoItem.stat.view,
|
view: videoItem.stat.view as int,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
],
|
],
|
||||||
if (showDanmaku)
|
if (showDanmaku)
|
||||||
StatDanMu(
|
StatDanMu(
|
||||||
theme: 'gray',
|
theme: 'gray',
|
||||||
danmu: videoItem.stat.danmaku,
|
danmu: videoItem.stat.danmaku as int,
|
||||||
),
|
),
|
||||||
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
@ -267,7 +282,6 @@ class VideoContent extends StatelessWidget {
|
|||||||
height: 24,
|
height: 24,
|
||||||
child: PopupMenuButton<String>(
|
child: PopupMenuButton<String>(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
tooltip: '稍后再看',
|
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.more_vert_outlined,
|
Icons.more_vert_outlined,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
@ -281,11 +295,11 @@ class VideoContent extends StatelessWidget {
|
|||||||
PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var res = await UserHttp.toViewLater(
|
var res = await UserHttp.toViewLater(
|
||||||
bvid: videoItem.bvid);
|
bvid: videoItem.bvid as String);
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
},
|
},
|
||||||
value: 'pause',
|
value: 'pause',
|
||||||
height: 35,
|
height: 40,
|
||||||
child: const Row(
|
child: const Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.watch_later_outlined, size: 16),
|
Icon(Icons.watch_later_outlined, size: 16),
|
||||||
@ -294,6 +308,60 @@ class VideoContent extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
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))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
|
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:flutter/material.dart';
|
import '../../models/model_rec_video_item.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'stat/danmu.dart';
|
||||||
import 'package:pilipala/common/widgets/badge.dart';
|
import 'stat/view.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import '../../http/dynamics.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import '../../http/search.dart';
|
||||||
import 'package:pilipala/http/dynamics.dart';
|
import '../../http/user.dart';
|
||||||
import 'package:pilipala/http/search.dart';
|
import '../../http/video.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import '../../models/common/search_type.dart';
|
||||||
import 'package:pilipala/models/common/search_type.dart';
|
import '../../utils/id_utils.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import '../../utils/utils.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import '../constants.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'badge.dart';
|
||||||
|
import 'network_img_layer.dart';
|
||||||
|
|
||||||
// 视频卡片 - 垂直布局
|
// 视频卡片 - 垂直布局
|
||||||
class VideoCardV extends StatelessWidget {
|
class VideoCardV extends StatelessWidget {
|
||||||
@ -159,12 +161,12 @@ class VideoCardV extends StatelessWidget {
|
|||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (videoItem.duration != null)
|
if (videoItem.duration > 0)
|
||||||
if (crossAxisCount == 1) ...[
|
if (crossAxisCount == 1) ...[
|
||||||
PBadge(
|
PBadge(
|
||||||
bottom: 10,
|
bottom: 10,
|
||||||
right: 10,
|
right: 10,
|
||||||
text: videoItem.duration,
|
text: Utils.timeFormat(videoItem.duration),
|
||||||
)
|
)
|
||||||
] else ...[
|
] else ...[
|
||||||
PBadge(
|
PBadge(
|
||||||
@ -172,7 +174,7 @@ class VideoCardV extends StatelessWidget {
|
|||||||
right: 7,
|
right: 7,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
type: 'gray',
|
type: 'gray',
|
||||||
text: videoItem.duration,
|
text: Utils.timeFormat(videoItem.duration),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -217,15 +219,10 @@ class VideoContent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
if (videoItem.goto == 'av' && crossAxisCount == 1) ...[
|
if (videoItem.goto == 'av' && crossAxisCount == 1) ...[
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
WatchLater(
|
VideoPopupMenu(
|
||||||
size: 32,
|
size: 32,
|
||||||
iconSize: 18,
|
iconSize: 18,
|
||||||
callFn: () async {
|
videoItem: videoItem,
|
||||||
int aid = videoItem.param;
|
|
||||||
var res =
|
|
||||||
await UserHttp.toViewLater(bvid: IdUtils.av2bv(aid));
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -234,6 +231,7 @@ class VideoContent extends StatelessWidget {
|
|||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
VideoStat(
|
VideoStat(
|
||||||
videoItem: videoItem,
|
videoItem: videoItem,
|
||||||
|
crossAxisCount: crossAxisCount,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||||
@ -297,19 +295,15 @@ class VideoContent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
VideoStat(
|
VideoStat(
|
||||||
videoItem: videoItem,
|
videoItem: videoItem,
|
||||||
|
crossAxisCount: crossAxisCount,
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
],
|
],
|
||||||
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
|
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
|
||||||
WatchLater(
|
VideoPopupMenu(
|
||||||
size: 24,
|
size: 24,
|
||||||
iconSize: 14,
|
iconSize: 14,
|
||||||
callFn: () async {
|
videoItem: videoItem,
|
||||||
int aid = videoItem.param;
|
|
||||||
var res =
|
|
||||||
await UserHttp.toViewLater(bvid: IdUtils.av2bv(aid));
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
] else ...[
|
] else ...[
|
||||||
const SizedBox(height: 24)
|
const SizedBox(height: 24)
|
||||||
@ -325,42 +319,55 @@ class VideoContent extends StatelessWidget {
|
|||||||
|
|
||||||
class VideoStat extends StatelessWidget {
|
class VideoStat extends StatelessWidget {
|
||||||
final dynamic videoItem;
|
final dynamic videoItem;
|
||||||
|
final int crossAxisCount;
|
||||||
|
|
||||||
const VideoStat({
|
const VideoStat({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.videoItem,
|
required this.videoItem,
|
||||||
|
required this.crossAxisCount,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return RichText(
|
return Row(
|
||||||
maxLines: 1,
|
children: [
|
||||||
text: TextSpan(
|
StatView(
|
||||||
style: TextStyle(
|
theme: 'gray',
|
||||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
view: videoItem.stat.view,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
),
|
||||||
children: [
|
const SizedBox(width: 8),
|
||||||
if (videoItem.stat.view != '-')
|
StatDanMu(
|
||||||
TextSpan(text: '${videoItem.stat.view}观看'),
|
theme: 'gray',
|
||||||
if (videoItem.stat.danmu != '-')
|
danmu: videoItem.stat.danmu,
|
||||||
TextSpan(text: ' • ${videoItem.stat.danmu}弹幕'),
|
),
|
||||||
],
|
if (videoItem is RecVideoItemModel) ...<Widget>[
|
||||||
),
|
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
|
||||||
|
RichText(
|
||||||
|
maxLines: 1,
|
||||||
|
text: TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
text: Utils.formatTimestampToRelativeTime(videoItem.pubdate)),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
]
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WatchLater extends StatelessWidget {
|
class VideoPopupMenu extends StatelessWidget {
|
||||||
final double? size;
|
final double? size;
|
||||||
final double? iconSize;
|
final double? iconSize;
|
||||||
final Function? callFn;
|
final dynamic videoItem;
|
||||||
|
|
||||||
const WatchLater({
|
const VideoPopupMenu({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.size,
|
required this.size,
|
||||||
required this.iconSize,
|
required this.iconSize,
|
||||||
this.callFn,
|
required this.videoItem,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -370,7 +377,6 @@ class WatchLater extends StatelessWidget {
|
|||||||
height: size,
|
height: size,
|
||||||
child: PopupMenuButton<String>(
|
child: PopupMenuButton<String>(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
tooltip: '稍后再看',
|
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.more_vert_outlined,
|
Icons.more_vert_outlined,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
@ -381,9 +387,13 @@ class WatchLater extends StatelessWidget {
|
|||||||
onSelected: (String type) {},
|
onSelected: (String type) {},
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||||
PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
onTap: () => callFn!(),
|
onTap: () async {
|
||||||
|
var res =
|
||||||
|
await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
},
|
||||||
value: 'pause',
|
value: 'pause',
|
||||||
height: 35,
|
height: 40,
|
||||||
child: const Row(
|
child: const Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.watch_later_outlined, size: 16),
|
Icon(Icons.watch_later_outlined, size: 16),
|
||||||
@ -392,6 +402,55 @@ class WatchLater extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
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['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))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -185,7 +185,7 @@ class Api {
|
|||||||
static const String searchDefault = '/x/web-interface/wbi/search/default';
|
static const String searchDefault = '/x/web-interface/wbi/search/default';
|
||||||
|
|
||||||
// 搜索关键词
|
// 搜索关键词
|
||||||
static const String serachSuggest =
|
static const String searchSuggest =
|
||||||
'https://s.search.bilibili.com/main/suggest';
|
'https://s.search.bilibili.com/main/suggest';
|
||||||
|
|
||||||
// 分类搜索
|
// 分类搜索
|
||||||
@ -214,6 +214,9 @@ class Api {
|
|||||||
// https://api.bilibili.com/x/relation/tags
|
// https://api.bilibili.com/x/relation/tags
|
||||||
static const String followingsClass = '/x/relation/tags';
|
static const String followingsClass = '/x/relation/tags';
|
||||||
|
|
||||||
|
// 搜索follow
|
||||||
|
static const followSearch = '/x/relation/followings/search';
|
||||||
|
|
||||||
// 粉丝
|
// 粉丝
|
||||||
// vmid 用户id pn 页码 ps 每页个数,最大50 order: desc
|
// vmid 用户id pn 页码 ps 每页个数,最大50 order: desc
|
||||||
// order_type 排序规则 最近访问传空,最常访问传 attention
|
// order_type 排序规则 最近访问传空,最常访问传 attention
|
||||||
@ -230,6 +233,10 @@ class Api {
|
|||||||
static const String liveRoomInfo =
|
static const String liveRoomInfo =
|
||||||
'${HttpString.liveBaseUrl}/xlive/web-room/v2/index/getRoomPlayInfo';
|
'${HttpString.liveBaseUrl}/xlive/web-room/v2/index/getRoomPlayInfo';
|
||||||
|
|
||||||
|
// 直播间详情 H5
|
||||||
|
static const String liveRoomInfoH5 =
|
||||||
|
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getH5InfoByRoom';
|
||||||
|
|
||||||
// 用户信息 需要Wbi签名
|
// 用户信息 需要Wbi签名
|
||||||
// https://api.bilibili.com/x/space/wbi/acc/info?mid=503427686&token=&platform=web&web_location=1550101&w_rid=d709892496ce93e3d94d6d37c95bde91&wts=1689301482
|
// https://api.bilibili.com/x/space/wbi/acc/info?mid=503427686&token=&platform=web&web_location=1550101&w_rid=d709892496ce93e3d94d6d37c95bde91&wts=1689301482
|
||||||
static const String memberInfo = '/x/space/wbi/acc/info';
|
static const String memberInfo = '/x/space/wbi/acc/info';
|
||||||
@ -467,4 +474,36 @@ class Api {
|
|||||||
/// page_size
|
/// page_size
|
||||||
static const getSeasonDetailApi =
|
static const getSeasonDetailApi =
|
||||||
'/x/polymer/web-space/seasons_archives_list';
|
'/x/polymer/web-space/seasons_archives_list';
|
||||||
|
|
||||||
|
/// 获取未读动态数
|
||||||
|
static const getUnreadDynamic = '/x/web-interface/dynamic/entrance';
|
||||||
|
|
||||||
|
/// 用户动态主页
|
||||||
|
static const dynamicSpmPrefix = 'https://space.bilibili.com/1/dynamic';
|
||||||
|
|
||||||
|
/// 激活buvid3
|
||||||
|
static const activateBuvidApi = '/x/internal/gaia-gateway/ExClimbWuzhi';
|
||||||
|
|
||||||
|
/// 获取字幕配置
|
||||||
|
static const getSubtitleConfig = '/x/player/v2';
|
||||||
|
|
||||||
|
/// 我的订阅
|
||||||
|
static const userSubFolder = '/x/v3/fav/folder/collected/list';
|
||||||
|
|
||||||
|
/// 我的订阅详情
|
||||||
|
static const userSubFolderDetail = '/x/space/fav/season/list';
|
||||||
|
|
||||||
|
/// 表情
|
||||||
|
static const emojiList = '/x/emote/user/panel/web';
|
||||||
|
|
||||||
|
/// 已读标记
|
||||||
|
static const String ackSessionMsg =
|
||||||
|
'${HttpString.tUrl}/session_svr/v1/session_svr/update_ack';
|
||||||
|
|
||||||
|
/// 发送私信
|
||||||
|
static const String sendMsg = '${HttpString.tUrl}/web_im/v1/web_im/send_msg';
|
||||||
|
|
||||||
|
/// 排行榜
|
||||||
|
static const String getRankApi = "/x/web-interface/ranking/v2";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:pilipala/http/index.dart';
|
import '../models/bangumi/list.dart';
|
||||||
import 'package:pilipala/models/bangumi/list.dart';
|
import 'index.dart';
|
||||||
|
|
||||||
class BangumiHttp {
|
class BangumiHttp {
|
||||||
static Future bangumiList({int? page}) async {
|
static Future bangumiList({int? page}) async {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:pilipala/http/index.dart';
|
import '../models/user/black.dart';
|
||||||
import 'package:pilipala/models/user/black.dart';
|
import 'index.dart';
|
||||||
|
|
||||||
class BlackHttp {
|
class BlackHttp {
|
||||||
static Future blackList({required int pn, int? ps}) async {
|
static Future blackList({required int pn, int? ps}) async {
|
||||||
|
17
lib/http/common.dart
Normal file
17
lib/http/common.dart
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import 'index.dart';
|
||||||
|
|
||||||
|
class CommonHttp {
|
||||||
|
static Future unReadDynamic() async {
|
||||||
|
var res = await Request().get(Api.getUnreadDynamic,
|
||||||
|
data: {'alltype_offset': 0, 'video_offset': '', 'article_offset': 0});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {'status': true, 'data': res.data['data']['dyn_basic_infos']};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,6 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import '../models/danmaku/dm.pb.dart';
|
||||||
import 'package:pilipala/http/index.dart';
|
import 'index.dart';
|
||||||
import 'package:pilipala/models/danmaku/dm.pb.dart';
|
|
||||||
|
|
||||||
import 'constants.dart';
|
|
||||||
|
|
||||||
class DanmakaHttp {
|
class DanmakaHttp {
|
||||||
// 获取视频弹幕
|
// 获取视频弹幕
|
||||||
@ -24,21 +21,23 @@ class DanmakaHttp {
|
|||||||
);
|
);
|
||||||
return DmSegMobileReply.fromBuffer(response.data);
|
return DmSegMobileReply.fromBuffer(response.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future shootDanmaku({
|
static Future shootDanmaku({
|
||||||
int type = 1,//弹幕类选择(1:视频弹幕 2:漫画弹幕)
|
int type = 1, //弹幕类选择(1:视频弹幕 2:漫画弹幕)
|
||||||
required int oid,// 视频cid
|
required int oid, // 视频cid
|
||||||
required String msg,//弹幕文本(长度小于 100 字符)
|
required String msg, //弹幕文本(长度小于 100 字符)
|
||||||
int mode = 1,// 弹幕类型(1:滚动弹幕 4:底端弹幕 5:顶端弹幕 6:逆向弹幕(不能使用) 7:高级弹幕 8:代码弹幕(不能使用) 9:BAS弹幕(pool必须为2))
|
int mode =
|
||||||
|
1, // 弹幕类型(1:滚动弹幕 4:底端弹幕 5:顶端弹幕 6:逆向弹幕(不能使用) 7:高级弹幕 8:代码弹幕(不能使用) 9:BAS弹幕(pool必须为2))
|
||||||
// String? aid,// 稿件avid
|
// String? aid,// 稿件avid
|
||||||
// String? bvid,// bvid与aid必须有一个
|
// String? bvid,// bvid与aid必须有一个
|
||||||
required String bvid,
|
required String bvid,
|
||||||
int? progress,// 弹幕出现在视频内的时间(单位为毫秒,默认为0)
|
int? progress, // 弹幕出现在视频内的时间(单位为毫秒,默认为0)
|
||||||
int? color,// 弹幕颜色(默认白色,16777215)
|
int? color, // 弹幕颜色(默认白色,16777215)
|
||||||
int? fontsize,// 弹幕字号(默认25)
|
int? fontsize, // 弹幕字号(默认25)
|
||||||
int? pool,// 弹幕池选择(0:普通池 1:字幕池 2:特殊池(代码/BAS弹幕)默认普通池,0)
|
int? pool, // 弹幕池选择(0:普通池 1:字幕池 2:特殊池(代码/BAS弹幕)默认普通池,0)
|
||||||
//int? rnd,// 当前时间戳*1000000(若无此项,则发送弹幕冷却时间限制为90s;若有此项,则发送弹幕冷却时间限制为5s)
|
//int? rnd,// 当前时间戳*1000000(若无此项,则发送弹幕冷却时间限制为90s;若有此项,则发送弹幕冷却时间限制为5s)
|
||||||
int? colorful,//60001:专属渐变彩色(需要会员)
|
int? colorful, //60001:专属渐变彩色(需要会员)
|
||||||
int? checkbox_type,//是否带 UP 身份标识(0:普通;4:带有标识)
|
int? checkbox_type, //是否带 UP 身份标识(0:普通;4:带有标识)
|
||||||
// String? csrf,//CSRF Token(位于 Cookie) Cookie 方式必要
|
// String? csrf,//CSRF Token(位于 Cookie) Cookie 方式必要
|
||||||
// String? access_key,// APP 登录 Token APP 方式必要
|
// String? access_key,// APP 登录 Token APP 方式必要
|
||||||
}) async {
|
}) async {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:pilipala/http/index.dart';
|
import '../models/dynamics/result.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import '../models/dynamics/up.dart';
|
||||||
import 'package:pilipala/models/dynamics/up.dart';
|
import 'index.dart';
|
||||||
|
|
||||||
class DynamicsHttp {
|
class DynamicsHttp {
|
||||||
static Future followDynamic({
|
static Future followDynamic({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:pilipala/http/index.dart';
|
import '../models/fans/result.dart';
|
||||||
import 'package:pilipala/models/fans/result.dart';
|
import 'index.dart';
|
||||||
|
|
||||||
class FanHttp {
|
class FanHttp {
|
||||||
static Future fans({int? vmid, int? pn, int? ps, String? orderType}) async {
|
static Future fans({int? vmid, int? pn, int? ps, String? orderType}) async {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:pilipala/http/index.dart';
|
import '../models/follow/result.dart';
|
||||||
import 'package:pilipala/models/follow/result.dart';
|
import 'index.dart';
|
||||||
|
|
||||||
class FollowHttp {
|
class FollowHttp {
|
||||||
static Future followings(
|
static Future followings(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:html/dom.dart';
|
import 'package:html/dom.dart';
|
||||||
import 'package:html/parser.dart';
|
import 'package:html/parser.dart';
|
||||||
import 'package:pilipala/http/index.dart';
|
import 'index.dart';
|
||||||
|
|
||||||
class HtmlHttp {
|
class HtmlHttp {
|
||||||
// article
|
// article
|
||||||
@ -15,7 +15,7 @@ class HtmlHttp {
|
|||||||
Match match = regex.firstMatch(response.data)!;
|
Match match = regex.firstMatch(response.data)!;
|
||||||
String matchedString = match.group(0)!;
|
String matchedString = match.group(0)!;
|
||||||
response = await Request().get(
|
response = await Request().get(
|
||||||
'https:$matchedString' + '/',
|
'https:$matchedString/',
|
||||||
extra: {'ua': 'pc'},
|
extra: {'ua': 'pc'},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
// ignore_for_file: avoid_print
|
// ignore_for_file: avoid_print
|
||||||
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:async';
|
import 'dart:math' show Random;
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:cookie_jar/cookie_jar.dart';
|
import 'package:cookie_jar/cookie_jar.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
import 'package:dio/io.dart';
|
import 'package:dio/io.dart';
|
||||||
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
|
||||||
import 'package:pilipala/utils/utils.dart';
|
|
||||||
import 'package:pilipala/http/constants.dart';
|
|
||||||
import 'package:pilipala/http/interceptor.dart';
|
|
||||||
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
|
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
|
||||||
|
// import 'package:dio_http2_adapter/dio_http2_adapter.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
|
import '../utils/storage.dart';
|
||||||
|
import '../utils/utils.dart';
|
||||||
|
import 'api.dart';
|
||||||
|
import 'constants.dart';
|
||||||
|
import 'interceptor.dart';
|
||||||
|
|
||||||
class Request {
|
class Request {
|
||||||
static final Request _instance = Request._internal();
|
static final Request _instance = Request._internal();
|
||||||
@ -20,25 +24,26 @@ class Request {
|
|||||||
factory Request() => _instance;
|
factory Request() => _instance;
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
static Box localCache = GStrorage.localCache;
|
static Box localCache = GStrorage.localCache;
|
||||||
late dynamic enableSystemProxy;
|
late bool enableSystemProxy;
|
||||||
late String systemProxyHost;
|
late String systemProxyHost;
|
||||||
late String systemProxyPort;
|
late String systemProxyPort;
|
||||||
|
static final RegExp spmPrefixExp = RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
|
||||||
|
|
||||||
/// 设置cookie
|
/// 设置cookie
|
||||||
static setCookie() async {
|
static setCookie() async {
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
var cookiePath = await Utils.getCookiePath();
|
final String cookiePath = await Utils.getCookiePath();
|
||||||
var cookieJar = PersistCookieJar(
|
final PersistCookieJar cookieJar = PersistCookieJar(
|
||||||
ignoreExpires: true,
|
ignoreExpires: true,
|
||||||
storage: FileStorage(cookiePath),
|
storage: FileStorage(cookiePath),
|
||||||
);
|
);
|
||||||
cookieManager = CookieManager(cookieJar);
|
cookieManager = CookieManager(cookieJar);
|
||||||
dio.interceptors.add(cookieManager);
|
dio.interceptors.add(cookieManager);
|
||||||
var cookie = await cookieManager.cookieJar
|
final List<Cookie> cookie = await cookieManager.cookieJar
|
||||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||||
var userInfo = userInfoCache.get('userInfoCache');
|
final userInfo = userInfoCache.get('userInfoCache');
|
||||||
if (userInfo != null && userInfo.mid != null) {
|
if (userInfo != null && userInfo.mid != null) {
|
||||||
var cookie2 = await cookieManager.cookieJar
|
final List<Cookie> cookie2 = await cookieManager.cookieJar
|
||||||
.loadForRequest(Uri.parse(HttpString.tUrl));
|
.loadForRequest(Uri.parse(HttpString.tUrl));
|
||||||
if (cookie2.isEmpty) {
|
if (cookie2.isEmpty) {
|
||||||
try {
|
try {
|
||||||
@ -50,21 +55,21 @@ class Request {
|
|||||||
}
|
}
|
||||||
setOptionsHeaders(userInfo, userInfo != null && userInfo.mid != null);
|
setOptionsHeaders(userInfo, userInfo != null && userInfo.mid != null);
|
||||||
|
|
||||||
if (cookie.isEmpty) {
|
try {
|
||||||
try {
|
await buvidActivate();
|
||||||
await Request().get(HttpString.baseUrl);
|
} catch (e) {
|
||||||
} catch (e) {
|
log("setCookie, ${e.toString()}");
|
||||||
log("setCookie, ${e.toString()}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var cookieString =
|
|
||||||
cookie.map((cookie) => '${cookie.name}=${cookie.value}').join('; ');
|
final String cookieString = cookie
|
||||||
|
.map((Cookie cookie) => '${cookie.name}=${cookie.value}')
|
||||||
|
.join('; ');
|
||||||
dio.options.headers['cookie'] = cookieString;
|
dio.options.headers['cookie'] = cookieString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从cookie中获取 csrf token
|
// 从cookie中获取 csrf token
|
||||||
static Future<String> getCsrf() async {
|
static Future<String> getCsrf() async {
|
||||||
var cookies = await cookieManager.cookieJar
|
List<Cookie> cookies = await cookieManager.cookieJar
|
||||||
.loadForRequest(Uri.parse(HttpString.apiBaseUrl));
|
.loadForRequest(Uri.parse(HttpString.apiBaseUrl));
|
||||||
String token = '';
|
String token = '';
|
||||||
if (cookies.where((e) => e.name == 'bili_jct').isNotEmpty) {
|
if (cookies.where((e) => e.name == 'bili_jct').isNotEmpty) {
|
||||||
@ -73,17 +78,45 @@ class Request {
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
static setOptionsHeaders(userInfo, 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();
|
||||||
|
dio.options.headers['x-bili-aurora-eid'] =
|
||||||
|
IdUtils.genAuroraEid(userInfo.mid);
|
||||||
}
|
}
|
||||||
dio.options.headers['env'] = 'prod';
|
dio.options.headers['env'] = 'prod';
|
||||||
dio.options.headers['app-key'] = 'android64';
|
dio.options.headers['app-key'] = 'android64';
|
||||||
dio.options.headers['x-bili-aurora-eid'] = 'UlMFQVcABlAH';
|
|
||||||
dio.options.headers['x-bili-aurora-zone'] = 'sh001';
|
dio.options.headers['x-bili-aurora-zone'] = 'sh001';
|
||||||
dio.options.headers['referer'] = 'https://www.bilibili.com/';
|
dio.options.headers['referer'] = 'https://www.bilibili.com/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future buvidActivate() async {
|
||||||
|
var html = await Request().get(Api.dynamicSpmPrefix);
|
||||||
|
String spmPrefix = spmPrefixExp.firstMatch(html.data)!.group(1)!;
|
||||||
|
Random rand = Random();
|
||||||
|
String rand_png_end = base64.encode(
|
||||||
|
List<int>.generate(32, (_) => rand.nextInt(256)) +
|
||||||
|
List<int>.filled(4, 0) +
|
||||||
|
[73, 69, 78, 68] +
|
||||||
|
List<int>.generate(4, (_) => rand.nextInt(256))
|
||||||
|
);
|
||||||
|
|
||||||
|
String jsonData = json.encode({
|
||||||
|
'3064': 1,
|
||||||
|
'39c8': '${spmPrefix}.fp.risk',
|
||||||
|
'3c43': {
|
||||||
|
'adca': 'Linux',
|
||||||
|
'bfe9': rand_png_end.substring(rand_png_end.length - 50),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await Request().post(
|
||||||
|
Api.activateBuvidApi,
|
||||||
|
data: {'payload': jsonData},
|
||||||
|
options: Options(contentType: 'application/json')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* config it and create
|
* config it and create
|
||||||
*/
|
*/
|
||||||
@ -100,30 +133,31 @@ class Request {
|
|||||||
headers: {},
|
headers: {},
|
||||||
);
|
);
|
||||||
|
|
||||||
enableSystemProxy =
|
enableSystemProxy = setting.get(SettingBoxKey.enableSystemProxy,
|
||||||
setting.get(SettingBoxKey.enableSystemProxy, defaultValue: false);
|
defaultValue: false) as bool;
|
||||||
systemProxyHost =
|
systemProxyHost =
|
||||||
localCache.get(LocalCacheKey.systemProxyHost, defaultValue: '');
|
localCache.get(LocalCacheKey.systemProxyHost, defaultValue: '');
|
||||||
systemProxyPort =
|
systemProxyPort =
|
||||||
localCache.get(LocalCacheKey.systemProxyPort, defaultValue: '');
|
localCache.get(LocalCacheKey.systemProxyPort, defaultValue: '');
|
||||||
|
|
||||||
dio = Dio(options)
|
dio = Dio(options);
|
||||||
|
|
||||||
/// fix 第三方登录 302重定向 跟iOS代理问题冲突
|
/// fix 第三方登录 302重定向 跟iOS代理问题冲突
|
||||||
..httpClientAdapter = Http2Adapter(
|
// ..httpClientAdapter = Http2Adapter(
|
||||||
ConnectionManager(
|
// ConnectionManager(
|
||||||
idleTimeout: const Duration(milliseconds: 10000),
|
// idleTimeout: const Duration(milliseconds: 10000),
|
||||||
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
|
// onClientCreate: (_, ClientSetting config) =>
|
||||||
),
|
// config.onBadCertificate = (_) => true,
|
||||||
);
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
/// 设置代理
|
/// 设置代理
|
||||||
if (enableSystemProxy) {
|
if (enableSystemProxy) {
|
||||||
dio.httpClientAdapter = IOHttpClientAdapter(
|
dio.httpClientAdapter = IOHttpClientAdapter(
|
||||||
createHttpClient: () {
|
createHttpClient: () {
|
||||||
final client = HttpClient();
|
final HttpClient client = HttpClient();
|
||||||
// Config the client.
|
// Config the client.
|
||||||
client.findProxy = (uri) {
|
client.findProxy = (Uri uri) {
|
||||||
// return 'PROXY host:port';
|
// return 'PROXY host:port';
|
||||||
return 'PROXY $systemProxyHost:$systemProxyPort';
|
return 'PROXY $systemProxyHost:$systemProxyPort';
|
||||||
};
|
};
|
||||||
@ -145,7 +179,7 @@ class Request {
|
|||||||
));
|
));
|
||||||
|
|
||||||
dio.transformer = BackgroundTransformer();
|
dio.transformer = BackgroundTransformer();
|
||||||
dio.options.validateStatus = (status) {
|
dio.options.validateStatus = (int? status) {
|
||||||
return status! >= 200 && status < 300 ||
|
return status! >= 200 && status < 300 ||
|
||||||
HttpString.validateStatusCodes.contains(status);
|
HttpString.validateStatusCodes.contains(status);
|
||||||
};
|
};
|
||||||
@ -156,7 +190,7 @@ class Request {
|
|||||||
*/
|
*/
|
||||||
get(url, {data, options, cancelToken, extra}) async {
|
get(url, {data, options, cancelToken, extra}) async {
|
||||||
Response response;
|
Response response;
|
||||||
Options options = Options();
|
final Options options = Options();
|
||||||
ResponseType resType = ResponseType.json;
|
ResponseType resType = ResponseType.json;
|
||||||
if (extra != null) {
|
if (extra != null) {
|
||||||
resType = extra!['resType'] ?? ResponseType.json;
|
resType = extra!['resType'] ?? ResponseType.json;
|
||||||
@ -175,8 +209,14 @@ class Request {
|
|||||||
);
|
);
|
||||||
return response;
|
return response;
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
print('get error: $e');
|
Response errResponse = Response(
|
||||||
return Future.error(await ApiInterceptor.dioError(e));
|
data: {
|
||||||
|
'message': await ApiInterceptor.dioError(e)
|
||||||
|
}, // 将自定义 Map 数据赋值给 Response 的 data 属性
|
||||||
|
statusCode: 200,
|
||||||
|
requestOptions: RequestOptions(),
|
||||||
|
);
|
||||||
|
return errResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,8 +237,14 @@ class Request {
|
|||||||
// print('post success: ${response.data}');
|
// print('post success: ${response.data}');
|
||||||
return response;
|
return response;
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
print('post error: $e');
|
Response errResponse = Response(
|
||||||
return Future.error(await ApiInterceptor.dioError(e));
|
data: {
|
||||||
|
'message': await ApiInterceptor.dioError(e)
|
||||||
|
}, // 将自定义 Map 数据赋值给 Response 的 data 属性
|
||||||
|
statusCode: 200,
|
||||||
|
requestOptions: RequestOptions(),
|
||||||
|
);
|
||||||
|
return errResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
// ignore_for_file: avoid_print
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
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:pilipala/utils/storage.dart';
|
import '../utils/storage.dart';
|
||||||
// import 'package:get/get.dart' hide Response;
|
|
||||||
|
|
||||||
class ApiInterceptor extends Interceptor {
|
class ApiInterceptor extends Interceptor {
|
||||||
@override
|
@override
|
||||||
@ -21,16 +20,16 @@ class ApiInterceptor extends Interceptor {
|
|||||||
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
||||||
try {
|
try {
|
||||||
if (response.statusCode == 302) {
|
if (response.statusCode == 302) {
|
||||||
List<String> locations = response.headers['location']!;
|
final List<String> locations = response.headers['location']!;
|
||||||
if (locations.isNotEmpty) {
|
if (locations.isNotEmpty) {
|
||||||
if (locations.first.startsWith('https://www.mcbbs.net')) {
|
if (locations.first.startsWith('https://www.mcbbs.net')) {
|
||||||
final uri = Uri.parse(locations.first);
|
final Uri uri = Uri.parse(locations.first);
|
||||||
final accessKey = uri.queryParameters['access_key'];
|
final String? accessKey = uri.queryParameters['access_key'];
|
||||||
final mid = uri.queryParameters['mid'];
|
final String? mid = uri.queryParameters['mid'];
|
||||||
try {
|
try {
|
||||||
Box localCache = GStrorage.localCache;
|
Box localCache = GStrorage.localCache;
|
||||||
localCache.put(
|
localCache.put(LocalCacheKey.accessKey,
|
||||||
LocalCacheKey.accessKey, {'mid': mid, 'value': accessKey});
|
<String, String?>{'mid': mid, 'value': accessKey});
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,54 +45,57 @@ class ApiInterceptor extends Interceptor {
|
|||||||
void onError(DioException err, ErrorInterceptorHandler handler) async {
|
void onError(DioException err, ErrorInterceptorHandler handler) async {
|
||||||
// 处理网络请求错误
|
// 处理网络请求错误
|
||||||
// handler.next(err);
|
// handler.next(err);
|
||||||
SmartDialog.showToast(
|
String url = err.requestOptions.uri.toString();
|
||||||
await dioError(err),
|
if (!url.contains('heartBeat')) {
|
||||||
displayType: SmartToastType.onlyRefresh,
|
SmartDialog.showToast(
|
||||||
);
|
await dioError(err),
|
||||||
|
displayType: SmartToastType.onlyRefresh,
|
||||||
|
);
|
||||||
|
}
|
||||||
super.onError(err, handler);
|
super.onError(err, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future dioError(DioException error) async {
|
static Future<String> dioError(DioException error) async {
|
||||||
switch (error.type) {
|
switch (error.type) {
|
||||||
case DioExceptionType.badCertificate:
|
case DioExceptionType.badCertificate:
|
||||||
return '证书有误!';
|
return '证书有误!';
|
||||||
case DioExceptionType.badResponse:
|
case DioExceptionType.badResponse:
|
||||||
return '服务器异常,请稍后重试!';
|
return '服务器异常,请稍后重试!';
|
||||||
case DioExceptionType.cancel:
|
case DioExceptionType.cancel:
|
||||||
return "请求已被取消,请重新请求";
|
return '请求已被取消,请重新请求';
|
||||||
case DioExceptionType.connectionError:
|
case DioExceptionType.connectionError:
|
||||||
return '连接错误,请检查网络设置';
|
return '连接错误,请检查网络设置';
|
||||||
case DioExceptionType.connectionTimeout:
|
case DioExceptionType.connectionTimeout:
|
||||||
return "网络连接超时,请检查网络设置";
|
return '网络连接超时,请检查网络设置';
|
||||||
case DioExceptionType.receiveTimeout:
|
case DioExceptionType.receiveTimeout:
|
||||||
return "响应超时,请稍后重试!";
|
return '响应超时,请稍后重试!';
|
||||||
case DioExceptionType.sendTimeout:
|
case DioExceptionType.sendTimeout:
|
||||||
return "发送请求超时,请检查网络设置";
|
return '发送请求超时,请检查网络设置';
|
||||||
case DioExceptionType.unknown:
|
case DioExceptionType.unknown:
|
||||||
var res = await checkConect();
|
final String res = await checkConnect();
|
||||||
return res + " \n 网络异常,请稍后重试!";
|
return '$res,网络异常!';
|
||||||
default:
|
|
||||||
return "Dio异常";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<dynamic> checkConect() async {
|
static Future<String> checkConnect() async {
|
||||||
final connectivityResult = await (Connectivity().checkConnectivity());
|
final List<ConnectivityResult> connectivityResult =
|
||||||
if (connectivityResult == ConnectivityResult.mobile) {
|
await Connectivity().checkConnectivity();
|
||||||
return 'connected with mobile network';
|
if (connectivityResult.contains(ConnectivityResult.mobile)) {
|
||||||
} else if (connectivityResult == ConnectivityResult.wifi) {
|
return '正在使用移动流量';
|
||||||
return 'connected with wifi network';
|
} else if (connectivityResult.contains(ConnectivityResult.wifi)) {
|
||||||
} else if (connectivityResult == ConnectivityResult.ethernet) {
|
return '正在使用wifi';
|
||||||
// I am connected to a ethernet network.
|
} else if (connectivityResult.contains(ConnectivityResult.ethernet)) {
|
||||||
} else if (connectivityResult == ConnectivityResult.vpn) {
|
return '正在使用局域网';
|
||||||
// I am connected to a vpn network.
|
} else if (connectivityResult.contains(ConnectivityResult.vpn)) {
|
||||||
// Note for iOS and macOS:
|
return '正在使用代理网络';
|
||||||
// There is no separate network interface type for [vpn].
|
} else if (connectivityResult.contains(ConnectivityResult.bluetooth)) {
|
||||||
// It returns [other] on any device (also simulator)
|
return '正在使用蓝牙网络';
|
||||||
} else if (connectivityResult == ConnectivityResult.other) {
|
} else if (connectivityResult.contains(ConnectivityResult.other)) {
|
||||||
// I am connected to a network which is not in the above mentioned networks.
|
return '正在使用其他网络';
|
||||||
} else if (connectivityResult == ConnectivityResult.none) {
|
} else if (connectivityResult.contains(ConnectivityResult.none)) {
|
||||||
return 'not connected to any network';
|
return '未连接到任何网络';
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import 'package:pilipala/http/api.dart';
|
import '../models/live/item.dart';
|
||||||
import 'package:pilipala/http/init.dart';
|
import '../models/live/room_info.dart';
|
||||||
import 'package:pilipala/models/live/item.dart';
|
import '../models/live/room_info_h5.dart';
|
||||||
import 'package:pilipala/models/live/room_info.dart';
|
import 'api.dart';
|
||||||
|
import 'init.dart';
|
||||||
|
|
||||||
class LiveHttp {
|
class LiveHttp {
|
||||||
static Future liveList(
|
static Future liveList(
|
||||||
@ -46,4 +47,22 @@ class LiveHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future liveRoomInfoH5({roomId, qn}) async {
|
||||||
|
var res = await Request().get(Api.liveRoomInfoH5, data: {
|
||||||
|
'room_id': roomId,
|
||||||
|
});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': RoomInfoH5Model.fromJson(res.data['data'])
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:math';
|
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/index.dart';
|
|
||||||
import 'package:pilipala/models/login/index.dart';
|
|
||||||
import 'package:pilipala/utils/login.dart';
|
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
import '../models/login/index.dart';
|
||||||
|
import '../utils/login.dart';
|
||||||
|
import 'index.dart';
|
||||||
|
|
||||||
class LoginHttp {
|
class LoginHttp {
|
||||||
static Future queryCaptcha() async {
|
static Future queryCaptcha() async {
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
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:pilipala/common/constants.dart';
|
import '../common/constants.dart';
|
||||||
import 'package:pilipala/http/index.dart';
|
import '../models/dynamics/result.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import '../models/follow/result.dart';
|
||||||
import 'package:pilipala/models/follow/result.dart';
|
import '../models/member/archive.dart';
|
||||||
import 'package:pilipala/models/member/archive.dart';
|
import '../models/member/coin.dart';
|
||||||
import 'package:pilipala/models/member/coin.dart';
|
import '../models/member/info.dart';
|
||||||
import 'package:pilipala/models/member/info.dart';
|
import '../models/member/seasons.dart';
|
||||||
import 'package:pilipala/models/member/seasons.dart';
|
import '../models/member/tags.dart';
|
||||||
import 'package:pilipala/models/member/tags.dart';
|
import '../utils/storage.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import '../utils/utils.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import '../utils/wbi_sign.dart';
|
||||||
import 'package:pilipala/utils/wbi_sign.dart';
|
import 'index.dart';
|
||||||
|
|
||||||
class MemberHttp {
|
class MemberHttp {
|
||||||
static Future memberInfo({
|
static Future memberInfo({
|
||||||
@ -79,6 +79,8 @@ class MemberHttp {
|
|||||||
String order = 'pubdate',
|
String order = 'pubdate',
|
||||||
bool orderAvoided = true,
|
bool orderAvoided = true,
|
||||||
}) async {
|
}) async {
|
||||||
|
String dmImgStr = Utils.base64EncodeRandomString(16, 64);
|
||||||
|
String dmCoverImgStr = Utils.base64EncodeRandomString(32, 128);
|
||||||
Map params = await WbiSign().makSign({
|
Map params = await WbiSign().makSign({
|
||||||
'mid': mid,
|
'mid': mid,
|
||||||
'ps': ps,
|
'ps': ps,
|
||||||
@ -88,7 +90,11 @@ class MemberHttp {
|
|||||||
'order': order,
|
'order': order,
|
||||||
'platform': 'web',
|
'platform': 'web',
|
||||||
'web_location': 1550101,
|
'web_location': 1550101,
|
||||||
'order_avoided': orderAvoided
|
'order_avoided': orderAvoided,
|
||||||
|
'dm_img_list': '[]',
|
||||||
|
'dm_img_str': dmImgStr.substring(0, dmImgStr.length - 2),
|
||||||
|
'dm_cover_img_str': dmCoverImgStr.substring(0, dmCoverImgStr.length - 2),
|
||||||
|
'dm_img_inter': '{"ds":[],"wh":[0,0,0],"of":[0,0,0]}',
|
||||||
});
|
});
|
||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
Api.memberArchive,
|
Api.memberArchive,
|
||||||
@ -101,10 +107,13 @@ class MemberHttp {
|
|||||||
'data': MemberArchiveDataModel.fromJson(res.data['data'])
|
'data': MemberArchiveDataModel.fromJson(res.data['data'])
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
Map errMap = {
|
||||||
|
-352: '风控校验失败,请检查登录状态',
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': [],
|
'data': [],
|
||||||
'msg': res.data['message'],
|
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,10 +132,13 @@ class MemberHttp {
|
|||||||
'data': DynamicsDataModel.fromJson(res.data['data']),
|
'data': DynamicsDataModel.fromJson(res.data['data']),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
Map errMap = {
|
||||||
|
-352: '风控校验失败,请检查登录状态',
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': [],
|
'data': [],
|
||||||
'msg': res.data['message'],
|
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -461,4 +473,41 @@ class MemberHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 搜索follow
|
||||||
|
static Future getfollowSearch({
|
||||||
|
required int mid,
|
||||||
|
required int ps,
|
||||||
|
required int pn,
|
||||||
|
required String name,
|
||||||
|
}) async {
|
||||||
|
Map<String, dynamic> data = {
|
||||||
|
'vmid': mid,
|
||||||
|
'pn': pn,
|
||||||
|
'ps': ps,
|
||||||
|
'order': 'desc',
|
||||||
|
'order_type': 'attention',
|
||||||
|
'gaia_source': 'main_web',
|
||||||
|
'name': name,
|
||||||
|
'web_location': 333.999,
|
||||||
|
};
|
||||||
|
Map params = await WbiSign().makSign(data);
|
||||||
|
var res = await Request().get(Api.followSearch, data: {
|
||||||
|
...data,
|
||||||
|
'w_rid': params['w_rid'],
|
||||||
|
'wts': params['wts'],
|
||||||
|
});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': FollowDataModel.fromJson(res.data['data'])
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import 'package:pilipala/http/api.dart';
|
import 'dart:math';
|
||||||
import 'package:pilipala/http/init.dart';
|
import '../models/msg/account.dart';
|
||||||
import 'package:pilipala/models/msg/account.dart';
|
import '../models/msg/session.dart';
|
||||||
import 'package:pilipala/models/msg/session.dart';
|
import '../utils/wbi_sign.dart';
|
||||||
import 'package:pilipala/utils/wbi_sign.dart';
|
import 'api.dart';
|
||||||
|
import 'init.dart';
|
||||||
|
|
||||||
class MsgHttp {
|
class MsgHttp {
|
||||||
// 会话列表
|
// 会话列表
|
||||||
@ -22,14 +23,22 @@ class MsgHttp {
|
|||||||
Map signParams = await WbiSign().makSign(params);
|
Map signParams = await WbiSign().makSign(params);
|
||||||
var res = await Request().get(Api.sessionList, data: signParams);
|
var res = await Request().get(Api.sessionList, data: signParams);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
try {
|
||||||
'status': true,
|
return {
|
||||||
'data': SessionDataModel.fromJson(res.data['data']),
|
'status': true,
|
||||||
};
|
'data': SessionDataModel.fromJson(res.data['data']),
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': err.toString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'date': [],
|
'data': [],
|
||||||
'msg': res.data['message'],
|
'msg': res.data['message'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -42,12 +51,16 @@ class MsgHttp {
|
|||||||
'mobi_app': 'web',
|
'mobi_app': 'web',
|
||||||
});
|
});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
try {
|
||||||
'status': true,
|
return {
|
||||||
'data': res.data['data']
|
'status': true,
|
||||||
.map<AccountListModel>((e) => AccountListModel.fromJson(e))
|
'data': res.data['data']
|
||||||
.toList(),
|
.map<AccountListModel>((e) => AccountListModel.fromJson(e))
|
||||||
};
|
.toList(),
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
print('err🔟: $err');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
@ -86,4 +99,125 @@ class MsgHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 消息标记已读
|
||||||
|
static Future ackSessionMsg({
|
||||||
|
int? talkerId,
|
||||||
|
int? ackSeqno,
|
||||||
|
}) async {
|
||||||
|
String csrf = await Request.getCsrf();
|
||||||
|
Map params = await WbiSign().makSign({
|
||||||
|
'talker_id': talkerId,
|
||||||
|
'session_type': 1,
|
||||||
|
'ack_seqno': ackSeqno,
|
||||||
|
'build': 0,
|
||||||
|
'mobi_app': 'web',
|
||||||
|
'csrf_token': csrf,
|
||||||
|
'csrf': csrf
|
||||||
|
});
|
||||||
|
var res = await Request().get(Api.ackSessionMsg, data: params);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': res.data['data'],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'date': [],
|
||||||
|
'msg': "message: ${res.data['message']},"
|
||||||
|
" msg: ${res.data['msg']},"
|
||||||
|
" code: ${res.data['code']}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送私信
|
||||||
|
static Future sendMsg({
|
||||||
|
int? senderUid,
|
||||||
|
int? receiverId,
|
||||||
|
int? receiverType,
|
||||||
|
int? msgType,
|
||||||
|
dynamic content,
|
||||||
|
}) async {
|
||||||
|
String csrf = await Request.getCsrf();
|
||||||
|
Map<String, dynamic> params = await WbiSign().makSign({
|
||||||
|
'msg[sender_uid]': senderUid,
|
||||||
|
'msg[receiver_id]': receiverId,
|
||||||
|
'msg[receiver_type]': receiverType ?? 1,
|
||||||
|
'msg[msg_type]': msgType ?? 1,
|
||||||
|
'msg[msg_status]': 0,
|
||||||
|
'msg[dev_id]': getDevId(),
|
||||||
|
'msg[timestamp]': DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
|
'msg[new_face_version]': 0,
|
||||||
|
'msg[content]': content,
|
||||||
|
'from_firework': 0,
|
||||||
|
'build': 0,
|
||||||
|
'mobi_app': 'web',
|
||||||
|
'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) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': res.data['data'],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'date': [],
|
||||||
|
'msg': "message: ${res.data['message']},"
|
||||||
|
" msg: ${res.data['msg']},"
|
||||||
|
" code: ${res.data['code']}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getDevId() {
|
||||||
|
final List<String> b = [
|
||||||
|
'0',
|
||||||
|
'1',
|
||||||
|
'2',
|
||||||
|
'3',
|
||||||
|
'4',
|
||||||
|
'5',
|
||||||
|
'6',
|
||||||
|
'7',
|
||||||
|
'8',
|
||||||
|
'9',
|
||||||
|
'A',
|
||||||
|
'B',
|
||||||
|
'C',
|
||||||
|
'D',
|
||||||
|
'E',
|
||||||
|
'F'
|
||||||
|
];
|
||||||
|
final List<String> s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split('');
|
||||||
|
for (int i = 0; i < s.length; i++) {
|
||||||
|
if ('-' == s[i] || '4' == s[i]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final int randomInt = Random().nextInt(16);
|
||||||
|
if ('x' == s[i]) {
|
||||||
|
s[i] = b[randomInt];
|
||||||
|
} else {
|
||||||
|
s[i] = b[3 & randomInt | 8];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s.join();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:pilipala/http/api.dart';
|
import '../models/video/reply/data.dart';
|
||||||
import 'package:pilipala/http/init.dart';
|
import '../models/video/reply/emote.dart';
|
||||||
import 'package:pilipala/models/video/reply/data.dart';
|
import 'api.dart';
|
||||||
|
import 'init.dart';
|
||||||
|
|
||||||
class ReplyHttp {
|
class ReplyHttp {
|
||||||
static Future replyList({
|
static Future replyList({
|
||||||
@ -100,4 +101,23 @@ class ReplyHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future getEmoteList({String? business}) async {
|
||||||
|
var res = await Request().get(Api.emojiList, data: {
|
||||||
|
'business': business ?? 'reply',
|
||||||
|
'web_location': '333.1245',
|
||||||
|
});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': EmoteModelData.fromJson(res.data['data']),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'date': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/index.dart';
|
import '../models/bangumi/info.dart';
|
||||||
import 'package:pilipala/models/bangumi/info.dart';
|
import '../models/common/search_type.dart';
|
||||||
import 'package:pilipala/models/common/search_type.dart';
|
import '../models/search/hot.dart';
|
||||||
import 'package:pilipala/models/search/hot.dart';
|
import '../models/search/result.dart';
|
||||||
import 'package:pilipala/models/search/result.dart';
|
import '../models/search/suggest.dart';
|
||||||
import 'package:pilipala/models/search/suggest.dart';
|
import '../utils/storage.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'index.dart';
|
||||||
|
|
||||||
class SearchHttp {
|
class SearchHttp {
|
||||||
static Box setting = GStrorage.setting;
|
static Box setting = GStrorage.setting;
|
||||||
@ -37,7 +36,7 @@ class SearchHttp {
|
|||||||
|
|
||||||
// 获取搜索建议
|
// 获取搜索建议
|
||||||
static Future searchSuggest({required term}) async {
|
static Future searchSuggest({required term}) async {
|
||||||
var res = await Request().get(Api.serachSuggest,
|
var res = await Request().get(Api.searchSuggest,
|
||||||
data: {'term': term, 'main_ver': 'v1', 'highlight': term});
|
data: {'term': term, 'main_ver': 'v1', 'highlight': term});
|
||||||
if (res.data is String) {
|
if (res.data is String) {
|
||||||
Map<String, dynamic> resultMap = json.decode(res.data);
|
Map<String, dynamic> resultMap = json.decode(res.data);
|
||||||
@ -129,25 +128,28 @@ class SearchHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future ab2c({int? aid, String? bvid}) async {
|
static Future<int> ab2c({int? aid, String? bvid}) async {
|
||||||
Map<String, dynamic> data = {};
|
Map<String, dynamic> data = {};
|
||||||
if (aid != null) {
|
if (aid != null) {
|
||||||
data['aid'] = aid;
|
data['aid'] = aid;
|
||||||
} else if (bvid != null) {
|
} else if (bvid != null) {
|
||||||
data['bvid'] = bvid;
|
data['bvid'] = bvid;
|
||||||
}
|
}
|
||||||
var res = await Request().get(Api.ab2c, data: {...data});
|
final dynamic res =
|
||||||
|
await Request().get(Api.ab2c, data: <String, dynamic>{...data});
|
||||||
return res.data['data'].first['cid'];
|
return res.data['data'].first['cid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future bangumiInfo({int? seasonId, int? epId}) async {
|
static Future<Map<String, dynamic>> bangumiInfo(
|
||||||
Map<String, dynamic> data = {};
|
{int? seasonId, int? epId}) async {
|
||||||
|
final Map<String, dynamic> data = {};
|
||||||
if (seasonId != null) {
|
if (seasonId != null) {
|
||||||
data['season_id'] = seasonId;
|
data['season_id'] = seasonId;
|
||||||
} else if (epId != null) {
|
} else if (epId != null) {
|
||||||
data['ep_id'] = epId;
|
data['ep_id'] = epId;
|
||||||
}
|
}
|
||||||
var res = await Request().get(Api.bangumiInfo, data: {...data});
|
final dynamic res =
|
||||||
|
await Request().get(Api.bangumiInfo, data: <String, dynamic>{...data});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import '../common/constants.dart';
|
||||||
import 'package:pilipala/http/api.dart';
|
import '../models/model_hot_video_item.dart';
|
||||||
import 'package:pilipala/http/init.dart';
|
import '../models/user/fav_detail.dart';
|
||||||
import 'package:pilipala/models/model_hot_video_item.dart';
|
import '../models/user/fav_folder.dart';
|
||||||
import 'package:pilipala/models/user/fav_detail.dart';
|
import '../models/user/history.dart';
|
||||||
import 'package:pilipala/models/user/fav_folder.dart';
|
import '../models/user/info.dart';
|
||||||
import 'package:pilipala/models/user/history.dart';
|
import '../models/user/stat.dart';
|
||||||
import 'package:pilipala/models/user/info.dart';
|
import '../models/user/sub_detail.dart';
|
||||||
import 'package:pilipala/models/user/stat.dart';
|
import '../models/user/sub_folder.dart';
|
||||||
import 'package:pilipala/utils/wbi_sign.dart';
|
import 'api.dart';
|
||||||
|
import 'init.dart';
|
||||||
|
|
||||||
class UserHttp {
|
class UserHttp {
|
||||||
static Future<dynamic> userStat({required int mid}) async {
|
static Future<dynamic> userStat({required int mid}) async {
|
||||||
@ -306,4 +307,46 @@ class UserHttp {
|
|||||||
return {'status': false, 'msg': res.data['message']};
|
return {'status': false, 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 我的订阅
|
||||||
|
static Future userSubFolder({
|
||||||
|
required int mid,
|
||||||
|
required int pn,
|
||||||
|
required int ps,
|
||||||
|
}) async {
|
||||||
|
var res = await Request().get(Api.userSubFolder, data: {
|
||||||
|
'up_mid': mid,
|
||||||
|
'ps': ps,
|
||||||
|
'pn': pn,
|
||||||
|
'platform': 'web',
|
||||||
|
});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': SubFolderModelData.fromJson(res.data['data'])
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'msg': res.data['message']};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future userSubFolderDetail({
|
||||||
|
required int seasonId,
|
||||||
|
required int pn,
|
||||||
|
required int ps,
|
||||||
|
}) async {
|
||||||
|
var res = await Request().get(Api.userSubFolderDetail, data: {
|
||||||
|
'season_id': seasonId,
|
||||||
|
'ps': ps,
|
||||||
|
'pn': pn,
|
||||||
|
});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': SubDetailModelData.fromJson(res.data['data'])
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'msg': res.data['message']};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import '../common/constants.dart';
|
||||||
import 'package:pilipala/http/api.dart';
|
import '../models/common/reply_type.dart';
|
||||||
import 'package:pilipala/http/init.dart';
|
import '../models/home/rcmd/result.dart';
|
||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import '../models/model_hot_video_item.dart';
|
||||||
import 'package:pilipala/models/home/rcmd/result.dart';
|
import '../models/model_rec_video_item.dart';
|
||||||
import 'package:pilipala/models/model_hot_video_item.dart';
|
import '../models/user/fav_folder.dart';
|
||||||
import 'package:pilipala/models/model_rec_video_item.dart';
|
import '../models/video/ai.dart';
|
||||||
import 'package:pilipala/models/user/fav_folder.dart';
|
import '../models/video/play/url.dart';
|
||||||
import 'package:pilipala/models/video/ai.dart';
|
import '../models/video/subTitile/result.dart';
|
||||||
import 'package:pilipala/models/video/play/url.dart';
|
import '../models/video_detail_res.dart';
|
||||||
import 'package:pilipala/models/video_detail_res.dart';
|
import '../utils/recommend_filter.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import '../utils/storage.dart';
|
||||||
import 'package:pilipala/utils/wbi_sign.dart';
|
import '../utils/subtitle.dart';
|
||||||
|
import '../utils/wbi_sign.dart';
|
||||||
|
import 'api.dart';
|
||||||
|
import 'init.dart';
|
||||||
|
|
||||||
/// res.data['code'] == 0 请求正常返回结果
|
/// res.data['code'] == 0 请求正常返回结果
|
||||||
/// res.data['data'] 为结果
|
/// res.data['data'] 为结果
|
||||||
@ -33,27 +35,41 @@ class VideoHttp {
|
|||||||
Api.recommendListWeb,
|
Api.recommendListWeb,
|
||||||
data: {
|
data: {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'feed_version': 'V3',
|
'feed_version': 'V8',
|
||||||
|
'homepage_ver': 1,
|
||||||
'ps': ps,
|
'ps': ps,
|
||||||
'fresh_idx': freshIdx,
|
'fresh_idx': freshIdx,
|
||||||
'fresh_type': 999999
|
'brush': freshIdx,
|
||||||
|
'fresh_type': 4
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
List<RecVideoItemModel> list = [];
|
List<RecVideoItemModel> list = [];
|
||||||
|
List<int> blackMidsList =
|
||||||
|
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
||||||
for (var i in res.data['data']['item']) {
|
for (var i in res.data['data']['item']) {
|
||||||
list.add(RecVideoItemModel.fromJson(i));
|
//过滤掉live与ad,以及拉黑用户
|
||||||
|
if (i['goto'] == 'av' &&
|
||||||
|
(i['owner'] != null &&
|
||||||
|
!blackMidsList.contains(i['owner']['mid']))) {
|
||||||
|
RecVideoItemModel videoItem = RecVideoItemModel.fromJson(i);
|
||||||
|
if (!RecommendFilter.filter(videoItem)) {
|
||||||
|
list.add(videoItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return {'status': true, 'data': list};
|
return {'status': true, 'data': list};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'data': [], 'msg': ''};
|
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return {'status': false, 'data': [], 'msg': err.toString()};
|
return {'status': false, 'data': [], 'msg': err.toString()};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future rcmdVideoListApp({int? ps, required int freshIdx}) async {
|
// 添加额外的loginState变量模拟未登录状态
|
||||||
|
static Future rcmdVideoListApp(
|
||||||
|
{bool loginStatus = true, required int freshIdx}) async {
|
||||||
try {
|
try {
|
||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
Api.recommendListApp,
|
Api.recommendListApp,
|
||||||
@ -66,9 +82,11 @@ class VideoHttp {
|
|||||||
'device_name': 'vivo',
|
'device_name': 'vivo',
|
||||||
'pull': freshIdx == 0 ? 'true' : 'false',
|
'pull': freshIdx == 0 ? 'true' : 'false',
|
||||||
'appkey': Constants.appKey,
|
'appkey': Constants.appKey,
|
||||||
'access_key': localCache
|
'access_key': loginStatus
|
||||||
.get(LocalCacheKey.accessKey, defaultValue: {})['value'] ??
|
? (localCache.get(LocalCacheKey.accessKey,
|
||||||
''
|
defaultValue: {})['value'] ??
|
||||||
|
'')
|
||||||
|
: ''
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
@ -81,12 +99,15 @@ class VideoHttp {
|
|||||||
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
|
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
|
||||||
(i['args'] != null &&
|
(i['args'] != null &&
|
||||||
!blackMidsList.contains(i['args']['up_mid']))) {
|
!blackMidsList.contains(i['args']['up_mid']))) {
|
||||||
list.add(RecVideoItemAppModel.fromJson(i));
|
RecVideoItemAppModel videoItem = RecVideoItemAppModel.fromJson(i);
|
||||||
|
if (!RecommendFilter.filter(videoItem)) {
|
||||||
|
list.add(videoItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {'status': true, 'data': list};
|
return {'status': true, 'data': list};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'data': [], 'msg': ''};
|
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return {'status': false, 'data': [], 'msg': err.toString()};
|
return {'status': false, 'data': [], 'msg': err.toString()};
|
||||||
@ -111,7 +132,7 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
return {'status': true, 'data': list};
|
return {'status': true, 'data': list};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'data': []};
|
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return {'status': false, 'data': [], 'msg': err};
|
return {'status': false, 'data': [], 'msg': err};
|
||||||
@ -134,6 +155,12 @@ class VideoHttp {
|
|||||||
data['bvid'] = bvid;
|
data['bvid'] = bvid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 免登录查看1080p
|
||||||
|
if (userInfoCache.get('userInfoCache') == null &&
|
||||||
|
setting.get(SettingBoxKey.p1080, defaultValue: true)) {
|
||||||
|
data['try_look'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
Map params = await WbiSign().makSign({
|
Map params = await WbiSign().makSign({
|
||||||
...data,
|
...data,
|
||||||
'fourk': 1,
|
'fourk': 1,
|
||||||
@ -142,11 +169,6 @@ class VideoHttp {
|
|||||||
'web_location': 1550101,
|
'web_location': 1550101,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 免登录查看1080p
|
|
||||||
if (userInfoCache.get('userInfoCache') == null &&
|
|
||||||
setting.get(SettingBoxKey.p1080, defaultValue: true)) {
|
|
||||||
data['try_look'] = 1;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
var res = await Request().get(Api.videoUrl, data: params);
|
var res = await Request().get(Api.videoUrl, data: params);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
@ -196,7 +218,10 @@ class VideoHttp {
|
|||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
List<HotVideoItemModel> list = [];
|
List<HotVideoItemModel> list = [];
|
||||||
for (var i in res.data['data']) {
|
for (var i in res.data['data']) {
|
||||||
list.add(HotVideoItemModel.fromJson(i));
|
HotVideoItemModel videoItem = HotVideoItemModel.fromJson(i);
|
||||||
|
if (!RecommendFilter.filter(videoItem, relatedVideos: true)) {
|
||||||
|
list.add(videoItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return {'status': true, 'data': list};
|
return {'status': true, 'data': list};
|
||||||
} else {
|
} else {
|
||||||
@ -217,10 +242,11 @@ class VideoHttp {
|
|||||||
// 获取投币状态
|
// 获取投币状态
|
||||||
static Future hasCoinVideo({required String bvid}) async {
|
static Future hasCoinVideo({required String bvid}) async {
|
||||||
var res = await Request().get(Api.hasCoinVideo, data: {'bvid': bvid});
|
var res = await Request().get(Api.hasCoinVideo, data: {'bvid': bvid});
|
||||||
|
print('res: $res');
|
||||||
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 {
|
||||||
return {'status': true, 'data': []};
|
return {'status': false, 'data': []};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +324,7 @@ class VideoHttp {
|
|||||||
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 {
|
||||||
return {'status': false, 'data': []};
|
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +380,7 @@ class VideoHttp {
|
|||||||
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 {
|
||||||
return {'status': true, 'data': []};
|
return {'status': false, 'data': []};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +396,7 @@ class VideoHttp {
|
|||||||
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 {
|
||||||
return {'status': true, 'data': []};
|
return {'status': false, 'data': []};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,6 +452,8 @@ class VideoHttp {
|
|||||||
});
|
});
|
||||||
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 {
|
||||||
|
return {'status': false, 'data': null, 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,11 +468,63 @@ class VideoHttp {
|
|||||||
'up_mid': upMid,
|
'up_mid': upMid,
|
||||||
});
|
});
|
||||||
var res = await Request().get(Api.aiConclusion, data: params);
|
var res = await Request().get(Api.aiConclusion, data: params);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0 && res.data['data']['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
'data': AiConclusionModel.fromJson(res.data['data']),
|
'data': AiConclusionModel.fromJson(res.data['data']),
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'data': []};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future getSubtitle({int? cid, String? bvid}) async {
|
||||||
|
var res = await Request().get(Api.getSubtitleConfig, data: {
|
||||||
|
'cid': cid,
|
||||||
|
'bvid': bvid,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': SubTitlteModel.fromJson(res.data['data']),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'data': [], 'msg': res.data['msg']};
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
print(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 视频排行
|
||||||
|
static Future getRankVideoList(int rid) async {
|
||||||
|
try {
|
||||||
|
var rankApi = "${Api.getRankApi}?rid=$rid&type=all";
|
||||||
|
var res = await Request().get(rankApi);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
List<HotVideoItemModel> list = [];
|
||||||
|
List<int> blackMidsList =
|
||||||
|
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
||||||
|
for (var i in res.data['data']['list']) {
|
||||||
|
if (!blackMidsList.contains(i['owner']['mid'])) {
|
||||||
|
list.add(HotVideoItemModel.fromJson(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {'status': true, 'data': list};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
return {'status': false, 'data': [], 'msg': err};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取字幕内容
|
||||||
|
static Future<Map<String, dynamic>> getSubtitleContent(url) async {
|
||||||
|
var res = await Request().get('https:$url');
|
||||||
|
final String content = SubTitleUtils.convertToWebVTT(res.data['body']);
|
||||||
|
final List body = res.data['body'];
|
||||||
|
return {'content': content, 'body': body};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,15 @@ 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/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:media_kit/media_kit.dart'; // Provides [Player], [Media], [Playlist] etc.
|
import 'package:media_kit/media_kit.dart'; // Provides [Player], [Media], [Playlist] etc.
|
||||||
|
import 'package:pilipala/utils/recommend_filter.dart';
|
||||||
|
import 'package:catcher_2/catcher_2.dart';
|
||||||
|
import './services/loggeer.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
@ -30,7 +34,35 @@ void main() async {
|
|||||||
.then((_) async {
|
.then((_) async {
|
||||||
await GStrorage.init();
|
await GStrorage.init();
|
||||||
await setupServiceLocator();
|
await setupServiceLocator();
|
||||||
runApp(const MyApp());
|
Request();
|
||||||
|
await Request.setCookie();
|
||||||
|
RecommendFilter();
|
||||||
|
|
||||||
|
// 异常捕获 logo记录
|
||||||
|
final Catcher2Options debugConfig = Catcher2Options(
|
||||||
|
SilentReportMode(),
|
||||||
|
[
|
||||||
|
FileHandler(await getLogsPath()),
|
||||||
|
ConsoleHandler(
|
||||||
|
enableDeviceParameters: false,
|
||||||
|
enableApplicationParameters: false,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
final Catcher2Options releaseConfig = Catcher2Options(
|
||||||
|
SilentReportMode(),
|
||||||
|
[FileHandler(await getLogsPath())],
|
||||||
|
);
|
||||||
|
|
||||||
|
Catcher2(
|
||||||
|
debugConfig: debugConfig,
|
||||||
|
releaseConfig: releaseConfig,
|
||||||
|
runAppFunction: () {
|
||||||
|
runApp(const MyApp());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// 小白条、导航栏沉浸
|
// 小白条、导航栏沉浸
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||||
@ -38,10 +70,9 @@ void main() async {
|
|||||||
systemNavigationBarDividerColor: Colors.transparent,
|
systemNavigationBarDividerColor: Colors.transparent,
|
||||||
statusBarColor: Colors.transparent,
|
statusBarColor: Colors.transparent,
|
||||||
));
|
));
|
||||||
await Request.setCookie();
|
|
||||||
Data.init();
|
Data.init();
|
||||||
GStrorage.lazyInit();
|
|
||||||
PiliSchame.init();
|
PiliSchame.init();
|
||||||
|
DisableBatteryOpt();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +143,13 @@ class MyApp extends StatelessWidget {
|
|||||||
? darkColorScheme
|
? darkColorScheme
|
||||||
: lightColorScheme,
|
: lightColorScheme,
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
|
snackBarTheme: SnackBarThemeData(
|
||||||
|
actionTextColor: lightColorScheme.primary,
|
||||||
|
backgroundColor: lightColorScheme.secondaryContainer,
|
||||||
|
closeIconColor: lightColorScheme.secondary,
|
||||||
|
contentTextStyle: TextStyle(color: lightColorScheme.secondary),
|
||||||
|
elevation: 20,
|
||||||
|
),
|
||||||
pageTransitionsTheme: const PageTransitionsTheme(
|
pageTransitionsTheme: const PageTransitionsTheme(
|
||||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||||
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
||||||
@ -126,10 +164,11 @@ class MyApp extends StatelessWidget {
|
|||||||
? lightColorScheme
|
? lightColorScheme
|
||||||
: darkColorScheme,
|
: darkColorScheme,
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
snackBarTheme: const SnackBarThemeData(
|
snackBarTheme: SnackBarThemeData(
|
||||||
actionTextColor: Colors.white,
|
actionTextColor: darkColorScheme.primary,
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: darkColorScheme.secondaryContainer,
|
||||||
contentTextStyle: TextStyle(color: Colors.white),
|
closeIconColor: darkColorScheme.secondary,
|
||||||
|
contentTextStyle: TextStyle(color: darkColorScheme.secondary),
|
||||||
elevation: 20,
|
elevation: 20,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -147,9 +186,8 @@ class MyApp extends StatelessWidget {
|
|||||||
return FlutterSmartDialog(
|
return FlutterSmartDialog(
|
||||||
toastBuilder: (String msg) => CustomToast(msg: msg),
|
toastBuilder: (String msg) => CustomToast(msg: msg),
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
data: MediaQuery.of(context).copyWith(
|
data: MediaQuery.of(context)
|
||||||
textScaleFactor:
|
.copyWith(textScaler: TextScaler.linear(textScale)),
|
||||||
MediaQuery.of(context).textScaleFactor * textScale),
|
|
||||||
child: child!,
|
child: child!,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
9
lib/models/common/dynamic_badge_mode.dart
Normal file
9
lib/models/common/dynamic_badge_mode.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
enum DynamicBadgeMode { hidden, point, number }
|
||||||
|
|
||||||
|
extension DynamicBadgeModeDesc on DynamicBadgeMode {
|
||||||
|
String get description => ['隐藏', '红点', '数字'][index];
|
||||||
|
}
|
||||||
|
|
||||||
|
extension DynamicBadgeModeCode on DynamicBadgeMode {
|
||||||
|
int get code => [0, 1, 2][index];
|
||||||
|
}
|
@ -7,5 +7,5 @@ enum DynamicsType {
|
|||||||
|
|
||||||
extension BusinessTypeExtension on DynamicsType {
|
extension BusinessTypeExtension on DynamicsType {
|
||||||
String get values => ['all', 'video', 'pgc', 'article'][index];
|
String get values => ['all', 'video', 'pgc', 'article'][index];
|
||||||
String get labels => ['全部', '视频', '追番', '专栏'][index];
|
String get labels => ['全部', '投稿', '番剧', '专栏'][index];
|
||||||
}
|
}
|
||||||
|
12
lib/models/common/gesture_mode.dart
Normal file
12
lib/models/common/gesture_mode.dart
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
enum FullScreenGestureMode {
|
||||||
|
/// 从上滑到下
|
||||||
|
fromToptoBottom,
|
||||||
|
|
||||||
|
/// 从下滑到上
|
||||||
|
fromBottomtoTop,
|
||||||
|
}
|
||||||
|
|
||||||
|
extension FullScreenGestureModeExtension on FullScreenGestureMode {
|
||||||
|
String get values => ['fromToptoBottom', 'fromBottomtoTop'][index];
|
||||||
|
String get labels => ['从上往下滑进入全屏', '从下往上滑进入全屏'][index];
|
||||||
|
}
|
4
lib/models/common/index.dart
Normal file
4
lib/models/common/index.dart
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
library commonn_model;
|
||||||
|
|
||||||
|
export './business_type.dart';
|
||||||
|
export './gesture_mode.dart';
|
56
lib/models/common/nav_bar_config.dart
Normal file
56
lib/models/common/nav_bar_config.dart
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
List defaultNavigationBars = [
|
||||||
|
{
|
||||||
|
'id': 0,
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.home_outlined,
|
||||||
|
size: 21,
|
||||||
|
),
|
||||||
|
'selectIcon': const Icon(
|
||||||
|
Icons.home,
|
||||||
|
size: 21,
|
||||||
|
),
|
||||||
|
'label': "首页",
|
||||||
|
'count': 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': 1,
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.trending_up,
|
||||||
|
size: 21,
|
||||||
|
),
|
||||||
|
'selectIcon': const Icon(
|
||||||
|
Icons.trending_up_outlined,
|
||||||
|
size: 21,
|
||||||
|
),
|
||||||
|
'label': "排行榜",
|
||||||
|
'count': 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': 2,
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.motion_photos_on_outlined,
|
||||||
|
size: 21,
|
||||||
|
),
|
||||||
|
'selectIcon': const Icon(
|
||||||
|
Icons.motion_photos_on,
|
||||||
|
size: 21,
|
||||||
|
),
|
||||||
|
'label': "动态",
|
||||||
|
'count': 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': 3,
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.video_collection_outlined,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
'selectIcon': const Icon(
|
||||||
|
Icons.video_collection,
|
||||||
|
size: 21,
|
||||||
|
),
|
||||||
|
'label': "媒体库",
|
||||||
|
'count': 0,
|
||||||
|
}
|
||||||
|
];
|
240
lib/models/common/rank_type.dart
Normal file
240
lib/models/common/rank_type.dart
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/pages/rank/zone/index.dart';
|
||||||
|
|
||||||
|
enum RandType {
|
||||||
|
all,
|
||||||
|
creation,
|
||||||
|
animation,
|
||||||
|
music,
|
||||||
|
dance,
|
||||||
|
game,
|
||||||
|
knowledge,
|
||||||
|
technology,
|
||||||
|
sport,
|
||||||
|
car,
|
||||||
|
life,
|
||||||
|
food,
|
||||||
|
animal,
|
||||||
|
madness,
|
||||||
|
fashion,
|
||||||
|
entertainment,
|
||||||
|
film,
|
||||||
|
origin,
|
||||||
|
rookie
|
||||||
|
}
|
||||||
|
|
||||||
|
extension RankTypeDesc on RandType {
|
||||||
|
String get description => [
|
||||||
|
'全站',
|
||||||
|
'国创相关',
|
||||||
|
'动画',
|
||||||
|
'音乐',
|
||||||
|
'舞蹈',
|
||||||
|
'游戏',
|
||||||
|
'知识',
|
||||||
|
'科技',
|
||||||
|
'运动',
|
||||||
|
'汽车',
|
||||||
|
'生活',
|
||||||
|
'美食',
|
||||||
|
'动物圈',
|
||||||
|
'鬼畜',
|
||||||
|
'时尚',
|
||||||
|
'娱乐',
|
||||||
|
'影视'
|
||||||
|
][index];
|
||||||
|
|
||||||
|
String get id => [
|
||||||
|
'all',
|
||||||
|
'creation',
|
||||||
|
'animation',
|
||||||
|
'music',
|
||||||
|
'dance',
|
||||||
|
'game',
|
||||||
|
'knowledge',
|
||||||
|
'technology',
|
||||||
|
'sport',
|
||||||
|
'car',
|
||||||
|
'life',
|
||||||
|
'food',
|
||||||
|
'animal',
|
||||||
|
'madness',
|
||||||
|
'fashion',
|
||||||
|
'entertainment',
|
||||||
|
'film'
|
||||||
|
][index];
|
||||||
|
}
|
||||||
|
|
||||||
|
List tabsConfig = [
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '全站',
|
||||||
|
'type': RandType.all,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 0),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '国创相关',
|
||||||
|
'type': RandType.creation,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 168),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '动画',
|
||||||
|
'type': RandType.animation,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 1),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '音乐',
|
||||||
|
'type': RandType.music,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 3),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '舞蹈',
|
||||||
|
'type': RandType.dance,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 129),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '游戏',
|
||||||
|
'type': RandType.game,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 4),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '知识',
|
||||||
|
'type': RandType.knowledge,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 36),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '科技',
|
||||||
|
'type': RandType.technology,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 188),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '运动',
|
||||||
|
'type': RandType.sport,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 234),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '汽车',
|
||||||
|
'type': RandType.car,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 223),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '生活',
|
||||||
|
'type': RandType.life,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 160),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '美食',
|
||||||
|
'type': RandType.food,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 211),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '动物圈',
|
||||||
|
'type': RandType.animal,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 217),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '鬼畜',
|
||||||
|
'type': RandType.madness,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 119),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '时尚',
|
||||||
|
'type': RandType.fashion,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 155),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '娱乐',
|
||||||
|
'type': RandType.entertainment,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 5),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'icon': const Icon(
|
||||||
|
Icons.live_tv_outlined,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
'label': '影视',
|
||||||
|
'type': RandType.film,
|
||||||
|
'ctr': Get.put<ZoneController>,
|
||||||
|
'page': const ZonePage(rid: 181),
|
||||||
|
}
|
||||||
|
];
|
@ -1,7 +1,7 @@
|
|||||||
// 首页推荐类型
|
// 首页推荐类型
|
||||||
enum RcmdType { web, app }
|
enum RcmdType { web, app, notLogin }
|
||||||
|
|
||||||
extension RcmdTypeExtension on RcmdType {
|
extension RcmdTypeExtension on RcmdType {
|
||||||
String get values => ['web', 'app'][index];
|
String get values => ['web', 'app', 'notLogin'][index];
|
||||||
String get labels => ['web端', 'app端'][index];
|
String get labels => ['web端', 'app端', '游客模式'][index];
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
enum ReplySortType { time, like, reply }
|
enum ReplySortType { time, like }
|
||||||
|
|
||||||
extension ReplySortTypeExtension on ReplySortType {
|
extension ReplySortTypeExtension on ReplySortType {
|
||||||
String get titles => ['最新评论', '最热评论', '回复最多'][index];
|
String get titles => ['最新评论', '最热评论'][index];
|
||||||
String get labels => ['最新', '最热', '最多回复'][index];
|
String get labels => ['最新', '最热'][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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ enum TabType { live, rcmd, hot, bangumi }
|
|||||||
|
|
||||||
extension TabTypeDesc on TabType {
|
extension TabTypeDesc on TabType {
|
||||||
String get description => ['直播', '推荐', '热门', '番剧'][index];
|
String get description => ['直播', '推荐', '热门', '番剧'][index];
|
||||||
|
String get id => ['live', 'rcmd', 'hot', 'bangumi'][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
List tabsConfig = [
|
List tabsConfig = [
|
||||||
|
@ -2,18 +2,28 @@ class FollowUpModel {
|
|||||||
FollowUpModel({
|
FollowUpModel({
|
||||||
this.liveUsers,
|
this.liveUsers,
|
||||||
this.upList,
|
this.upList,
|
||||||
|
this.liveList,
|
||||||
|
this.myInfo,
|
||||||
});
|
});
|
||||||
|
|
||||||
LiveUsers? liveUsers;
|
LiveUsers? liveUsers;
|
||||||
List<UpItem>? upList;
|
List<UpItem>? upList;
|
||||||
|
List<LiveUserItem>? liveList;
|
||||||
|
MyInfo? myInfo;
|
||||||
|
|
||||||
FollowUpModel.fromJson(Map<String, dynamic> json) {
|
FollowUpModel.fromJson(Map<String, dynamic> json) {
|
||||||
liveUsers = json['live_users'] != null
|
liveUsers = json['live_users'] != null
|
||||||
? LiveUsers.fromJson(json['live_users'])
|
? LiveUsers.fromJson(json['live_users'])
|
||||||
: null;
|
: null;
|
||||||
|
liveList = json['live_users'] != null
|
||||||
|
? json['live_users']['items']
|
||||||
|
.map<LiveUserItem>((e) => LiveUserItem.fromJson(e))
|
||||||
|
.toList()
|
||||||
|
: [];
|
||||||
upList = json['up_list'] != null
|
upList = json['up_list'] != null
|
||||||
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
|
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
|
||||||
: [];
|
: [];
|
||||||
|
myInfo = json['my_info'] != null ? MyInfo.fromJson(json['my_info']) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,3 +103,21 @@ class UpItem {
|
|||||||
uname = json['uname'];
|
uname = json['uname'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MyInfo {
|
||||||
|
MyInfo({
|
||||||
|
this.face,
|
||||||
|
this.mid,
|
||||||
|
this.name,
|
||||||
|
});
|
||||||
|
|
||||||
|
String? face;
|
||||||
|
int? mid;
|
||||||
|
String? name;
|
||||||
|
|
||||||
|
MyInfo.fromJson(Map<String, dynamic> json) {
|
||||||
|
face = json['face'];
|
||||||
|
mid = json['mid'];
|
||||||
|
name = json['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -17,8 +17,9 @@ class LatestDataModel {
|
|||||||
url = json['url'];
|
url = json['url'];
|
||||||
tagName = json['tag_name'];
|
tagName = json['tag_name'];
|
||||||
createdAt = json['created_at'];
|
createdAt = json['created_at'];
|
||||||
assets =
|
assets = json['assets'] != null
|
||||||
json['assets'].map<AssetItem>((e) => AssetItem.fromJson(e)).toList();
|
? json['assets'].map<AssetItem>((e) => AssetItem.fromJson(e)).toList()
|
||||||
|
: [];
|
||||||
body = json['body'];
|
body = json['body'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
|
|
||||||
part 'result.g.dart';
|
|
||||||
|
|
||||||
@HiveType(typeId: 0)
|
|
||||||
class RecVideoItemAppModel {
|
class RecVideoItemAppModel {
|
||||||
RecVideoItemAppModel({
|
RecVideoItemAppModel({
|
||||||
this.id,
|
this.id,
|
||||||
@ -27,47 +24,27 @@ class RecVideoItemAppModel {
|
|||||||
this.adInfo,
|
this.adInfo,
|
||||||
});
|
});
|
||||||
|
|
||||||
@HiveField(0)
|
|
||||||
int? id;
|
int? id;
|
||||||
@HiveField(1)
|
|
||||||
int? aid;
|
int? aid;
|
||||||
@HiveField(2)
|
|
||||||
String? bvid;
|
String? bvid;
|
||||||
@HiveField(3)
|
|
||||||
int? cid;
|
int? cid;
|
||||||
@HiveField(4)
|
|
||||||
String? pic;
|
String? pic;
|
||||||
@HiveField(5)
|
|
||||||
RcmdStat? stat;
|
RcmdStat? stat;
|
||||||
@HiveField(6)
|
int? duration;
|
||||||
String? duration;
|
|
||||||
@HiveField(7)
|
|
||||||
String? title;
|
String? title;
|
||||||
@HiveField(8)
|
|
||||||
int? isFollowed;
|
int? isFollowed;
|
||||||
@HiveField(9)
|
|
||||||
RcmdOwner? owner;
|
RcmdOwner? owner;
|
||||||
@HiveField(10)
|
|
||||||
RcmdReason? rcmdReason;
|
RcmdReason? rcmdReason;
|
||||||
@HiveField(11)
|
|
||||||
String? goto;
|
String? goto;
|
||||||
@HiveField(12)
|
|
||||||
int? param;
|
int? param;
|
||||||
@HiveField(13)
|
|
||||||
String? uri;
|
String? uri;
|
||||||
@HiveField(14)
|
|
||||||
String? talkBack;
|
String? talkBack;
|
||||||
// 番剧
|
// 番剧
|
||||||
@HiveField(15)
|
|
||||||
String? bangumiView;
|
String? bangumiView;
|
||||||
@HiveField(16)
|
|
||||||
String? bangumiFollow;
|
String? bangumiFollow;
|
||||||
@HiveField(17)
|
|
||||||
String? bangumiBadge;
|
String? bangumiBadge;
|
||||||
|
|
||||||
@HiveField(18)
|
|
||||||
String? cardType;
|
String? cardType;
|
||||||
@HiveField(19)
|
|
||||||
Map? adInfo;
|
Map? adInfo;
|
||||||
|
|
||||||
RecVideoItemAppModel.fromJson(Map<String, dynamic> json) {
|
RecVideoItemAppModel.fromJson(Map<String, dynamic> json) {
|
||||||
@ -75,17 +52,32 @@ class RecVideoItemAppModel {
|
|||||||
? json['player_args']['aid']
|
? json['player_args']['aid']
|
||||||
: int.parse(json['param'] ?? '-1');
|
: int.parse(json['param'] ?? '-1');
|
||||||
aid = json['player_args'] != null ? json['player_args']['aid'] : -1;
|
aid = json['player_args'] != null ? json['player_args']['aid'] : -1;
|
||||||
bvid = null;
|
bvid = json['player_args'] != null
|
||||||
|
? IdUtils.av2bv(json['player_args']['aid'])
|
||||||
|
: '';
|
||||||
cid = json['player_args'] != null ? json['player_args']['cid'] : -1;
|
cid = json['player_args'] != null ? json['player_args']['cid'] : -1;
|
||||||
pic = json['cover'];
|
pic = json['cover'];
|
||||||
stat = RcmdStat.fromJson(json);
|
stat = RcmdStat.fromJson(json);
|
||||||
duration = json['cover_right_text'];
|
// 改用player_args中的duration作为原始数据(秒数)
|
||||||
|
duration =
|
||||||
|
json['player_args'] != null ? json['player_args']['duration'] : -1;
|
||||||
|
//duration = json['cover_right_text'];
|
||||||
title = json['title'];
|
title = json['title'];
|
||||||
isFollowed = 0;
|
|
||||||
owner = RcmdOwner.fromJson(json);
|
owner = RcmdOwner.fromJson(json);
|
||||||
rcmdReason = json['rcmd_reason_style'] != null
|
rcmdReason = json['rcmd_reason_style'] != null
|
||||||
? RcmdReason.fromJson(json['rcmd_reason_style'])
|
? RcmdReason.fromJson(json['rcmd_reason_style'])
|
||||||
: null;
|
: null;
|
||||||
|
// 由于app端api并不会直接返回与owner的关注状态
|
||||||
|
// 所以借用推荐原因是否为“已关注”、“新关注”等判别关注状态,从而与web端接口等效
|
||||||
|
isFollowed = rcmdReason != null &&
|
||||||
|
rcmdReason!.content != null &&
|
||||||
|
rcmdReason!.content!.contains('关注')
|
||||||
|
? 1
|
||||||
|
: 0;
|
||||||
|
// 如果是,就无需再显示推荐原因,交由view统一处理即可
|
||||||
|
if (isFollowed == 1) {
|
||||||
|
rcmdReason = null;
|
||||||
|
}
|
||||||
goto = json['goto'];
|
goto = json['goto'];
|
||||||
param = int.parse(json['param']);
|
param = int.parse(json['param']);
|
||||||
uri = json['uri'];
|
uri = json['uri'];
|
||||||
@ -102,18 +94,14 @@ class RecVideoItemAppModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HiveType(typeId: 1)
|
|
||||||
class RcmdStat {
|
class RcmdStat {
|
||||||
RcmdStat({
|
RcmdStat({
|
||||||
this.view,
|
this.view,
|
||||||
this.like,
|
this.like,
|
||||||
this.danmu,
|
this.danmu,
|
||||||
});
|
});
|
||||||
@HiveField(0)
|
|
||||||
String? view;
|
String? view;
|
||||||
@HiveField(1)
|
|
||||||
String? like;
|
String? like;
|
||||||
@HiveField(2)
|
|
||||||
String? danmu;
|
String? danmu;
|
||||||
|
|
||||||
RcmdStat.fromJson(Map<String, dynamic> json) {
|
RcmdStat.fromJson(Map<String, dynamic> json) {
|
||||||
@ -122,13 +110,10 @@ class RcmdStat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HiveType(typeId: 2)
|
|
||||||
class RcmdOwner {
|
class RcmdOwner {
|
||||||
RcmdOwner({this.name, this.mid});
|
RcmdOwner({this.name, this.mid});
|
||||||
|
|
||||||
@HiveField(0)
|
|
||||||
String? name;
|
String? name;
|
||||||
@HiveField(1)
|
|
||||||
int? mid;
|
int? mid;
|
||||||
|
|
||||||
RcmdOwner.fromJson(Map<String, dynamic> json) {
|
RcmdOwner.fromJson(Map<String, dynamic> json) {
|
||||||
@ -141,13 +126,11 @@ class RcmdOwner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HiveType(typeId: 8)
|
|
||||||
class RcmdReason {
|
class RcmdReason {
|
||||||
RcmdReason({
|
RcmdReason({
|
||||||
this.content,
|
this.content,
|
||||||
});
|
});
|
||||||
|
|
||||||
@HiveField(0)
|
|
||||||
String? content;
|
String? content;
|
||||||
|
|
||||||
RcmdReason.fromJson(Map<String, dynamic> json) {
|
RcmdReason.fromJson(Map<String, dynamic> json) {
|
||||||
|
@ -1,209 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'result.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// TypeAdapterGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
class RecVideoItemAppModelAdapter extends TypeAdapter<RecVideoItemAppModel> {
|
|
||||||
@override
|
|
||||||
final int typeId = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
RecVideoItemAppModel read(BinaryReader reader) {
|
|
||||||
final numOfFields = reader.readByte();
|
|
||||||
final fields = <int, dynamic>{
|
|
||||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
|
||||||
};
|
|
||||||
return RecVideoItemAppModel(
|
|
||||||
id: fields[0] as int?,
|
|
||||||
aid: fields[1] as int?,
|
|
||||||
bvid: fields[2] as String?,
|
|
||||||
cid: fields[3] as int?,
|
|
||||||
pic: fields[4] as String?,
|
|
||||||
stat: fields[5] as RcmdStat?,
|
|
||||||
duration: fields[6] as String?,
|
|
||||||
title: fields[7] as String?,
|
|
||||||
isFollowed: fields[8] as int?,
|
|
||||||
owner: fields[9] as RcmdOwner?,
|
|
||||||
rcmdReason: fields[10] as RcmdReason?,
|
|
||||||
goto: fields[11] as String?,
|
|
||||||
param: fields[12] as int?,
|
|
||||||
uri: fields[13] as String?,
|
|
||||||
talkBack: fields[14] as String?,
|
|
||||||
bangumiView: fields[15] as String?,
|
|
||||||
bangumiFollow: fields[16] as String?,
|
|
||||||
bangumiBadge: fields[17] as String?,
|
|
||||||
cardType: fields[18] as String?,
|
|
||||||
adInfo: (fields[19] as Map?)?.cast<dynamic, dynamic>(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void write(BinaryWriter writer, RecVideoItemAppModel obj) {
|
|
||||||
writer
|
|
||||||
..writeByte(20)
|
|
||||||
..writeByte(0)
|
|
||||||
..write(obj.id)
|
|
||||||
..writeByte(1)
|
|
||||||
..write(obj.aid)
|
|
||||||
..writeByte(2)
|
|
||||||
..write(obj.bvid)
|
|
||||||
..writeByte(3)
|
|
||||||
..write(obj.cid)
|
|
||||||
..writeByte(4)
|
|
||||||
..write(obj.pic)
|
|
||||||
..writeByte(5)
|
|
||||||
..write(obj.stat)
|
|
||||||
..writeByte(6)
|
|
||||||
..write(obj.duration)
|
|
||||||
..writeByte(7)
|
|
||||||
..write(obj.title)
|
|
||||||
..writeByte(8)
|
|
||||||
..write(obj.isFollowed)
|
|
||||||
..writeByte(9)
|
|
||||||
..write(obj.owner)
|
|
||||||
..writeByte(10)
|
|
||||||
..write(obj.rcmdReason)
|
|
||||||
..writeByte(11)
|
|
||||||
..write(obj.goto)
|
|
||||||
..writeByte(12)
|
|
||||||
..write(obj.param)
|
|
||||||
..writeByte(13)
|
|
||||||
..write(obj.uri)
|
|
||||||
..writeByte(14)
|
|
||||||
..write(obj.talkBack)
|
|
||||||
..writeByte(15)
|
|
||||||
..write(obj.bangumiView)
|
|
||||||
..writeByte(16)
|
|
||||||
..write(obj.bangumiFollow)
|
|
||||||
..writeByte(17)
|
|
||||||
..write(obj.bangumiBadge)
|
|
||||||
..writeByte(18)
|
|
||||||
..write(obj.cardType)
|
|
||||||
..writeByte(19)
|
|
||||||
..write(obj.adInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => typeId.hashCode;
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) =>
|
|
||||||
identical(this, other) ||
|
|
||||||
other is RecVideoItemAppModelAdapter &&
|
|
||||||
runtimeType == other.runtimeType &&
|
|
||||||
typeId == other.typeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class RcmdStatAdapter extends TypeAdapter<RcmdStat> {
|
|
||||||
@override
|
|
||||||
final int typeId = 1;
|
|
||||||
|
|
||||||
@override
|
|
||||||
RcmdStat read(BinaryReader reader) {
|
|
||||||
final numOfFields = reader.readByte();
|
|
||||||
final fields = <int, dynamic>{
|
|
||||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
|
||||||
};
|
|
||||||
return RcmdStat(
|
|
||||||
view: fields[0] as String?,
|
|
||||||
like: fields[1] as String?,
|
|
||||||
danmu: fields[2] as String?,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void write(BinaryWriter writer, RcmdStat 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 RcmdStatAdapter &&
|
|
||||||
runtimeType == other.runtimeType &&
|
|
||||||
typeId == other.typeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class RcmdOwnerAdapter extends TypeAdapter<RcmdOwner> {
|
|
||||||
@override
|
|
||||||
final int typeId = 2;
|
|
||||||
|
|
||||||
@override
|
|
||||||
RcmdOwner read(BinaryReader reader) {
|
|
||||||
final numOfFields = reader.readByte();
|
|
||||||
final fields = <int, dynamic>{
|
|
||||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
|
||||||
};
|
|
||||||
return RcmdOwner(
|
|
||||||
name: fields[0] as String?,
|
|
||||||
mid: fields[1] as int?,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void write(BinaryWriter writer, RcmdOwner obj) {
|
|
||||||
writer
|
|
||||||
..writeByte(2)
|
|
||||||
..writeByte(0)
|
|
||||||
..write(obj.name)
|
|
||||||
..writeByte(1)
|
|
||||||
..write(obj.mid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => typeId.hashCode;
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) =>
|
|
||||||
identical(this, other) ||
|
|
||||||
other is RcmdOwnerAdapter &&
|
|
||||||
runtimeType == other.runtimeType &&
|
|
||||||
typeId == other.typeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
class RcmdReasonAdapter extends TypeAdapter<RcmdReason> {
|
|
||||||
@override
|
|
||||||
final int typeId = 8;
|
|
||||||
|
|
||||||
@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(
|
|
||||||
content: fields[0] as String?,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void write(BinaryWriter writer, RcmdReason obj) {
|
|
||||||
writer
|
|
||||||
..writeByte(1)
|
|
||||||
..writeByte(0)
|
|
||||||
..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;
|
|
||||||
}
|
|
43
lib/models/live/quality.dart
Normal file
43
lib/models/live/quality.dart
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
enum LiveQuality {
|
||||||
|
dolby,
|
||||||
|
super4K,
|
||||||
|
origin,
|
||||||
|
bluRay,
|
||||||
|
superHD,
|
||||||
|
smooth,
|
||||||
|
flunt,
|
||||||
|
}
|
||||||
|
|
||||||
|
extension LiveQualityCode on LiveQuality {
|
||||||
|
static final List<int> _codeList = [
|
||||||
|
30000,
|
||||||
|
20000,
|
||||||
|
10000,
|
||||||
|
400,
|
||||||
|
250,
|
||||||
|
150,
|
||||||
|
80,
|
||||||
|
];
|
||||||
|
int get code => _codeList[index];
|
||||||
|
|
||||||
|
static LiveQuality? fromCode(int code) {
|
||||||
|
final index = _codeList.indexOf(code);
|
||||||
|
if (index != -1) {
|
||||||
|
return LiveQuality.values[index];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension VideoQualityDesc on LiveQuality {
|
||||||
|
static final List<String> _descList = [
|
||||||
|
'杜比',
|
||||||
|
'4K',
|
||||||
|
'原画',
|
||||||
|
'蓝光',
|
||||||
|
'超清',
|
||||||
|
'高清',
|
||||||
|
'流畅',
|
||||||
|
];
|
||||||
|
get description => _descList[index];
|
||||||
|
}
|
130
lib/models/live/room_info_h5.dart
Normal file
130
lib/models/live/room_info_h5.dart
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
class RoomInfoH5Model {
|
||||||
|
RoomInfoH5Model({
|
||||||
|
this.roomInfo,
|
||||||
|
this.anchorInfo,
|
||||||
|
this.isRoomFeed,
|
||||||
|
this.watchedShow,
|
||||||
|
this.likeInfoV3,
|
||||||
|
this.blockInfo,
|
||||||
|
});
|
||||||
|
|
||||||
|
RoomInfo? roomInfo;
|
||||||
|
AnchorInfo? anchorInfo;
|
||||||
|
int? isRoomFeed;
|
||||||
|
Map? watchedShow;
|
||||||
|
LikeInfoV3? likeInfoV3;
|
||||||
|
Map? blockInfo;
|
||||||
|
|
||||||
|
RoomInfoH5Model.fromJson(Map<String, dynamic> json) {
|
||||||
|
roomInfo = RoomInfo.fromJson(json['room_info']);
|
||||||
|
anchorInfo = AnchorInfo.fromJson(json['anchor_info']);
|
||||||
|
isRoomFeed = json['is_room_feed'];
|
||||||
|
watchedShow = json['watched_show'];
|
||||||
|
likeInfoV3 = LikeInfoV3.fromJson(json['like_info_v3']);
|
||||||
|
blockInfo = json['block_info'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RoomInfo {
|
||||||
|
RoomInfo({
|
||||||
|
this.uid,
|
||||||
|
this.roomId,
|
||||||
|
this.title,
|
||||||
|
this.cover,
|
||||||
|
this.description,
|
||||||
|
this.liveStatus,
|
||||||
|
this.liveStartTime,
|
||||||
|
this.areaId,
|
||||||
|
this.areaName,
|
||||||
|
this.parentAreaId,
|
||||||
|
this.parentAreaName,
|
||||||
|
this.online,
|
||||||
|
this.background,
|
||||||
|
this.appBackground,
|
||||||
|
this.liveId,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? uid;
|
||||||
|
int? roomId;
|
||||||
|
String? title;
|
||||||
|
String? cover;
|
||||||
|
String? description;
|
||||||
|
int? liveStatus;
|
||||||
|
int? liveStartTime;
|
||||||
|
int? areaId;
|
||||||
|
String? areaName;
|
||||||
|
int? parentAreaId;
|
||||||
|
String? parentAreaName;
|
||||||
|
int? online;
|
||||||
|
String? background;
|
||||||
|
String? appBackground;
|
||||||
|
String? liveId;
|
||||||
|
|
||||||
|
RoomInfo.fromJson(Map<String, dynamic> json) {
|
||||||
|
uid = json['uid'];
|
||||||
|
roomId = json['room_id'];
|
||||||
|
title = json['title'];
|
||||||
|
cover = json['cover'];
|
||||||
|
description = json['description'];
|
||||||
|
liveStatus = json['liveS_satus'];
|
||||||
|
liveStartTime = json['live_start_time'];
|
||||||
|
areaId = json['area_id'];
|
||||||
|
areaName = json['area_name'];
|
||||||
|
parentAreaId = json['parent_area_id'];
|
||||||
|
parentAreaName = json['parent_area_name'];
|
||||||
|
online = json['online'];
|
||||||
|
background = json['background'];
|
||||||
|
appBackground = json['app_background'];
|
||||||
|
liveId = json['live_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AnchorInfo {
|
||||||
|
AnchorInfo({
|
||||||
|
this.baseInfo,
|
||||||
|
this.relationInfo,
|
||||||
|
});
|
||||||
|
|
||||||
|
BaseInfo? baseInfo;
|
||||||
|
RelationInfo? relationInfo;
|
||||||
|
|
||||||
|
AnchorInfo.fromJson(Map<String, dynamic> json) {
|
||||||
|
baseInfo = BaseInfo.fromJson(json['base_info']);
|
||||||
|
relationInfo = RelationInfo.fromJson(json['relation_info']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BaseInfo {
|
||||||
|
BaseInfo({
|
||||||
|
this.uname,
|
||||||
|
this.face,
|
||||||
|
});
|
||||||
|
|
||||||
|
String? uname;
|
||||||
|
String? face;
|
||||||
|
|
||||||
|
BaseInfo.fromJson(Map<String, dynamic> json) {
|
||||||
|
uname = json['uname'];
|
||||||
|
face = json['face'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RelationInfo {
|
||||||
|
RelationInfo({this.attention});
|
||||||
|
|
||||||
|
int? attention;
|
||||||
|
|
||||||
|
RelationInfo.fromJson(Map<String, dynamic> json) {
|
||||||
|
attention = json['attention'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LikeInfoV3 {
|
||||||
|
LikeInfoV3({this.totalLikes});
|
||||||
|
|
||||||
|
int? totalLikes;
|
||||||
|
|
||||||
|
LikeInfoV3.fromJson(Map<String, dynamic> json) {
|
||||||
|
totalLikes = json['total_likes'];
|
||||||
|
}
|
||||||
|
}
|
@ -142,7 +142,7 @@ class Stat {
|
|||||||
|
|
||||||
Stat.fromJson(Map<String, dynamic> json) {
|
Stat.fromJson(Map<String, dynamic> json) {
|
||||||
view = json["play"];
|
view = json["play"];
|
||||||
danmaku = json['comment'];
|
danmaku = json['video_review'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import 'package:pilipala/utils/utils.dart';
|
|
||||||
|
|
||||||
import './model_owner.dart';
|
import './model_owner.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
@ -38,7 +36,7 @@ class RecVideoItemModel {
|
|||||||
@HiveField(6)
|
@HiveField(6)
|
||||||
String? title = '';
|
String? title = '';
|
||||||
@HiveField(7)
|
@HiveField(7)
|
||||||
String? duration = '';
|
int? duration = -1;
|
||||||
@HiveField(8)
|
@HiveField(8)
|
||||||
int? pubdate = -1;
|
int? pubdate = -1;
|
||||||
@HiveField(9)
|
@HiveField(9)
|
||||||
@ -58,7 +56,7 @@ class RecVideoItemModel {
|
|||||||
uri = json["uri"];
|
uri = json["uri"];
|
||||||
pic = json["pic"];
|
pic = json["pic"];
|
||||||
title = json["title"];
|
title = json["title"];
|
||||||
duration = Utils.tampToSeektime(json["duration"]);
|
duration = json["duration"];
|
||||||
pubdate = json["pubdate"];
|
pubdate = json["pubdate"];
|
||||||
owner = Owner.fromJson(json["owner"]);
|
owner = Owner.fromJson(json["owner"]);
|
||||||
stat = Stat.fromJson(json["stat"]);
|
stat = Stat.fromJson(json["stat"]);
|
||||||
@ -77,14 +75,15 @@ class Stat {
|
|||||||
this.danmu,
|
this.danmu,
|
||||||
});
|
});
|
||||||
@HiveField(0)
|
@HiveField(0)
|
||||||
String? view;
|
int? view;
|
||||||
@HiveField(1)
|
@HiveField(1)
|
||||||
int? like;
|
int? like;
|
||||||
@HiveField(2)
|
@HiveField(2)
|
||||||
int? danmu;
|
int? danmu;
|
||||||
|
|
||||||
Stat.fromJson(Map<String, dynamic> json) {
|
Stat.fromJson(Map<String, dynamic> json) {
|
||||||
view = Utils.numFormat(json["view"]);
|
// 无需在model中转换以保留原始数据,在view层处理即可
|
||||||
|
view = json["view"];
|
||||||
like = json["like"];
|
like = json["like"];
|
||||||
danmu = json['danmaku'];
|
danmu = json['danmaku'];
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class RecVideoItemModelAdapter extends TypeAdapter<RecVideoItemModel> {
|
|||||||
uri: fields[4] as String?,
|
uri: fields[4] as String?,
|
||||||
pic: fields[5] as String?,
|
pic: fields[5] as String?,
|
||||||
title: fields[6] as String?,
|
title: fields[6] as String?,
|
||||||
duration: fields[7] as String?,
|
duration: fields[7] as int?,
|
||||||
pubdate: fields[8] as int?,
|
pubdate: fields[8] as int?,
|
||||||
owner: fields[9] as Owner?,
|
owner: fields[9] as Owner?,
|
||||||
stat: fields[10] as Stat?,
|
stat: fields[10] as Stat?,
|
||||||
@ -87,7 +87,7 @@ class StatAdapter extends TypeAdapter<Stat> {
|
|||||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
};
|
};
|
||||||
return Stat(
|
return Stat(
|
||||||
view: fields[0] as String?,
|
view: fields[0] as int?,
|
||||||
like: fields[1] as int?,
|
like: fields[1] as int?,
|
||||||
danmu: fields[2] as int?,
|
danmu: fields[2] as int?,
|
||||||
);
|
);
|
||||||
|
@ -8,7 +8,7 @@ class SessionDataModel {
|
|||||||
this.hasMore,
|
this.hasMore,
|
||||||
});
|
});
|
||||||
|
|
||||||
List? sessionList;
|
List<SessionList>? sessionList;
|
||||||
int? hasMore;
|
int? hasMore;
|
||||||
|
|
||||||
SessionDataModel.fromJson(Map<String, dynamic> json) {
|
SessionDataModel.fromJson(Map<String, dynamic> json) {
|
||||||
@ -121,35 +121,37 @@ class LastMsg {
|
|||||||
this.msgKey,
|
this.msgKey,
|
||||||
this.msgStatus,
|
this.msgStatus,
|
||||||
this.notifyCode,
|
this.notifyCode,
|
||||||
this.newFaceVersion,
|
// this.newFaceVersion,
|
||||||
});
|
});
|
||||||
|
|
||||||
int? senderIid;
|
int? senderIid;
|
||||||
int? receiverType;
|
int? receiverType;
|
||||||
int? receiverId;
|
int? receiverId;
|
||||||
int? msgType;
|
int? msgType;
|
||||||
Map? content;
|
dynamic content;
|
||||||
int? msgSeqno;
|
int? msgSeqno;
|
||||||
int? timestamp;
|
int? timestamp;
|
||||||
String? atUids;
|
String? atUids;
|
||||||
int? msgKey;
|
int? msgKey;
|
||||||
int? msgStatus;
|
int? msgStatus;
|
||||||
String? notifyCode;
|
String? notifyCode;
|
||||||
int? newFaceVersion;
|
// int? newFaceVersion;
|
||||||
|
|
||||||
LastMsg.fromJson(Map<String, dynamic> json) {
|
LastMsg.fromJson(Map<String, dynamic> json) {
|
||||||
senderIid = json['sender_uid'];
|
senderIid = json['sender_uid'];
|
||||||
receiverType = json['receiver_type'];
|
receiverType = json['receiver_type'];
|
||||||
receiverId = json['receiver_id'];
|
receiverId = json['receiver_id'];
|
||||||
msgType = json['msg_type'];
|
msgType = json['msg_type'];
|
||||||
content = jsonDecode(json['content']);
|
content = json['content'] != null && json['content'] != ''
|
||||||
|
? jsonDecode(json['content'])
|
||||||
|
: '';
|
||||||
msgSeqno = json['msg_seqno'];
|
msgSeqno = json['msg_seqno'];
|
||||||
timestamp = json['timestamp'];
|
timestamp = json['timestamp'];
|
||||||
atUids = json['at_uids'];
|
atUids = json['at_uids'];
|
||||||
msgKey = json['msg_key'];
|
msgKey = json['msg_key'];
|
||||||
msgStatus = json['msg_status'];
|
msgStatus = json['msg_status'];
|
||||||
notifyCode = json['notify_code'];
|
notifyCode = json['notify_code'];
|
||||||
newFaceVersion = json['new_face_version'];
|
// newFaceVersion = json['new_face_version'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +168,7 @@ class SessionMsgDataModel {
|
|||||||
int? hasMore;
|
int? hasMore;
|
||||||
int? minSeqno;
|
int? minSeqno;
|
||||||
int? maxSeqno;
|
int? maxSeqno;
|
||||||
List? eInfos;
|
List<dynamic>? eInfos;
|
||||||
|
|
||||||
SessionMsgDataModel.fromJson(Map<String, dynamic> json) {
|
SessionMsgDataModel.fromJson(Map<String, dynamic> json) {
|
||||||
messages = json['messages']
|
messages = json['messages']
|
||||||
@ -214,7 +216,9 @@ class MessageItem {
|
|||||||
receiverId = json['receiver_id'];
|
receiverId = json['receiver_id'];
|
||||||
// 1 文本 2 图片 18 系统提示 10 系统通知 5 撤回的消息
|
// 1 文本 2 图片 18 系统提示 10 系统通知 5 撤回的消息
|
||||||
msgType = json['msg_type'];
|
msgType = json['msg_type'];
|
||||||
content = jsonDecode(json['content']);
|
content = json['content'] != null && json['content'] != ''
|
||||||
|
? jsonDecode(json['content'])
|
||||||
|
: '';
|
||||||
msgSeqno = json['msg_seqno'];
|
msgSeqno = json['msg_seqno'];
|
||||||
timestamp = json['timestamp'];
|
timestamp = json['timestamp'];
|
||||||
atUids = json['at_uids'];
|
atUids = json['at_uids'];
|
||||||
|
@ -85,7 +85,9 @@ class SearchVideoItemModel {
|
|||||||
// title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
// title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
||||||
title = Em.regTitle(json['title']);
|
title = Em.regTitle(json['title']);
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
pic = 'https:${json['pic']}';
|
pic = json['pic'] != null && json['pic'].startsWith('//')
|
||||||
|
? 'https:${json['pic']}'
|
||||||
|
: json['pic'] ?? '';
|
||||||
videoReview = json['video_review'];
|
videoReview = json['video_review'];
|
||||||
pubdate = json['pubdate'];
|
pubdate = json['pubdate'];
|
||||||
senddate = json['senddate'];
|
senddate = json['senddate'];
|
||||||
@ -435,7 +437,8 @@ class SearchArticleItemModel {
|
|||||||
pubTime = json['pub_time'];
|
pubTime = json['pub_time'];
|
||||||
like = json['like'];
|
like = json['like'];
|
||||||
title = Em.regTitle(json['title']);
|
title = Em.regTitle(json['title']);
|
||||||
subTitle = json['title'].replaceAll(RegExp(r'<[^>]*>'), '');
|
subTitle =
|
||||||
|
Em.decodeHtmlEntities(json['title'].replaceAll(RegExp(r'<[^>]*>'), ''));
|
||||||
rankOffset = json['rank_offset'];
|
rankOffset = json['rank_offset'];
|
||||||
mid = json['mid'];
|
mid = json['mid'];
|
||||||
imageUrls = json['image_urls'];
|
imageUrls = json['image_urls'];
|
||||||
|
@ -15,7 +15,7 @@ class FavFolderData {
|
|||||||
? json['list']
|
? json['list']
|
||||||
.map<FavFolderItemData>((e) => FavFolderItemData.fromJson(e))
|
.map<FavFolderItemData>((e) => FavFolderItemData.fromJson(e))
|
||||||
.toList()
|
.toList()
|
||||||
: [FavFolderItemData()];
|
: <FavFolderItemData>[];
|
||||||
hasMore = json['has_more'];
|
hasMore = json['has_more'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
123
lib/models/user/sub_detail.dart
Normal file
123
lib/models/user/sub_detail.dart
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
class SubDetailModelData {
|
||||||
|
DetailInfo? info;
|
||||||
|
List<SubDetailMediaItem>? medias;
|
||||||
|
|
||||||
|
SubDetailModelData({this.info, this.medias});
|
||||||
|
|
||||||
|
SubDetailModelData.fromJson(Map<String, dynamic> json) {
|
||||||
|
info = DetailInfo.fromJson(json['info']);
|
||||||
|
if (json['medias'] != null) {
|
||||||
|
medias = <SubDetailMediaItem>[];
|
||||||
|
json['medias'].forEach((v) {
|
||||||
|
medias!.add(SubDetailMediaItem.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SubDetailMediaItem {
|
||||||
|
int? id;
|
||||||
|
String? title;
|
||||||
|
String? cover;
|
||||||
|
String? pic;
|
||||||
|
int? duration;
|
||||||
|
int? pubtime;
|
||||||
|
String? bvid;
|
||||||
|
Map? upper;
|
||||||
|
Map? cntInfo;
|
||||||
|
int? enableVt;
|
||||||
|
String? vtDisplay;
|
||||||
|
|
||||||
|
SubDetailMediaItem({
|
||||||
|
this.id,
|
||||||
|
this.title,
|
||||||
|
this.cover,
|
||||||
|
this.pic,
|
||||||
|
this.duration,
|
||||||
|
this.pubtime,
|
||||||
|
this.bvid,
|
||||||
|
this.upper,
|
||||||
|
this.cntInfo,
|
||||||
|
this.enableVt,
|
||||||
|
this.vtDisplay,
|
||||||
|
});
|
||||||
|
|
||||||
|
SubDetailMediaItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
title = json['title'];
|
||||||
|
cover = json['cover'];
|
||||||
|
pic = json['cover'];
|
||||||
|
duration = json['duration'];
|
||||||
|
pubtime = json['pubtime'];
|
||||||
|
bvid = json['bvid'];
|
||||||
|
upper = json['upper'];
|
||||||
|
cntInfo = json['cnt_info'];
|
||||||
|
enableVt = json['enable_vt'];
|
||||||
|
vtDisplay = json['vt_display'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['title'] = title;
|
||||||
|
data['cover'] = cover;
|
||||||
|
data['duration'] = duration;
|
||||||
|
data['pubtime'] = pubtime;
|
||||||
|
data['bvid'] = bvid;
|
||||||
|
data['upper'] = upper;
|
||||||
|
data['cnt_info'] = cntInfo;
|
||||||
|
data['enable_vt'] = enableVt;
|
||||||
|
data['vt_display'] = vtDisplay;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DetailInfo {
|
||||||
|
int? id;
|
||||||
|
int? seasonType;
|
||||||
|
String? title;
|
||||||
|
String? cover;
|
||||||
|
Map? upper;
|
||||||
|
Map? cntInfo;
|
||||||
|
int? mediaCount;
|
||||||
|
String? intro;
|
||||||
|
int? enableVt;
|
||||||
|
|
||||||
|
DetailInfo({
|
||||||
|
this.id,
|
||||||
|
this.seasonType,
|
||||||
|
this.title,
|
||||||
|
this.cover,
|
||||||
|
this.upper,
|
||||||
|
this.cntInfo,
|
||||||
|
this.mediaCount,
|
||||||
|
this.intro,
|
||||||
|
this.enableVt,
|
||||||
|
});
|
||||||
|
|
||||||
|
DetailInfo.fromJson(Map<String, dynamic> json) {
|
||||||
|
id = json['id'];
|
||||||
|
seasonType = json['season_type'];
|
||||||
|
title = json['title'];
|
||||||
|
cover = json['cover'];
|
||||||
|
upper = json['upper'];
|
||||||
|
cntInfo = json['cnt_info'];
|
||||||
|
mediaCount = json['media_count'];
|
||||||
|
intro = json['intro'];
|
||||||
|
enableVt = json['enable_vt'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final data = <String, dynamic>{};
|
||||||
|
data['id'] = id;
|
||||||
|
data['season_type'] = seasonType;
|
||||||
|
data['title'] = title;
|
||||||
|
data['cover'] = cover;
|
||||||
|
data['upper'] = upper;
|
||||||
|
data['cnt_info'] = cntInfo;
|
||||||
|
data['media_count'] = mediaCount;
|
||||||
|
data['intro'] = intro;
|
||||||
|
data['enable_vt'] = enableVt;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
111
lib/models/user/sub_folder.dart
Normal file
111
lib/models/user/sub_folder.dart
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
class SubFolderModelData {
|
||||||
|
final int? count;
|
||||||
|
final List<SubFolderItemData>? list;
|
||||||
|
|
||||||
|
SubFolderModelData({
|
||||||
|
this.count,
|
||||||
|
this.list,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory SubFolderModelData.fromJson(Map<String, dynamic> json) {
|
||||||
|
return SubFolderModelData(
|
||||||
|
count: json['count'],
|
||||||
|
list: json['list'] != null
|
||||||
|
? (json['list'] as List)
|
||||||
|
.map<SubFolderItemData>((i) => SubFolderItemData.fromJson(i))
|
||||||
|
.toList()
|
||||||
|
: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SubFolderItemData {
|
||||||
|
final int? id;
|
||||||
|
final int? fid;
|
||||||
|
final int? mid;
|
||||||
|
final int? attr;
|
||||||
|
final String? title;
|
||||||
|
final String? cover;
|
||||||
|
final Upper? upper;
|
||||||
|
final int? coverType;
|
||||||
|
final String? intro;
|
||||||
|
final int? ctime;
|
||||||
|
final int? mtime;
|
||||||
|
final int? state;
|
||||||
|
final int? favState;
|
||||||
|
final int? mediaCount;
|
||||||
|
final int? viewCount;
|
||||||
|
final int? vt;
|
||||||
|
final int? playSwitch;
|
||||||
|
final int? type;
|
||||||
|
final String? link;
|
||||||
|
final String? bvid;
|
||||||
|
|
||||||
|
SubFolderItemData({
|
||||||
|
this.id,
|
||||||
|
this.fid,
|
||||||
|
this.mid,
|
||||||
|
this.attr,
|
||||||
|
this.title,
|
||||||
|
this.cover,
|
||||||
|
this.upper,
|
||||||
|
this.coverType,
|
||||||
|
this.intro,
|
||||||
|
this.ctime,
|
||||||
|
this.mtime,
|
||||||
|
this.state,
|
||||||
|
this.favState,
|
||||||
|
this.mediaCount,
|
||||||
|
this.viewCount,
|
||||||
|
this.vt,
|
||||||
|
this.playSwitch,
|
||||||
|
this.type,
|
||||||
|
this.link,
|
||||||
|
this.bvid,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory SubFolderItemData.fromJson(Map<String, dynamic> json) {
|
||||||
|
return SubFolderItemData(
|
||||||
|
id: json['id'],
|
||||||
|
fid: json['fid'],
|
||||||
|
mid: json['mid'],
|
||||||
|
attr: json['attr'],
|
||||||
|
title: json['title'],
|
||||||
|
cover: json['cover'],
|
||||||
|
upper: json['upper'] != null ? Upper.fromJson(json['upper']) : null,
|
||||||
|
coverType: json['cover_type'],
|
||||||
|
intro: json['intro'],
|
||||||
|
ctime: json['ctime'],
|
||||||
|
mtime: json['mtime'],
|
||||||
|
state: json['state'],
|
||||||
|
favState: json['fav_state'],
|
||||||
|
mediaCount: json['media_count'],
|
||||||
|
viewCount: json['view_count'],
|
||||||
|
vt: json['vt'],
|
||||||
|
playSwitch: json['play_switch'],
|
||||||
|
type: json['type'],
|
||||||
|
link: json['link'],
|
||||||
|
bvid: json['bvid'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Upper {
|
||||||
|
final int? mid;
|
||||||
|
final String? name;
|
||||||
|
final String? face;
|
||||||
|
|
||||||
|
Upper({
|
||||||
|
this.mid,
|
||||||
|
this.name,
|
||||||
|
this.face,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Upper.fromJson(Map<String, dynamic> json) {
|
||||||
|
return Upper(
|
||||||
|
mid: json['mid'],
|
||||||
|
name: json['name'],
|
||||||
|
face: json['face'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -34,6 +34,7 @@ class PlayUrlModel {
|
|||||||
String? seekParam;
|
String? seekParam;
|
||||||
String? seekType;
|
String? seekType;
|
||||||
Dash? dash;
|
Dash? dash;
|
||||||
|
List<Durl>? durl;
|
||||||
List<FormatItem>? supportFormats;
|
List<FormatItem>? supportFormats;
|
||||||
// String? highFormat;
|
// String? highFormat;
|
||||||
int? lastPlayTime;
|
int? lastPlayTime;
|
||||||
@ -52,7 +53,8 @@ class PlayUrlModel {
|
|||||||
videoCodecid = json['video_codecid'];
|
videoCodecid = json['video_codecid'];
|
||||||
seekParam = json['seek_param'];
|
seekParam = json['seek_param'];
|
||||||
seekType = json['seek_type'];
|
seekType = json['seek_type'];
|
||||||
dash = Dash.fromJson(json['dash']);
|
dash = json['dash'] != null ? Dash.fromJson(json['dash']) : null;
|
||||||
|
durl = json['durl']?.map<Durl>((e) => Durl.fromJson(e)).toList();
|
||||||
supportFormats = json['support_formats'] != null
|
supportFormats = json['support_formats'] != null
|
||||||
? json['support_formats']
|
? json['support_formats']
|
||||||
.map<FormatItem>((e) => FormatItem.fromJson(e))
|
.map<FormatItem>((e) => FormatItem.fromJson(e))
|
||||||
@ -250,3 +252,30 @@ class Flac {
|
|||||||
audio = json['audio'] != null ? AudioItem.fromJson(json['audio']) : null;
|
audio = json['audio'] != null ? AudioItem.fromJson(json['audio']) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Durl {
|
||||||
|
Durl({
|
||||||
|
this.order,
|
||||||
|
this.length,
|
||||||
|
this.size,
|
||||||
|
this.ahead,
|
||||||
|
this.vhead,
|
||||||
|
this.url,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? order;
|
||||||
|
int? length;
|
||||||
|
int? size;
|
||||||
|
String? ahead;
|
||||||
|
String? vhead;
|
||||||
|
String? url;
|
||||||
|
|
||||||
|
Durl.fromJson(Map<String, dynamic> json) {
|
||||||
|
order = json['order'];
|
||||||
|
length = json['length'];
|
||||||
|
size = json['size'];
|
||||||
|
ahead = json['ahead'];
|
||||||
|
vhead = json['vhead'];
|
||||||
|
url = json['url'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -9,6 +9,7 @@ class ReplyContent {
|
|||||||
this.vote,
|
this.vote,
|
||||||
this.richText,
|
this.richText,
|
||||||
this.isText,
|
this.isText,
|
||||||
|
this.topicsMeta,
|
||||||
});
|
});
|
||||||
|
|
||||||
String? message;
|
String? message;
|
||||||
@ -20,6 +21,7 @@ class ReplyContent {
|
|||||||
Map? vote;
|
Map? vote;
|
||||||
Map? richText;
|
Map? richText;
|
||||||
bool? isText;
|
bool? isText;
|
||||||
|
Map? topicsMeta;
|
||||||
|
|
||||||
ReplyContent.fromJson(Map<String, dynamic> json) {
|
ReplyContent.fromJson(Map<String, dynamic> json) {
|
||||||
message = json['message']
|
message = json['message']
|
||||||
@ -39,6 +41,7 @@ class ReplyContent {
|
|||||||
richText = json['rich_text'] ?? {};
|
richText = json['rich_text'] ?? {};
|
||||||
// 不包含@ 笔记 图片的时候,文字可折叠
|
// 不包含@ 笔记 图片的时候,文字可折叠
|
||||||
isText = atNameToMid!.isEmpty && vote!.isEmpty && pictures!.isEmpty;
|
isText = atNameToMid!.isEmpty && vote!.isEmpty && pictures!.isEmpty;
|
||||||
|
topicsMeta = json['topics_meta'] ?? {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
120
lib/models/video/reply/emote.dart
Normal file
120
lib/models/video/reply/emote.dart
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
class EmoteModelData {
|
||||||
|
final List<PackageItem>? packages;
|
||||||
|
|
||||||
|
EmoteModelData({
|
||||||
|
required this.packages,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory EmoteModelData.fromJson(Map<String, dynamic> jsonRes) {
|
||||||
|
final List<PackageItem>? packages =
|
||||||
|
jsonRes['packages'] is List ? <PackageItem>[] : null;
|
||||||
|
if (packages != null) {
|
||||||
|
for (final dynamic item in jsonRes['packages']!) {
|
||||||
|
if (item != null) {
|
||||||
|
try {
|
||||||
|
packages.add(PackageItem.fromJson(item));
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EmoteModelData(
|
||||||
|
packages: packages,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PackageItem {
|
||||||
|
final int? id;
|
||||||
|
final String? text;
|
||||||
|
final String? url;
|
||||||
|
final int? mtime;
|
||||||
|
final int? type;
|
||||||
|
final int? attr;
|
||||||
|
final Meta? meta;
|
||||||
|
final List<Emote>? emote;
|
||||||
|
|
||||||
|
PackageItem({
|
||||||
|
required this.id,
|
||||||
|
required this.text,
|
||||||
|
required this.url,
|
||||||
|
required this.mtime,
|
||||||
|
required this.type,
|
||||||
|
required this.attr,
|
||||||
|
required this.meta,
|
||||||
|
required this.emote,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory PackageItem.fromJson(Map<String, dynamic> jsonRes) {
|
||||||
|
final List<Emote>? emote = jsonRes['emote'] is List ? <Emote>[] : null;
|
||||||
|
if (emote != null) {
|
||||||
|
for (final dynamic item in jsonRes['emote']!) {
|
||||||
|
if (item != null) {
|
||||||
|
try {
|
||||||
|
emote.add(Emote.fromJson(item));
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PackageItem(
|
||||||
|
id: jsonRes['id'],
|
||||||
|
text: jsonRes['text'],
|
||||||
|
url: jsonRes['url'],
|
||||||
|
mtime: jsonRes['mtime'],
|
||||||
|
type: jsonRes['type'],
|
||||||
|
attr: jsonRes['attr'],
|
||||||
|
meta: Meta.fromJson(jsonRes['meta']),
|
||||||
|
emote: emote,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Meta {
|
||||||
|
final int? size;
|
||||||
|
final List<String>? suggest;
|
||||||
|
|
||||||
|
Meta({
|
||||||
|
required this.size,
|
||||||
|
required this.suggest,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Meta.fromJson(Map<String, dynamic> jsonRes) => Meta(
|
||||||
|
size: jsonRes['size'],
|
||||||
|
suggest: jsonRes['suggest'] is List ? <String>[] : null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Emote {
|
||||||
|
final int? id;
|
||||||
|
final int? packageId;
|
||||||
|
final String? text;
|
||||||
|
final String? url;
|
||||||
|
final int? mtime;
|
||||||
|
final int? type;
|
||||||
|
final int? attr;
|
||||||
|
final Meta? meta;
|
||||||
|
final dynamic activity;
|
||||||
|
|
||||||
|
Emote({
|
||||||
|
required this.id,
|
||||||
|
required this.packageId,
|
||||||
|
required this.text,
|
||||||
|
required this.url,
|
||||||
|
required this.mtime,
|
||||||
|
required this.type,
|
||||||
|
required this.attr,
|
||||||
|
required this.meta,
|
||||||
|
required this.activity,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Emote.fromJson(Map<String, dynamic> jsonRes) => Emote(
|
||||||
|
id: jsonRes['id'],
|
||||||
|
packageId: jsonRes['package_id'],
|
||||||
|
text: jsonRes['text'],
|
||||||
|
url: jsonRes['url'],
|
||||||
|
mtime: jsonRes['mtime'],
|
||||||
|
type: jsonRes['type'],
|
||||||
|
attr: jsonRes['attr'],
|
||||||
|
meta: Meta.fromJson(jsonRes['meta']),
|
||||||
|
activity: jsonRes['activity'],
|
||||||
|
);
|
||||||
|
}
|
20
lib/models/video/subTitile/content.dart
Normal file
20
lib/models/video/subTitile/content.dart
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
class SubTitileContentModel {
|
||||||
|
double? from;
|
||||||
|
double? to;
|
||||||
|
int? location;
|
||||||
|
String? content;
|
||||||
|
|
||||||
|
SubTitileContentModel({
|
||||||
|
this.from,
|
||||||
|
this.to,
|
||||||
|
this.location,
|
||||||
|
this.content,
|
||||||
|
});
|
||||||
|
|
||||||
|
SubTitileContentModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
from = json['from'];
|
||||||
|
to = json['to'];
|
||||||
|
location = json['location'];
|
||||||
|
content = json['content'];
|
||||||
|
}
|
||||||
|
}
|
89
lib/models/video/subTitile/result.dart
Normal file
89
lib/models/video/subTitile/result.dart
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import '../../common/subtitle_type.dart';
|
||||||
|
|
||||||
|
class SubTitlteModel {
|
||||||
|
SubTitlteModel({
|
||||||
|
this.aid,
|
||||||
|
this.bvid,
|
||||||
|
this.cid,
|
||||||
|
this.loginMid,
|
||||||
|
this.loginMidHash,
|
||||||
|
this.isOwner,
|
||||||
|
this.name,
|
||||||
|
this.subtitles,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? aid;
|
||||||
|
String? bvid;
|
||||||
|
int? cid;
|
||||||
|
int? loginMid;
|
||||||
|
String? loginMidHash;
|
||||||
|
bool? isOwner;
|
||||||
|
String? name;
|
||||||
|
List<SubTitlteItemModel>? subtitles;
|
||||||
|
|
||||||
|
factory SubTitlteModel.fromJson(Map<String, dynamic> json) => SubTitlteModel(
|
||||||
|
aid: json["aid"],
|
||||||
|
bvid: json["bvid"],
|
||||||
|
cid: json["cid"],
|
||||||
|
loginMid: json["login_mid"],
|
||||||
|
loginMidHash: json["login_mid_hash"],
|
||||||
|
isOwner: json["is_owner"],
|
||||||
|
name: json["name"],
|
||||||
|
subtitles: json["subtitle"] != null
|
||||||
|
? json["subtitle"]["subtitles"]
|
||||||
|
.map<SubTitlteItemModel>((x) => SubTitlteItemModel.fromJson(x))
|
||||||
|
.toList()
|
||||||
|
: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class SubTitlteItemModel {
|
||||||
|
SubTitlteItemModel({
|
||||||
|
this.id,
|
||||||
|
this.lan,
|
||||||
|
this.lanDoc,
|
||||||
|
this.isLock,
|
||||||
|
this.subtitleUrl,
|
||||||
|
this.type,
|
||||||
|
this.aiType,
|
||||||
|
this.aiStatus,
|
||||||
|
this.title,
|
||||||
|
this.code,
|
||||||
|
this.content,
|
||||||
|
this.body,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? id;
|
||||||
|
String? lan;
|
||||||
|
String? lanDoc;
|
||||||
|
bool? isLock;
|
||||||
|
String? subtitleUrl;
|
||||||
|
int? type;
|
||||||
|
int? aiType;
|
||||||
|
int? aiStatus;
|
||||||
|
String? title;
|
||||||
|
int? code;
|
||||||
|
String? content;
|
||||||
|
List? body;
|
||||||
|
|
||||||
|
factory SubTitlteItemModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
SubTitlteItemModel(
|
||||||
|
id: json["id"],
|
||||||
|
lan: json["lan"].replaceAll('-', ''),
|
||||||
|
lanDoc: json["lan_doc"],
|
||||||
|
isLock: json["is_lock"],
|
||||||
|
subtitleUrl: json["subtitle_url"],
|
||||||
|
type: json["type"],
|
||||||
|
aiType: json["ai_type"],
|
||||||
|
aiStatus: json["ai_status"],
|
||||||
|
title: json["lan_doc"],
|
||||||
|
code: SubtitleType.values
|
||||||
|
.firstWhereOrNull(
|
||||||
|
(element) => element.id.toString() == json["lan"])
|
||||||
|
?.index ??
|
||||||
|
-1,
|
||||||
|
content: '',
|
||||||
|
body: [],
|
||||||
|
);
|
||||||
|
}
|
@ -7,6 +7,7 @@ import 'package:pilipala/http/index.dart';
|
|||||||
import 'package:pilipala/models/github/latest.dart';
|
import 'package:pilipala/models/github/latest.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
import '../../utils/cache_manage.dart';
|
||||||
|
|
||||||
class AboutPage extends StatefulWidget {
|
class AboutPage extends StatefulWidget {
|
||||||
const AboutPage({super.key});
|
const AboutPage({super.key});
|
||||||
@ -17,10 +18,23 @@ class AboutPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _AboutPageState extends State<AboutPage> {
|
class _AboutPageState extends State<AboutPage> {
|
||||||
final AboutController _aboutController = Get.put(AboutController());
|
final AboutController _aboutController = Get.put(AboutController());
|
||||||
|
String cacheSize = '';
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
// 读取缓存占用
|
||||||
|
getCacheSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getCacheSize() async {
|
||||||
|
final res = await CacheManage().loadApplicationCache();
|
||||||
|
setState(() => cacheSize = res);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Color outline = Theme.of(context).colorScheme.outline;
|
final Color outline = Theme.of(context).colorScheme.outline;
|
||||||
TextStyle subTitleStyle =
|
TextStyle subTitleStyle =
|
||||||
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
|
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -29,7 +43,6 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/images/logo/logo_android_2.png',
|
'assets/images/logo/logo_android_2.png',
|
||||||
@ -40,29 +53,54 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
Text(
|
|
||||||
'使用Flutter开发的哔哩哔哩第三方客户端',
|
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
Obx(
|
Obx(
|
||||||
() => ListTile(
|
() => Badge(
|
||||||
title: const Text("当前版本"),
|
isLabelVisible: _aboutController.isLoading.value
|
||||||
trailing: Text(_aboutController.currentVersion.value,
|
? false
|
||||||
style: subTitleStyle),
|
: _aboutController.isUpdate.value,
|
||||||
),
|
label: const Text('New'),
|
||||||
),
|
child: Padding(
|
||||||
Obx(
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 30),
|
||||||
() => ListTile(
|
child: FilledButton.tonal(
|
||||||
onTap: () => _aboutController.onUpdate(),
|
onPressed: () {
|
||||||
title: const Text('最新版本'),
|
showModalBottomSheet(
|
||||||
trailing: Text(
|
context: context,
|
||||||
_aboutController.isLoading.value
|
builder: (context) {
|
||||||
? '正在获取'
|
return Column(
|
||||||
: _aboutController.isUpdate.value
|
mainAxisSize: MainAxisSize.min,
|
||||||
? '有新版本 ❤️${_aboutController.remoteVersion.value}'
|
children: [
|
||||||
: '当前已是最新版',
|
ListTile(
|
||||||
style: subTitleStyle,
|
onTap: () => _aboutController.githubRelease(),
|
||||||
|
title: const Text('Github下载'),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () => _aboutController.panDownload(),
|
||||||
|
title: const Text('网盘下载'),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () => _aboutController.webSiteUrl(),
|
||||||
|
title: const Text('官网下载'),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () => _aboutController.qimiao(),
|
||||||
|
title: const Text('奇妙应用'),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height:
|
||||||
|
MediaQuery.of(context).padding.bottom +
|
||||||
|
20)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'V${_aboutController.currentVersion.value}',
|
||||||
|
style: subTitleStyle.copyWith(
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -74,19 +112,22 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
// size: 16,
|
// size: 16,
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
Divider(
|
|
||||||
thickness: 1,
|
|
||||||
height: 30,
|
|
||||||
color: Theme.of(context).colorScheme.outlineVariant,
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => _aboutController.githubUrl(),
|
onTap: () => _aboutController.githubUrl(),
|
||||||
title: const Text('Github'),
|
title: const Text('开源地址'),
|
||||||
trailing: Text(
|
trailing: Text(
|
||||||
'github.com/guozhigq/pilipala',
|
'github.com/guozhigq/pilipala',
|
||||||
style: subTitleStyle,
|
style: subTitleStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () => _aboutController.webSiteUrl(),
|
||||||
|
title: const Text('访问官网'),
|
||||||
|
trailing: Text(
|
||||||
|
'https://pilipalanet.mysxl.cn',
|
||||||
|
style: subTitleStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => _aboutController.panDownload(),
|
onTap: () => _aboutController.panDownload(),
|
||||||
title: const Text('网盘下载'),
|
title: const Text('网盘下载'),
|
||||||
@ -108,24 +149,64 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => _aboutController.qqChanel(),
|
onTap: () {
|
||||||
title: const Text('QQ群'),
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
onTap: () => _aboutController.qqChanel(),
|
||||||
|
title: const Text('QQ群'),
|
||||||
|
trailing: Text(
|
||||||
|
'616150809',
|
||||||
|
style: subTitleStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () => _aboutController.tgChanel(),
|
||||||
|
title: const Text('TG频道'),
|
||||||
|
trailing: Text(
|
||||||
|
'https://t.me/+lm_oOVmF0RJiODk1',
|
||||||
|
style: subTitleStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: MediaQuery.of(context).padding.bottom + 20)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
title: const Text('交流社区'),
|
||||||
trailing: Icon(
|
trailing: Icon(
|
||||||
Icons.arrow_forward_ios,
|
Icons.arrow_forward_ios,
|
||||||
size: 16,
|
size: 16,
|
||||||
color: outline,
|
color: outline,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
|
||||||
onTap: () => _aboutController.tgChanel(),
|
|
||||||
title: const Text('TG频道'),
|
|
||||||
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => _aboutController.aPay(),
|
onTap: () => _aboutController.aPay(),
|
||||||
title: const Text('赞助'),
|
title: const Text('赞助'),
|
||||||
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () => _aboutController.logs(),
|
||||||
|
title: const Text('错误日志'),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () async {
|
||||||
|
var cleanStatus = await CacheManage().clearCacheAll();
|
||||||
|
if (cleanStatus) {
|
||||||
|
getCacheSize();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: const Text('清除缓存'),
|
||||||
|
subtitle: Text('图片及网络缓存 $cacheSize', style: subTitleStyle),
|
||||||
|
),
|
||||||
|
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -172,12 +253,16 @@ class AboutController extends GetxController {
|
|||||||
// 获取远程版本
|
// 获取远程版本
|
||||||
Future getRemoteApp() async {
|
Future getRemoteApp() async {
|
||||||
var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'});
|
var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'});
|
||||||
|
isLoading.value = false;
|
||||||
|
if (result.data == null || result.data.isEmpty) {
|
||||||
|
SmartDialog.showToast('获取远程版本失败,请检查网络');
|
||||||
|
return;
|
||||||
|
}
|
||||||
data = LatestDataModel.fromJson(result.data);
|
data = LatestDataModel.fromJson(result.data);
|
||||||
remoteAppInfo = data;
|
remoteAppInfo = data;
|
||||||
remoteVersion.value = data.tagName!;
|
remoteVersion.value = data.tagName!;
|
||||||
isUpdate.value =
|
isUpdate.value =
|
||||||
Utils.needUpdate(currentVersion.value, remoteVersion.value);
|
Utils.needUpdate(currentVersion.value, remoteVersion.value);
|
||||||
isLoading.value = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 跳转下载/本地更新
|
// 跳转下载/本地更新
|
||||||
@ -193,11 +278,26 @@ class AboutController extends GetxController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
githubRelease() {
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse('https://github.com/guozhigq/pilipala/releases'),
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 从网盘下载
|
// 从网盘下载
|
||||||
panDownload() {
|
panDownload() {
|
||||||
launchUrl(
|
Clipboard.setData(
|
||||||
Uri.parse('https://www.123pan.com/s/9sVqVv-flu0A.html'),
|
const ClipboardData(text: 'pili'),
|
||||||
mode: LaunchMode.externalApplication,
|
);
|
||||||
|
SmartDialog.showToast(
|
||||||
|
'已复制提取码:pili',
|
||||||
|
displayTime: const Duration(milliseconds: 500),
|
||||||
|
).then(
|
||||||
|
(value) => launchUrl(
|
||||||
|
Uri.parse('https://www.123pan.com/s/9sVqVv-flu0A.html'),
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +313,7 @@ class AboutController extends GetxController {
|
|||||||
// qq频道
|
// qq频道
|
||||||
qqChanel() {
|
qqChanel() {
|
||||||
Clipboard.setData(
|
Clipboard.setData(
|
||||||
const ClipboardData(text: '489981949'),
|
const ClipboardData(text: '616150809'),
|
||||||
);
|
);
|
||||||
SmartDialog.showToast('已复制QQ群号');
|
SmartDialog.showToast('已复制QQ群号');
|
||||||
}
|
}
|
||||||
@ -245,4 +345,24 @@ class AboutController extends GetxController {
|
|||||||
print(e);
|
print(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 官网
|
||||||
|
webSiteUrl() {
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse('https://pilipalanet.mysxl.cn'),
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
qimiao() {
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse('https://www.magicalapk.com/home'),
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 日志
|
||||||
|
logs() {
|
||||||
|
Get.toNamed('/logs');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import 'package:pilipala/utils/storage.dart';
|
|||||||
|
|
||||||
class BangumiController extends GetxController {
|
class BangumiController extends GetxController {
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
RxList<BangumiListItemModel> bangumiList = [BangumiListItemModel()].obs;
|
RxList<BangumiListItemModel> bangumiList = <BangumiListItemModel>[].obs;
|
||||||
RxList<BangumiListItemModel> bangumiFollowList = [BangumiListItemModel()].obs;
|
RxList<BangumiListItemModel> bangumiFollowList = <BangumiListItemModel>[].obs;
|
||||||
int _currentPage = 1;
|
int _currentPage = 1;
|
||||||
bool isLoadingMore = true;
|
bool isLoadingMore = true;
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
|
@ -25,13 +25,6 @@ class BangumiIntroController extends GetxController {
|
|||||||
? int.tryParse(Get.parameters['epId']!)
|
? int.tryParse(Get.parameters['epId']!)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
// 是否预渲染 骨架屏
|
|
||||||
bool preRender = false;
|
|
||||||
|
|
||||||
// 视频详情 上个页面传入
|
|
||||||
Map? videoItem = {};
|
|
||||||
BangumiInfoModel? bangumiItem;
|
|
||||||
|
|
||||||
// 请求状态
|
// 请求状态
|
||||||
RxBool isLoading = false.obs;
|
RxBool isLoading = false.obs;
|
||||||
|
|
||||||
@ -63,27 +56,6 @@ class BangumiIntroController extends GetxController {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
if (Get.arguments.isNotEmpty) {
|
|
||||||
if (Get.arguments.containsKey('bangumiItem')) {
|
|
||||||
preRender = true;
|
|
||||||
bangumiItem = Get.arguments['bangumiItem'];
|
|
||||||
// bangumiItem!['pic'] = args.pic;
|
|
||||||
// if (args.title is String) {
|
|
||||||
// videoItem!['title'] = args.title;
|
|
||||||
// } else {
|
|
||||||
// String str = '';
|
|
||||||
// for (Map map in args.title) {
|
|
||||||
// str += map['text'];
|
|
||||||
// }
|
|
||||||
// videoItem!['title'] = str;
|
|
||||||
// }
|
|
||||||
// if (args.stat != null) {
|
|
||||||
// videoItem!['stat'] = args.stat;
|
|
||||||
// }
|
|
||||||
// videoItem!['pubdate'] = args.pubdate;
|
|
||||||
// videoItem!['owner'] = args.owner;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
userInfo = userInfoCache.get('userInfoCache');
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
userLogin = userInfo != null;
|
userLogin = userInfo != null;
|
||||||
}
|
}
|
||||||
@ -183,20 +155,21 @@ class BangumiIntroController extends GetxController {
|
|||||||
actions: [
|
actions: [
|
||||||
TextButton(onPressed: () => Get.back(), child: const Text('取消')),
|
TextButton(onPressed: () => Get.back(), child: const Text('取消')),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var res = await VideoHttp.coinVideo(
|
var res = await VideoHttp.coinVideo(
|
||||||
bvid: bvid, multiply: _tempThemeValue);
|
bvid: bvid, multiply: _tempThemeValue);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast('投币成功 👏');
|
SmartDialog.showToast('投币成功 👏');
|
||||||
hasCoin.value = true;
|
hasCoin.value = true;
|
||||||
bangumiDetail.value.stat!['coins'] =
|
bangumiDetail.value.stat!['coins'] =
|
||||||
bangumiDetail.value.stat!['coins'] + _tempThemeValue;
|
bangumiDetail.value.stat!['coins'] + _tempThemeValue;
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
}
|
}
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
child: const Text('确定'))
|
child: const Text('确定'),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -218,14 +191,12 @@ class BangumiIntroController extends GetxController {
|
|||||||
addIds: addMediaIdsNew.join(','),
|
addIds: addMediaIdsNew.join(','),
|
||||||
delIds: delMediaIdsNew.join(','));
|
delIds: delMediaIdsNew.join(','));
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
if (result['data']['prompt']) {
|
addMediaIdsNew = [];
|
||||||
addMediaIdsNew = [];
|
delMediaIdsNew = [];
|
||||||
delMediaIdsNew = [];
|
// 重新获取收藏状态
|
||||||
Get.back();
|
queryHasFavVideo();
|
||||||
// 重新获取收藏状态
|
SmartDialog.showToast('✅ 操作成功');
|
||||||
queryHasFavVideo();
|
Get.back();
|
||||||
SmartDialog.showToast('✅ 操作成功');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,11 +12,10 @@ import 'package:pilipala/models/bangumi/info.dart';
|
|||||||
import 'package:pilipala/pages/bangumi/widgets/bangumi_panel.dart';
|
import 'package:pilipala/pages/bangumi/widgets/bangumi_panel.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/pages/video/detail/introduction/widgets/action_item.dart';
|
import 'package:pilipala/pages/video/detail/introduction/widgets/action_item.dart';
|
||||||
import 'package:pilipala/pages/video/detail/introduction/widgets/action_row_item.dart';
|
|
||||||
import 'package:pilipala/pages/video/detail/introduction/widgets/fav_panel.dart';
|
import 'package:pilipala/pages/video/detail/introduction/widgets/fav_panel.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
import '../../../common/widgets/http_error.dart';
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'widgets/intro_detail.dart';
|
import 'widgets/intro_detail.dart';
|
||||||
|
|
||||||
@ -51,12 +50,8 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
|||||||
cid = widget.cid!;
|
cid = widget.cid!;
|
||||||
bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag);
|
bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag);
|
||||||
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
||||||
bangumiIntroController.bangumiDetail.listen((value) {
|
|
||||||
bangumiDetail = value;
|
|
||||||
});
|
|
||||||
_futureBuilderFuture = bangumiIntroController.queryBangumiIntro();
|
_futureBuilderFuture = bangumiIntroController.queryBangumiIntro();
|
||||||
videoDetailCtr.cid.listen((p0) {
|
videoDetailCtr.cid.listen((int p0) {
|
||||||
print('🐶🐶$p0');
|
|
||||||
cid = p0;
|
cid = p0;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
@ -67,29 +62,34 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
|||||||
super.build(context);
|
super.build(context);
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
if (snapshot.data == null) {
|
||||||
|
return const SliverToBoxAdapter(child: SizedBox());
|
||||||
|
}
|
||||||
if (snapshot.data['status']) {
|
if (snapshot.data['status']) {
|
||||||
// 请求成功
|
// 请求成功
|
||||||
|
return Obx(
|
||||||
return BangumiInfo(
|
() => BangumiInfo(
|
||||||
loadingStatus: false,
|
bangumiDetail: bangumiIntroController.bangumiDetail.value,
|
||||||
bangumiDetail: bangumiDetail,
|
cid: cid,
|
||||||
cid: cid,
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 请求错误
|
// 请求错误
|
||||||
// return HttpError(
|
return HttpError(
|
||||||
// errMsg: snapshot.data['msg'],
|
errMsg: snapshot.data['msg'],
|
||||||
// fn: () => Get.back(),
|
fn: () => Get.back(),
|
||||||
// );
|
);
|
||||||
return SizedBox();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return BangumiInfo(
|
return const SliverToBoxAdapter(
|
||||||
loadingStatus: true,
|
child: SizedBox(
|
||||||
bangumiDetail: bangumiDetail,
|
height: 100,
|
||||||
cid: cid,
|
child: Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -98,16 +98,14 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
|||||||
}
|
}
|
||||||
|
|
||||||
class BangumiInfo extends StatefulWidget {
|
class BangumiInfo extends StatefulWidget {
|
||||||
final bool loadingStatus;
|
|
||||||
final BangumiInfoModel? bangumiDetail;
|
|
||||||
final int? cid;
|
|
||||||
|
|
||||||
const BangumiInfo({
|
const BangumiInfo({
|
||||||
Key? key,
|
super.key,
|
||||||
this.loadingStatus = false,
|
|
||||||
this.bangumiDetail,
|
this.bangumiDetail,
|
||||||
this.cid,
|
this.cid,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
|
final BangumiInfoModel? bangumiDetail;
|
||||||
|
final int? cid;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<BangumiInfo> createState() => _BangumiInfoState();
|
State<BangumiInfo> createState() => _BangumiInfoState();
|
||||||
@ -118,29 +116,28 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
late final BangumiIntroController bangumiIntroController;
|
late final BangumiIntroController bangumiIntroController;
|
||||||
late final VideoDetailController videoDetailCtr;
|
late final VideoDetailController videoDetailCtr;
|
||||||
Box localCache = GStrorage.localCache;
|
Box localCache = GStrorage.localCache;
|
||||||
late final BangumiInfoModel? bangumiItem;
|
|
||||||
late double sheetHeight;
|
late double sheetHeight;
|
||||||
int? cid;
|
int? cid;
|
||||||
bool isProcessing = false;
|
bool isProcessing = false;
|
||||||
void Function()? handleState(Future Function() action) {
|
void Function()? handleState(Future Function() action) {
|
||||||
return isProcessing ? null : () async {
|
return isProcessing
|
||||||
setState(() => isProcessing = true);
|
? null
|
||||||
await action();
|
: () async {
|
||||||
setState(() => isProcessing = false);
|
setState(() => isProcessing = true);
|
||||||
};
|
await action();
|
||||||
|
setState(() => isProcessing = false);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag);
|
bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag);
|
||||||
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
||||||
bangumiItem = bangumiIntroController.bangumiItem;
|
|
||||||
sheetHeight = localCache.get('sheetHeight');
|
sheetHeight = localCache.get('sheetHeight');
|
||||||
cid = widget.cid!;
|
cid = widget.cid!;
|
||||||
print('cid: $cid');
|
|
||||||
videoDetailCtr.cid.listen((p0) {
|
videoDetailCtr.cid.listen((p0) {
|
||||||
cid = p0;
|
cid = p0;
|
||||||
print('cid: $cid');
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -155,7 +152,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
context: context,
|
context: context,
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: (context) {
|
builder: (BuildContext context) {
|
||||||
return FavPanel(ctr: bangumiIntroController);
|
return FavPanel(ctr: bangumiIntroController);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -175,218 +172,166 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
ThemeData t = Theme.of(context);
|
final ThemeData t = Theme.of(context);
|
||||||
return SliverPadding(
|
return SliverPadding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: StyleString.safeSpace, right: StyleString.safeSpace, top: 20),
|
left: StyleString.safeSpace, right: StyleString.safeSpace, top: 20),
|
||||||
sliver: SliverToBoxAdapter(
|
sliver: SliverToBoxAdapter(
|
||||||
child: !widget.loadingStatus || bangumiItem != null
|
child: Column(
|
||||||
? Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Stack(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
NetworkImgLayer(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
width: 105,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
height: 160,
|
||||||
children: [
|
src: widget.bangumiDetail!.cover!,
|
||||||
Stack(
|
),
|
||||||
children: [
|
PBadge(
|
||||||
NetworkImgLayer(
|
text: '评分 ${widget.bangumiDetail!.rating!['score']!}',
|
||||||
width: 105,
|
top: null,
|
||||||
height: 160,
|
right: 6,
|
||||||
src: !widget.loadingStatus
|
bottom: 6,
|
||||||
? widget.bangumiDetail!.cover!
|
left: null,
|
||||||
: bangumiItem!.cover!,
|
),
|
||||||
),
|
],
|
||||||
if (bangumiItem != null &&
|
),
|
||||||
bangumiItem!.rating != null)
|
const SizedBox(width: 10),
|
||||||
PBadge(
|
Expanded(
|
||||||
text:
|
child: InkWell(
|
||||||
'评分 ${!widget.loadingStatus ? widget.bangumiDetail!.rating!['score']! : bangumiItem!.rating!['score']!}',
|
onTap: () => showIntroDetail(),
|
||||||
top: null,
|
child: SizedBox(
|
||||||
right: 6,
|
height: 158,
|
||||||
bottom: 6,
|
child: Column(
|
||||||
left: null,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
widget.bangumiDetail!.title!,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
const SizedBox(width: 20),
|
||||||
),
|
SizedBox(
|
||||||
const SizedBox(width: 10),
|
width: 34,
|
||||||
Expanded(
|
height: 34,
|
||||||
child: InkWell(
|
child: IconButton(
|
||||||
onTap: () => showIntroDetail(),
|
style: ButtonStyle(
|
||||||
child: SizedBox(
|
padding: MaterialStateProperty.all(
|
||||||
height: 158,
|
EdgeInsets.zero),
|
||||||
child: Column(
|
backgroundColor:
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
MaterialStateProperty.resolveWith(
|
||||||
mainAxisSize: MainAxisSize.min,
|
(Set<MaterialState> states) {
|
||||||
children: [
|
return t.colorScheme.primaryContainer
|
||||||
Row(
|
.withOpacity(0.7);
|
||||||
children: [
|
}),
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
!widget.loadingStatus
|
|
||||||
? widget.bangumiDetail!.title!
|
|
||||||
: bangumiItem!.title!,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 20),
|
|
||||||
SizedBox(
|
|
||||||
width: 34,
|
|
||||||
height: 34,
|
|
||||||
child: IconButton(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: MaterialStateProperty.all(
|
|
||||||
EdgeInsets.zero),
|
|
||||||
backgroundColor:
|
|
||||||
MaterialStateProperty.resolveWith(
|
|
||||||
(states) {
|
|
||||||
return t
|
|
||||||
.colorScheme.primaryContainer
|
|
||||||
.withOpacity(0.7);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
onPressed: () =>
|
|
||||||
bangumiIntroController.bangumiAdd(),
|
|
||||||
icon: Icon(
|
|
||||||
Icons.favorite_border_rounded,
|
|
||||||
color: t.colorScheme.primary,
|
|
||||||
size: 22,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Row(
|
onPressed: () =>
|
||||||
children: [
|
bangumiIntroController.bangumiAdd(),
|
||||||
StatView(
|
icon: Icon(
|
||||||
theme: 'gray',
|
Icons.favorite_border_rounded,
|
||||||
view: !widget.loadingStatus
|
color: t.colorScheme.primary,
|
||||||
? widget.bangumiDetail!.stat!['views']
|
size: 22,
|
||||||
: bangumiItem!.stat!['views'],
|
|
||||||
size: 'medium',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
StatDanMu(
|
|
||||||
theme: 'gray',
|
|
||||||
danmu: !widget.loadingStatus
|
|
||||||
? widget
|
|
||||||
.bangumiDetail!.stat!['danmakus']
|
|
||||||
: bangumiItem!.stat!['danmakus'],
|
|
||||||
size: 'medium',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 6),
|
),
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
!widget.loadingStatus
|
|
||||||
? (widget.bangumiDetail!.areas!
|
|
||||||
.isNotEmpty
|
|
||||||
? widget.bangumiDetail!.areas!
|
|
||||||
.first['name']
|
|
||||||
: '')
|
|
||||||
: (bangumiItem!.areas!.isNotEmpty
|
|
||||||
? bangumiItem!
|
|
||||||
.areas!.first['name']
|
|
||||||
: ''),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: t.colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
Text(
|
|
||||||
!widget.loadingStatus
|
|
||||||
? widget.bangumiDetail!
|
|
||||||
.publish!['pub_time_show']
|
|
||||||
: bangumiItem!
|
|
||||||
.publish!['pub_time_show'],
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: t.colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
// const SizedBox(height: 4),
|
|
||||||
Text(
|
|
||||||
!widget.loadingStatus
|
|
||||||
? widget.bangumiDetail!.newEp!['desc']
|
|
||||||
: bangumiItem!.newEp!['desc'],
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: t.colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// const SizedBox(height: 10),
|
|
||||||
const Spacer(),
|
|
||||||
Text(
|
|
||||||
'简介:${!widget.loadingStatus ? widget.bangumiDetail!.evaluate! : bangumiItem!.evaluate!}',
|
|
||||||
maxLines: 3,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 13,
|
|
||||||
color: t.colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
StatView(
|
||||||
|
theme: 'gray',
|
||||||
|
view: widget.bangumiDetail!.stat!['views'],
|
||||||
|
size: 'medium',
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
StatDanMu(
|
||||||
|
theme: 'gray',
|
||||||
|
danmu: widget.bangumiDetail!.stat!['danmakus'],
|
||||||
|
size: 'medium',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
(widget.bangumiDetail!.areas!.isNotEmpty
|
||||||
|
? widget.bangumiDetail!.areas!.first['name']
|
||||||
|
: ''),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: t.colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(
|
||||||
|
widget.bangumiDetail!.publish!['pub_time_show'],
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: t.colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
widget.bangumiDetail!.newEp!['desc'],
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: t.colorScheme.outline,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const Spacer(),
|
||||||
],
|
Text(
|
||||||
|
'简介:${widget.bangumiDetail!.evaluate!}',
|
||||||
|
maxLines: 3,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: t.colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 6),
|
|
||||||
// 点赞收藏转发 布局样式1
|
|
||||||
// SingleChildScrollView(
|
|
||||||
// padding: const EdgeInsets.only(top: 7, bottom: 7),
|
|
||||||
// scrollDirection: Axis.horizontal,
|
|
||||||
// child: actionRow(
|
|
||||||
// context,
|
|
||||||
// bangumiIntroController,
|
|
||||||
// videoDetailCtr,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// 点赞收藏转发 布局样式2
|
|
||||||
actionGrid(context, bangumiIntroController),
|
|
||||||
// 番剧分p
|
|
||||||
if ((!widget.loadingStatus &&
|
|
||||||
widget.bangumiDetail!.episodes!.isNotEmpty) ||
|
|
||||||
bangumiItem != null &&
|
|
||||||
bangumiItem!.episodes!.isNotEmpty) ...[
|
|
||||||
BangumiPanel(
|
|
||||||
pages: bangumiItem != null
|
|
||||||
? bangumiItem!.episodes!
|
|
||||||
: widget.bangumiDetail!.episodes!,
|
|
||||||
cid: cid ??
|
|
||||||
(bangumiItem != null
|
|
||||||
? bangumiItem!.episodes!.first.cid
|
|
||||||
: widget.bangumiDetail!.episodes!.first.cid),
|
|
||||||
sheetHeight: sheetHeight,
|
|
||||||
changeFuc: (bvid, cid, aid) => bangumiIntroController
|
|
||||||
.changeSeasonOrbangu(bvid, cid, aid),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: const SizedBox(
|
|
||||||
height: 100,
|
|
||||||
child: Center(
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
|
||||||
|
/// 点赞收藏转发
|
||||||
|
actionGrid(context, bangumiIntroController),
|
||||||
|
// 番剧分p
|
||||||
|
if (widget.bangumiDetail!.episodes!.isNotEmpty) ...[
|
||||||
|
BangumiPanel(
|
||||||
|
pages: widget.bangumiDetail!.episodes!,
|
||||||
|
cid: cid ?? widget.bangumiDetail!.episodes!.first.cid,
|
||||||
|
sheetHeight: sheetHeight,
|
||||||
|
changeFuc: (bvid, cid, aid) =>
|
||||||
|
bangumiIntroController.changeSeasonOrbangu(bvid, cid, aid),
|
||||||
|
bangumiDetail: bangumiIntroController.bangumiDetail.value,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
],
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget actionGrid(BuildContext context, bangumiIntroController) {
|
Widget actionGrid(BuildContext context, bangumiIntroController) {
|
||||||
return LayoutBuilder(builder: (context, constraints) {
|
return LayoutBuilder(
|
||||||
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
return Material(
|
return Material(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(top: 16, bottom: 8),
|
padding: const EdgeInsets.only(top: 16, bottom: 8),
|
||||||
@ -394,61 +339,50 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
height: constraints.maxWidth / 5 * 0.8,
|
height: constraints.maxWidth / 5 * 0.8,
|
||||||
child: GridView.count(
|
child: GridView.count(
|
||||||
primary: false,
|
primary: false,
|
||||||
padding: const EdgeInsets.all(0),
|
padding: EdgeInsets.zero,
|
||||||
crossAxisCount: 5,
|
crossAxisCount: 5,
|
||||||
childAspectRatio: 1.25,
|
childAspectRatio: 1.25,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Obx(
|
Obx(
|
||||||
() => ActionItem(
|
() => ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
||||||
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
||||||
onTap: handleState(bangumiIntroController.actionLikeVideo),
|
onTap: handleState(bangumiIntroController.actionLikeVideo),
|
||||||
selectStatus: bangumiIntroController.hasLike.value,
|
selectStatus: bangumiIntroController.hasLike.value,
|
||||||
loadingStatus: false,
|
text: widget.bangumiDetail!.stat!['likes']!.toString(),
|
||||||
text: !widget.loadingStatus
|
),
|
||||||
? widget.bangumiDetail!.stat!['likes']!.toString()
|
|
||||||
: bangumiItem!.stat!['likes']!.toString()),
|
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => ActionItem(
|
() => ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.b),
|
icon: const Icon(FontAwesomeIcons.b),
|
||||||
selectIcon: const Icon(FontAwesomeIcons.b),
|
selectIcon: const Icon(FontAwesomeIcons.b),
|
||||||
onTap: handleState(bangumiIntroController.actionCoinVideo),
|
onTap: handleState(bangumiIntroController.actionCoinVideo),
|
||||||
selectStatus: bangumiIntroController.hasCoin.value,
|
selectStatus: bangumiIntroController.hasCoin.value,
|
||||||
loadingStatus: false,
|
text: widget.bangumiDetail!.stat!['coins']!.toString(),
|
||||||
text: !widget.loadingStatus
|
),
|
||||||
? widget.bangumiDetail!.stat!['coins']!.toString()
|
|
||||||
: bangumiItem!.stat!['coins']!.toString()),
|
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => ActionItem(
|
() => ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.star),
|
icon: const Icon(FontAwesomeIcons.star),
|
||||||
selectIcon: const Icon(FontAwesomeIcons.solidStar),
|
selectIcon: const Icon(FontAwesomeIcons.solidStar),
|
||||||
onTap: () => showFavBottomSheet(),
|
onTap: () => showFavBottomSheet(),
|
||||||
selectStatus: bangumiIntroController.hasFav.value,
|
selectStatus: bangumiIntroController.hasFav.value,
|
||||||
loadingStatus: false,
|
text: widget.bangumiDetail!.stat!['favorite']!.toString(),
|
||||||
text: !widget.loadingStatus
|
),
|
||||||
? widget.bangumiDetail!.stat!['favorite']!.toString()
|
|
||||||
: bangumiItem!.stat!['favorite']!.toString()),
|
|
||||||
),
|
),
|
||||||
ActionItem(
|
ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.comment),
|
icon: const Icon(FontAwesomeIcons.comment),
|
||||||
selectIcon: const Icon(FontAwesomeIcons.reply),
|
selectIcon: const Icon(FontAwesomeIcons.reply),
|
||||||
onTap: () => videoDetailCtr.tabCtr.animateTo(1),
|
onTap: () => videoDetailCtr.tabCtr.animateTo(1),
|
||||||
selectStatus: false,
|
selectStatus: false,
|
||||||
loadingStatus: false,
|
text: widget.bangumiDetail!.stat!['reply']!.toString(),
|
||||||
text: !widget.loadingStatus
|
|
||||||
? widget.bangumiDetail!.stat!['reply']!.toString()
|
|
||||||
: bangumiItem!.stat!['reply']!.toString(),
|
|
||||||
),
|
),
|
||||||
ActionItem(
|
ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
||||||
onTap: () => bangumiIntroController.actionShareVideo(),
|
onTap: () => bangumiIntroController.actionShareVideo(),
|
||||||
selectStatus: false,
|
selectStatus: false,
|
||||||
loadingStatus: false,
|
text: widget.bangumiDetail!.stat!['share']!.toString(),
|
||||||
text: !widget.loadingStatus
|
),
|
||||||
? widget.bangumiDetail!.stat!['share']!.toString()
|
|
||||||
: bangumiItem!.stat!['share']!.toString()),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -456,63 +390,4 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget actionRow(BuildContext context, videoIntroController, videoDetailCtr) {
|
|
||||||
return Row(children: [
|
|
||||||
Obx(
|
|
||||||
() => ActionRowItem(
|
|
||||||
icon: const Icon(FontAwesomeIcons.thumbsUp),
|
|
||||||
onTap: handleState(videoIntroController.actionLikeVideo),
|
|
||||||
selectStatus: videoIntroController.hasLike.value,
|
|
||||||
loadingStatus: widget.loadingStatus,
|
|
||||||
text: !widget.loadingStatus
|
|
||||||
? widget.bangumiDetail!.stat!['likes']!.toString()
|
|
||||||
: '-',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Obx(
|
|
||||||
() => ActionRowItem(
|
|
||||||
icon: const Icon(FontAwesomeIcons.b),
|
|
||||||
onTap: handleState(videoIntroController.actionCoinVideo),
|
|
||||||
selectStatus: videoIntroController.hasCoin.value,
|
|
||||||
loadingStatus: widget.loadingStatus,
|
|
||||||
text: !widget.loadingStatus
|
|
||||||
? widget.bangumiDetail!.stat!['coins']!.toString()
|
|
||||||
: '-',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Obx(
|
|
||||||
() => ActionRowItem(
|
|
||||||
icon: const Icon(FontAwesomeIcons.heart),
|
|
||||||
onTap: () => showFavBottomSheet(),
|
|
||||||
selectStatus: videoIntroController.hasFav.value,
|
|
||||||
loadingStatus: widget.loadingStatus,
|
|
||||||
text: !widget.loadingStatus
|
|
||||||
? widget.bangumiDetail!.stat!['favorite']!.toString()
|
|
||||||
: '-',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
ActionRowItem(
|
|
||||||
icon: const Icon(FontAwesomeIcons.comment),
|
|
||||||
onTap: () {
|
|
||||||
videoDetailCtr.tabCtr.animateTo(1);
|
|
||||||
},
|
|
||||||
selectStatus: false,
|
|
||||||
loadingStatus: widget.loadingStatus,
|
|
||||||
text: !widget.loadingStatus
|
|
||||||
? widget.bangumiDetail!.stat!['reply']!.toString()
|
|
||||||
: '-',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
ActionRowItem(
|
|
||||||
icon: const Icon(FontAwesomeIcons.share),
|
|
||||||
onTap: () => videoIntroController.actionShareVideo(),
|
|
||||||
selectStatus: false,
|
|
||||||
loadingStatus: widget.loadingStatus,
|
|
||||||
text: '转发'),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ import 'package:easy_debounce/easy_throttle.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/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/pages/home/index.dart';
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
import 'package:pilipala/pages/main/index.dart';
|
import 'package:pilipala/pages/main/index.dart';
|
||||||
import 'package:pilipala/pages/rcmd/view.dart';
|
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'widgets/bangumu_card_v.dart';
|
import 'widgets/bangumu_card_v.dart';
|
||||||
@ -74,7 +74,7 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
super.build(context);
|
super.build(context);
|
||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
await _bangumidController.queryBangumiListFeed(type: 'init');
|
await _bangumidController.queryBangumiListFeed();
|
||||||
return _bangumidController.queryBangumiFollow();
|
return _bangumidController.queryBangumiFollow();
|
||||||
},
|
},
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
@ -112,10 +112,11 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 258,
|
height: 268,
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _futureBuilderFutureFollow,
|
future: _futureBuilderFutureFollow,
|
||||||
builder: (context, snapshot) {
|
builder:
|
||||||
|
(BuildContext context, AsyncSnapshot snapshot) {
|
||||||
if (snapshot.connectionState ==
|
if (snapshot.connectionState ==
|
||||||
ConnectionState.done) {
|
ConnectionState.done) {
|
||||||
if (snapshot.data == null) {
|
if (snapshot.data == null) {
|
||||||
@ -156,10 +157,10 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox();
|
return nil;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox();
|
return nil;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -188,7 +189,7 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
StyleString.safeSpace, 0, StyleString.safeSpace, 0),
|
StyleString.safeSpace, 0, StyleString.safeSpace, 0),
|
||||||
sliver: FutureBuilder(
|
sliver: FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
Map data = snapshot.data as Map;
|
Map data = snapshot.data as Map;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
@ -197,7 +198,10 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
} else {
|
} else {
|
||||||
return HttpError(
|
return HttpError(
|
||||||
errMsg: data['msg'],
|
errMsg: data['msg'],
|
||||||
fn: () => {},
|
fn: () {
|
||||||
|
_futureBuilderFuture =
|
||||||
|
_bangumidController.queryBangumiListFeed();
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -206,7 +210,6 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
LoadingMore()
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -222,13 +225,13 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
// 列数
|
// 列数
|
||||||
crossAxisCount: 3,
|
crossAxisCount: 3,
|
||||||
mainAxisExtent: Get.size.width / 3 / 0.65 +
|
mainAxisExtent: Get.size.width / 3 / 0.65 +
|
||||||
32 * MediaQuery.of(context).textScaleFactor,
|
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,
|
||||||
),
|
),
|
||||||
|
@ -8,19 +8,21 @@ import 'package:pilipala/utils/storage.dart';
|
|||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||||
|
|
||||||
class BangumiPanel extends StatefulWidget {
|
class BangumiPanel extends StatefulWidget {
|
||||||
final List<EpisodeItem> pages;
|
|
||||||
final int? cid;
|
|
||||||
final double? sheetHeight;
|
|
||||||
final Function? changeFuc;
|
|
||||||
|
|
||||||
const BangumiPanel({
|
const BangumiPanel({
|
||||||
super.key,
|
super.key,
|
||||||
required this.pages,
|
required this.pages,
|
||||||
this.cid,
|
this.cid,
|
||||||
this.sheetHeight,
|
this.sheetHeight,
|
||||||
this.changeFuc,
|
this.changeFuc,
|
||||||
|
this.bangumiDetail,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final List<EpisodeItem> pages;
|
||||||
|
final int? cid;
|
||||||
|
final double? sheetHeight;
|
||||||
|
final Function? changeFuc;
|
||||||
|
final BangumiInfoModel? bangumiDetail;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<BangumiPanel> createState() => _BangumiPanelState();
|
State<BangumiPanel> createState() => _BangumiPanelState();
|
||||||
}
|
}
|
||||||
@ -50,10 +52,10 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
}
|
}
|
||||||
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
||||||
|
|
||||||
videoDetailCtr.cid.listen((p0) {
|
videoDetailCtr.cid.listen((int p0) {
|
||||||
cid = p0;
|
cid = p0;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
currentIndex = widget.pages.indexWhere((e) => e.cid == cid);
|
currentIndex = widget.pages.indexWhere((EpisodeItem e) => e.cid == cid);
|
||||||
scrollToIndex();
|
scrollToIndex();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -65,6 +67,47 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
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() {
|
void showBangumiPanel() {
|
||||||
showBottomSheet(
|
showBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@ -105,37 +148,22 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
child: ScrollablePositionedList.builder(
|
child: ScrollablePositionedList.builder(
|
||||||
itemCount: widget.pages.length,
|
itemCount: widget.pages.length + 1,
|
||||||
itemBuilder: (context, index) => ListTile(
|
itemBuilder: (BuildContext context, int index) {
|
||||||
onTap: () {
|
bool isLastItem = index == widget.pages.length;
|
||||||
setState(() {
|
bool isCurrentIndex = currentIndex == index;
|
||||||
changeFucCall(widget.pages[index], index);
|
return isLastItem
|
||||||
});
|
? SizedBox(
|
||||||
},
|
height:
|
||||||
dense: false,
|
MediaQuery.of(context).padding.bottom +
|
||||||
leading: index == currentIndex
|
20,
|
||||||
? Image.asset(
|
|
||||||
'assets/images/live.gif',
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
height: 12,
|
|
||||||
)
|
)
|
||||||
: null,
|
: buildPageListItem(
|
||||||
title: Text(
|
widget.pages[index],
|
||||||
'第${index + 1}话 ${widget.pages[index].longTitle!}',
|
index,
|
||||||
style: TextStyle(
|
isCurrentIndex,
|
||||||
fontSize: 14,
|
);
|
||||||
color: index == currentIndex
|
},
|
||||||
? Theme.of(context).colorScheme.primary
|
|
||||||
: Theme.of(context).colorScheme.onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
trailing: widget.pages[index].badge != null
|
|
||||||
? Image.asset(
|
|
||||||
'assets/images/big-vip.png',
|
|
||||||
height: 20,
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
),
|
|
||||||
itemScrollController: itemScrollController,
|
itemScrollController: itemScrollController,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -150,7 +178,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void changeFucCall(item, i) async {
|
void changeFucCall(item, i) async {
|
||||||
if (item.badge != null && vipStatus != 1) {
|
if (item.badge != null && item.badge == '会员' && vipStatus != 1) {
|
||||||
SmartDialog.showToast('需要大会员');
|
SmartDialog.showToast('需要大会员');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -177,11 +205,11 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 10, bottom: 6),
|
padding: const EdgeInsets.only(top: 10, bottom: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
const Text('合集 '),
|
const Text('选集 '),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
' 正在播放:${widget.pages[currentIndex].longTitle}',
|
' 正在播放:${widget.pages[currentIndex].longTitle}',
|
||||||
@ -201,7 +229,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
),
|
),
|
||||||
onPressed: () => showBangumiPanel(),
|
onPressed: () => showBangumiPanel(),
|
||||||
child: Text(
|
child: Text(
|
||||||
'全${widget.pages.length}话',
|
'${widget.bangumiDetail!.newEp!['desc']}',
|
||||||
style: const TextStyle(fontSize: 13),
|
style: const TextStyle(fontSize: 13),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -212,78 +240,79 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 60,
|
height: 60,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
controller: listViewScrollCtr,
|
controller: listViewScrollCtr,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemCount: widget.pages.length,
|
itemCount: widget.pages.length,
|
||||||
itemExtent: 150,
|
itemExtent: 150,
|
||||||
itemBuilder: ((context, i) {
|
itemBuilder: (BuildContext context, int i) {
|
||||||
return Container(
|
return Container(
|
||||||
width: 150,
|
width: 150,
|
||||||
margin: const EdgeInsets.only(right: 10),
|
margin: const EdgeInsets.only(right: 10),
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => changeFucCall(widget.pages[i], i),
|
onTap: () => changeFucCall(widget.pages[i], i),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 8, horizontal: 10),
|
vertical: 8, horizontal: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
if (i == currentIndex) ...[
|
if (i == currentIndex) ...<Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/images/live.png',
|
'assets/images/live.png',
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6)
|
||||||
|
],
|
||||||
|
Text(
|
||||||
|
'第${i + 1}话',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: i == currentIndex
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSurface),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 2),
|
||||||
|
if (widget.pages[i].badge != null) ...[
|
||||||
|
const Spacer(),
|
||||||
|
Text(
|
||||||
|
widget.pages[i].badge!,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
color:
|
color:
|
||||||
Theme.of(context).colorScheme.primary,
|
Theme.of(context).colorScheme.primary,
|
||||||
height: 12,
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6)
|
|
||||||
],
|
|
||||||
Text(
|
|
||||||
'第${i + 1}话',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 13,
|
|
||||||
color: i == currentIndex
|
|
||||||
? Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary
|
|
||||||
: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSurface),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 2),
|
]
|
||||||
if (widget.pages[i].badge != null) ...[
|
],
|
||||||
Image.asset(
|
),
|
||||||
'assets/images/big-vip.png',
|
const SizedBox(height: 3),
|
||||||
height: 16,
|
Text(
|
||||||
),
|
widget.pages[i].longTitle!,
|
||||||
],
|
maxLines: 1,
|
||||||
],
|
style: TextStyle(
|
||||||
),
|
fontSize: 13,
|
||||||
const SizedBox(height: 3),
|
color: i == currentIndex
|
||||||
Text(
|
? Theme.of(context).colorScheme.primary
|
||||||
widget.pages[i].longTitle!,
|
: Theme.of(context).colorScheme.onSurface),
|
||||||
maxLines: 1,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
)
|
||||||
fontSize: 13,
|
],
|
||||||
color: i == currentIndex
|
|
||||||
? Theme.of(context).colorScheme.primary
|
|
||||||
: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSurface),
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
})),
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -11,17 +11,16 @@ import 'package:pilipala/common/widgets/network_img_layer.dart';
|
|||||||
|
|
||||||
// 视频卡片 - 垂直布局
|
// 视频卡片 - 垂直布局
|
||||||
class BangumiCardV extends StatelessWidget {
|
class BangumiCardV extends StatelessWidget {
|
||||||
// ignore: prefer_typing_uninitialized_variables
|
|
||||||
final bangumiItem;
|
|
||||||
final Function()? longPress;
|
|
||||||
final Function()? longPressEnd;
|
|
||||||
|
|
||||||
const BangumiCardV({
|
const BangumiCardV({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.bangumiItem,
|
required this.bangumiItem,
|
||||||
this.longPress,
|
this.longPress,
|
||||||
this.longPressEnd,
|
this.longPressEnd,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
|
final bangumiItem;
|
||||||
|
final Function()? longPress;
|
||||||
|
final Function()? longPressEnd;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -43,9 +42,9 @@ class BangumiCardV extends StatelessWidget {
|
|||||||
// },
|
// },
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
int seasonId = bangumiItem.seasonId;
|
final int seasonId = bangumiItem.seasonId;
|
||||||
SmartDialog.showLoading(msg: '获取中...');
|
SmartDialog.showLoading(msg: '获取中...');
|
||||||
var res = await SearchHttp.bangumiInfo(seasonId: seasonId);
|
final res = await SearchHttp.bangumiInfo(seasonId: seasonId);
|
||||||
SmartDialog.dismiss().then((value) {
|
SmartDialog.dismiss().then((value) {
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
if (res['data'].episodes.isEmpty) {
|
if (res['data'].episodes.isEmpty) {
|
||||||
@ -81,8 +80,8 @@ class BangumiCardV extends StatelessWidget {
|
|||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 0.65,
|
aspectRatio: 0.65,
|
||||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||||
double maxWidth = boxConstraints.maxWidth;
|
final double maxWidth = boxConstraints.maxWidth;
|
||||||
double maxHeight = boxConstraints.maxHeight;
|
final double maxHeight = boxConstraints.maxHeight;
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Hero(
|
Hero(
|
||||||
@ -124,9 +123,9 @@ class BangumiCardV extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class BangumiContent extends StatelessWidget {
|
class BangumiContent extends StatelessWidget {
|
||||||
|
const BangumiContent({super.key, required this.bangumiItem});
|
||||||
// ignore: prefer_typing_uninitialized_variables
|
// ignore: prefer_typing_uninitialized_variables
|
||||||
final bangumiItem;
|
final bangumiItem;
|
||||||
const BangumiContent({Key? key, required this.bangumiItem}) : super(key: key);
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
|
@ -70,7 +70,7 @@ class _BlackListPageState extends State<BlackListPage> {
|
|||||||
onRefresh: () async => await _blackListController.queryBlacklist(),
|
onRefresh: () async => await _blackListController.queryBlacklist(),
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
var data = snapshot.data;
|
var data = snapshot.data;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
@ -139,7 +139,7 @@ class BlackListController extends GetxController {
|
|||||||
int currentPage = 1;
|
int currentPage = 1;
|
||||||
int pageSize = 50;
|
int pageSize = 50;
|
||||||
RxInt total = 0.obs;
|
RxInt total = 0.obs;
|
||||||
RxList<BlackListItem> blackList = [BlackListItem()].obs;
|
RxList<BlackListItem> blackList = <BlackListItem>[].obs;
|
||||||
|
|
||||||
Future queryBlacklist({type = 'init'}) async {
|
Future queryBlacklist({type = 'init'}) async {
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
|
@ -1,26 +1,23 @@
|
|||||||
import 'package:pilipala/http/danmaku.dart';
|
import 'package:pilipala/http/danmaku.dart';
|
||||||
import 'package:pilipala/models/danmaku/dm.pb.dart';
|
import 'package:pilipala/models/danmaku/dm.pb.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
|
||||||
|
|
||||||
class PlDanmakuController {
|
class PlDanmakuController {
|
||||||
PlDanmakuController(this.cid);
|
PlDanmakuController(this.cid);
|
||||||
final int cid;
|
final int cid;
|
||||||
Map<int,List<DanmakuElem>> dmSegMap = {};
|
Map<int, List<DanmakuElem>> dmSegMap = {};
|
||||||
// 已请求的段落标记
|
// 已请求的段落标记
|
||||||
List<bool> requestedSeg = [];
|
List<bool> requestedSeg = [];
|
||||||
|
|
||||||
bool get initiated => requestedSeg.isNotEmpty;
|
bool get initiated => requestedSeg.isNotEmpty;
|
||||||
|
|
||||||
static int SEGMENT_LENGTH = 60 * 6 * 1000;
|
static int segmentLength = 60 * 6 * 1000;
|
||||||
|
|
||||||
void initiate(int videoDuration, int progress) {
|
void initiate(int videoDuration, int progress) {
|
||||||
if (requestedSeg.isEmpty) {
|
if (requestedSeg.isEmpty) {
|
||||||
int segCount = (videoDuration / SEGMENT_LENGTH).ceil();
|
int segCount = (videoDuration / segmentLength).ceil();
|
||||||
requestedSeg = List<bool>.generate(segCount, (index) => false);
|
requestedSeg = List<bool>.generate(segCount, (index) => false);
|
||||||
}
|
}
|
||||||
queryDanmaku(
|
queryDanmaku(calcSegment(progress));
|
||||||
calcSegment(progress)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
@ -29,17 +26,17 @@ class PlDanmakuController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int calcSegment(int progress) {
|
int calcSegment(int progress) {
|
||||||
return progress ~/ SEGMENT_LENGTH;
|
return progress ~/ segmentLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryDanmaku(int segmentIndex) async {
|
void queryDanmaku(int segmentIndex) async {
|
||||||
assert(requestedSeg[segmentIndex] == false);
|
assert(requestedSeg[segmentIndex] == false);
|
||||||
requestedSeg[segmentIndex] = true;
|
requestedSeg[segmentIndex] = true;
|
||||||
DmSegMobileReply result =
|
final DmSegMobileReply result = await DanmakaHttp.queryDanmaku(
|
||||||
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] = [];
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import 'package:easy_debounce/easy_throttle.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
@ -36,6 +35,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
late double opacityVal;
|
late double opacityVal;
|
||||||
late double fontSizeVal;
|
late double fontSizeVal;
|
||||||
late double danmakuDurationVal;
|
late double danmakuDurationVal;
|
||||||
|
late double strokeWidth;
|
||||||
int latestAddedPosition = -1;
|
int latestAddedPosition = -1;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -43,15 +43,13 @@ 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 = PlDanmakuController(widget.cid);
|
||||||
PlDanmakuController(widget.cid);
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
playerController = widget.playerController;
|
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,
|
||||||
playerController.position.value.inMilliseconds
|
playerController.position.value.inMilliseconds);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
playerController
|
playerController
|
||||||
..addStatusLister(playerListener)
|
..addStatusLister(playerListener)
|
||||||
@ -61,14 +59,14 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
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;
|
||||||
fontSizeVal = playerController.fontSizeVal;
|
fontSizeVal = playerController.fontSizeVal;
|
||||||
|
strokeWidth = playerController.strokeWidth;
|
||||||
danmakuDurationVal = playerController.danmakuDurationVal;
|
danmakuDurationVal = playerController.danmakuDurationVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +85,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int currentPosition = position.inMilliseconds;
|
int currentPosition = position.inMilliseconds;
|
||||||
currentPosition -= currentPosition % 100;//取整百的毫秒数
|
currentPosition -= currentPosition % 100; //取整百的毫秒数
|
||||||
|
|
||||||
if (currentPosition == latestAddedPosition) {
|
if (currentPosition == latestAddedPosition) {
|
||||||
return;
|
return;
|
||||||
@ -98,17 +96,18 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
_plDanmakuController.getCurrentDanmaku(currentPosition);
|
_plDanmakuController.getCurrentDanmaku(currentPosition);
|
||||||
|
|
||||||
if (currentDanmakuList != null) {
|
if (currentDanmakuList != null) {
|
||||||
Color? defaultColor = playerController.blockTypes.contains(6) ?
|
Color? defaultColor = playerController.blockTypes.contains(6)
|
||||||
DmUtils.decimalToColor(16777215) : null;
|
? DmUtils.decimalToColor(16777215)
|
||||||
|
: null;
|
||||||
|
|
||||||
_controller!.addItems(
|
_controller!.addItems(currentDanmakuList
|
||||||
currentDanmakuList.map((e) => DanmakuItem(
|
.map((e) => DanmakuItem(
|
||||||
e.content,
|
e.content,
|
||||||
color: defaultColor ?? DmUtils.decimalToColor(e.color),
|
color: defaultColor ?? DmUtils.decimalToColor(e.color),
|
||||||
time: e.progress,
|
time: e.progress,
|
||||||
type: DmUtils.getPosition(e.mode),
|
type: DmUtils.getPosition(e.mode),
|
||||||
)).toList()
|
))
|
||||||
);
|
.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +127,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
|||||||
duration: const Duration(milliseconds: 100),
|
duration: const Duration(milliseconds: 100),
|
||||||
child: DanmakuView(
|
child: DanmakuView(
|
||||||
createdController: (DanmakuController e) async {
|
createdController: (DanmakuController e) async {
|
||||||
widget.playerController.danmakuController = _controller = e;
|
playerController.danmakuController = _controller = e;
|
||||||
},
|
},
|
||||||
option: DanmakuOption(
|
option: DanmakuOption(
|
||||||
fontSize: 15 * fontSizeVal,
|
fontSize: 15 * fontSizeVal,
|
||||||
@ -137,7 +136,9 @@ 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 / widget.playerController.playbackSpeed,
|
duration:
|
||||||
|
danmakuDurationVal / playerController.playbackSpeed,
|
||||||
|
strokeWidth: strokeWidth,
|
||||||
// initDuration /
|
// initDuration /
|
||||||
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
|
// (danmakuSpeedVal * widget.playerController.playbackSpeed),
|
||||||
),
|
),
|
||||||
|
@ -20,7 +20,7 @@ import 'package:pilipala/utils/utils.dart';
|
|||||||
class DynamicsController extends GetxController {
|
class DynamicsController extends GetxController {
|
||||||
int page = 1;
|
int page = 1;
|
||||||
String? offset = '';
|
String? offset = '';
|
||||||
RxList<DynamicItemModel> dynamicsList = [DynamicItemModel()].obs;
|
RxList<DynamicItemModel> dynamicsList = <DynamicItemModel>[].obs;
|
||||||
Rx<DynamicsType> dynamicsType = DynamicsType.values[0].obs;
|
Rx<DynamicsType> dynamicsType = DynamicsType.values[0].obs;
|
||||||
RxString dynamicsTypeLabel = '全部'.obs;
|
RxString dynamicsTypeLabel = '全部'.obs;
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
@ -105,7 +105,7 @@ class DynamicsController extends GetxController {
|
|||||||
|
|
||||||
onSelectType(value) async {
|
onSelectType(value) async {
|
||||||
dynamicsType.value = filterTypeList[value]['value'];
|
dynamicsType.value = filterTypeList[value]['value'];
|
||||||
dynamicsList.value = [DynamicItemModel()];
|
dynamicsList.value = <DynamicItemModel>[];
|
||||||
page = 1;
|
page = 1;
|
||||||
initialValue.value = value;
|
initialValue.value = value;
|
||||||
await queryFollowDynamic();
|
await queryFollowDynamic();
|
||||||
@ -249,8 +249,8 @@ class DynamicsController extends GetxController {
|
|||||||
return {'status': false, 'msg': '账号未登录'};
|
return {'status': false, 'msg': '账号未登录'};
|
||||||
}
|
}
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
upData.value.upList = [];
|
upData.value.upList = <UpItem>[];
|
||||||
upData.value.liveUsers = LiveUsers();
|
upData.value.liveList = <LiveUserItem>[];
|
||||||
}
|
}
|
||||||
var res = await DynamicsHttp.followUp();
|
var res = await DynamicsHttp.followUp();
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
@ -258,20 +258,23 @@ class DynamicsController extends GetxController {
|
|||||||
if (upData.value.upList!.isEmpty) {
|
if (upData.value.upList!.isEmpty) {
|
||||||
mid.value = -1;
|
mid.value = -1;
|
||||||
}
|
}
|
||||||
|
upData.value.upList!.insertAll(0, [
|
||||||
|
UpItem(face: '', uname: '全部动态', mid: -1),
|
||||||
|
UpItem(face: userInfo.face, uname: '我', mid: userInfo.mid),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectUp(mid) async {
|
onSelectUp(mid) async {
|
||||||
dynamicsType.value = DynamicsType.values[0];
|
dynamicsType.value = DynamicsType.values[0];
|
||||||
dynamicsList.value = [DynamicItemModel()];
|
dynamicsList.value = <DynamicItemModel>[];
|
||||||
page = 1;
|
page = 1;
|
||||||
queryFollowDynamic();
|
queryFollowDynamic();
|
||||||
}
|
}
|
||||||
|
|
||||||
onRefresh() async {
|
onRefresh() async {
|
||||||
page = 1;
|
page = 1;
|
||||||
print('onRefresh');
|
|
||||||
await queryFollowUp();
|
await queryFollowUp();
|
||||||
await queryFollowDynamic();
|
await queryFollowDynamic();
|
||||||
}
|
}
|
||||||
@ -293,7 +296,7 @@ class DynamicsController extends GetxController {
|
|||||||
dynamicsType.value = DynamicsType.values[0];
|
dynamicsType.value = DynamicsType.values[0];
|
||||||
initialValue.value = 0;
|
initialValue.value = 0;
|
||||||
SmartDialog.showToast('还原默认加载');
|
SmartDialog.showToast('还原默认加载');
|
||||||
dynamicsList.value = [DynamicItemModel()];
|
dynamicsList.value = <DynamicItemModel>[];
|
||||||
queryFollowDynamic();
|
queryFollowDynamic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class DynamicDetailController extends GetxController {
|
|||||||
int currentPage = 0;
|
int currentPage = 0;
|
||||||
bool isLoadingMore = false;
|
bool isLoadingMore = false;
|
||||||
RxString noMore = ''.obs;
|
RxString noMore = ''.obs;
|
||||||
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs;
|
RxList<ReplyItemModel> replyList = <ReplyItemModel>[].obs;
|
||||||
RxInt acount = 0.obs;
|
RxInt acount = 0.obs;
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
|
|
||||||
@ -37,6 +37,10 @@ class DynamicDetailController extends GetxController {
|
|||||||
}
|
}
|
||||||
int deaultReplySortIndex =
|
int deaultReplySortIndex =
|
||||||
setting.get(SettingBoxKey.replySortType, defaultValue: 0);
|
setting.get(SettingBoxKey.replySortType, defaultValue: 0);
|
||||||
|
if (deaultReplySortIndex == 2) {
|
||||||
|
setting.put(SettingBoxKey.replySortType, 0);
|
||||||
|
deaultReplySortIndex = 0;
|
||||||
|
}
|
||||||
_sortType = ReplySortType.values[deaultReplySortIndex];
|
_sortType = ReplySortType.values[deaultReplySortIndex];
|
||||||
sortTypeTitle.value = _sortType.titles;
|
sortTypeTitle.value = _sortType.titles;
|
||||||
sortTypeLabel.value = _sortType.labels;
|
sortTypeLabel.value = _sortType.labels;
|
||||||
@ -92,9 +96,6 @@ class DynamicDetailController extends GetxController {
|
|||||||
_sortType = ReplySortType.like;
|
_sortType = ReplySortType.like;
|
||||||
break;
|
break;
|
||||||
case ReplySortType.like:
|
case ReplySortType.like:
|
||||||
_sortType = ReplySortType.reply;
|
|
||||||
break;
|
|
||||||
case ReplySortType.reply:
|
|
||||||
_sortType = ReplySortType.time;
|
_sortType = ReplySortType.time;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
@ -8,11 +8,11 @@ import 'package:pilipala/common/skeleton/video_reply.dart';
|
|||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/pages/dynamics/deatil/index.dart';
|
import 'package:pilipala/pages/dynamics/detail/index.dart';
|
||||||
import 'package:pilipala/pages/dynamics/widgets/author_panel.dart';
|
import 'package:pilipala/pages/dynamics/widgets/author_panel.dart';
|
||||||
import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.dart';
|
import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.dart';
|
||||||
import 'package:pilipala/pages/video/detail/replyNew/index.dart';
|
import 'package:pilipala/pages/video/detail/reply_new/index.dart';
|
||||||
import 'package:pilipala/pages/video/detail/replyReply/index.dart';
|
import 'package:pilipala/pages/video/detail/reply_reply/index.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
|
|
@ -14,6 +14,7 @@ import 'package:pilipala/pages/main/index.dart';
|
|||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
|
import '../mine/controller.dart';
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'widgets/dynamic_panel.dart';
|
import 'widgets/dynamic_panel.dart';
|
||||||
import 'widgets/up_panel.dart';
|
import 'widgets/up_panel.dart';
|
||||||
@ -28,6 +29,7 @@ class DynamicsPage extends StatefulWidget {
|
|||||||
class _DynamicsPageState extends State<DynamicsPage>
|
class _DynamicsPageState extends State<DynamicsPage>
|
||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
||||||
|
final MineController mineController = Get.put(MineController());
|
||||||
late Future _futureBuilderFuture;
|
late Future _futureBuilderFuture;
|
||||||
late Future _futureBuilderFutureUp;
|
late Future _futureBuilderFutureUp;
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
@ -192,22 +194,6 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// Obx(
|
|
||||||
// () => Visibility(
|
|
||||||
// visible: _dynamicsController.userLogin.value,
|
|
||||||
// child: Positioned(
|
|
||||||
// right: 4,
|
|
||||||
// top: 0,
|
|
||||||
// bottom: 0,
|
|
||||||
// child: IconButton(
|
|
||||||
// padding: EdgeInsets.zero,
|
|
||||||
// onPressed: () =>
|
|
||||||
// {feedBack(), _dynamicsController.resetSearch()},
|
|
||||||
// icon: const Icon(Icons.history, size: 21),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -229,7 +215,8 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
return Obx(() => UpPanel(_dynamicsController.upData.value));
|
return Obx(() => UpPanel(_dynamicsController.upData.value));
|
||||||
} else {
|
} else {
|
||||||
return const SliverToBoxAdapter(
|
return const SliverToBoxAdapter(
|
||||||
child: SizedBox(height: 80));
|
child: SizedBox(height: 80),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return const SliverToBoxAdapter(
|
return const SliverToBoxAdapter(
|
||||||
@ -240,15 +227,6 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: Container(
|
|
||||||
height: 6,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onInverseSurface
|
|
||||||
.withOpacity(0.5),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
@ -280,6 +258,14 @@ class _DynamicsPageState extends State<DynamicsPage>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} else if (data['msg'] == "账号未登录") {
|
||||||
|
return HttpError(
|
||||||
|
errMsg: data['msg'],
|
||||||
|
btnText: "去登录",
|
||||||
|
fn: () {
|
||||||
|
mineController.onLogin();
|
||||||
|
},
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return HttpError(
|
return HttpError(
|
||||||
errMsg: data['msg'],
|
errMsg: data['msg'],
|
||||||
|
@ -34,25 +34,25 @@ Widget articlePanel(item, context, {floor = 1}) {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
],
|
],
|
||||||
Text(
|
// Text(
|
||||||
item.modules.moduleDynamic.major.opus.title,
|
// item.modules.moduleDynamic.major.opus.title,
|
||||||
style: Theme.of(context)
|
// style: Theme.of(context)
|
||||||
.textTheme
|
// .textTheme
|
||||||
.titleMedium!
|
// .titleMedium!
|
||||||
.copyWith(fontWeight: FontWeight.bold),
|
// .copyWith(fontWeight: FontWeight.bold),
|
||||||
),
|
// ),
|
||||||
const SizedBox(height: 2),
|
// const SizedBox(height: 2),
|
||||||
if (item.modules.moduleDynamic.major.opus.summary.text !=
|
// if (item.modules.moduleDynamic.major.opus.summary.text !=
|
||||||
'undefined') ...[
|
// 'undefined') ...[
|
||||||
Text(
|
// Text(
|
||||||
item.modules.moduleDynamic.major.opus.summary.richTextNodes.first
|
// item.modules.moduleDynamic.major.opus.summary.richTextNodes.first
|
||||||
.text,
|
// .text,
|
||||||
maxLines: 4,
|
// maxLines: 4,
|
||||||
style: const TextStyle(height: 1.55),
|
// style: const TextStyle(height: 1.55),
|
||||||
overflow: TextOverflow.ellipsis,
|
// overflow: TextOverflow.ellipsis,
|
||||||
),
|
// ),
|
||||||
const SizedBox(height: 2),
|
// const SizedBox(height: 2),
|
||||||
],
|
// ],
|
||||||
picWidget(item, context)
|
picWidget(item, context)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -1,7 +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/common/widgets/badge.dart';
|
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// 内容
|
// 内容
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/pages/preview/index.dart';
|
import 'package:pilipala/pages/preview/index.dart';
|
||||||
@ -43,11 +45,20 @@ class _ContentState extends State<Content> {
|
|||||||
if (len == 1) {
|
if (len == 1) {
|
||||||
OpusPicsModel pictureItem = pics.first;
|
OpusPicsModel pictureItem = pics.first;
|
||||||
picList.add(pictureItem.url!);
|
picList.add(pictureItem.url!);
|
||||||
spanChilds.add(const TextSpan(text: '\n'));
|
|
||||||
|
/// 图片上方的空白间隔
|
||||||
|
// spanChilds.add(const TextSpan(text: '\n'));
|
||||||
spanChilds.add(
|
spanChilds.add(
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, BoxConstraints box) {
|
builder: (context, BoxConstraints box) {
|
||||||
|
double maxWidth = box.maxWidth.truncateToDouble();
|
||||||
|
double maxHeight = box.maxWidth * 0.6; // 设置最大高度
|
||||||
|
double height = maxWidth *
|
||||||
|
0.5 *
|
||||||
|
(pictureItem.height != null && pictureItem.width != null
|
||||||
|
? pictureItem.height! / pictureItem.width!
|
||||||
|
: 1);
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
@ -58,18 +69,29 @@ class _ContentState extends State<Content> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Container(
|
||||||
padding: const EdgeInsets.only(top: 4),
|
padding: const EdgeInsets.only(top: 4),
|
||||||
child: NetworkImgLayer(
|
constraints: BoxConstraints(maxHeight: maxHeight),
|
||||||
src: pictureItem.url,
|
|
||||||
width: box.maxWidth / 2,
|
width: box.maxWidth / 2,
|
||||||
height: box.maxWidth *
|
height: height,
|
||||||
0.5 *
|
child: Stack(
|
||||||
(pictureItem.height != null && pictureItem.width != null
|
children: [
|
||||||
? pictureItem.height! / pictureItem.width!
|
Positioned.fill(
|
||||||
: 1),
|
child: NetworkImgLayer(
|
||||||
),
|
src: pictureItem.url,
|
||||||
),
|
width: maxWidth / 2,
|
||||||
|
height: height,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height > Get.size.height * 0.9
|
||||||
|
? const PBadge(
|
||||||
|
text: '长图',
|
||||||
|
right: 8,
|
||||||
|
bottom: 8,
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
],
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -83,6 +105,7 @@ class _ContentState extends State<Content> {
|
|||||||
list.add(
|
list.add(
|
||||||
LayoutBuilder(
|
LayoutBuilder(
|
||||||
builder: (context, BoxConstraints box) {
|
builder: (context, BoxConstraints box) {
|
||||||
|
double maxWidth = box.maxWidth.truncateToDouble();
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
@ -95,8 +118,10 @@ class _ContentState extends State<Content> {
|
|||||||
},
|
},
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: pics[i].url,
|
src: pics[i].url,
|
||||||
width: box.maxWidth,
|
width: maxWidth,
|
||||||
height: box.maxWidth,
|
height: maxWidth,
|
||||||
|
origAspectRatio:
|
||||||
|
pics[i].width!.toInt() / pics[i].height!.toInt(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -107,7 +132,7 @@ class _ContentState extends State<Content> {
|
|||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, BoxConstraints box) {
|
builder: (context, BoxConstraints box) {
|
||||||
double maxWidth = box.maxWidth;
|
double maxWidth = box.maxWidth.truncateToDouble();
|
||||||
double crossCount = len < 3 ? 2 : 3;
|
double crossCount = len < 3 ? 2 : 3;
|
||||||
double height = maxWidth /
|
double height = maxWidth /
|
||||||
crossCount *
|
crossCount *
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/badge.dart';
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
@ -87,7 +88,7 @@ Widget picWidget(item, context) {
|
|||||||
childAspectRatio: aspectRatio,
|
childAspectRatio: aspectRatio,
|
||||||
children: list,
|
children: list,
|
||||||
),
|
),
|
||||||
if (len == 1 && origAspectRatio < 0.4)
|
if (len == 1 && height > Get.size.height * 0.9)
|
||||||
const PBadge(
|
const PBadge(
|
||||||
text: '长图',
|
text: '长图',
|
||||||
top: null,
|
top: null,
|
||||||
|
@ -19,6 +19,17 @@ InlineSpan richNode(item, context) {
|
|||||||
// 动态页面 richTextNodes 层级可能与主页动态层级不同
|
// 动态页面 richTextNodes 层级可能与主页动态层级不同
|
||||||
richTextNodes =
|
richTextNodes =
|
||||||
item.modules.moduleDynamic.major.opus.summary.richTextNodes;
|
item.modules.moduleDynamic.major.opus.summary.richTextNodes;
|
||||||
|
if (item.modules.moduleDynamic.major.opus.title != null) {
|
||||||
|
spanChilds.add(
|
||||||
|
TextSpan(
|
||||||
|
text: item.modules.moduleDynamic.major.opus.title + '\n',
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (richTextNodes == null || richTextNodes.isEmpty) {
|
if (richTextNodes == null || richTextNodes.isEmpty) {
|
||||||
return spacer;
|
return spacer;
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.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/pages/dynamics/controller.dart';
|
import 'package:pilipala/pages/dynamics/controller.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class UpPanel extends StatefulWidget {
|
class UpPanel extends StatefulWidget {
|
||||||
final FollowUpModel? upData;
|
final FollowUpModel upData;
|
||||||
const UpPanel(this.upData, {Key? key}) : super(key: key);
|
const UpPanel(this.upData, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -24,39 +22,22 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
List<UpItem> upList = [];
|
List<UpItem> upList = [];
|
||||||
List<LiveUserItem> liveList = [];
|
List<LiveUserItem> liveList = [];
|
||||||
static const itemPadding = EdgeInsets.symmetric(horizontal: 5, vertical: 0);
|
static const itemPadding = EdgeInsets.symmetric(horizontal: 5, vertical: 0);
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
late MyInfo userInfo;
|
||||||
var userInfo;
|
|
||||||
|
|
||||||
@override
|
void listFormat() {
|
||||||
void initState() {
|
userInfo = widget.upData.myInfo!;
|
||||||
super.initState();
|
upList = widget.upData.upList!;
|
||||||
upList = widget.upData!.upList!;
|
liveList = widget.upData.liveList!;
|
||||||
if (widget.upData!.liveUsers != null) {
|
|
||||||
liveList = widget.upData!.liveUsers!.items!;
|
|
||||||
}
|
|
||||||
upList.insert(
|
|
||||||
0,
|
|
||||||
UpItem(
|
|
||||||
face: 'https://files.catbox.moe/8uc48f.png', uname: '全部动态', mid: -1),
|
|
||||||
);
|
|
||||||
userInfo = userInfoCache.get('userInfoCache');
|
|
||||||
upList.insert(
|
|
||||||
1,
|
|
||||||
UpItem(
|
|
||||||
face: userInfo.face,
|
|
||||||
uname: '我',
|
|
||||||
mid: userInfo.mid,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
listFormat();
|
||||||
return SliverPersistentHeader(
|
return SliverPersistentHeader(
|
||||||
floating: true,
|
floating: true,
|
||||||
pinned: false,
|
pinned: false,
|
||||||
delegate: _SliverHeaderDelegate(
|
delegate: _SliverHeaderDelegate(
|
||||||
height: 124,
|
height: liveList.isNotEmpty || upList.isNotEmpty ? 126 : 0,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -91,7 +72,7 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.background,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Flexible(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
@ -121,6 +102,13 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Container(
|
||||||
|
height: 6,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onInverseSurface
|
||||||
|
.withOpacity(0.5),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
@ -139,7 +127,7 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
int liveLen = liveList.length;
|
int liveLen = liveList.length;
|
||||||
int upLen = upList.length;
|
int upLen = upList.length;
|
||||||
double itemWidth = contentWidth + itemPadding.horizontal;
|
double itemWidth = contentWidth + itemPadding.horizontal;
|
||||||
double screenWidth = MediaQuery.of(context).size.width;
|
double screenWidth = MediaQuery.sizeOf(context).width;
|
||||||
double moveDistance = 0.0;
|
double moveDistance = 0.0;
|
||||||
if (itemWidth * (upList.length + liveList.length) <= screenWidth) {
|
if (itemWidth * (upList.length + liveList.length) <= screenWidth) {
|
||||||
} else if ((upLen - i - 0.5) * itemWidth > screenWidth / 2) {
|
} else if ((upLen - i - 0.5) * itemWidth > screenWidth / 2) {
|
||||||
@ -171,6 +159,9 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
},
|
},
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
feedBack();
|
feedBack();
|
||||||
|
if (data.mid == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String heroTag = Utils.makeHeroTag(data.mid);
|
String heroTag = Utils.makeHeroTag(data.mid);
|
||||||
Get.toNamed('/member?mid=${data.mid}',
|
Get.toNamed('/member?mid=${data.mid}',
|
||||||
arguments: {'face': data.face, 'heroTag': heroTag});
|
arguments: {'face': data.face, 'heroTag': heroTag});
|
||||||
@ -198,12 +189,19 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
backgroundColor: data.type == 'live'
|
backgroundColor: data.type == 'live'
|
||||||
? Theme.of(context).colorScheme.secondaryContainer
|
? Theme.of(context).colorScheme.secondaryContainer
|
||||||
: Theme.of(context).colorScheme.primary,
|
: Theme.of(context).colorScheme.primary,
|
||||||
child: NetworkImgLayer(
|
child: data.face != ''
|
||||||
width: 49,
|
? NetworkImgLayer(
|
||||||
height: 49,
|
width: 50,
|
||||||
src: data.face,
|
height: 50,
|
||||||
type: 'avatar',
|
src: data.face,
|
||||||
),
|
type: 'avatar',
|
||||||
|
)
|
||||||
|
: const CircleAvatar(
|
||||||
|
radius: 25,
|
||||||
|
backgroundImage: AssetImage(
|
||||||
|
'assets/images/noface.jpeg',
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 4),
|
padding: const EdgeInsets.only(top: 4),
|
||||||
@ -271,13 +269,11 @@ class UpPanelSkeleton extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: 49,
|
width: 50,
|
||||||
height: 49,
|
height: 50,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||||
borderRadius: const BorderRadius.all(
|
borderRadius: BorderRadius.circular(50),
|
||||||
Radius.circular(24),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
|
20
lib/pages/emote/controller.dart
Normal file
20
lib/pages/emote/controller.dart
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../http/reply.dart';
|
||||||
|
import '../../models/video/reply/emote.dart';
|
||||||
|
|
||||||
|
class EmotePanelController extends GetxController
|
||||||
|
with GetTickerProviderStateMixin {
|
||||||
|
late List<PackageItem> emotePackage;
|
||||||
|
late TabController tabController;
|
||||||
|
|
||||||
|
Future getEmote() async {
|
||||||
|
var res = await ReplyHttp.getEmoteList(business: 'reply');
|
||||||
|
if (res['status']) {
|
||||||
|
emotePackage = res['data'].packages;
|
||||||
|
tabController = TabController(length: emotePackage.length, vsync: this);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
4
lib/pages/emote/index.dart
Normal file
4
lib/pages/emote/index.dart
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
library emote;
|
||||||
|
|
||||||
|
export './controller.dart';
|
||||||
|
export './view.dart';
|
116
lib/pages/emote/view.dart
Normal file
116
lib/pages/emote/view.dart
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import '../../models/video/reply/emote.dart';
|
||||||
|
import 'controller.dart';
|
||||||
|
|
||||||
|
class EmotePanel extends StatefulWidget {
|
||||||
|
final Function onChoose;
|
||||||
|
const EmotePanel({super.key, required this.onChoose});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<EmotePanel> createState() => _EmotePanelState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EmotePanelState extends State<EmotePanel>
|
||||||
|
with AutomaticKeepAliveClientMixin {
|
||||||
|
final EmotePanelController _emotePanelController =
|
||||||
|
Get.put(EmotePanelController());
|
||||||
|
late Future _futureBuilderFuture;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_futureBuilderFuture = _emotePanelController.getEmote();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
super.build(context);
|
||||||
|
return FutureBuilder(
|
||||||
|
future: _futureBuilderFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
if (data['status']) {
|
||||||
|
List<PackageItem> emotePackage =
|
||||||
|
_emotePanelController.emotePackage;
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
controller: _emotePanelController.tabController,
|
||||||
|
children: emotePackage.map(
|
||||||
|
(e) {
|
||||||
|
int size = e.emote!.first.meta!.size!;
|
||||||
|
int type = e.type!;
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(12, 6, 12, 0),
|
||||||
|
child: GridView.builder(
|
||||||
|
gridDelegate:
|
||||||
|
SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
|
maxCrossAxisExtent: size == 1 ? 40 : 60,
|
||||||
|
crossAxisSpacing: 8,
|
||||||
|
mainAxisSpacing: 8,
|
||||||
|
),
|
||||||
|
itemCount: e.emote!.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onChoose(e, e.emote![index]);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(3),
|
||||||
|
child: type == 4
|
||||||
|
? Text(
|
||||||
|
e.emote![index].text!,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
maxLines: 1,
|
||||||
|
)
|
||||||
|
: Image.network(
|
||||||
|
e.emote![index].url!,
|
||||||
|
width: size * 38,
|
||||||
|
height: size * 38,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
).toList(),
|
||||||
|
)),
|
||||||
|
Divider(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
||||||
|
),
|
||||||
|
TabBar(
|
||||||
|
controller: _emotePanelController.tabController,
|
||||||
|
dividerColor: Colors.transparent,
|
||||||
|
isScrollable: true,
|
||||||
|
tabs: _emotePanelController.emotePackage
|
||||||
|
.map((e) => Tab(text: e.text))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
SizedBox(height: MediaQuery.of(context).padding.bottom + 20),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Center(child: Text(data['msg']));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return const Center(child: Text('加载中...'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user