Merge branch 'main' into opt-dataInt
This commit is contained in:
3
.github/workflows/beta_ci.yml
vendored
3
.github/workflows/beta_ci.yml
vendored
@ -12,7 +12,6 @@ on:
|
||||
- ".idea/**"
|
||||
- "!.github/workflows/**"
|
||||
|
||||
|
||||
jobs:
|
||||
update_version:
|
||||
name: Read and update version
|
||||
@ -96,7 +95,7 @@ jobs:
|
||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.16.5
|
||||
flutter-version: 3.19.6
|
||||
channel: any
|
||||
|
||||
- name: 下载项目依赖
|
||||
|
4
.github/workflows/release_ci.yml
vendored
4
.github/workflows/release_ci.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.16.5
|
||||
flutter-version: 3.19.6
|
||||
channel: any
|
||||
|
||||
- name: 下载项目依赖
|
||||
@ -98,7 +98,7 @@ jobs:
|
||||
uses: subosito/flutter-action@v2.10.0
|
||||
with:
|
||||
cache: true
|
||||
flutter-version: 3.16.5
|
||||
flutter-version: 3.19.6
|
||||
|
||||
- name: flutter build ipa
|
||||
run: |
|
||||
|
@ -12,7 +12,6 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="https" />
|
||||
</intent>
|
||||
|
||||
</queries>
|
||||
<queries>
|
||||
<intent>
|
||||
@ -20,7 +19,6 @@
|
||||
"android.support.customtabs.action.CustomTabsService" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<queries>
|
||||
<!-- If your app checks for http support -->
|
||||
<intent>
|
||||
@ -34,7 +32,6 @@
|
||||
<data android:scheme="https" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:label="PiliPala"
|
||||
android:name="${applicationName}"
|
||||
@ -47,13 +44,14 @@
|
||||
<activity
|
||||
android:name="com.guozhigq.pilipala.MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:supportsPictureInPicture="true"
|
||||
android:resizeableActivity="true"
|
||||
android:autoVerify="true"
|
||||
>
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
@ -63,10 +61,21 @@
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<!-- Deep Link -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="pili"/>
|
||||
<data android:scheme="pilipala"/>
|
||||
</intent-filter>
|
||||
<!-- App Link -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
@ -132,102 +141,55 @@
|
||||
<data android:scheme="bilibili" android:host="assistant" />
|
||||
<data android:scheme="bilibili" android:host="feedback" />
|
||||
<data android:scheme="bilibili" android:host="auth" android:path="/launch" />
|
||||
|
||||
<data android:scheme="http" android:host="live.bilibili.com"
|
||||
android:pathPattern="/live/.*" />
|
||||
<data android:scheme="https" android:host="live.bilibili.com"
|
||||
android:pathPattern="/live/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.tv"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.tv"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.cn"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.cn"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/mobile/video/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/mobile/video/.*" />
|
||||
<data android:scheme="http" android:host="m.bilibili.com"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="https" android:host="m.bilibili.com"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/story/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/story/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/bangumi/i/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/bangumi/i/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/mobile/bangumi/i/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/mobile/bangumi/i/.*" />
|
||||
<data android:scheme="http" android:host="bangumi.bilibili.com"
|
||||
android:pathPattern="/.*" />
|
||||
<data android:scheme="https" android:host="bangumi.bilibili.com"
|
||||
android:pathPattern="/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/bangumi/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/bangumi/.*" />
|
||||
<data android:scheme="http" android:host="m.bilibili.com"
|
||||
android:pathPattern="/bangumi/.*" />
|
||||
<data android:scheme="https" android:host="m.bilibili.com"
|
||||
android:pathPattern="/bangumi/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/cheese/play/ss.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/cheese/play/ss.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/cheese/play/ep.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/cheese/play/ep.*" />
|
||||
<data android:scheme="http" android:host="m.bilibili.com"
|
||||
android:pathPattern="/bangumi/play/ss.*" />
|
||||
<data android:scheme="https" android:host="m.bilibili.com"
|
||||
android:pathPattern="/cheese/play/ss.*" />
|
||||
<data android:scheme="http" android:host="m.bilibili.com"
|
||||
android:pathPattern="/cheese/play/ep.*" />
|
||||
<data android:scheme="https" android:host="m.bilibili.com"
|
||||
android:pathPattern="/cheese/play/ep.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/read/cv.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/read/cv.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com" android:path="/review/" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com" android:path="/review/" />
|
||||
<data android:scheme="http" android:host="bilibili.cn"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="https" android:host="bilibili.cn"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="http" android:host="bilibili.com"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="https" android:host="bilibili.com"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.cn"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.cn"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/video/.*" />
|
||||
<data android:scheme="http" android:host="www.bilibili.com"
|
||||
android:pathPattern="/mobile/video/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
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>
|
||||
</activity>
|
||||
<service
|
||||
@ -239,7 +201,6 @@
|
||||
<action android:name="android.media.browse.MediaBrowserService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<receiver
|
||||
android:name="com.ryanheise.audioservice.MediaButtonReceiver"
|
||||
android:exported="true"
|
||||
@ -247,7 +208,7 @@
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</receiver>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
@ -269,4 +230,4 @@
|
||||
-->
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
</manifest>
|
||||
</manifest>
|
BIN
assets/images/pay/alipay.jpg
Normal file
BIN
assets/images/pay/alipay.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 143 KiB |
BIN
assets/images/pay/wechat.png
Normal file
BIN
assets/images/pay/wechat.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 KiB |
39
change_log/1.0.25.1010.md
Normal file
39
change_log/1.0.25.1010.md
Normal file
@ -0,0 +1,39 @@
|
||||
## 1.0.25
|
||||
|
||||
### 功能
|
||||
+ 直播弹幕
|
||||
+ 稍后再看、收藏夹播放全部
|
||||
+ 收藏夹新建、编辑
|
||||
+ 评论删除
|
||||
+ 评论保存为图片
|
||||
+ 动态页滑动切换up
|
||||
+ up投稿筛选充电视频
|
||||
+ 直播tab展示关注up
|
||||
+ up主页专栏展示
|
||||
|
||||
### 优化
|
||||
+ 视频详情页一键三连
|
||||
+ 动态页标识充电视频
|
||||
+ 播放器亮度、音量调整百分比展示
|
||||
+ 封面预览时视频标题可复制
|
||||
+ 竖屏直播布局
|
||||
+ 图片预览
|
||||
+ 专栏渲染优化
|
||||
+ 私信图片查看
|
||||
|
||||
### 修复
|
||||
+ 收藏夹点击异常
|
||||
+ 搜索up异常
|
||||
+ 系统通知已读异常
|
||||
+ [赞了我的]展示错误
|
||||
+ 部分up合集无法打开
|
||||
+ 切换合集视频投币个数未重置
|
||||
+ 搜索条件筛选面板无法滚动
|
||||
+ 部分机型导航条未沉浸
|
||||
+ 专栏图片渲染问题
|
||||
+ 专栏浏览历史记录
|
||||
+ 直播间历史记录
|
||||
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
@ -1,5 +1,5 @@
|
||||
PODS:
|
||||
- appscheme (1.0.4):
|
||||
- app_links (0.0.2):
|
||||
- Flutter
|
||||
- audio_service (0.0.1):
|
||||
- Flutter
|
||||
@ -27,6 +27,8 @@ PODS:
|
||||
- Flutter
|
||||
- GT3Captcha-iOS
|
||||
- GT3Captcha-iOS (0.15.8.3)
|
||||
- image_picker_ios (0.0.1):
|
||||
- Flutter
|
||||
- media_kit_libs_ios_video (1.0.4):
|
||||
- Flutter
|
||||
- media_kit_native_event_loop (1.0.0):
|
||||
@ -66,7 +68,7 @@ PODS:
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- appscheme (from `.symlinks/plugins/appscheme/ios`)
|
||||
- app_links (from `.symlinks/plugins/app_links/ios`)
|
||||
- audio_service (from `.symlinks/plugins/audio_service/ios`)
|
||||
- audio_session (from `.symlinks/plugins/audio_session/ios`)
|
||||
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
|
||||
@ -77,6 +79,7 @@ DEPENDENCIES:
|
||||
- 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`)
|
||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/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_video (from `.symlinks/plugins/media_kit_video/ios`)
|
||||
@ -102,8 +105,8 @@ SPEC REPOS:
|
||||
- Toast
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
appscheme:
|
||||
:path: ".symlinks/plugins/appscheme/ios"
|
||||
app_links:
|
||||
:path: ".symlinks/plugins/app_links/ios"
|
||||
audio_service:
|
||||
:path: ".symlinks/plugins/audio_service/ios"
|
||||
audio_session:
|
||||
@ -124,6 +127,8 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||
gt3_flutter_plugin:
|
||||
:path: ".symlinks/plugins/gt3_flutter_plugin/ios"
|
||||
image_picker_ios:
|
||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||
media_kit_libs_ios_video:
|
||||
:path: ".symlinks/plugins/media_kit_libs_ios_video/ios"
|
||||
media_kit_native_event_loop:
|
||||
@ -160,7 +165,7 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
appscheme: b1c3f8862331cb20430cf9e0e4af85dbc1572ad8
|
||||
app_links: e7a6750a915a9e161c58d91bc610e8cd1d4d0ad0
|
||||
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
||||
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
||||
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||
@ -173,6 +178,7 @@ SPEC CHECKSUMS:
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
gt3_flutter_plugin: 5bd2c08d3c19cbb6ee3b08f4358439e54c8ab2ee
|
||||
GT3Captcha-iOS: 5e3b1077834d8a9d6f4d64a447a30af3e14affe6
|
||||
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
|
||||
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
|
||||
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
|
||||
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
||||
|
@ -1,5 +1,6 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
import AVFoundation
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
@ -8,6 +9,14 @@ import Flutter
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
|
||||
// 设置音频会话类别,确保在静音模式下播放音频
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().setCategory(.playback, options: [.duckOthers])
|
||||
} catch {
|
||||
print("Failed to set audio session category: \(error)")
|
||||
}
|
||||
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
}
|
||||
}
|
@ -65,44 +65,29 @@
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string></string>
|
||||
<string>bilibili</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>http</string>
|
||||
<string>https</string>
|
||||
</array>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string></string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>m.bilibili.com</string>
|
||||
<string>bilibili.com</string>
|
||||
<string>www.bilibili.com</string>
|
||||
<string>bangumi.bilibili.com</string>
|
||||
<string>bilibili.cn</string>
|
||||
<string>www.bilibili.cn</string>
|
||||
<string>bangumi.bilibili.cn</string>
|
||||
<string>bilibili.tv</string>
|
||||
<string>www.bilibili.tv</string>
|
||||
<string>bangumi.bilibili.tv</string>
|
||||
<string>miniapp.bilibili.com</string>
|
||||
<string>live.bilibili.com</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
|
||||
<!-- 当其他应用程序或系统通过 bilibili -->
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>bilibili</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>bilibili</string>
|
||||
<string>m.bilibili.com</string>
|
||||
<string>bilibili.com</string>
|
||||
<string>www.bilibili.com</string>
|
||||
<string>bangumi.bilibili.com</string>
|
||||
<string>bilibili.cn</string>
|
||||
<string>www.bilibili.cn</string>
|
||||
<string>bangumi.bilibili.cn</string>
|
||||
<string>bilibili.tv</string>
|
||||
<string>www.bilibili.tv</string>
|
||||
<string>bangumi.bilibili.tv</string>
|
||||
<string>miniapp.bilibili.com</string>
|
||||
<string>live.bilibili.com</string>
|
||||
<string>pili</string>
|
||||
<string>pilipala</string>
|
||||
</array>
|
||||
<key>FlutterDeepLinkingEnabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>UIBackgroundModes</key>
|
||||
|
@ -15,6 +15,4 @@ class Constants {
|
||||
// 59b43e04ad6965f34319062b478f83dd TV端
|
||||
static const String appSec = '59b43e04ad6965f34319062b478f83dd';
|
||||
static const String thirdSign = '04224646d1fea004e79606d3b038c84a';
|
||||
static const String thirdApi =
|
||||
'https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png';
|
||||
}
|
||||
|
@ -1,35 +1,462 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
import 'package:pilipala/http/video.dart';
|
||||
import 'package:pilipala/models/video_detail_res.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import 'package:scrollview_observer/scrollview_observer.dart';
|
||||
import '../models/common/video_episode_type.dart';
|
||||
import 'widgets/badge.dart';
|
||||
import 'widgets/stat/danmu.dart';
|
||||
import 'widgets/stat/view.dart';
|
||||
|
||||
class EpisodeBottomSheet {
|
||||
final List<dynamic> episodes;
|
||||
final int currentCid;
|
||||
final dynamic dataType;
|
||||
final BuildContext context;
|
||||
final Function changeFucCall;
|
||||
final int? cid;
|
||||
final double? sheetHeight;
|
||||
bool isFullScreen = false;
|
||||
final UgcSeason? ugcSeason;
|
||||
final int? currentEpisodeIndex;
|
||||
final int? currentIndex;
|
||||
|
||||
EpisodeBottomSheet({
|
||||
required this.episodes,
|
||||
required this.currentCid,
|
||||
required this.dataType,
|
||||
required this.context,
|
||||
required this.changeFucCall,
|
||||
this.cid,
|
||||
this.sheetHeight,
|
||||
this.isFullScreen = false,
|
||||
this.ugcSeason,
|
||||
this.currentEpisodeIndex,
|
||||
this.currentIndex,
|
||||
});
|
||||
|
||||
Widget buildEpisodeListItem(
|
||||
dynamic episode,
|
||||
int index,
|
||||
bool isCurrentIndex,
|
||||
) {
|
||||
Widget buildShowContent() {
|
||||
return PagesBottomSheet(
|
||||
episodes: episodes,
|
||||
currentCid: currentCid,
|
||||
dataType: dataType,
|
||||
changeFucCall: changeFucCall,
|
||||
cid: cid,
|
||||
sheetHeight: sheetHeight,
|
||||
isFullScreen: isFullScreen,
|
||||
ugcSeason: ugcSeason,
|
||||
currentEpisodeIndex: currentEpisodeIndex,
|
||||
currentIndex: currentIndex,
|
||||
);
|
||||
}
|
||||
|
||||
PersistentBottomSheetController show(BuildContext context) {
|
||||
final PersistentBottomSheetController btmSheetCtr = showBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return buildShowContent();
|
||||
},
|
||||
);
|
||||
return btmSheetCtr;
|
||||
}
|
||||
}
|
||||
|
||||
class PagesBottomSheet extends StatefulWidget {
|
||||
const PagesBottomSheet({
|
||||
super.key,
|
||||
required this.episodes,
|
||||
required this.currentCid,
|
||||
required this.dataType,
|
||||
required this.changeFucCall,
|
||||
this.cid,
|
||||
this.sheetHeight,
|
||||
this.isFullScreen = false,
|
||||
this.ugcSeason,
|
||||
this.currentEpisodeIndex,
|
||||
this.currentIndex,
|
||||
});
|
||||
|
||||
final List<dynamic> episodes;
|
||||
final int currentCid;
|
||||
final dynamic dataType;
|
||||
final Function changeFucCall;
|
||||
final int? cid;
|
||||
final double? sheetHeight;
|
||||
final bool isFullScreen;
|
||||
final UgcSeason? ugcSeason;
|
||||
final int? currentEpisodeIndex;
|
||||
final int? currentIndex;
|
||||
|
||||
@override
|
||||
State<PagesBottomSheet> createState() => _PagesBottomSheetState();
|
||||
}
|
||||
|
||||
class _PagesBottomSheetState extends State<PagesBottomSheet>
|
||||
with TickerProviderStateMixin {
|
||||
final ScrollController _listScrollController = ScrollController();
|
||||
late ListObserverController _listObserverController;
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
late int currentIndex;
|
||||
TabController? tabController;
|
||||
List<ListObserverController>? _listObserverControllerList;
|
||||
List<ScrollController>? _listScrollControllerList;
|
||||
final String heroTag = Get.arguments['heroTag'];
|
||||
VideoDetailController? _videoDetailController;
|
||||
RxInt isSubscribe = (-1).obs;
|
||||
bool isVisible = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
currentIndex = widget.currentIndex ??
|
||||
widget.episodes.indexWhere((dynamic e) => e.cid == widget.currentCid);
|
||||
_scrollToInit();
|
||||
_scrollPositionInit();
|
||||
if (widget.dataType == VideoEpidoesType.videoEpisode) {
|
||||
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
||||
_getSubscribeStatus();
|
||||
}
|
||||
}
|
||||
|
||||
String prefix() {
|
||||
switch (widget.dataType) {
|
||||
case VideoEpidoesType.videoEpisode:
|
||||
return '选集';
|
||||
case VideoEpidoesType.videoPart:
|
||||
return '分集';
|
||||
case VideoEpidoesType.bangumiEpisode:
|
||||
return '选集';
|
||||
}
|
||||
return '选集';
|
||||
}
|
||||
|
||||
// 滚动器初始化
|
||||
void _scrollToInit() {
|
||||
/// 单个
|
||||
_listObserverController =
|
||||
ListObserverController(controller: _listScrollController);
|
||||
|
||||
if (widget.dataType == VideoEpidoesType.videoEpisode &&
|
||||
widget.ugcSeason?.sections != null &&
|
||||
widget.ugcSeason!.sections!.length > 1) {
|
||||
tabController = TabController(
|
||||
length: widget.ugcSeason!.sections!.length,
|
||||
vsync: this,
|
||||
initialIndex: widget.currentEpisodeIndex ?? 0,
|
||||
);
|
||||
|
||||
/// 多tab
|
||||
_listScrollControllerList = List.generate(
|
||||
widget.ugcSeason!.sections!.length,
|
||||
(index) {
|
||||
return ScrollController();
|
||||
},
|
||||
);
|
||||
_listObserverControllerList = List.generate(
|
||||
widget.ugcSeason!.sections!.length,
|
||||
(index) {
|
||||
return ListObserverController(
|
||||
controller: _listScrollControllerList![index],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 滚动器位置初始化
|
||||
void _scrollPositionInit() {
|
||||
if (widget.dataType == VideoEpidoesType.videoEpisode) {
|
||||
// 单个 多tab
|
||||
if (widget.ugcSeason?.sections != null) {
|
||||
if (widget.ugcSeason!.sections!.length == 1) {
|
||||
_listObserverController.initialIndexModel =
|
||||
ObserverIndexPositionModel(
|
||||
index: currentIndex,
|
||||
isFixedHeight: true,
|
||||
);
|
||||
} else {
|
||||
_listObserverControllerList![widget.currentEpisodeIndex!]
|
||||
.initialIndexModel = ObserverIndexPositionModel(
|
||||
index: currentIndex,
|
||||
isFixedHeight: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (widget.dataType != VideoEpidoesType.videoEpisode) {
|
||||
double itemHeight = (widget.isFullScreen
|
||||
? 400
|
||||
: Get.size.width - 3 * StyleString.safeSpace) /
|
||||
5.2;
|
||||
double offset = ((currentIndex - 1) / 2).ceil() * itemHeight;
|
||||
_scrollController.jumpTo(offset);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 获取订阅状态
|
||||
void _getSubscribeStatus() async {
|
||||
var res =
|
||||
await VideoHttp.getSubscribeStatus(bvid: _videoDetailController!.bvid);
|
||||
if (res['status']) {
|
||||
isSubscribe.value = res['data']['season_fav'] ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 更改订阅状态
|
||||
void _changeSubscribeStatus() async {
|
||||
if (isSubscribe.value == -1) {
|
||||
return;
|
||||
}
|
||||
dynamic result = await VideoHttp.seasonFav(
|
||||
isFav: isSubscribe.value == 1,
|
||||
seasonId: widget.ugcSeason!.id,
|
||||
);
|
||||
if (result['status']) {
|
||||
SmartDialog.showToast(isSubscribe.value == 1 ? '取消订阅成功' : '订阅成功');
|
||||
isSubscribe.value = isSubscribe.value == 1 ? 0 : 1;
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
// 更改展开状态
|
||||
void _changeVisible() {
|
||||
setState(() {
|
||||
isVisible = !isVisible;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
try {
|
||||
_listObserverController.controller?.dispose();
|
||||
_listScrollController.dispose();
|
||||
for (var element in _listObserverControllerList!) {
|
||||
element.controller?.dispose();
|
||||
}
|
||||
for (var element in _listScrollControllerList!) {
|
||||
element.dispose();
|
||||
}
|
||||
} catch (_) {}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
return SizedBox(
|
||||
height: widget.sheetHeight,
|
||||
child: Column(
|
||||
children: [
|
||||
TitleBar(
|
||||
title: '${prefix()}(${widget.episodes.length})',
|
||||
isFullScreen: widget.isFullScreen,
|
||||
),
|
||||
if (widget.ugcSeason != null) ...[
|
||||
UgcSeasonBuild(
|
||||
ugcSeason: widget.ugcSeason!,
|
||||
isSubscribe: isSubscribe,
|
||||
isVisible: isVisible,
|
||||
changeFucCall: _changeSubscribeStatus,
|
||||
changeVisible: _changeVisible,
|
||||
),
|
||||
],
|
||||
Expanded(
|
||||
child: Material(
|
||||
child: widget.dataType == VideoEpidoesType.videoEpisode
|
||||
? (widget.ugcSeason!.sections!.length == 1
|
||||
? ListViewObserver(
|
||||
controller: _listObserverController,
|
||||
child: ListView.builder(
|
||||
controller: _listScrollController,
|
||||
itemCount: widget.episodes.length + 1,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
bool isLastItem =
|
||||
index == widget.episodes.length;
|
||||
bool isCurrentIndex = currentIndex == index;
|
||||
return isLastItem
|
||||
? SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.padding
|
||||
.bottom +
|
||||
20,
|
||||
)
|
||||
: EpisodeListItem(
|
||||
episode: widget.episodes[index],
|
||||
index: index,
|
||||
isCurrentIndex: isCurrentIndex,
|
||||
dataType: widget.dataType,
|
||||
changeFucCall: widget.changeFucCall,
|
||||
isFullScreen: widget.isFullScreen,
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: buildTabBar())
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0), // 设置左右间距为12
|
||||
child: GridView.count(
|
||||
controller: _scrollController,
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
childAspectRatio: 2.6,
|
||||
children: List.generate(
|
||||
widget.episodes.length,
|
||||
(index) {
|
||||
bool isCurrentIndex = currentIndex == index;
|
||||
return EpisodeGridItem(
|
||||
episode: widget.episodes[index],
|
||||
index: index,
|
||||
isCurrentIndex: isCurrentIndex,
|
||||
dataType: widget.dataType,
|
||||
changeFucCall: widget.changeFucCall,
|
||||
isFullScreen: widget.isFullScreen,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget buildTabBar() {
|
||||
return Column(
|
||||
children: [
|
||||
// 背景色
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: TabBar(
|
||||
controller: tabController,
|
||||
isScrollable: true,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
tabAlignment: TabAlignment.start,
|
||||
splashBorderRadius: BorderRadius.circular(4),
|
||||
tabs: [
|
||||
...widget.ugcSeason!.sections!.map((SectionItem section) {
|
||||
return Tab(
|
||||
text: section.title,
|
||||
);
|
||||
}).toList()
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: tabController,
|
||||
children: [
|
||||
...widget.ugcSeason!.sections!.map((SectionItem section) {
|
||||
final int fIndex = widget.ugcSeason!.sections!.indexOf(section);
|
||||
return ListViewObserver(
|
||||
controller: _listObserverControllerList![fIndex],
|
||||
child: ListView.builder(
|
||||
controller: _listScrollControllerList![fIndex],
|
||||
itemCount: section.episodes!.length + 1,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final bool isLastItem = index == section.episodes!.length;
|
||||
return isLastItem
|
||||
? SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).padding.bottom + 20,
|
||||
)
|
||||
: EpisodeListItem(
|
||||
episode: section.episodes![index], // 调整索引
|
||||
index: index, // 调整索引
|
||||
isCurrentIndex: widget.currentCid ==
|
||||
section.episodes![index].cid,
|
||||
dataType: widget.dataType,
|
||||
changeFucCall: widget.changeFucCall,
|
||||
isFullScreen: widget.isFullScreen,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList()
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TitleBar extends StatelessWidget {
|
||||
final String title;
|
||||
final bool isFullScreen;
|
||||
|
||||
const TitleBar({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.isFullScreen,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
toolbarHeight: 45,
|
||||
automaticallyImplyLeading: false,
|
||||
centerTitle: false,
|
||||
elevation: 1,
|
||||
scrolledUnderElevation: 1,
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
actions: !isFullScreen
|
||||
? [
|
||||
SizedBox(
|
||||
width: 35,
|
||||
height: 35,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
]
|
||||
: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class EpisodeListItem extends StatelessWidget {
|
||||
final dynamic episode;
|
||||
final int index;
|
||||
final bool isCurrentIndex;
|
||||
final dynamic dataType;
|
||||
final Function changeFucCall;
|
||||
final bool isFullScreen;
|
||||
|
||||
const EpisodeListItem({
|
||||
Key? key,
|
||||
required this.episode,
|
||||
required this.index,
|
||||
required this.isCurrentIndex,
|
||||
required this.dataType,
|
||||
required this.changeFucCall,
|
||||
required this.isFullScreen,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color primary = Theme.of(context).colorScheme.primary;
|
||||
Color onSurface = Theme.of(context).colorScheme.onSurface;
|
||||
|
||||
@ -45,128 +472,365 @@ class EpisodeBottomSheet {
|
||||
title = '第${episode.title}话 ${episode.longTitle!}';
|
||||
break;
|
||||
}
|
||||
|
||||
return isFullScreen || episode?.cover == null || episode?.cover == ''
|
||||
? ListTile(
|
||||
onTap: () {
|
||||
SmartDialog.showToast('切换至「$title」');
|
||||
changeFucCall.call(episode, index);
|
||||
},
|
||||
dense: false,
|
||||
leading: isCurrentIndex
|
||||
? Image.asset(
|
||||
'assets/images/live.gif',
|
||||
color: primary,
|
||||
height: 12,
|
||||
? _buildListTile(context, title, primary, onSurface)
|
||||
: _buildInkWell(context, title, primary, onSurface);
|
||||
}
|
||||
|
||||
Widget _buildListTile(
|
||||
BuildContext context, String title, Color primary, Color onSurface) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
if (isCurrentIndex) {
|
||||
return;
|
||||
}
|
||||
SmartDialog.showToast('切换至「$title」');
|
||||
changeFucCall.call(episode, index);
|
||||
},
|
||||
dense: false,
|
||||
leading: isCurrentIndex
|
||||
? Image.asset(
|
||||
'assets/images/live.png',
|
||||
color: primary,
|
||||
height: 12,
|
||||
)
|
||||
: null,
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isCurrentIndex ? primary : onSurface,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInkWell(
|
||||
BuildContext context, String title, Color primary, Color onSurface) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (isCurrentIndex) {
|
||||
return;
|
||||
}
|
||||
SmartDialog.showToast('切换至「$title」');
|
||||
changeFucCall.call(episode, index);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
StyleString.safeSpace, 6, StyleString.safeSpace, 6),
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints boxConstraints) {
|
||||
const double width = 160;
|
||||
return Container(
|
||||
constraints: const BoxConstraints(minHeight: 88),
|
||||
height: width / StyleString.aspectRatio,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context,
|
||||
BoxConstraints boxConstraints) {
|
||||
final double maxWidth = boxConstraints.maxWidth;
|
||||
final double maxHeight = boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
src: episode?.cover ?? '',
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
),
|
||||
if (episode.duration != 0)
|
||||
PBadge(
|
||||
text: Utils.timeFormat(episode.duration!),
|
||||
right: 6.0,
|
||||
bottom: 6.0,
|
||||
type: 'gray',
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(10, 2, 6, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
episode.title as String,
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isCurrentIndex ? primary : onSurface,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
if (dataType != VideoEpidoesType.videoPart) ...[
|
||||
if (episode?.pubdate != null ||
|
||||
episode.pubTime != null)
|
||||
Text(
|
||||
Utils.dateFormat(
|
||||
episode?.pubdate ?? episode.pubTime),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color:
|
||||
Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
if (episode.stat != null)
|
||||
Row(
|
||||
children: [
|
||||
StatView(view: episode.stat.view),
|
||||
const SizedBox(width: 8),
|
||||
StatDanMu(danmu: episode.stat.danmaku),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
title: Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isCurrentIndex ? primary : onSurface,
|
||||
)))
|
||||
: InkWell(
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class EpisodeGridItem extends StatelessWidget {
|
||||
final dynamic episode;
|
||||
final int index;
|
||||
final bool isCurrentIndex;
|
||||
final dynamic dataType;
|
||||
final Function changeFucCall;
|
||||
final bool isFullScreen;
|
||||
|
||||
const EpisodeGridItem({
|
||||
Key? key,
|
||||
required this.episode,
|
||||
required this.index,
|
||||
required this.isCurrentIndex,
|
||||
required this.dataType,
|
||||
required this.changeFucCall,
|
||||
required this.isFullScreen,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
TextStyle textStyle = TextStyle(
|
||||
color: isCurrentIndex ? colorScheme.primary : colorScheme.onSurface,
|
||||
fontSize: 14,
|
||||
);
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
margin: const EdgeInsets.only(top: StyleString.safeSpace),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: isCurrentIndex
|
||||
? colorScheme.primaryContainer.withOpacity(0.6)
|
||||
: colorScheme.onInverseSurface.withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: isCurrentIndex
|
||||
? colorScheme.primary.withOpacity(0.8)
|
||||
: Colors.transparent,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
onTap: () {
|
||||
SmartDialog.showToast('切换至「$title」');
|
||||
if (isCurrentIndex) {
|
||||
return;
|
||||
}
|
||||
SmartDialog.showToast('切换至「${episode.title}」');
|
||||
changeFucCall.call(episode, index);
|
||||
},
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 14, right: 14, top: 8, bottom: 8),
|
||||
child: Row(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 130, height: 75, src: episode?.cover ?? ''),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isCurrentIndex ? primary : onSurface,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
dataType == VideoEpidoesType.bangumiEpisode
|
||||
? '第${index + 1}话'
|
||||
: '第${index + 1}p',
|
||||
style: textStyle),
|
||||
const SizedBox(height: 1),
|
||||
Text(
|
||||
episode.title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: textStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildTitle() {
|
||||
return AppBar(
|
||||
toolbarHeight: 45,
|
||||
automaticallyImplyLeading: false,
|
||||
centerTitle: false,
|
||||
title: Text(
|
||||
'合集(${episodes.length})',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
actions: !isFullScreen
|
||||
? [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
]
|
||||
: null,
|
||||
),
|
||||
),
|
||||
if (dataType == VideoEpidoesType.bangumiEpisode &&
|
||||
episode.badge != '' &&
|
||||
episode.badge != null)
|
||||
Positioned(
|
||||
right: 8,
|
||||
top: 18,
|
||||
child: Text(
|
||||
episode.badge,
|
||||
style: const TextStyle(fontSize: 11, color: Color(0xFFFF6699)),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget buildShowContent(BuildContext context) {
|
||||
final ItemScrollController itemScrollController = ItemScrollController();
|
||||
int currentIndex = episodes.indexWhere((dynamic e) => e.cid == currentCid);
|
||||
return StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
itemScrollController.jumpTo(index: currentIndex);
|
||||
});
|
||||
return Container(
|
||||
height: sheetHeight,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Column(
|
||||
children: [
|
||||
buildTitle(),
|
||||
Expanded(
|
||||
child: Material(
|
||||
child: PageStorage(
|
||||
bucket: PageStorageBucket(),
|
||||
child: ScrollablePositionedList.builder(
|
||||
itemScrollController: itemScrollController,
|
||||
itemCount: episodes.length + 1,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
bool isLastItem = index == episodes.length;
|
||||
bool isCurrentIndex = currentIndex == index;
|
||||
return isLastItem
|
||||
? SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).padding.bottom + 20,
|
||||
)
|
||||
: buildEpisodeListItem(
|
||||
episodes[index],
|
||||
index,
|
||||
isCurrentIndex,
|
||||
);
|
||||
},
|
||||
class UgcSeasonBuild extends StatelessWidget {
|
||||
final UgcSeason ugcSeason;
|
||||
final RxInt isSubscribe;
|
||||
final bool isVisible;
|
||||
final Function changeFucCall;
|
||||
final Function changeVisible;
|
||||
|
||||
const UgcSeasonBuild({
|
||||
Key? key,
|
||||
required this.ugcSeason,
|
||||
required this.isSubscribe,
|
||||
required this.isVisible,
|
||||
required this.changeFucCall,
|
||||
required this.changeVisible,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final Color outline = theme.colorScheme.outline;
|
||||
final Color surface = theme.colorScheme.surface;
|
||||
final Color primary = theme.colorScheme.primary;
|
||||
final Color onPrimary = theme.colorScheme.onPrimary;
|
||||
final Color onInverseSurface = theme.colorScheme.onInverseSurface;
|
||||
final TextStyle titleMedium = theme.textTheme.titleMedium!;
|
||||
final TextStyle labelMedium = theme.textTheme.labelMedium!;
|
||||
final Color dividerColor = theme.dividerColor.withOpacity(0.1);
|
||||
|
||||
return isVisible
|
||||
? Container(
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 0),
|
||||
color: surface,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Divider(height: 1, thickness: 1, color: dividerColor),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'合集:${ugcSeason.title}',
|
||||
style: titleMedium,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Obx(
|
||||
() => isSubscribe.value == -1
|
||||
? const SizedBox(height: 32)
|
||||
: SizedBox(
|
||||
height: 32,
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => changeFucCall.call(),
|
||||
style: TextButton.styleFrom(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 8, right: 8),
|
||||
foregroundColor: isSubscribe.value == 1
|
||||
? outline
|
||||
: onPrimary,
|
||||
backgroundColor: isSubscribe.value == 1
|
||||
? onInverseSurface
|
||||
: primary,
|
||||
),
|
||||
child:
|
||||
Text(isSubscribe.value == 1 ? '已订阅' : '订阅'),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (ugcSeason.intro != null && ugcSeason.intro != '') ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
ugcSeason.intro!,
|
||||
style: TextStyle(color: outline, fontSize: 12),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: labelMedium.fontSize, color: outline),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '${Utils.numFormat(ugcSeason.stat!.view)}播放'),
|
||||
const TextSpan(text: ' · '),
|
||||
TextSpan(
|
||||
text:
|
||||
'${Utils.numFormat(ugcSeason.stat!.danmaku)}弹幕'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Material(
|
||||
color: surface,
|
||||
child: InkWell(
|
||||
onTap: () => changeVisible.call(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10, horizontal: 0),
|
||||
child: Text(
|
||||
'收起简介',
|
||||
style: TextStyle(color: primary, fontSize: 12),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(height: 1, thickness: 1, color: dividerColor),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Align(
|
||||
alignment: Alignment.center,
|
||||
child: InkWell(
|
||||
onTap: () => changeVisible.call(),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 10, horizontal: 0),
|
||||
child: Text(
|
||||
'展开简介',
|
||||
style: TextStyle(color: primary, fontSize: 12),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// The [BuildContext] of the widget that calls the bottom sheet.
|
||||
PersistentBottomSheetController show(BuildContext context) {
|
||||
final PersistentBottomSheetController btmSheetCtr = showBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return buildShowContent(context);
|
||||
},
|
||||
);
|
||||
return btmSheetCtr;
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,9 @@ import 'package:pilipala/common/constants.dart';
|
||||
|
||||
import 'skeleton.dart';
|
||||
|
||||
class MediaBangumiSkeleton extends StatefulWidget {
|
||||
class MediaBangumiSkeleton extends StatelessWidget {
|
||||
const MediaBangumiSkeleton({super.key});
|
||||
|
||||
@override
|
||||
State<MediaBangumiSkeleton> createState() => _MediaBangumiSkeletonState();
|
||||
}
|
||||
|
||||
class _MediaBangumiSkeletonState extends State<MediaBangumiSkeleton> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color bgColor = Theme.of(context).colorScheme.onInverseSurface;
|
||||
@ -35,25 +30,25 @@ class _MediaBangumiSkeletonState extends State<MediaBangumiSkeleton> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
color: bgColor,
|
||||
width: 200,
|
||||
height: 20,
|
||||
margin: const EdgeInsets.only(bottom: 15),
|
||||
),
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
color: bgColor,
|
||||
width: 150,
|
||||
height: 13,
|
||||
margin: const EdgeInsets.only(bottom: 5),
|
||||
),
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
color: bgColor,
|
||||
width: 150,
|
||||
height: 13,
|
||||
margin: const EdgeInsets.only(bottom: 5),
|
||||
),
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
color: bgColor,
|
||||
width: 150,
|
||||
height: 13,
|
||||
),
|
||||
@ -64,7 +59,7 @@ class _MediaBangumiSkeletonState extends State<MediaBangumiSkeleton> {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(20)),
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
color: bgColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
42
lib/common/skeleton/user_list.dart
Normal file
42
lib/common/skeleton/user_list.dart
Normal file
@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../constants.dart';
|
||||
|
||||
class UserListSkeleton extends StatelessWidget {
|
||||
const UserListSkeleton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color bgColor = Theme.of(context).colorScheme.onInverseSurface;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: StyleString.safeSpace, vertical: 7),
|
||||
child: Row(
|
||||
children: [
|
||||
ClipOval(
|
||||
child: Container(width: 42, height: 42, color: bgColor),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(color: bgColor, width: 60, height: 13),
|
||||
const SizedBox(width: 10),
|
||||
Container(color: bgColor, width: 40, height: 13),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Container(
|
||||
color: bgColor,
|
||||
width: 100,
|
||||
height: 13,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
Box<dynamic> setting = GStrorage.setting;
|
||||
Box<dynamic> setting = GStorage.setting;
|
||||
|
||||
class CustomToast extends StatelessWidget {
|
||||
const CustomToast({super.key, required this.msg});
|
||||
|
@ -1,7 +1,9 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'network_img_layer.dart';
|
||||
import 'package:pilipala/plugin/pl_gallery/hero_dialog_route.dart';
|
||||
import 'package:pilipala/plugin/pl_gallery/interactiveviewer_gallery.dart';
|
||||
import 'package:pilipala/utils/highlight.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class HtmlRender extends StatelessWidget {
|
||||
@ -22,6 +24,20 @@ class HtmlRender extends StatelessWidget {
|
||||
data: htmlContent,
|
||||
onLinkTap: (String? url, Map<String, String> buildContext, attributes) {},
|
||||
extensions: [
|
||||
TagExtension(
|
||||
tagsToExtend: <String>{'pre'},
|
||||
builder: (ExtensionContext extensionContext) {
|
||||
final Map<String, dynamic> attributes = extensionContext.attributes;
|
||||
final String lang = attributes['data-lang'] as String;
|
||||
final String code = attributes['codecontent'] as String;
|
||||
List<String> selectedLanguages = [lang.split('@').first];
|
||||
TextSpan? result = highlightExistingText(code, selectedLanguages);
|
||||
if (result == null) {
|
||||
return const Center(child: Text('代码块渲染失败'));
|
||||
}
|
||||
return SelectableText.rich(result);
|
||||
},
|
||||
),
|
||||
TagExtension(
|
||||
tagsToExtend: <String>{'img'},
|
||||
builder: (ExtensionContext extensionContext) {
|
||||
@ -44,20 +60,52 @@ class HtmlRender extends StatelessWidget {
|
||||
if (isMall) {
|
||||
return const SizedBox();
|
||||
}
|
||||
// bool inTable =
|
||||
// extensionContext.element!.previousElementSibling == null ||
|
||||
// extensionContext.element!.nextElementSibling == null;
|
||||
// imgUrl = Utils().imageUrl(imgUrl!);
|
||||
// return Image.network(
|
||||
// imgUrl,
|
||||
// width: isEmote ? 22 : null,
|
||||
// height: isEmote ? 22 : null,
|
||||
// );
|
||||
return NetworkImgLayer(
|
||||
width: isEmote ? 22 : Get.size.width - 24,
|
||||
height: isEmote ? 22 : 200,
|
||||
src: imgUrl,
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
HeroDialogRoute<void>(
|
||||
builder: (BuildContext context) =>
|
||||
InteractiveviewerGallery(
|
||||
sources: imgList ?? [imgUrl],
|
||||
initIndex: imgList?.indexOf(imgUrl) ?? 0,
|
||||
itemBuilder: (
|
||||
BuildContext context,
|
||||
int index,
|
||||
bool isFocus,
|
||||
bool enablePageView,
|
||||
) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
if (enablePageView) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
child: Center(
|
||||
child: Hero(
|
||||
tag: imgList?[index] ?? imgUrl,
|
||||
child: CachedNetworkImage(
|
||||
fadeInDuration:
|
||||
const Duration(milliseconds: 0),
|
||||
imageUrl: imgList?[index] ?? imgUrl,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
onPageChanged: (int pageIndex) {},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: CachedNetworkImage(imageUrl: imgUrl),
|
||||
);
|
||||
// return NetworkImgLayer(
|
||||
// width: isEmote ? 22 : Get.size.width - 24,
|
||||
// height: isEmote ? 22 : 200,
|
||||
// src: imgUrl,
|
||||
// );
|
||||
} catch (err) {
|
||||
return const SizedBox();
|
||||
}
|
||||
@ -66,7 +114,7 @@ class HtmlRender extends StatelessWidget {
|
||||
],
|
||||
style: {
|
||||
'html': Style(
|
||||
fontSize: FontSize.medium,
|
||||
fontSize: FontSize.large,
|
||||
lineHeight: LineHeight.percent(140),
|
||||
),
|
||||
'body': Style(margin: Margins.zero, padding: HtmlPaddings.zero),
|
||||
@ -78,7 +126,7 @@ class HtmlRender extends StatelessWidget {
|
||||
margin: Margins.only(bottom: 10),
|
||||
),
|
||||
'span': Style(
|
||||
fontSize: FontSize.medium,
|
||||
fontSize: FontSize.large,
|
||||
height: Height(1.65),
|
||||
),
|
||||
'div': Style(height: Height.auto()),
|
||||
|
@ -4,9 +4,10 @@ import 'package:flutter_svg/flutter_svg.dart';
|
||||
class HttpError extends StatelessWidget {
|
||||
const HttpError({
|
||||
required this.errMsg,
|
||||
required this.fn,
|
||||
this.fn,
|
||||
this.btnText,
|
||||
this.isShowBtn = true,
|
||||
this.isInSliver = true,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@ -14,46 +15,41 @@ class HttpError extends StatelessWidget {
|
||||
final Function()? fn;
|
||||
final String? btnText;
|
||||
final bool isShowBtn;
|
||||
final bool isInSliver;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
"assets/images/error.svg",
|
||||
height: 200,
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
errMsg ?? '请求异常',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
if (isShowBtn)
|
||||
FilledButton.tonal(
|
||||
onPressed: () {
|
||||
fn!();
|
||||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
return Theme.of(context).colorScheme.primary.withAlpha(20);
|
||||
}),
|
||||
),
|
||||
child: Text(
|
||||
btnText ?? '点击重试',
|
||||
style:
|
||||
TextStyle(color: Theme.of(context).colorScheme.primary),
|
||||
),
|
||||
Color primary = Theme.of(context).colorScheme.primary;
|
||||
final errorContent = SizedBox(
|
||||
height: 400,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset("assets/images/error.svg", height: 200),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
errMsg ?? '请求异常',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
if (isShowBtn)
|
||||
FilledButton.tonal(
|
||||
onPressed: () => fn?.call(),
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
return primary.withAlpha(20);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text(btnText ?? '点击重试', style: TextStyle(color: primary)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (isInSliver) {
|
||||
return SliverToBoxAdapter(child: errorContent);
|
||||
} else {
|
||||
return Align(alignment: Alignment.topCenter, child: errorContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import '../../utils/storage.dart';
|
||||
import '../constants.dart';
|
||||
|
||||
Box<dynamic> setting = GStrorage.setting;
|
||||
Box<dynamic> setting = GStorage.setting;
|
||||
|
||||
class NetworkImgLayer extends StatelessWidget {
|
||||
const NetworkImgLayer({
|
||||
@ -20,6 +20,7 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
// 图片质量 默认1%
|
||||
this.quality,
|
||||
this.origAspectRatio,
|
||||
this.radius,
|
||||
});
|
||||
|
||||
final String? src;
|
||||
@ -30,10 +31,26 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
final Duration? fadeInDuration;
|
||||
final int? quality;
|
||||
final double? origAspectRatio;
|
||||
final double? radius;
|
||||
|
||||
BorderRadius getBorderRadius(String? type, double? radius) {
|
||||
return BorderRadius.circular(
|
||||
radius ??
|
||||
(type == 'avatar'
|
||||
? 50
|
||||
: type == 'emote'
|
||||
? 0
|
||||
: StyleString.imgRadius.x),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final int defaultImgQuality = GlobalDataCache().imgQuality;
|
||||
int defaultImgQuality = 10;
|
||||
try {
|
||||
defaultImgQuality = GlobalDataCache().imgQuality;
|
||||
} catch (_) {}
|
||||
|
||||
if (src == '' || src == null) {
|
||||
return placeholder(context);
|
||||
}
|
||||
@ -68,13 +85,7 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
return src != '' && src != null
|
||||
? ClipRRect(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
borderRadius: BorderRadius.circular(
|
||||
type == 'avatar'
|
||||
? 50
|
||||
: type == 'emote'
|
||||
? 0
|
||||
: StyleString.imgRadius.x,
|
||||
),
|
||||
borderRadius: getBorderRadius(type, radius),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
width: width,
|
||||
@ -103,11 +114,7 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.4),
|
||||
borderRadius: BorderRadius.circular(type == 'avatar'
|
||||
? 50
|
||||
: type == 'emote'
|
||||
? 0
|
||||
: StyleString.imgRadius.x),
|
||||
borderRadius: getBorderRadius(type, radius),
|
||||
),
|
||||
child: type == 'bg'
|
||||
? const SizedBox()
|
||||
|
@ -6,7 +6,7 @@ class StatDanMu extends StatelessWidget {
|
||||
final dynamic danmu;
|
||||
final String? size;
|
||||
|
||||
const StatDanMu({Key? key, this.theme, this.danmu, this.size})
|
||||
const StatDanMu({Key? key, this.theme = 'gray', this.danmu, this.size})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@ -17,21 +17,46 @@ class StatDanMu extends StatelessWidget {
|
||||
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
||||
};
|
||||
Color color = colorObject[theme]!;
|
||||
return StatIconText(
|
||||
icon: Icons.subtitles_outlined,
|
||||
text: Utils.numFormat(danmu!),
|
||||
color: color,
|
||||
size: size,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StatIconText extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final Color color;
|
||||
final String? size;
|
||||
|
||||
const StatIconText({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.text,
|
||||
required this.color,
|
||||
this.size,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.subtitles_outlined,
|
||||
icon,
|
||||
size: 14,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
Utils.numFormat(danmu!),
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: size == 'medium' ? 12 : 11,
|
||||
color: color,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -6,8 +6,12 @@ class StatView extends StatelessWidget {
|
||||
final dynamic view;
|
||||
final String? size;
|
||||
|
||||
const StatView({Key? key, this.theme, this.view, this.size})
|
||||
: super(key: key);
|
||||
const StatView({
|
||||
Key? key,
|
||||
this.theme = 'gray',
|
||||
this.view,
|
||||
this.size,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -17,16 +21,41 @@ class StatView extends StatelessWidget {
|
||||
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
||||
};
|
||||
Color color = colorObject[theme]!;
|
||||
return StatIconText(
|
||||
icon: Icons.play_circle_outlined,
|
||||
text: Utils.numFormat(view!),
|
||||
color: color,
|
||||
size: size,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StatIconText extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final Color color;
|
||||
final String? size;
|
||||
|
||||
const StatIconText({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.text,
|
||||
required this.color,
|
||||
this.size,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.play_circle_outlined,
|
||||
icon,
|
||||
size: 13,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
Utils.numFormat(view!),
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: size == 'medium' ? 12 : 11,
|
||||
color: color,
|
||||
|
@ -266,17 +266,11 @@ class VideoContent extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
if (showView) ...[
|
||||
StatView(
|
||||
theme: 'gray',
|
||||
view: videoItem.stat.view as int,
|
||||
),
|
||||
StatView(view: videoItem.stat.view as int),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
if (showDanmaku)
|
||||
StatDanMu(
|
||||
theme: 'gray',
|
||||
danmu: videoItem.stat.danmaku as int,
|
||||
),
|
||||
StatDanMu(danmu: videoItem.stat.danmaku as int),
|
||||
const Spacer(),
|
||||
if (source == 'normal')
|
||||
SizedBox(
|
||||
|
@ -60,17 +60,13 @@ class VideoCardV extends StatelessWidget {
|
||||
// 动态
|
||||
case 'picture':
|
||||
try {
|
||||
String dynamicType = 'picture';
|
||||
String uri = videoItem.uri;
|
||||
String id = '';
|
||||
if (videoItem.uri.startsWith('bilibili://article/')) {
|
||||
// https://www.bilibili.com/read/cv27063554
|
||||
dynamicType = 'read';
|
||||
RegExp regex = RegExp(r'\d+');
|
||||
Match match = regex.firstMatch(videoItem.uri)!;
|
||||
String matchedNumber = match.group(0)!;
|
||||
videoItem.param = int.parse(matchedNumber);
|
||||
id = 'cv${videoItem.param}';
|
||||
}
|
||||
if (uri.startsWith('http')) {
|
||||
String path = Uri.parse(uri).path;
|
||||
@ -88,11 +84,10 @@ class VideoCardV extends StatelessWidget {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
'url': uri,
|
||||
Get.toNamed('/read', parameters: {
|
||||
'title': videoItem.title,
|
||||
'id': id,
|
||||
'dynamicType': dynamicType
|
||||
'id': videoItem.param,
|
||||
'articleType': 'read'
|
||||
});
|
||||
} catch (err) {
|
||||
SmartDialog.showToast(err.toString());
|
||||
@ -287,9 +282,10 @@ class VideoStat extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
StatView(theme: 'gray', view: videoItem.stat.view),
|
||||
if (videoItem.stat.view != null) StatView(view: videoItem.stat.view),
|
||||
const SizedBox(width: 8),
|
||||
StatDanMu(theme: 'gray', danmu: videoItem.stat.danmu),
|
||||
if (videoItem.stat.danmu != null)
|
||||
StatDanMu(danmu: videoItem.stat.danmu),
|
||||
if (videoItem is RecVideoItemModel) ...<Widget>[
|
||||
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
|
||||
RichText(
|
||||
|
@ -104,7 +104,7 @@ class Api {
|
||||
|
||||
// 评论列表
|
||||
// https://api.bilibili.com/x/v2/reply/main?csrf=6e22efc1a47225ea25f901f922b5cfdd&mode=3&oid=254175381&pagination_str=%7B%22offset%22:%22%22%7D&plat=1&seek_rpid=0&type=11
|
||||
static const String replyList = '/x/v2/reply';
|
||||
static const String replyList = '/x/v2/reply/main';
|
||||
|
||||
// 楼中楼
|
||||
static const String replyReplyList = '/x/v2/reply/reply';
|
||||
@ -175,7 +175,7 @@ class Api {
|
||||
static const String delHistory = '/x/v2/history/delete';
|
||||
|
||||
// 搜索历史记录
|
||||
static const String searchHistory = '/x/web-goblin/history/search';
|
||||
static const String searchHistory = '/x/web-interface/history/search';
|
||||
|
||||
// 热搜
|
||||
static const String hotSearchList =
|
||||
@ -301,10 +301,6 @@ class Api {
|
||||
static const String bangumiList =
|
||||
'/pgc/season/index/result?st=1&order=3&season_version=-1&spoken_language_type=-1&area=-1&is_finish=-1©right=-1&season_status=-1&season_month=-1&year=-1&style_id=-1&sort=0&season_type=1&pagesize=20&type=1';
|
||||
|
||||
// 我的订阅
|
||||
static const String bangumiFollow =
|
||||
'/x/space/bangumi/follow/list?type=1&follow_status=0&pn=1&ps=15&ts=1691544359969';
|
||||
|
||||
// 黑名单
|
||||
static const String blackLst = '/x/relation/blacks';
|
||||
|
||||
@ -499,7 +495,7 @@ class Api {
|
||||
static const activateBuvidApi = '/x/internal/gaia-gateway/ExClimbWuzhi';
|
||||
|
||||
/// 获取字幕配置
|
||||
static const getSubtitleConfig = '/x/player/v2';
|
||||
static const getSubtitleConfig = '/x/player/wbi/v2';
|
||||
|
||||
/// 我的订阅
|
||||
static const userSubFolder = '/x/v3/fav/folder/collected/list';
|
||||
@ -555,14 +551,75 @@ class Api {
|
||||
static const String messageSystemAPi =
|
||||
'${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
|
||||
|
||||
/// 系统通知 个人
|
||||
static const String userMessageSystemAPi =
|
||||
'${HttpString.messageBaseUrl}/x/sys-msg/query_user_notify';
|
||||
|
||||
/// 系统通知标记已读
|
||||
static const String systemMarkRead =
|
||||
'${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
|
||||
|
||||
/// 编辑收藏夹
|
||||
static const String editFavFolder = '/x/v3/fav/folder/edit';
|
||||
|
||||
/// 新建收藏夹
|
||||
static const String addFavFolder = '/x/v3/fav/folder/add';
|
||||
|
||||
/// 直播间弹幕信息
|
||||
static const String getDanmuInfo =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getDanmuInfo';
|
||||
|
||||
/// 直播间发送弹幕
|
||||
static const String sendLiveMsg = '${HttpString.liveBaseUrl}/msg/send';
|
||||
|
||||
/// 我的关注 - 正在直播
|
||||
static const String getFollowingLive =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-ucenter/user/following';
|
||||
|
||||
/// 稍后再看&收藏夹视频列表
|
||||
static const String mediaList = '/x/v2/medialist/resource/list';
|
||||
|
||||
/// 用户专栏
|
||||
static const String opusList = '/x/polymer/web-dynamic/v1/opus/feed/space';
|
||||
|
||||
///
|
||||
static const String getViewInfo = '/x/article/viewinfo';
|
||||
|
||||
/// 直播间记录
|
||||
static const String liveRoomEntry =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/roomEntryAction';
|
||||
|
||||
/// 用户信息
|
||||
static const String accountInfo = '/x/member/web/account';
|
||||
|
||||
/// 更新用户信息
|
||||
static const String updateAccountInfo = '/x/member/web/update';
|
||||
|
||||
/// 删除评论
|
||||
static const String replyDel = '/x/v2/reply/del';
|
||||
|
||||
/// 图片上传
|
||||
static const String uploadImage = '/x/dynamic/feed/draw/upload_bfs';
|
||||
|
||||
/// 更新追番状态
|
||||
static const String updateBangumiStatus = '/pgc/web/follow/status/update';
|
||||
|
||||
/// 番剧点赞投币收藏状态
|
||||
static const String bangumiActionStatus = '/pgc/season/episode/community';
|
||||
|
||||
/// @我的
|
||||
static const String messageAtAPi = '/x/msgfeed/at?';
|
||||
|
||||
/// 订阅
|
||||
static const String confirmSub = '/x/v3/fav/season/fav';
|
||||
|
||||
/// 订阅状态
|
||||
static const String videoRelation = '/x/web-interface/archive/relation';
|
||||
|
||||
/// 获取空降区间
|
||||
static const String getSkipSegments =
|
||||
'${HttpString.sponsorBlockBaseUrl}/api/skipSegments';
|
||||
|
||||
/// 视频标签
|
||||
static const String videoTag = '/x/tag/archive/tags';
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
import 'dart:convert';
|
||||
import '../models/bangumi/list.dart';
|
||||
import 'index.dart';
|
||||
import 'package:html/parser.dart' as html_parser;
|
||||
import 'package:html/dom.dart' as html_dom;
|
||||
|
||||
class BangumiHttp {
|
||||
static Future bangumiList({int? page}) async {
|
||||
@ -18,8 +21,19 @@ class BangumiHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future bangumiFollow({int? mid}) async {
|
||||
var res = await Request().get(Api.bangumiFollow, data: {'vmid': mid});
|
||||
static Future getRecentBangumi({
|
||||
int? mid,
|
||||
int type = 1,
|
||||
int pn = 1,
|
||||
int ps = 20,
|
||||
}) async {
|
||||
var res = await Request().get(Api.getRecentBangumiApi, data: {
|
||||
'vmid': mid,
|
||||
'type': type,
|
||||
'follow_status': 0,
|
||||
'pn': pn,
|
||||
'ps': ps,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
@ -33,4 +47,62 @@ class BangumiHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 获取追番状态
|
||||
static Future bangumiStatus({required int seasonId}) async {
|
||||
var res = await Request()
|
||||
.get('https://www.bilibili.com/bangumi/play/ss$seasonId');
|
||||
html_dom.Document document = html_parser.parse(res.data);
|
||||
// 查找 id 为 __NEXT_DATA__ 的 script 元素
|
||||
html_dom.Element? scriptElement =
|
||||
document.querySelector('script#\\__NEXT_DATA__');
|
||||
if (scriptElement != null) {
|
||||
// 提取 script 元素的内容
|
||||
String scriptContent = scriptElement.text;
|
||||
final dynamic scriptContentJson = jsonDecode(scriptContent);
|
||||
Map followState = scriptContentJson['props']['pageProps']['followState'];
|
||||
return {
|
||||
'status': true,
|
||||
'data': {
|
||||
'isFollowed': followState['isFollowed'],
|
||||
'followStatus': followState['followStatus']
|
||||
}
|
||||
};
|
||||
} else {
|
||||
print('Script element with id "__NEXT_DATA__" not found.');
|
||||
}
|
||||
}
|
||||
|
||||
// 更新追番状态
|
||||
static Future updateBangumiStatus({
|
||||
required int seasonId,
|
||||
required int status,
|
||||
}) async {
|
||||
var res = await Request().post(Api.updateBangumiStatus, data: {
|
||||
'season_id': seasonId,
|
||||
'status': status,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 获取番剧点赞投币收藏状态
|
||||
static Future bangumiActionStatus({required int epId}) async {
|
||||
var res = await Request().get(
|
||||
Api.bangumiActionStatus,
|
||||
data: {'ep_id': epId},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class BlackHttp {
|
||||
static Future removeBlack({required int fid}) async {
|
||||
var res = await Request().post(
|
||||
Api.removeBlack,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'act': 6,
|
||||
'csrf': await Request.getCsrf(),
|
||||
'fid': fid,
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'package:pilipala/models/sponsor_block/segment.dart';
|
||||
|
||||
import 'index.dart';
|
||||
|
||||
class CommonHttp {
|
||||
@ -14,4 +16,31 @@ class CommonHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future querySkipSegments({required String bvid}) async {
|
||||
var res = await Request().getWithoutCookie(Api.getSkipSegments, data: {
|
||||
'videoID': bvid,
|
||||
});
|
||||
if (res.data is List && res.data.isNotEmpty) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data
|
||||
.map<SegmentDataModel>((e) => SegmentDataModel.fromJson(e))
|
||||
.toList(),
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': 'sponsorBlock数据解析失败: $err',
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ class HttpString {
|
||||
static const String passBaseUrl = 'https://passport.bilibili.com';
|
||||
static const String messageBaseUrl = 'https://message.bilibili.com';
|
||||
static const String bangumiBaseUrl = 'https://bili.meark.me';
|
||||
static const String sponsorBlockBaseUrl = 'https://www.bsbsb.top';
|
||||
static const List<int> validateStatusCodes = [
|
||||
302,
|
||||
304,
|
||||
|
@ -17,7 +17,9 @@ class DanmakaHttp {
|
||||
var response = await Request().get(
|
||||
Api.webDanmaku,
|
||||
data: params,
|
||||
extra: {'resType': ResponseType.bytes},
|
||||
options: Options(
|
||||
responseType: ResponseType.bytes,
|
||||
),
|
||||
);
|
||||
return DmSegMobileReply.fromBuffer(response.data);
|
||||
}
|
||||
@ -67,9 +69,6 @@ class DanmakaHttp {
|
||||
var response = await Request().post(
|
||||
Api.shootDanmaku,
|
||||
data: params,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
return {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'dart:math';
|
||||
import 'package:dio/dio.dart';
|
||||
import '../models/dynamics/result.dart';
|
||||
import '../models/dynamics/up.dart';
|
||||
import 'index.dart';
|
||||
@ -69,7 +70,7 @@ class DynamicsHttp {
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.likeDynamic,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'dynamic_id': dynamicId,
|
||||
'up': up,
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -91,7 +92,7 @@ class DynamicsHttp {
|
||||
|
||||
//
|
||||
static Future dynamicDetail({
|
||||
String? id,
|
||||
required String id,
|
||||
}) async {
|
||||
var res = await Request().get(Api.dynamicDetail, data: {
|
||||
'timezone_offset': -480,
|
||||
@ -175,27 +176,32 @@ class DynamicsHttp {
|
||||
'revs_id': {'dyn_type': 8, 'rid': oid}
|
||||
};
|
||||
}
|
||||
var res = await Request().post(Api.dynamicCreate, queryParameters: {
|
||||
'platform': 'web',
|
||||
'csrf': await Request.getCsrf(),
|
||||
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
||||
'x-bili-web-req-json': {'spm_id': '333.999'},
|
||||
}, data: {
|
||||
'dyn_req': {
|
||||
'content': {
|
||||
'contents': [
|
||||
{'raw_text': rawText ?? '', 'type': 1, 'biz_id': ''}
|
||||
]
|
||||
},
|
||||
'scene': scene,
|
||||
'attach_card': null,
|
||||
'upload_id': uploadId,
|
||||
'meta': {
|
||||
'app_meta': {'from': 'create.dynamic.web', 'mobi_app': 'web'}
|
||||
}
|
||||
var res = await Request().post(
|
||||
Api.dynamicCreate,
|
||||
queryParameters: {
|
||||
'platform': 'web',
|
||||
'csrf': await Request.getCsrf(),
|
||||
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
||||
'x-bili-web-req-json': {'spm_id': '333.999'},
|
||||
},
|
||||
'web_repost_src': webRepostSrc
|
||||
});
|
||||
data: {
|
||||
'dyn_req': {
|
||||
'content': {
|
||||
'contents': [
|
||||
{'raw_text': rawText ?? '', 'type': 1, 'biz_id': ''}
|
||||
]
|
||||
},
|
||||
'scene': scene,
|
||||
'attach_card': null,
|
||||
'upload_id': uploadId,
|
||||
'meta': {
|
||||
'app_meta': {'from': 'create.dynamic.web', 'mobi_app': 'web'}
|
||||
}
|
||||
},
|
||||
'web_repost_src': webRepostSrc
|
||||
},
|
||||
options: Options(contentType: 'application/json'),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
|
67
lib/http/fav.dart
Normal file
67
lib/http/fav.dart
Normal file
@ -0,0 +1,67 @@
|
||||
import 'index.dart';
|
||||
|
||||
class FavHttp {
|
||||
/// 编辑收藏夹
|
||||
static Future editFolder({
|
||||
required String title,
|
||||
required String intro,
|
||||
required String mediaId,
|
||||
String? cover,
|
||||
int? privacy,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.editFavFolder,
|
||||
data: {
|
||||
'title': title,
|
||||
'intro': intro,
|
||||
'media_id': mediaId,
|
||||
'cover': cover ?? '',
|
||||
'privacy': privacy ?? 0,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// 新建收藏夹
|
||||
static Future addFolder({
|
||||
required String title,
|
||||
required String intro,
|
||||
String? cover,
|
||||
int? privacy,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.addFavFolder,
|
||||
data: {
|
||||
'title': title,
|
||||
'intro': intro,
|
||||
'cover': cover ?? '',
|
||||
'privacy': privacy ?? 0,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -21,7 +21,6 @@ class HtmlHttp {
|
||||
}
|
||||
try {
|
||||
Document rootTree = parse(response.data);
|
||||
// log(response.data.body.toString());
|
||||
Element body = rootTree.body!;
|
||||
Element appDom = body.querySelector('#app')!;
|
||||
Element authorHeader = appDom.querySelector('.fixed-author-header')!;
|
||||
@ -52,7 +51,6 @@ class HtmlHttp {
|
||||
.className
|
||||
.split(' ')[1]
|
||||
.split('-')[2];
|
||||
// List imgList = opusDetail.querySelectorAll('bili-album__preview__picture__img');
|
||||
return {
|
||||
'status': true,
|
||||
'avatar': avatar,
|
||||
@ -76,20 +74,10 @@ class HtmlHttp {
|
||||
Element body = rootTree.body!;
|
||||
Element appDom = body.querySelector('#app')!;
|
||||
Element authorHeader = appDom.querySelector('.up-left')!;
|
||||
// 头像
|
||||
// String avatar =
|
||||
// authorHeader.querySelector('.bili-avatar-img')!.attributes['data-src']!;
|
||||
// print(avatar);
|
||||
// avatar = 'https:${avatar.split('@')[0]}';
|
||||
String uname = authorHeader.querySelector('.up-name')!.text.trim();
|
||||
// 动态详情
|
||||
Element opusDetail = appDom.querySelector('.article-content')!;
|
||||
// 发布时间
|
||||
// String updateTime =
|
||||
// opusDetail.querySelector('.opus-module-author__pub__text')!.text;
|
||||
// print(updateTime);
|
||||
|
||||
//
|
||||
String opusContent =
|
||||
opusDetail.querySelector('#read-article-holder')!.innerHtml;
|
||||
RegExp digitRegExp = RegExp(r'\d+');
|
||||
|
@ -8,8 +8,8 @@ import 'package:cookie_jar/cookie_jar.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio/io.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/models/user/info.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import '../utils/storage.dart';
|
||||
import '../utils/utils.dart';
|
||||
@ -22,8 +22,8 @@ class Request {
|
||||
static late CookieManager cookieManager;
|
||||
static late final Dio dio;
|
||||
factory Request() => _instance;
|
||||
Box setting = GStrorage.setting;
|
||||
static Box localCache = GStrorage.localCache;
|
||||
Box setting = GStorage.setting;
|
||||
static Box localCache = GStorage.localCache;
|
||||
late bool enableSystemProxy;
|
||||
late String systemProxyHost;
|
||||
late String systemProxyPort;
|
||||
@ -33,8 +33,8 @@ class Request {
|
||||
|
||||
/// 设置cookie
|
||||
static setCookie() async {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box setting = GStrorage.setting;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
Box setting = GStorage.setting;
|
||||
final String cookiePath = await Utils.getCookiePath();
|
||||
final PersistCookieJar cookieJar = PersistCookieJar(
|
||||
ignoreExpires: true,
|
||||
@ -44,7 +44,7 @@ class Request {
|
||||
dio.interceptors.add(cookieManager);
|
||||
final List<Cookie> cookie = await cookieManager.cookieJar
|
||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||
final userInfo = userInfoCache.get('userInfoCache');
|
||||
final UserInfoData? userInfo = userInfoCache.get('userInfoCache');
|
||||
if (userInfo != null && userInfo.mid != null) {
|
||||
final List<Cookie> cookie2 = await cookieManager.cookieJar
|
||||
.loadForRequest(Uri.parse(HttpString.tUrl));
|
||||
@ -171,15 +171,6 @@ class Request {
|
||||
|
||||
dio = Dio(options);
|
||||
|
||||
/// fix 第三方登录 302重定向 跟iOS代理问题冲突
|
||||
// ..httpClientAdapter = Http2Adapter(
|
||||
// ConnectionManager(
|
||||
// idleTimeout: const Duration(milliseconds: 10000),
|
||||
// onClientCreate: (_, ClientSetting config) =>
|
||||
// config.onBadCertificate = (_) => true,
|
||||
// ),
|
||||
// );
|
||||
|
||||
/// 设置代理
|
||||
if (enableSystemProxy) {
|
||||
dio.httpClientAdapter = IOHttpClientAdapter(
|
||||
@ -217,18 +208,15 @@ class Request {
|
||||
/*
|
||||
* get请求
|
||||
*/
|
||||
get(url, {data, options, cancelToken, extra}) async {
|
||||
get(url, {data, Options? options, cancelToken, extra}) async {
|
||||
Response response;
|
||||
final Options options = Options();
|
||||
ResponseType resType = ResponseType.json;
|
||||
if (extra != null) {
|
||||
resType = extra!['resType'] ?? ResponseType.json;
|
||||
if (extra['ua'] != null) {
|
||||
options.headers = {'user-agent': headerUa(type: extra['ua'])};
|
||||
options ??= Options();
|
||||
options.headers ??= <String, dynamic>{};
|
||||
options.headers?['user-agent'] = headerUa(type: extra['ua']);
|
||||
}
|
||||
}
|
||||
options.responseType = resType;
|
||||
|
||||
try {
|
||||
response = await dio.get(
|
||||
url,
|
||||
@ -238,32 +226,44 @@ class Request {
|
||||
);
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
Response errResponse = Response(
|
||||
data: {
|
||||
'message': await ApiInterceptor.dioError(e)
|
||||
}, // 将自定义 Map 数据赋值给 Response 的 data 属性
|
||||
return Response(
|
||||
data: {'message': await ApiInterceptor.dioError(e)},
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(),
|
||||
);
|
||||
return errResponse;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* get请求
|
||||
*/
|
||||
getWithoutCookie(url, {data}) {
|
||||
return get(
|
||||
url,
|
||||
data: data,
|
||||
options: Options(
|
||||
headers: {
|
||||
'cookie': 'buvid3= ; b_nut= ; sid= ',
|
||||
'user-agent': headerUa(type: 'pc'),
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* post请求
|
||||
*/
|
||||
post(url, {data, queryParameters, options, cancelToken, extra}) async {
|
||||
// print('post-data: $data');
|
||||
Response response;
|
||||
try {
|
||||
response = await dio.post(
|
||||
url,
|
||||
data: data,
|
||||
queryParameters: queryParameters,
|
||||
options: options,
|
||||
options:
|
||||
options ?? Options(contentType: Headers.formUrlEncodedContentType),
|
||||
cancelToken: cancelToken,
|
||||
);
|
||||
// print('post success: ${response.data}');
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
Response errResponse = Response(
|
||||
@ -319,7 +319,7 @@ class Request {
|
||||
}
|
||||
} else {
|
||||
headerUa =
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15';
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36';
|
||||
}
|
||||
return headerUa;
|
||||
}
|
||||
|
@ -3,8 +3,7 @@
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import '../utils/storage.dart';
|
||||
import 'package:pilipala/utils/login.dart';
|
||||
|
||||
class ApiInterceptor extends Interceptor {
|
||||
@override
|
||||
@ -19,20 +18,9 @@ class ApiInterceptor extends Interceptor {
|
||||
@override
|
||||
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
||||
try {
|
||||
if (response.statusCode == 302) {
|
||||
final List<String> locations = response.headers['location']!;
|
||||
if (locations.isNotEmpty) {
|
||||
if (locations.first.startsWith('https://www.mcbbs.net')) {
|
||||
final Uri uri = Uri.parse(locations.first);
|
||||
final String? accessKey = uri.queryParameters['access_key'];
|
||||
final String? mid = uri.queryParameters['mid'];
|
||||
try {
|
||||
Box localCache = GStrorage.localCache;
|
||||
localCache.put(LocalCacheKey.accessKey,
|
||||
<String, String?>{'mid': mid, 'value': accessKey});
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
// 在响应之后处理数据
|
||||
if (response.data is Map && response.data['code'] == -101) {
|
||||
LoginUtils.loginOut();
|
||||
}
|
||||
} catch (err) {
|
||||
print('ApiInterceptor: $err');
|
||||
@ -46,7 +34,8 @@ class ApiInterceptor extends Interceptor {
|
||||
// 处理网络请求错误
|
||||
// handler.next(err);
|
||||
String url = err.requestOptions.uri.toString();
|
||||
if (!url.contains('heartbeat')) {
|
||||
final excludedPatterns = RegExp(r'heartbeat|seg\.so|online/total');
|
||||
if (!excludedPatterns.hasMatch(url)) {
|
||||
SmartDialog.showToast(
|
||||
await dioError(err),
|
||||
displayType: SmartToastType.onlyRefresh,
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'package:pilipala/models/live/follow.dart';
|
||||
|
||||
import '../models/live/item.dart';
|
||||
import '../models/live/room_info.dart';
|
||||
import '../models/live/room_info_h5.dart';
|
||||
@ -87,23 +89,26 @@ class LiveHttp {
|
||||
|
||||
// 发送弹幕
|
||||
static Future sendDanmaku({roomId, msg}) async {
|
||||
var res = await Request().post(Api.sendLiveMsg, queryParameters: {
|
||||
'bubble': 0,
|
||||
'msg': msg,
|
||||
'color': 16777215, // 颜色
|
||||
'mode': 1, // 模式
|
||||
'room_type': 0,
|
||||
'jumpfrom': 71001, // 直播间来源
|
||||
'reply_mid': 0,
|
||||
'reply_attr': 0,
|
||||
'replay_dmid': '',
|
||||
'statistics': {"appId": 100, "platform": 5},
|
||||
'fontsize': 25, // 字体大小
|
||||
'rnd': DateTime.now().millisecondsSinceEpoch ~/ 1000, // 时间戳
|
||||
'roomid': roomId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
'csrf_token': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.sendLiveMsg,
|
||||
data: {
|
||||
'bubble': 0,
|
||||
'msg': msg,
|
||||
'color': 16777215, // 颜色
|
||||
'mode': 1, // 模式
|
||||
'room_type': 0,
|
||||
'jumpfrom': 71001, // 直播间来源
|
||||
'reply_mid': 0,
|
||||
'reply_attr': 0,
|
||||
'replay_dmid': '',
|
||||
'statistics': {"appId": 100, "platform": 5},
|
||||
'fontsize': 25, // 字体大小
|
||||
'rnd': DateTime.now().millisecondsSinceEpoch ~/ 1000, // 时间戳
|
||||
'roomid': roomId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
'csrf_token': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
@ -117,4 +122,41 @@ class LiveHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 我的关注 正在直播
|
||||
static Future liveFollowing({int? pn, int? ps}) async {
|
||||
var res = await Request().get(Api.getFollowingLive, data: {
|
||||
'page': pn,
|
||||
'page_size': ps,
|
||||
'platform': 'web',
|
||||
'ignoreRecord': 1,
|
||||
'hit_ab': true,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': LiveFollowingModel.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 直播历史记录
|
||||
static Future liveRoomEntry({required int roomId}) async {
|
||||
await Request().post(
|
||||
Api.liveRoomEntry,
|
||||
data: {
|
||||
'room_id': roomId,
|
||||
'platform': 'pc',
|
||||
'csrf_token': await Request.getCsrf(),
|
||||
'csrf': await Request.getCsrf(),
|
||||
'visit_id': '',
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -71,9 +71,6 @@ class LoginHttp {
|
||||
var res = await Request().post(
|
||||
Api.webSmsCode,
|
||||
data: formData,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
@ -106,9 +103,6 @@ class LoginHttp {
|
||||
var res = await Request().post(
|
||||
Api.webSmsLogin,
|
||||
data: formData,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
@ -155,9 +149,6 @@ class LoginHttp {
|
||||
var res = await Request().post(
|
||||
Api.appSmsCode,
|
||||
data: data,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
print(res);
|
||||
}
|
||||
@ -208,9 +199,6 @@ class LoginHttp {
|
||||
var res = await Request().post(
|
||||
Api.loginInByPwdApi,
|
||||
data: data,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
print(res);
|
||||
}
|
||||
@ -239,17 +227,27 @@ class LoginHttp {
|
||||
var res = await Request().post(
|
||||
Api.loginInByWebPwd,
|
||||
data: formData,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
if (res.data['data']['status'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'code': 1,
|
||||
'data': res.data['data'],
|
||||
'msg': res.data['data']['message'],
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:pilipala/models/member/article.dart';
|
||||
import 'package:pilipala/models/member/like.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import '../common/constants.dart';
|
||||
import '../models/dynamics/result.dart';
|
||||
import '../models/follow/result.dart';
|
||||
@ -16,14 +21,20 @@ import 'index.dart';
|
||||
|
||||
class MemberHttp {
|
||||
static Future memberInfo({
|
||||
int? mid,
|
||||
required int mid,
|
||||
String token = '',
|
||||
}) async {
|
||||
String? wWebid;
|
||||
if ((await getWWebid(mid: mid))['status']) {
|
||||
wWebid = GlobalDataCache().wWebid;
|
||||
}
|
||||
|
||||
Map params = await WbiSign().makSign({
|
||||
'mid': mid,
|
||||
'token': token,
|
||||
'platform': 'web',
|
||||
'web_location': 1550101,
|
||||
...wWebid != null ? {'w_webid': wWebid} : {},
|
||||
});
|
||||
var res = await Request().get(
|
||||
Api.memberInfo,
|
||||
@ -195,13 +206,15 @@ class MemberHttp {
|
||||
|
||||
// 设置分组
|
||||
static Future addUsers(int? fids, String? tagids) async {
|
||||
var res = await Request().post(Api.addUsers, queryParameters: {
|
||||
'fids': fids,
|
||||
'tagids': tagids ?? '0',
|
||||
'csrf': await Request.getCsrf(),
|
||||
}, data: {
|
||||
'cross_domain': true
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.addUsers,
|
||||
data: {
|
||||
'fids': fids,
|
||||
'tagids': tagids ?? '0',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
queryParameters: {'cross_domain': true},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': [], 'msg': '操作成功'};
|
||||
} else {
|
||||
@ -419,11 +432,14 @@ class MemberHttp {
|
||||
static Future cookieToKey() async {
|
||||
var authCodeRes = await getTVCode();
|
||||
if (authCodeRes['status']) {
|
||||
var res = await Request().post(Api.cookieToKey, queryParameters: {
|
||||
'auth_code': authCodeRes['data'],
|
||||
'build': 708200,
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.cookieToKey,
|
||||
data: {
|
||||
'auth_code': authCodeRes['data'],
|
||||
'build': 708200,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
await qrcodePoll(authCodeRes['data']);
|
||||
if (res.data['code'] == 0) {
|
||||
@ -455,11 +471,11 @@ class MemberHttp {
|
||||
SmartDialog.dismiss();
|
||||
if (res.data['code'] == 0) {
|
||||
String accessKey = res.data['data']['access_token'];
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
var userInfo = userInfoCache.get('userInfoCache');
|
||||
Box localCache = GStorage.localCache;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
final UserInfoData? userInfo = userInfoCache.get('userInfoCache');
|
||||
localCache.put(
|
||||
LocalCacheKey.accessKey, {'mid': userInfo.mid, 'value': accessKey});
|
||||
LocalCacheKey.accessKey, {'mid': userInfo!.mid, 'value': accessKey});
|
||||
return {'status': true, 'data': [], 'msg': '操作成功'};
|
||||
} else {
|
||||
return {
|
||||
@ -556,4 +572,60 @@ class MemberHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future getWWebid({required int mid}) async {
|
||||
String? wWebid = GlobalDataCache().wWebid;
|
||||
if (wWebid != null) {
|
||||
return {'status': true, 'data': wWebid};
|
||||
}
|
||||
var res = await Request().get('https://space.bilibili.com/$mid/article');
|
||||
String? headContent = parse(res.data).head?.outerHtml;
|
||||
final regex = RegExp(
|
||||
r'<script id="__RENDER_DATA__" type="application/json">(.*?)</script>');
|
||||
if (headContent != null) {
|
||||
final match = regex.firstMatch(headContent);
|
||||
if (match != null && match.groupCount >= 1) {
|
||||
final content = match.group(1);
|
||||
String decodedString = Uri.decodeComponent(content!);
|
||||
Map<String, dynamic> map = jsonDecode(decodedString);
|
||||
GlobalDataCache().wWebid = map['access_id'];
|
||||
return {'status': true, 'data': map['access_id']};
|
||||
} else {
|
||||
return {'status': false, 'data': '请检查登录状态'};
|
||||
}
|
||||
}
|
||||
return {'status': false, 'data': '请检查登录状态'};
|
||||
}
|
||||
|
||||
// 获取用户专栏
|
||||
static Future getMemberArticle({
|
||||
required int mid,
|
||||
required int pn,
|
||||
String? offset,
|
||||
}) async {
|
||||
String? wWebid;
|
||||
if ((await getWWebid(mid: mid))['status']) {
|
||||
wWebid = GlobalDataCache().wWebid;
|
||||
}
|
||||
Map params = await WbiSign().makSign({
|
||||
'host_mid': mid,
|
||||
'page': pn,
|
||||
'offset': offset,
|
||||
'web_location': 333.999,
|
||||
...wWebid != null ? {'w_webid': wWebid} : {},
|
||||
});
|
||||
var res = await Request().get(Api.opusList, data: params);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': MemberArticleDataModel.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'] ?? '请求异常',
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/models/msg/at.dart';
|
||||
import 'package:pilipala/models/msg/like.dart';
|
||||
import 'package:pilipala/models/msg/reply.dart';
|
||||
import 'package:pilipala/models/msg/system.dart';
|
||||
@ -64,7 +65,7 @@ class MsgHttp {
|
||||
.toList(),
|
||||
};
|
||||
} catch (err) {
|
||||
print('err🔟: $err');
|
||||
debugPrint('err: $err');
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
@ -158,9 +159,6 @@ class MsgHttp {
|
||||
'csrf_token': csrf,
|
||||
'csrf': csrf,
|
||||
},
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
@ -282,10 +280,10 @@ class MsgHttp {
|
||||
'data': MessageLikeModel.fromJson(res.data['data']),
|
||||
};
|
||||
} catch (err) {
|
||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
||||
return {'status': false, 'data': [], 'msg': err.toString()};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,4 +328,47 @@ class MsgHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future messageSystemAccount() async {
|
||||
var res = await Request().get(Api.userMessageSystemAPi, data: {
|
||||
'csrf': await Request.getCsrf(),
|
||||
'page_size': 20,
|
||||
'build': 0,
|
||||
'mobi_app': 'web',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data']['system_notify_list']
|
||||
.map<MessageSystemModel>((e) => MessageSystemModel.fromJson(e))
|
||||
.toList(),
|
||||
};
|
||||
} catch (err) {
|
||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// @我的
|
||||
static Future messageAt() async {
|
||||
var res = await Request().get(Api.messageAtAPi, data: {
|
||||
'build': 0,
|
||||
'mobi_app': 'web',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': MessageAtModel.fromJson(res.data['data']),
|
||||
};
|
||||
} catch (err) {
|
||||
return {'status': false, 'data': [], 'msg': err.toString()};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
122
lib/http/read.dart
Normal file
122
lib/http/read.dart
Normal file
@ -0,0 +1,122 @@
|
||||
import 'dart:convert';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:pilipala/models/read/opus.dart';
|
||||
import 'package:pilipala/models/read/read.dart';
|
||||
import 'package:pilipala/utils/wbi_sign.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class ReadHttp {
|
||||
static List<String> extractScriptContents(String htmlContent) {
|
||||
RegExp scriptRegExp = RegExp(r'<script>([\s\S]*?)<\/script>');
|
||||
Iterable<Match> matches = scriptRegExp.allMatches(htmlContent);
|
||||
List<String> scriptContents = [];
|
||||
for (Match match in matches) {
|
||||
String scriptContent = match.group(1)!;
|
||||
scriptContents.add(scriptContent);
|
||||
}
|
||||
return scriptContents;
|
||||
}
|
||||
|
||||
// 解析专栏 opus格式
|
||||
static Future parseArticleOpus({required String id}) async {
|
||||
var res = await Request().get('https://www.bilibili.com/opus/$id', extra: {
|
||||
'ua': 'pc',
|
||||
});
|
||||
String? headContent = parse(res.data).head?.outerHtml;
|
||||
var document = parse(headContent);
|
||||
var linkTags = document.getElementsByTagName('link');
|
||||
bool isCv = false;
|
||||
String cvId = '';
|
||||
for (var linkTag in linkTags) {
|
||||
var attributes = linkTag.attributes;
|
||||
if (attributes.containsKey('rel') &&
|
||||
attributes['rel'] == 'canonical' &&
|
||||
attributes.containsKey('data-vue-meta') &&
|
||||
attributes['data-vue-meta'] == 'true') {
|
||||
final String cvHref = linkTag.attributes['href']!;
|
||||
RegExp regex = RegExp(r'cv(\d+)');
|
||||
RegExpMatch? match = regex.firstMatch(cvHref);
|
||||
if (match != null) {
|
||||
cvId = match.group(1)!;
|
||||
} else {
|
||||
print('No match found.');
|
||||
}
|
||||
isCv = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String scriptContent =
|
||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||
int startIndex = scriptContent.indexOf('{');
|
||||
int endIndex = scriptContent.lastIndexOf('};');
|
||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
||||
// 解析JSON字符串为Map
|
||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
||||
return {
|
||||
'status': true,
|
||||
'data': OpusDataModel.fromJson(jsonData),
|
||||
'isCv': isCv,
|
||||
'cvId': cvId,
|
||||
};
|
||||
}
|
||||
|
||||
// 解析专栏 cv格式
|
||||
static Future parseArticleCv({required String id}) async {
|
||||
var res = await Request().get(
|
||||
'https://www.bilibili.com/read/cv$id',
|
||||
extra: {'ua': 'pc'},
|
||||
options: Options(
|
||||
headers: {
|
||||
'cookie': 'opus-goback=1',
|
||||
},
|
||||
),
|
||||
);
|
||||
String scriptContent =
|
||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||
int startIndex = scriptContent.indexOf('{');
|
||||
int endIndex = scriptContent.lastIndexOf('};');
|
||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
||||
// 解析JSON字符串为Map
|
||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
||||
return {
|
||||
'status': true,
|
||||
'data': ReadDataModel.fromJson(jsonData),
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
static Future getViewInfo({required String id}) async {
|
||||
Map params = await WbiSign().makSign({
|
||||
'id': id,
|
||||
'mobi_app': 'pc',
|
||||
'from': 'web',
|
||||
'gaia_source': 'main_web',
|
||||
'web_location': 333.976,
|
||||
});
|
||||
var res = await Request().get(
|
||||
Api.getViewInfo,
|
||||
data: {
|
||||
'id': id,
|
||||
'mobi_app': 'pc',
|
||||
'from': 'web',
|
||||
'gaia_source': 'main_web',
|
||||
'web_location': 333.976,
|
||||
'w_rid': params['w_rid'],
|
||||
'wts': params['wts'],
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'dart:io';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import '../models/video/reply/data.dart';
|
||||
import '../models/video/reply/emote.dart';
|
||||
import 'api.dart';
|
||||
@ -6,17 +11,16 @@ import 'init.dart';
|
||||
class ReplyHttp {
|
||||
static Future replyList({
|
||||
required int oid,
|
||||
required int pageNum,
|
||||
required String nextOffset,
|
||||
required int type,
|
||||
int? ps,
|
||||
int sort = 1,
|
||||
}) async {
|
||||
var res = await Request().get(Api.replyList, data: {
|
||||
'oid': oid,
|
||||
'pn': pageNum,
|
||||
'type': type,
|
||||
'sort': sort,
|
||||
'ps': ps ?? 20
|
||||
'pagination_str': jsonEncode({'offset': nextOffset}),
|
||||
'mode': sort + 2,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
@ -52,19 +56,13 @@ class ReplyHttp {
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': ReplyData.fromJson(res.data['data']),
|
||||
'data': ReplyReplyData.fromJson(res.data['data']),
|
||||
};
|
||||
} else {
|
||||
Map errMap = {
|
||||
-400: '请求错误',
|
||||
-404: '无此项',
|
||||
12002: '评论区已关闭',
|
||||
12009: '评论主体的type不合法',
|
||||
};
|
||||
return {
|
||||
'status': false,
|
||||
'date': [],
|
||||
'msg': errMap[res.data['code']] ?? '请求异常',
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -78,7 +76,7 @@ class ReplyHttp {
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.likeReply,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'type': type,
|
||||
'oid': oid,
|
||||
'rpid': rpid,
|
||||
@ -115,4 +113,65 @@ class ReplyHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future replyDel({
|
||||
required int type, //replyType
|
||||
required int oid,
|
||||
required int rpid,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.replyDel,
|
||||
queryParameters: {
|
||||
'type': type, //type.index
|
||||
'oid': oid,
|
||||
'rpid': rpid,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': '删除成功'};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 图片上传
|
||||
static Future uploadImage(
|
||||
{required XFile xFile, String type = 'new_dyn'}) async {
|
||||
var formData = FormData.fromMap({
|
||||
'file_up': await xFileToMultipartFile(xFile),
|
||||
'biz': type,
|
||||
'csrf': await Request.getCsrf(),
|
||||
'category': 'daily',
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.uploadImage,
|
||||
data: formData,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
var data = res.data['data'];
|
||||
data['img_src'] = data['image_url'];
|
||||
data['img_width'] = data['image_width'];
|
||||
data['img_height'] = data['image_height'];
|
||||
data.remove('image_url');
|
||||
data.remove('image_width');
|
||||
data.remove('image_height');
|
||||
return {
|
||||
'status': true,
|
||||
'data': data,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'date': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future<MultipartFile> xFileToMultipartFile(XFile xFile) async {
|
||||
var file = File(xFile.path);
|
||||
var bytes = await file.readAsBytes();
|
||||
return MultipartFile.fromBytes(bytes, filename: xFile.name);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import '../utils/storage.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class SearchHttp {
|
||||
static Box setting = GStrorage.setting;
|
||||
static Box setting = GStorage.setting;
|
||||
static Future hotSearchList() async {
|
||||
var res = await Request().get(Api.hotSearchList);
|
||||
if (res.data is String) {
|
||||
@ -143,7 +143,11 @@ class SearchHttp {
|
||||
}
|
||||
final dynamic res =
|
||||
await Request().get(Api.ab2c, data: <String, dynamic>{...data});
|
||||
return res.data['data'].first['cid'];
|
||||
if (res.data['code'] == 0) {
|
||||
return res.data['data'].first['cid'];
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> bangumiInfo(
|
||||
|
@ -1,5 +1,8 @@
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import '../common/constants.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:pilipala/models/video/later.dart';
|
||||
import '../models/model_hot_video_item.dart';
|
||||
import '../models/user/fav_detail.dart';
|
||||
import '../models/user/fav_folder.dart';
|
||||
@ -57,6 +60,8 @@ class UserHttp {
|
||||
if (res.data['data'] != null) {
|
||||
data = FavFolderData.fromJson(res.data['data']);
|
||||
return {'status': true, 'data': data};
|
||||
} else {
|
||||
return {'status': false, 'msg': '收藏夹为空'};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
@ -146,7 +151,7 @@ class UserHttp {
|
||||
// 暂停switchStatus传true 否则false
|
||||
var res = await Request().post(
|
||||
Api.pauseHistory,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'switch': switchStatus,
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -165,7 +170,7 @@ class UserHttp {
|
||||
static Future clearHistory() async {
|
||||
var res = await Request().post(
|
||||
Api.clearHistory,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
@ -183,7 +188,7 @@ class UserHttp {
|
||||
}
|
||||
var res = await Request().post(
|
||||
Api.toViewLater,
|
||||
queryParameters: data,
|
||||
data: data,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': 'yeah!稍后再看'};
|
||||
@ -202,7 +207,7 @@ class UserHttp {
|
||||
params[aid != null ? 'aid' : 'viewed'] = aid ?? true;
|
||||
var res = await Request().post(
|
||||
Api.toViewDel,
|
||||
queryParameters: params,
|
||||
data: params,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': 'yeah!成功移除'};
|
||||
@ -211,30 +216,11 @@ class UserHttp {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取用户凭证 失效
|
||||
static Future thirdLogin() async {
|
||||
var res = await Request().get(
|
||||
'https://passport.bilibili.com/login/app/third',
|
||||
data: {
|
||||
'appkey': Constants.appKey,
|
||||
'api': Constants.thirdApi,
|
||||
'sign': Constants.thirdSign,
|
||||
},
|
||||
);
|
||||
try {
|
||||
if (res.data['code'] == 0 && res.data['data']['has_login'] == 1) {
|
||||
Request().get(res.data['data']['confirm_uri']);
|
||||
}
|
||||
} catch (err) {
|
||||
SmartDialog.showNotify(msg: '获取用户凭证: $err', notifyType: NotifyType.error);
|
||||
}
|
||||
}
|
||||
|
||||
// 清空稍后再看
|
||||
static Future toViewClear() async {
|
||||
var res = await Request().post(
|
||||
Api.toViewClear,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
@ -250,7 +236,7 @@ class UserHttp {
|
||||
static Future delHistory(kid) async {
|
||||
var res = await Request().post(
|
||||
Api.delHistory,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'kid': kid,
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -276,30 +262,6 @@ class UserHttp {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
// // 相互关系查询
|
||||
// static Future relationSearch(int mid) async {
|
||||
// Map params = await WbiSign().makSign({
|
||||
// 'mid': mid,
|
||||
// 'token': '',
|
||||
// 'platform': 'web',
|
||||
// 'web_location': 1550101,
|
||||
// });
|
||||
// var res = await Request().get(
|
||||
// Api.relationSearch,
|
||||
// data: {
|
||||
// 'mid': mid,
|
||||
// 'w_rid': params['w_rid'],
|
||||
// 'wts': params['wts'],
|
||||
// },
|
||||
// );
|
||||
// if (res.data['code'] == 0) {
|
||||
// // relation 主动状态
|
||||
// // 被动状态
|
||||
// return {'status': true, 'data': res.data['data']};
|
||||
// } else {
|
||||
// return {'status': false, 'msg': res.data['message']};
|
||||
// }
|
||||
// }
|
||||
|
||||
// 搜索历史记录
|
||||
static Future searchHistory(
|
||||
@ -399,7 +361,7 @@ class UserHttp {
|
||||
static Future cancelSub({required int seasonId}) async {
|
||||
var res = await Request().post(
|
||||
Api.cancelSub,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'platform': 'web',
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -416,7 +378,7 @@ class UserHttp {
|
||||
static Future delFavFolder({required int mediaIds}) async {
|
||||
var res = await Request().post(
|
||||
Api.delFavFolder,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'media_ids': mediaIds,
|
||||
'platform': 'web',
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -428,4 +390,160 @@ class UserHttp {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
static List<String> extractScriptContents(String htmlContent) {
|
||||
RegExp scriptRegExp = RegExp(r'<script>([\s\S]*?)<\/script>');
|
||||
Iterable<Match> matches = scriptRegExp.allMatches(htmlContent);
|
||||
List<String> scriptContents = [];
|
||||
for (Match match in matches) {
|
||||
String scriptContent = match.group(1)!;
|
||||
scriptContents.add(scriptContent);
|
||||
}
|
||||
return scriptContents;
|
||||
}
|
||||
|
||||
// 稍后再看列表
|
||||
static Future getMediaList({
|
||||
required int type,
|
||||
required int bizId,
|
||||
required int ps,
|
||||
int? oid,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
Api.mediaList,
|
||||
data: {
|
||||
'mobi_app': 'web',
|
||||
'type': type,
|
||||
'biz_id': bizId,
|
||||
'oid': oid ?? '',
|
||||
'otype': 2,
|
||||
'ps': ps,
|
||||
'direction': false,
|
||||
'desc': true,
|
||||
'sort_field': 1,
|
||||
'tid': 0,
|
||||
'with_current': false,
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data']['media_list'] != null
|
||||
? res.data['data']['media_list']
|
||||
.map<MediaVideoItemModel>(
|
||||
(e) => MediaVideoItemModel.fromJson(e))
|
||||
.toList()
|
||||
: []
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 解析收藏夹视频
|
||||
static Future parseFavVideo({
|
||||
required int mediaId,
|
||||
required int oid,
|
||||
required String bvid,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
'https://www.bilibili.com/list/ml$mediaId',
|
||||
data: {
|
||||
'oid': mediaId,
|
||||
'bvid': bvid,
|
||||
},
|
||||
);
|
||||
String scriptContent =
|
||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||
int startIndex = scriptContent.indexOf('{');
|
||||
int endIndex = scriptContent.lastIndexOf('};');
|
||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
||||
// 解析JSON字符串为Map
|
||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
||||
return {
|
||||
'status': true,
|
||||
'data': jsonData['resourceList']
|
||||
.map<MediaVideoItemModel>((e) => MediaVideoItemModel.fromJson(e))
|
||||
.toList()
|
||||
};
|
||||
}
|
||||
|
||||
static Future getAccountInfo() async {
|
||||
var res = await Request().get(
|
||||
Api.accountInfo,
|
||||
data: {'web_location': 333.33},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': {},
|
||||
'mag': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future updateAccountInfo({
|
||||
required String uname,
|
||||
required String sign,
|
||||
required String sex,
|
||||
required String birthday,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.updateAccountInfo,
|
||||
data: {
|
||||
'uname': uname,
|
||||
'usersign': sign,
|
||||
'sex': sex,
|
||||
'birthday': birthday,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'msg': '更新成功',
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 解析up投稿
|
||||
static Future parseUpArchiveVideo({
|
||||
required int mid,
|
||||
required int oid,
|
||||
required String bvid,
|
||||
String sortField = 'pubtime',
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
'https://www.bilibili.com/list/$mid',
|
||||
data: {
|
||||
'oid': oid,
|
||||
'bvid': bvid,
|
||||
'sort_field': sortField,
|
||||
},
|
||||
);
|
||||
String scriptContent =
|
||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||
int startIndex = scriptContent.indexOf('{');
|
||||
int endIndex = scriptContent.lastIndexOf('};');
|
||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
||||
// 解析JSON字符串为Map
|
||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
||||
return {
|
||||
'status': true,
|
||||
'data': jsonData['resourceList']
|
||||
.map<MediaVideoItemModel>((e) => MediaVideoItemModel.fromJson(e))
|
||||
.toList()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import 'package:pilipala/models/video/tags.dart';
|
||||
import '../common/constants.dart';
|
||||
import '../models/common/reply_type.dart';
|
||||
import '../models/home/rcmd/result.dart';
|
||||
@ -22,11 +26,11 @@ import 'init.dart';
|
||||
/// 返回{'status': bool, 'data': List}
|
||||
/// view层根据 status 判断渲染逻辑
|
||||
class VideoHttp {
|
||||
static Box localCache = GStrorage.localCache;
|
||||
static Box setting = GStrorage.setting;
|
||||
static Box localCache = GStorage.localCache;
|
||||
static Box setting = GStorage.setting;
|
||||
static bool enableRcmdDynamic =
|
||||
setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
|
||||
static Box userInfoCache = GStrorage.userInfo;
|
||||
static Box userInfoCache = GStorage.userInfo;
|
||||
|
||||
// 首页推荐视频
|
||||
static Future rcmdVideoList({required int ps, required int freshIdx}) async {
|
||||
@ -95,6 +99,8 @@ class VideoHttp {
|
||||
for (var i in res.data['data']['items']) {
|
||||
// 屏蔽推广和拉黑用户
|
||||
if (i['card_goto'] != 'ad_av' &&
|
||||
i['card_goto'] != 'ad_web_s' &&
|
||||
i['card_goto'] != 'ad_web' &&
|
||||
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
|
||||
(i['args'] != null &&
|
||||
!blackMidsList.contains(i['args']['up_mid']))) {
|
||||
@ -243,7 +249,7 @@ class VideoHttp {
|
||||
static Future coinVideo({required String bvid, required int multiply}) async {
|
||||
var res = await Request().post(
|
||||
Api.coinVideo,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'bvid': bvid,
|
||||
'multiply': multiply,
|
||||
'select_like': 0,
|
||||
@ -271,7 +277,7 @@ class VideoHttp {
|
||||
static Future oneThree({required String bvid}) async {
|
||||
var res = await Request().post(
|
||||
Api.oneThree,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'bvid': bvid,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
@ -287,7 +293,7 @@ class VideoHttp {
|
||||
static Future likeVideo({required String bvid, required bool type}) async {
|
||||
var res = await Request().post(
|
||||
Api.likeVideo,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'bvid': bvid,
|
||||
'like': type ? 1 : 2,
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -303,13 +309,16 @@ class VideoHttp {
|
||||
// (取消)收藏
|
||||
static Future favVideo(
|
||||
{required int aid, String? addIds, String? delIds}) async {
|
||||
var res = await Request().post(Api.favVideo, queryParameters: {
|
||||
'rid': aid,
|
||||
'type': 2,
|
||||
'add_media_ids': addIds ?? '',
|
||||
'del_media_ids': delIds ?? '',
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.favVideo,
|
||||
data: {
|
||||
'rid': aid,
|
||||
'type': 2,
|
||||
'add_media_ids': addIds ?? '',
|
||||
'del_media_ids': delIds ?? '',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
@ -343,20 +352,37 @@ class VideoHttp {
|
||||
required String message,
|
||||
int? root,
|
||||
int? parent,
|
||||
List<Map<dynamic, dynamic>>? pictures,
|
||||
}) async {
|
||||
if (message == '') {
|
||||
return {'status': false, 'data': [], 'msg': '请输入评论内容'};
|
||||
}
|
||||
var res = await Request().post(Api.replyAdd, queryParameters: {
|
||||
'type': type.index,
|
||||
var params = <String, dynamic>{
|
||||
'plat': 1,
|
||||
'oid': oid,
|
||||
'type': type.index,
|
||||
'root': root == null || root == 0 ? '' : root,
|
||||
'parent': parent == null || parent == 0 ? '' : parent,
|
||||
'message': message,
|
||||
'at_name_to_mid': {},
|
||||
if (pictures != null) 'pictures': jsonEncode(pictures),
|
||||
'gaia_source': 'main_web',
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
log(res.toString());
|
||||
};
|
||||
Map sign = await WbiSign().makSign(params);
|
||||
params.remove('wts');
|
||||
params.remove('w_rid');
|
||||
FormData formData = FormData.fromMap({...params});
|
||||
var res = await Request().post(
|
||||
Api.replyAdd,
|
||||
queryParameters: {
|
||||
'w_rid': sign['w_rid'],
|
||||
'wts': sign['wts'],
|
||||
},
|
||||
data: formData,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
log(res.toString());
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
@ -376,12 +402,15 @@ class VideoHttp {
|
||||
// 操作用户关系
|
||||
static Future relationMod(
|
||||
{required int mid, required int act, required int reSrc}) async {
|
||||
var res = await Request().post(Api.relationMod, queryParameters: {
|
||||
'fid': mid,
|
||||
'act': act,
|
||||
're_src': reSrc,
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.relationMod,
|
||||
data: {
|
||||
'fid': mid,
|
||||
'act': act,
|
||||
're_src': reSrc,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
if (act == 5) {
|
||||
List<int> blackMidsList =
|
||||
@ -397,27 +426,33 @@ class VideoHttp {
|
||||
|
||||
// 视频播放进度
|
||||
static Future heartBeat({bvid, cid, progress, realtime}) async {
|
||||
await Request().post(Api.heartBeat, queryParameters: {
|
||||
// 'aid': aid,
|
||||
'bvid': bvid,
|
||||
'cid': cid,
|
||||
// 'epid': '',
|
||||
// 'sid': '',
|
||||
// 'mid': '',
|
||||
'played_time': progress,
|
||||
// 'realtime': realtime,
|
||||
// 'type': '',
|
||||
// 'sub_type': '',
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
await Request().post(
|
||||
Api.heartBeat,
|
||||
data: {
|
||||
// 'aid': aid,
|
||||
'bvid': bvid,
|
||||
'cid': cid,
|
||||
// 'epid': '',
|
||||
// 'sid': '',
|
||||
// 'mid': '',
|
||||
'played_time': progress,
|
||||
// 'realtime': realtime,
|
||||
// 'type': '',
|
||||
// 'sub_type': '',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 添加追番
|
||||
static Future bangumiAdd({int? seasonId}) async {
|
||||
var res = await Request().post(Api.bangumiAdd, queryParameters: {
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.bangumiAdd,
|
||||
data: {
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': res.data['result']['toast']};
|
||||
} else {
|
||||
@ -427,10 +462,13 @@ class VideoHttp {
|
||||
|
||||
// 取消追番
|
||||
static Future bangumiDel({int? seasonId}) async {
|
||||
var res = await Request().post(Api.bangumiDel, queryParameters: {
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.bangumiDel,
|
||||
data: {
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': res.data['result']['toast']};
|
||||
} else {
|
||||
@ -473,10 +511,11 @@ class VideoHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future getSubtitle({int? cid, String? bvid}) async {
|
||||
static Future getSubtitle({int? cid, String? bvid, String? aid}) async {
|
||||
var res = await Request().get(Api.getSubtitleConfig, data: {
|
||||
'cid': cid,
|
||||
'bvid': bvid,
|
||||
if (bvid != null) 'bvid': bvid,
|
||||
if (aid != null) 'aid': aid,
|
||||
});
|
||||
try {
|
||||
if (res.data['code'] == 0) {
|
||||
@ -518,8 +557,70 @@ class VideoHttp {
|
||||
// 获取字幕内容
|
||||
static Future<Map<String, dynamic>> getSubtitleContent(url) async {
|
||||
var res = await Request().get('https:$url');
|
||||
final String content = SubTitleUtils.convertToWebVTT(res.data['body']);
|
||||
final String content =
|
||||
await SubTitleUtils.convertToWebVTT(res.data['body']);
|
||||
final List body = res.data['body'];
|
||||
return {'content': content, 'body': body};
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> getSubscribeStatus(
|
||||
{required dynamic bvid}) async {
|
||||
var res = await Request().get(
|
||||
Api.videoRelation,
|
||||
data: {
|
||||
'aid': IdUtils.bv2av(bvid),
|
||||
'bvid': bvid,
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future seasonFav({
|
||||
required bool isFav,
|
||||
required dynamic seasonId,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
isFav ? Api.cancelSub : Api.confirmSub,
|
||||
data: {
|
||||
'platform': 'web',
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 获取视频标签
|
||||
static Future getVideoTag({required String bvid}) async {
|
||||
var res = await Request().get(Api.videoTag, data: {'bvid': bvid});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'].map<VideoTagItem>((e) {
|
||||
return VideoTagItem.fromJson(e);
|
||||
}).toList()
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ void main() async {
|
||||
MediaKit.ensureInitialized();
|
||||
await SystemChrome.setPreferredOrientations(
|
||||
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
|
||||
await GStrorage.init();
|
||||
await GStorage.init();
|
||||
clearLogs();
|
||||
Request();
|
||||
await Request.setCookie();
|
||||
@ -60,6 +60,7 @@ void main() async {
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
systemNavigationBarDividerColor: Colors.transparent,
|
||||
statusBarColor: Colors.transparent,
|
||||
systemNavigationBarContrastEnforced: false,
|
||||
));
|
||||
}
|
||||
|
||||
@ -72,7 +73,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
// 主题色
|
||||
Color defaultColor =
|
||||
colorThemeTypes[setting.get(SettingBoxKey.customColor, defaultValue: 0)]
|
||||
@ -221,13 +222,23 @@ class BuildMainApp extends StatelessWidget {
|
||||
elevation: 20,
|
||||
);
|
||||
|
||||
return GetMaterialApp(
|
||||
title: 'PiliPala',
|
||||
theme: ThemeData(
|
||||
colorScheme: currentThemeValue == ThemeType.dark
|
||||
? darkColorScheme
|
||||
: lightColorScheme,
|
||||
AppBarTheme appBarTheme(ColorScheme colorScheme) {
|
||||
return AppBarTheme(
|
||||
backgroundColor: colorScheme.surface,
|
||||
foregroundColor: colorScheme.onSurface,
|
||||
elevation: 0,
|
||||
titleSpacing: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
// titleTextStyle: TextStyle(
|
||||
// fontSize: Theme.of(context).textTheme.titleLarge!.fontSize),
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData buildThemeData(ColorScheme colorScheme) {
|
||||
return ThemeData(
|
||||
colorScheme: colorScheme,
|
||||
snackBarTheme: snackBarTheme,
|
||||
appBarTheme: appBarTheme(colorScheme),
|
||||
pageTransitionsTheme: const PageTransitionsTheme(
|
||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
||||
@ -235,12 +246,20 @@ class BuildMainApp extends StatelessWidget {
|
||||
),
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return GetMaterialApp(
|
||||
title: 'PiliPala',
|
||||
theme: buildThemeData(
|
||||
currentThemeValue == ThemeType.dark
|
||||
? darkColorScheme
|
||||
: lightColorScheme,
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
colorScheme: currentThemeValue == ThemeType.light
|
||||
darkTheme: buildThemeData(
|
||||
currentThemeValue == ThemeType.light
|
||||
? lightColorScheme
|
||||
: darkColorScheme,
|
||||
snackBarTheme: snackBarTheme,
|
||||
),
|
||||
localizationsDelegates: const [
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
|
@ -144,6 +144,7 @@ class EpisodeItem {
|
||||
this.link,
|
||||
this.longTitle,
|
||||
this.pubTime,
|
||||
this.pubdate,
|
||||
this.pv,
|
||||
this.releaseDate,
|
||||
this.rights,
|
||||
@ -155,6 +156,7 @@ class EpisodeItem {
|
||||
this.subtitle,
|
||||
this.title,
|
||||
this.vid,
|
||||
this.stat,
|
||||
});
|
||||
|
||||
int? aid;
|
||||
@ -173,6 +175,7 @@ class EpisodeItem {
|
||||
String? link;
|
||||
String? longTitle;
|
||||
int? pubTime;
|
||||
int? pubdate;
|
||||
int? pv;
|
||||
String? releaseDate;
|
||||
Map? rights;
|
||||
@ -184,6 +187,7 @@ class EpisodeItem {
|
||||
String? subtitle;
|
||||
String? title;
|
||||
String? vid;
|
||||
String? stat;
|
||||
|
||||
EpisodeItem.fromJson(Map<String, dynamic> json) {
|
||||
aid = json['aid'];
|
||||
@ -202,6 +206,7 @@ class EpisodeItem {
|
||||
link = json['link'];
|
||||
longTitle = json['long_title'];
|
||||
pubTime = json['pub_time'];
|
||||
pubdate = json['pub_time'];
|
||||
pv = json['pv'];
|
||||
releaseDate = json['release_date'];
|
||||
rights = json['rights'];
|
||||
@ -211,7 +216,7 @@ class EpisodeItem {
|
||||
skip = json['skip'];
|
||||
status = json['status'];
|
||||
subtitle = json['subtitle'];
|
||||
title = json['title'];
|
||||
title = json['long_title'];
|
||||
vid = json['vid'];
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ class BangumiListItemModel {
|
||||
this.title,
|
||||
this.titleIcon,
|
||||
this.progress,
|
||||
this.progressIndex,
|
||||
});
|
||||
|
||||
String? badge;
|
||||
@ -66,8 +67,8 @@ class BangumiListItemModel {
|
||||
String? subTitle;
|
||||
String? title;
|
||||
String? titleIcon;
|
||||
|
||||
String? progress;
|
||||
int? progressIndex;
|
||||
|
||||
BangumiListItemModel.fromJson(Map<String, dynamic> json) {
|
||||
badge = json['badge'] == '' ? null : json['badge'];
|
||||
@ -87,7 +88,9 @@ class BangumiListItemModel {
|
||||
subTitle = json['sub_title'];
|
||||
title = json['title'];
|
||||
titleIcon = json['title_icon'];
|
||||
|
||||
progress = json['progress'];
|
||||
progressIndex = int.parse(
|
||||
RegExp(r'第(\d+)话').firstMatch(json['progress'] ?? '第1话')?.group(1) ??
|
||||
'0');
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,12 @@ enum FullScreenGestureMode {
|
||||
|
||||
/// 从下滑到上
|
||||
fromBottomtoTop,
|
||||
|
||||
/// 关闭手势
|
||||
none,
|
||||
}
|
||||
|
||||
extension FullScreenGestureModeExtension on FullScreenGestureMode {
|
||||
String get values => ['fromToptoBottom', 'fromBottomtoTop'][index];
|
||||
String get labels => ['从上往下滑进入全屏', '从下往上滑进入全屏'][index];
|
||||
String get values => ['fromToptoBottom', 'fromBottomtoTop', 'none'][index];
|
||||
String get labels => ['从上往下滑进入全屏', '从下往上滑进入全屏', '关闭手势'][index];
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pilipala/pages/mine/index.dart';
|
||||
import '../../pages/dynamics/index.dart';
|
||||
import '../../pages/home/index.dart';
|
||||
import '../../pages/media/index.dart';
|
||||
import '../../pages/rank/index.dart';
|
||||
|
||||
List defaultNavigationBars = [
|
||||
@ -51,15 +50,15 @@ List defaultNavigationBars = [
|
||||
{
|
||||
'id': 3,
|
||||
'icon': const Icon(
|
||||
Icons.video_collection_outlined,
|
||||
Icons.person_outline,
|
||||
size: 20,
|
||||
),
|
||||
'selectIcon': const Icon(
|
||||
Icons.video_collection,
|
||||
Icons.person,
|
||||
size: 21,
|
||||
),
|
||||
'label': "媒体库",
|
||||
'label': "我的",
|
||||
'count': 0,
|
||||
'page': const MediaPage(),
|
||||
}
|
||||
'page': const MinePage(),
|
||||
},
|
||||
];
|
||||
|
@ -28,7 +28,7 @@ extension SearchTypeExtension on SearchType {
|
||||
String get label => ['视频', '番剧', '直播间', '用户', '专栏'][index];
|
||||
}
|
||||
|
||||
// 搜索类型为视频、专栏及相簿时
|
||||
// 搜索类型为视频时
|
||||
enum ArchiveFilterType {
|
||||
totalrank,
|
||||
click,
|
||||
@ -44,3 +44,21 @@ extension ArchiveFilterTypeExtension on ArchiveFilterType {
|
||||
String get description =>
|
||||
['默认排序', '播放多', '新发布', '弹幕多', '收藏多', '评论多', '最多喜欢'][index];
|
||||
}
|
||||
|
||||
// 搜索类型为专栏时
|
||||
enum ArticleFilterType {
|
||||
// 综合排序
|
||||
totalrank,
|
||||
// 最新发布
|
||||
pubdate,
|
||||
// 最多点击
|
||||
click,
|
||||
// 最多喜欢
|
||||
attention,
|
||||
// 最多评论
|
||||
scores,
|
||||
}
|
||||
|
||||
extension ArticleFilterTypeExtension on ArticleFilterType {
|
||||
String get description => ['综合排序', '最新发布', '最多点击', '最多喜欢', '最多评论'][index];
|
||||
}
|
||||
|
127
lib/models/live/follow.dart
Normal file
127
lib/models/live/follow.dart
Normal file
@ -0,0 +1,127 @@
|
||||
class LiveFollowingModel {
|
||||
int? count;
|
||||
List<LiveFollowingItemModel>? list;
|
||||
int? liveCount;
|
||||
int? neverLivedCount;
|
||||
List? neverLivedFaces;
|
||||
int? pageSize;
|
||||
String? title;
|
||||
int? totalPage;
|
||||
|
||||
LiveFollowingModel({
|
||||
this.count,
|
||||
this.list,
|
||||
this.liveCount,
|
||||
this.neverLivedCount,
|
||||
this.neverLivedFaces,
|
||||
this.pageSize,
|
||||
this.title,
|
||||
this.totalPage,
|
||||
});
|
||||
|
||||
LiveFollowingModel.fromJson(Map<String, dynamic> json) {
|
||||
count = json['count'];
|
||||
if (json['list'] != null) {
|
||||
list = <LiveFollowingItemModel>[];
|
||||
json['list'].forEach((v) {
|
||||
list!.add(LiveFollowingItemModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
liveCount = json['live_count'];
|
||||
neverLivedCount = json['never_lived_count'];
|
||||
if (json['never_lived_faces'] != null) {
|
||||
neverLivedFaces = <dynamic>[];
|
||||
json['never_lived_faces'].forEach((v) {
|
||||
neverLivedFaces!.add(v);
|
||||
});
|
||||
}
|
||||
pageSize = json['pageSize'];
|
||||
title = json['title'];
|
||||
totalPage = json['totalPage'];
|
||||
}
|
||||
}
|
||||
|
||||
class LiveFollowingItemModel {
|
||||
int? roomId;
|
||||
int? uid;
|
||||
String? uname;
|
||||
String? title;
|
||||
String? face;
|
||||
int? liveStatus;
|
||||
int? recordNum;
|
||||
String? recentRecordId;
|
||||
int? isAttention;
|
||||
int? clipNum;
|
||||
int? fansNum;
|
||||
String? areaName;
|
||||
String? areaValue;
|
||||
String? tags;
|
||||
String? recentRecordIdV2;
|
||||
int? recordNumV2;
|
||||
int? recordLiveTime;
|
||||
String? areaNameV2;
|
||||
String? roomNews;
|
||||
String? watchIcon;
|
||||
String? textSmall;
|
||||
String? cover;
|
||||
String? pic;
|
||||
int? parentAreaId;
|
||||
int? areaId;
|
||||
|
||||
LiveFollowingItemModel({
|
||||
this.roomId,
|
||||
this.uid,
|
||||
this.uname,
|
||||
this.title,
|
||||
this.face,
|
||||
this.liveStatus,
|
||||
this.recordNum,
|
||||
this.recentRecordId,
|
||||
this.isAttention,
|
||||
this.clipNum,
|
||||
this.fansNum,
|
||||
this.areaName,
|
||||
this.areaValue,
|
||||
this.tags,
|
||||
this.recentRecordIdV2,
|
||||
this.recordNumV2,
|
||||
this.recordLiveTime,
|
||||
this.areaNameV2,
|
||||
this.roomNews,
|
||||
this.watchIcon,
|
||||
this.textSmall,
|
||||
this.cover,
|
||||
this.pic,
|
||||
this.parentAreaId,
|
||||
this.areaId,
|
||||
});
|
||||
|
||||
LiveFollowingItemModel.fromJson(Map<String, dynamic> json) {
|
||||
roomId = json['roomid'];
|
||||
uid = json['uid'];
|
||||
uname = json['uname'];
|
||||
title = json['title'];
|
||||
face = json['face'];
|
||||
liveStatus = json['live_status'];
|
||||
recordNum = json['record_num'];
|
||||
recentRecordId = json['recent_record_id'];
|
||||
isAttention = json['is_attention'];
|
||||
clipNum = json['clipnum'];
|
||||
fansNum = json['fans_num'];
|
||||
areaName =
|
||||
json['area_name'] == '' ? json['area_name_v2'] : json['area_name'];
|
||||
areaValue = json['area_value'];
|
||||
tags = json['tags'];
|
||||
recentRecordIdV2 = json['recent_record_id_v2'];
|
||||
recordNumV2 = json['record_num_v2'];
|
||||
recordLiveTime = json['record_live_time'];
|
||||
areaNameV2 = json['area_name_v2'];
|
||||
roomNews = json['room_news'];
|
||||
watchIcon = json['watch_icon'];
|
||||
textSmall = json['text_small'];
|
||||
cover = json['room_cover'];
|
||||
pic = json['room_cover'];
|
||||
parentAreaId = json['parent_area_id'];
|
||||
areaId = json['area_id'];
|
||||
}
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
class RoomInfoModel {
|
||||
RoomInfoModel({
|
||||
this.roomId,
|
||||
this.isPortrait,
|
||||
this.liveStatus,
|
||||
this.liveTime,
|
||||
this.playurlInfo,
|
||||
});
|
||||
int? roomId;
|
||||
bool? isPortrait;
|
||||
int? liveStatus;
|
||||
int? liveTime;
|
||||
PlayurlInfo? playurlInfo;
|
||||
@ -13,6 +15,7 @@ class RoomInfoModel {
|
||||
RoomInfoModel.fromJson(Map<String, dynamic> json) {
|
||||
roomId = json['room_id'];
|
||||
liveStatus = json['live_status'];
|
||||
isPortrait = json['is_portrait'];
|
||||
liveTime = json['live_time'];
|
||||
playurlInfo = PlayurlInfo.fromJson(json['playurl_info']);
|
||||
}
|
||||
|
46
lib/models/member/article.dart
Normal file
46
lib/models/member/article.dart
Normal file
@ -0,0 +1,46 @@
|
||||
class MemberArticleDataModel {
|
||||
MemberArticleDataModel({
|
||||
this.hasMore,
|
||||
this.items,
|
||||
this.offset,
|
||||
this.updateNum,
|
||||
});
|
||||
|
||||
bool? hasMore;
|
||||
List<MemberArticleItemModel>? items;
|
||||
String? offset;
|
||||
int? updateNum;
|
||||
|
||||
MemberArticleDataModel.fromJson(Map<String, dynamic> json) {
|
||||
hasMore = json['has_more'];
|
||||
items = json['items']
|
||||
.map<MemberArticleItemModel>((e) => MemberArticleItemModel.fromJson(e))
|
||||
.toList();
|
||||
offset = json['offset'];
|
||||
updateNum = json['update_num'];
|
||||
}
|
||||
}
|
||||
|
||||
class MemberArticleItemModel {
|
||||
MemberArticleItemModel({
|
||||
this.content,
|
||||
this.cover,
|
||||
this.jumpUrl,
|
||||
this.opusId,
|
||||
this.stat,
|
||||
});
|
||||
|
||||
String? content;
|
||||
Map? cover;
|
||||
String? jumpUrl;
|
||||
String? opusId;
|
||||
Map? stat;
|
||||
|
||||
MemberArticleItemModel.fromJson(Map<String, dynamic> json) {
|
||||
content = json['content'];
|
||||
cover = json['cover'];
|
||||
jumpUrl = json['jump_url'];
|
||||
opusId = json['opus_id'];
|
||||
stat = json['stat'];
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ class MemberInfoModel {
|
||||
this.level,
|
||||
this.isFollowed,
|
||||
this.topPhoto,
|
||||
this.silence,
|
||||
this.official,
|
||||
this.vip,
|
||||
this.liveRoom,
|
||||
@ -21,6 +22,7 @@ class MemberInfoModel {
|
||||
int? level;
|
||||
bool? isFollowed;
|
||||
String? topPhoto;
|
||||
int? silence;
|
||||
Map? official;
|
||||
Vip? vip;
|
||||
LiveRoom? liveRoom;
|
||||
@ -34,6 +36,7 @@ class MemberInfoModel {
|
||||
level = json['level'];
|
||||
isFollowed = json['is_followed'];
|
||||
topPhoto = json['top_photo'];
|
||||
silence = json['silence'] ?? 0;
|
||||
official = json['official'];
|
||||
vip = Vip.fromJson(json['vip']);
|
||||
liveRoom =
|
||||
|
140
lib/models/msg/at.dart
Normal file
140
lib/models/msg/at.dart
Normal file
@ -0,0 +1,140 @@
|
||||
class MessageAtModel {
|
||||
Cursor? cursor;
|
||||
List<MessageAtItems>? items;
|
||||
|
||||
MessageAtModel({this.cursor, this.items});
|
||||
|
||||
MessageAtModel.fromJson(Map<String, dynamic> json) {
|
||||
cursor = json['cursor'] != null ? Cursor.fromJson(json['cursor']) : null;
|
||||
if (json['items'] != null) {
|
||||
items = <MessageAtItems>[];
|
||||
json['items'].forEach((v) {
|
||||
items!.add(MessageAtItems.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Cursor {
|
||||
Cursor({
|
||||
this.id,
|
||||
this.isEnd,
|
||||
this.time,
|
||||
});
|
||||
|
||||
int? id;
|
||||
bool? isEnd;
|
||||
int? time;
|
||||
|
||||
Cursor.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
isEnd = json['isEnd'];
|
||||
time = json['time'];
|
||||
}
|
||||
}
|
||||
|
||||
class MessageAtItems {
|
||||
int? id;
|
||||
int? atTime;
|
||||
User? user;
|
||||
MessageAtItem? item;
|
||||
|
||||
MessageAtItems({this.id, this.atTime, this.user, this.item});
|
||||
|
||||
MessageAtItems.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
atTime = json['at_time'];
|
||||
user = json['user'] != null ? User.fromJson(json['user']) : null;
|
||||
item = json['item'] != null ? MessageAtItem.fromJson(json['item']) : null;
|
||||
}
|
||||
}
|
||||
|
||||
class MessageAtItem {
|
||||
String? type;
|
||||
String? business;
|
||||
int? businessId;
|
||||
String? title;
|
||||
String? image;
|
||||
String? uri;
|
||||
int? subjectId;
|
||||
int? rootId;
|
||||
int? targetId;
|
||||
int? sourceId;
|
||||
String? sourceContent;
|
||||
String? nativeUri;
|
||||
List<User>? atDetails;
|
||||
List<dynamic>? topicDetails;
|
||||
bool? hideReplyButton;
|
||||
|
||||
MessageAtItem({
|
||||
this.type,
|
||||
this.business,
|
||||
this.businessId,
|
||||
this.title,
|
||||
this.image,
|
||||
this.uri,
|
||||
this.subjectId,
|
||||
this.rootId,
|
||||
this.targetId,
|
||||
this.sourceId,
|
||||
this.sourceContent,
|
||||
this.nativeUri,
|
||||
this.atDetails,
|
||||
this.topicDetails,
|
||||
this.hideReplyButton,
|
||||
});
|
||||
|
||||
MessageAtItem.fromJson(Map<String, dynamic> json) {
|
||||
type = json['type'];
|
||||
business = json['business'];
|
||||
businessId = json['business_id'];
|
||||
title = json['title'];
|
||||
image = json['image'];
|
||||
uri = json['uri'];
|
||||
subjectId = json['subject_id'];
|
||||
rootId = json['root_id'];
|
||||
targetId = json['target_id'];
|
||||
sourceId = json['source_id'];
|
||||
sourceContent = json['source_content'];
|
||||
nativeUri = json['native_uri'];
|
||||
if (json['at_details'] != null) {
|
||||
atDetails = <User>[];
|
||||
json['at_details'].forEach((v) {
|
||||
atDetails!.add(User.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['topic_details'] != null) {
|
||||
topicDetails = <dynamic>[];
|
||||
json['topic_details'].forEach((v) {
|
||||
topicDetails!.add(v);
|
||||
});
|
||||
}
|
||||
hideReplyButton = json['hide_reply_button'];
|
||||
}
|
||||
}
|
||||
|
||||
class User {
|
||||
int? mid;
|
||||
int? fans;
|
||||
String? nickname;
|
||||
String? avatar;
|
||||
String? midLink;
|
||||
bool? follow;
|
||||
|
||||
User(
|
||||
{this.mid,
|
||||
this.fans,
|
||||
this.nickname,
|
||||
this.avatar,
|
||||
this.midLink,
|
||||
this.follow});
|
||||
|
||||
User.fromJson(Map<String, dynamic> json) {
|
||||
mid = json['mid'];
|
||||
fans = json['fans'];
|
||||
nickname = json['nickname'];
|
||||
avatar = json['avatar'];
|
||||
midLink = json['mid_link'];
|
||||
follow = json['follow'];
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ class Total {
|
||||
List<MessageLikeItem>? items;
|
||||
|
||||
factory Total.fromJson(Map<String, dynamic> json) => Total(
|
||||
cursor: Cursor.fromJson(json['cursor']),
|
||||
cursor: json['cursor'] != null ? Cursor.fromJson(json['cursor']) : null,
|
||||
items: json["items"] == null
|
||||
? []
|
||||
: json["items"].map<MessageLikeItem>((e) {
|
||||
|
@ -13,8 +13,9 @@ class SessionDataModel {
|
||||
|
||||
SessionDataModel.fromJson(Map<String, dynamic> json) {
|
||||
sessionList = json['session_list']
|
||||
?.map<SessionList>((e) => SessionList.fromJson(e))
|
||||
.toList();
|
||||
?.map<SessionList>((e) => SessionList.fromJson(e))
|
||||
.toList() ??
|
||||
[];
|
||||
hasMore = json['has_more'];
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ class MessageSystemModel {
|
||||
int? cursor;
|
||||
int? type;
|
||||
String? title;
|
||||
Map? content;
|
||||
dynamic content;
|
||||
Source? source;
|
||||
String? timeAt;
|
||||
int? cardType;
|
||||
@ -45,7 +45,9 @@ class MessageSystemModel {
|
||||
cursor: jsons["cursor"],
|
||||
type: jsons["type"],
|
||||
title: jsons["title"],
|
||||
content: json.decode(jsons["content"]),
|
||||
content: isValidJson(jsons["content"])
|
||||
? json.decode(jsons["content"])
|
||||
: jsons["content"],
|
||||
source: Source.fromJson(jsons["source"]),
|
||||
timeAt: jsons["time_at"],
|
||||
cardType: jsons["card_type"],
|
||||
@ -75,3 +77,12 @@ class Source {
|
||||
logo: json["logo"],
|
||||
);
|
||||
}
|
||||
|
||||
bool isValidJson(String str) {
|
||||
try {
|
||||
json.decode(str);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
485
lib/models/read/opus.dart
Normal file
485
lib/models/read/opus.dart
Normal file
@ -0,0 +1,485 @@
|
||||
class OpusDataModel {
|
||||
OpusDataModel({
|
||||
this.id,
|
||||
this.detail,
|
||||
this.type,
|
||||
this.theme,
|
||||
this.themeMode,
|
||||
});
|
||||
|
||||
String? id;
|
||||
OpusDetailDataModel? detail;
|
||||
int? type;
|
||||
String? theme;
|
||||
String? themeMode;
|
||||
|
||||
OpusDataModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
detail = json['detail'] != null
|
||||
? OpusDetailDataModel.fromJson(json['detail'])
|
||||
: null;
|
||||
type = json['type'];
|
||||
theme = json['theme'];
|
||||
themeMode = json['themeMode'];
|
||||
}
|
||||
}
|
||||
|
||||
class OpusDetailDataModel {
|
||||
OpusDetailDataModel({
|
||||
this.basic,
|
||||
this.idStr,
|
||||
this.modules,
|
||||
this.type,
|
||||
});
|
||||
|
||||
Basic? basic;
|
||||
String? idStr;
|
||||
List<OpusModuleDataModel>? modules;
|
||||
int? type;
|
||||
|
||||
OpusDetailDataModel.fromJson(Map<String, dynamic> json) {
|
||||
basic = json['basic'] != null ? Basic.fromJson(json['basic']) : null;
|
||||
idStr = json['id_str'];
|
||||
if (json['modules'] != null) {
|
||||
modules = <OpusModuleDataModel>[];
|
||||
json['modules'].forEach((v) {
|
||||
modules!.add(OpusModuleDataModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
type = json['type'];
|
||||
}
|
||||
}
|
||||
|
||||
class Basic {
|
||||
Basic({
|
||||
this.commentIdStr,
|
||||
this.commentType,
|
||||
this.ridStr,
|
||||
this.title,
|
||||
this.uid,
|
||||
});
|
||||
|
||||
String? commentIdStr;
|
||||
int? commentType;
|
||||
String? ridStr;
|
||||
String? title;
|
||||
int? uid;
|
||||
|
||||
Basic.fromJson(Map<String, dynamic> json) {
|
||||
commentIdStr = json['comment_id_str'];
|
||||
commentType = json['comment_type'];
|
||||
ridStr = json['rid_str'];
|
||||
title = json['title'];
|
||||
uid = json['uid'];
|
||||
}
|
||||
}
|
||||
|
||||
class OpusModuleDataModel {
|
||||
OpusModuleDataModel({
|
||||
this.moduleTitle,
|
||||
this.moduleAuthor,
|
||||
this.moduleContent,
|
||||
this.moduleExtend,
|
||||
this.moduleBottom,
|
||||
this.moduleStat,
|
||||
});
|
||||
|
||||
ModuleTop? moduleTop;
|
||||
ModuleTitle? moduleTitle;
|
||||
ModuleAuthor? moduleAuthor;
|
||||
ModuleContent? moduleContent;
|
||||
ModuleExtend? moduleExtend;
|
||||
ModuleBottom? moduleBottom;
|
||||
ModuleStat? moduleStat;
|
||||
|
||||
OpusModuleDataModel.fromJson(Map<String, dynamic> json) {
|
||||
moduleTop = json['module_top'] != null
|
||||
? ModuleTop.fromJson(json['module_top'])
|
||||
: null;
|
||||
moduleTitle = json['module_title'] != null
|
||||
? ModuleTitle.fromJson(json['module_title'])
|
||||
: null;
|
||||
moduleAuthor = json['module_author'] != null
|
||||
? ModuleAuthor.fromJson(json['module_author'])
|
||||
: null;
|
||||
moduleContent = json['module_content'] != null
|
||||
? ModuleContent.fromJson(json['module_content'])
|
||||
: null;
|
||||
moduleExtend = json['module_extend'] != null
|
||||
? ModuleExtend.fromJson(json['module_extend'])
|
||||
: null;
|
||||
moduleBottom = json['module_bottom'] != null
|
||||
? ModuleBottom.fromJson(json['module_bottom'])
|
||||
: null;
|
||||
moduleStat = json['module_stat'] != null
|
||||
? ModuleStat.fromJson(json['module_stat'])
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleTop {
|
||||
ModuleTop({
|
||||
this.type,
|
||||
this.video,
|
||||
});
|
||||
|
||||
int? type;
|
||||
Map? video;
|
||||
|
||||
ModuleTop.fromJson(Map<String, dynamic> json) {
|
||||
type = json['type'];
|
||||
video = json['video'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleTitle {
|
||||
ModuleTitle({
|
||||
this.text,
|
||||
});
|
||||
|
||||
String? text;
|
||||
|
||||
ModuleTitle.fromJson(Map<String, dynamic> json) {
|
||||
text = json['text'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleAuthor {
|
||||
ModuleAuthor({
|
||||
this.face,
|
||||
this.mid,
|
||||
this.name,
|
||||
this.pubTime,
|
||||
});
|
||||
|
||||
String? face;
|
||||
int? mid;
|
||||
String? name;
|
||||
String? pubTime;
|
||||
|
||||
ModuleAuthor.fromJson(Map<String, dynamic> json) {
|
||||
face = json['face'];
|
||||
mid = json['mid'];
|
||||
name = json['name'];
|
||||
pubTime = json['pub_time'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleContent {
|
||||
ModuleContent({
|
||||
this.paragraphs,
|
||||
this.moduleType,
|
||||
});
|
||||
|
||||
List<ModuleParagraph>? paragraphs;
|
||||
String? moduleType;
|
||||
|
||||
ModuleContent.fromJson(Map<String, dynamic> json) {
|
||||
if (json['paragraphs'] != null) {
|
||||
paragraphs = <ModuleParagraph>[];
|
||||
json['paragraphs'].forEach((v) {
|
||||
paragraphs!.add(ModuleParagraph.fromJson(v));
|
||||
});
|
||||
}
|
||||
moduleType = json['module_type'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleParagraph {
|
||||
ModuleParagraph({
|
||||
this.align,
|
||||
this.paraType,
|
||||
this.pic,
|
||||
this.text,
|
||||
});
|
||||
|
||||
// 0 左对齐 1 居中 2 右对齐
|
||||
int? align;
|
||||
int? paraType;
|
||||
Pics? pic;
|
||||
ModuleParagraphText? text;
|
||||
LinkCard? linkCard;
|
||||
|
||||
ModuleParagraph.fromJson(Map<String, dynamic> json) {
|
||||
align = json['align'];
|
||||
paraType = json['para_type'] == null && json['link_card'] != null
|
||||
? 3
|
||||
: json['para_type'];
|
||||
pic = json['pic'] != null ? Pics.fromJson(json['pic']) : null;
|
||||
text = json['text'] != null
|
||||
? ModuleParagraphText.fromJson(json['text'])
|
||||
: null;
|
||||
linkCard =
|
||||
json['link_card'] != null ? LinkCard.fromJson(json['link_card']) : null;
|
||||
}
|
||||
}
|
||||
|
||||
class Pics {
|
||||
Pics({
|
||||
this.pics,
|
||||
this.style,
|
||||
});
|
||||
|
||||
List<Pic>? pics;
|
||||
int? style;
|
||||
|
||||
Pics.fromJson(Map<String, dynamic> json) {
|
||||
if (json['pics'] != null) {
|
||||
pics = <Pic>[];
|
||||
json['pics'].forEach((v) {
|
||||
pics!.add(Pic.fromJson(v));
|
||||
});
|
||||
}
|
||||
style = json['style'];
|
||||
}
|
||||
}
|
||||
|
||||
class Pic {
|
||||
Pic({
|
||||
this.height,
|
||||
this.size,
|
||||
this.url,
|
||||
this.width,
|
||||
this.aspectRatio,
|
||||
this.scale,
|
||||
});
|
||||
|
||||
int? height;
|
||||
double? size;
|
||||
String? url;
|
||||
int? width;
|
||||
double? aspectRatio;
|
||||
double? scale;
|
||||
|
||||
Pic.fromJson(Map<String, dynamic> json) {
|
||||
height = json['height'];
|
||||
size = json['size'];
|
||||
url = json['url'];
|
||||
width = json['width'];
|
||||
aspectRatio = json['width'] / json['height'];
|
||||
scale = customDivision(json['width'], 600);
|
||||
}
|
||||
}
|
||||
|
||||
class LinkCard {
|
||||
LinkCard({
|
||||
this.cover,
|
||||
this.descSecond,
|
||||
this.duration,
|
||||
this.jumpUrl,
|
||||
this.title,
|
||||
});
|
||||
|
||||
String? cover;
|
||||
String? descSecond;
|
||||
String? duration;
|
||||
String? jumpUrl;
|
||||
String? title;
|
||||
|
||||
LinkCard.fromJson(Map<String, dynamic> json) {
|
||||
cover = json['card']['cover'];
|
||||
descSecond = json['card']['desc_second'];
|
||||
duration = json['card']['duration'];
|
||||
jumpUrl = json['card']['jump_url'];
|
||||
title = json['card']['title'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleParagraphText {
|
||||
ModuleParagraphText({
|
||||
this.nodes,
|
||||
});
|
||||
|
||||
List<ModuleParagraphTextNode>? nodes;
|
||||
|
||||
ModuleParagraphText.fromJson(Map<String, dynamic> json) {
|
||||
if (json['nodes'] != null) {
|
||||
nodes = <ModuleParagraphTextNode>[];
|
||||
json['nodes'].forEach((v) {
|
||||
nodes!.add(ModuleParagraphTextNode.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleParagraphTextNode {
|
||||
ModuleParagraphTextNode({
|
||||
this.type,
|
||||
this.nodeType,
|
||||
this.word,
|
||||
});
|
||||
|
||||
String? type;
|
||||
int? nodeType;
|
||||
ModuleParagraphTextNodeWord? word;
|
||||
|
||||
ModuleParagraphTextNode.fromJson(Map<String, dynamic> json) {
|
||||
type = json['type'];
|
||||
nodeType = json['node_type'];
|
||||
word = json['word'] != null
|
||||
? ModuleParagraphTextNodeWord.fromJson(json['word'])
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleParagraphTextNodeWord {
|
||||
ModuleParagraphTextNodeWord({
|
||||
this.color,
|
||||
this.fontSize,
|
||||
this.style,
|
||||
this.words,
|
||||
});
|
||||
|
||||
String? color;
|
||||
int? fontSize;
|
||||
ModuleParagraphTextNodeWordStyle? style;
|
||||
String? words;
|
||||
|
||||
ModuleParagraphTextNodeWord.fromJson(Map<String, dynamic> json) {
|
||||
color = json['color'];
|
||||
fontSize = json['font_size'];
|
||||
style = json['style'] != null
|
||||
? ModuleParagraphTextNodeWordStyle.fromJson(json['style'])
|
||||
: null;
|
||||
words = json['words'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleParagraphTextNodeWordStyle {
|
||||
ModuleParagraphTextNodeWordStyle({
|
||||
this.bold,
|
||||
});
|
||||
|
||||
bool? bold;
|
||||
|
||||
ModuleParagraphTextNodeWordStyle.fromJson(Map<String, dynamic> json) {
|
||||
bold = json['bold'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleExtend {
|
||||
ModuleExtend({
|
||||
this.items,
|
||||
});
|
||||
|
||||
List<ModuleExtendItem>? items;
|
||||
|
||||
ModuleExtend.fromJson(Map<String, dynamic> json) {
|
||||
if (json['items'] != null) {
|
||||
items = <ModuleExtendItem>[];
|
||||
json['items'].forEach((v) {
|
||||
items!.add(ModuleExtendItem.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleExtendItem {
|
||||
ModuleExtendItem({
|
||||
this.bizId,
|
||||
this.bizType,
|
||||
this.icon,
|
||||
this.jumpUrl,
|
||||
this.text,
|
||||
});
|
||||
|
||||
dynamic bizId;
|
||||
int? bizType;
|
||||
dynamic icon;
|
||||
String? jumpUrl;
|
||||
String? text;
|
||||
|
||||
ModuleExtendItem.fromJson(Map<String, dynamic> json) {
|
||||
bizId = json['biz_id'];
|
||||
bizType = json['biz_type'];
|
||||
icon = json['icon'];
|
||||
jumpUrl = json['jump_url'];
|
||||
text = json['text'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleBottom {
|
||||
ModuleBottom({
|
||||
this.shareInfo,
|
||||
});
|
||||
|
||||
ShareInfo? shareInfo;
|
||||
|
||||
ModuleBottom.fromJson(Map<String, dynamic> json) {
|
||||
shareInfo = json['share_info'] != null
|
||||
? ShareInfo.fromJson(json['share_info'])
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
class ShareInfo {
|
||||
ShareInfo({
|
||||
this.pic,
|
||||
this.summary,
|
||||
this.title,
|
||||
});
|
||||
|
||||
String? pic;
|
||||
String? summary;
|
||||
String? title;
|
||||
|
||||
ShareInfo.fromJson(Map<String, dynamic> json) {
|
||||
pic = json['pic'];
|
||||
summary = json['summary'];
|
||||
title = json['title'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleStat {
|
||||
ModuleStat({
|
||||
this.coin,
|
||||
this.comment,
|
||||
this.favorite,
|
||||
this.forward,
|
||||
this.like,
|
||||
});
|
||||
|
||||
StatItem? coin;
|
||||
StatItem? comment;
|
||||
StatItem? favorite;
|
||||
StatItem? forward;
|
||||
StatItem? like;
|
||||
|
||||
ModuleStat.fromJson(Map<String, dynamic> json) {
|
||||
coin = json['coin'] != null ? StatItem.fromJson(json['coin']) : null;
|
||||
comment =
|
||||
json['comment'] != null ? StatItem.fromJson(json['comment']) : null;
|
||||
favorite =
|
||||
json['favorite'] != null ? StatItem.fromJson(json['favorite']) : null;
|
||||
forward =
|
||||
json['forward'] != null ? StatItem.fromJson(json['forward']) : null;
|
||||
like = json['like'] != null ? StatItem.fromJson(json['like']) : null;
|
||||
}
|
||||
}
|
||||
|
||||
class StatItem {
|
||||
StatItem({
|
||||
this.count,
|
||||
this.forbidden,
|
||||
this.status,
|
||||
});
|
||||
|
||||
int? count;
|
||||
bool? forbidden;
|
||||
bool? status;
|
||||
|
||||
StatItem.fromJson(Map<String, dynamic> json) {
|
||||
count = json['count'];
|
||||
forbidden = json['forbidden'];
|
||||
status = json['status'];
|
||||
}
|
||||
}
|
||||
|
||||
double customDivision(int a, int b) {
|
||||
double result = a / b;
|
||||
if (result < 1) {
|
||||
return result;
|
||||
} else {
|
||||
return 1.0;
|
||||
}
|
||||
}
|
286
lib/models/read/read.dart
Normal file
286
lib/models/read/read.dart
Normal file
@ -0,0 +1,286 @@
|
||||
import 'package:pilipala/models/member/info.dart';
|
||||
|
||||
import 'opus.dart';
|
||||
|
||||
class ReadDataModel {
|
||||
ReadDataModel({
|
||||
this.cvid,
|
||||
this.readInfo,
|
||||
this.readViewInfo,
|
||||
this.upInfo,
|
||||
this.catalogList,
|
||||
this.recommendInfoList,
|
||||
this.hiddenInteraction,
|
||||
this.isModern,
|
||||
});
|
||||
|
||||
int? cvid;
|
||||
ReadInfo? readInfo;
|
||||
Map? readViewInfo;
|
||||
Map? upInfo;
|
||||
List<dynamic>? catalogList;
|
||||
List<dynamic>? recommendInfoList;
|
||||
bool? hiddenInteraction;
|
||||
bool? isModern;
|
||||
|
||||
ReadDataModel.fromJson(Map<String, dynamic> json) {
|
||||
cvid = json['cvid'];
|
||||
readInfo =
|
||||
json['readInfo'] != null ? ReadInfo.fromJson(json['readInfo']) : null;
|
||||
readViewInfo = json['readViewInfo'];
|
||||
upInfo = json['upInfo'];
|
||||
if (json['catalogList'] != null) {
|
||||
catalogList = <dynamic>[];
|
||||
json['catalogList'].forEach((v) {
|
||||
catalogList!.add(v);
|
||||
});
|
||||
}
|
||||
if (json['recommendInfoList'] != null) {
|
||||
recommendInfoList = <dynamic>[];
|
||||
json['recommendInfoList'].forEach((v) {
|
||||
recommendInfoList!.add(v);
|
||||
});
|
||||
}
|
||||
hiddenInteraction = json['hiddenInteraction'];
|
||||
isModern = json['isModern'];
|
||||
}
|
||||
}
|
||||
|
||||
class ReadInfo {
|
||||
ReadInfo({
|
||||
this.id,
|
||||
this.category,
|
||||
this.title,
|
||||
this.summary,
|
||||
this.bannerUrl,
|
||||
this.author,
|
||||
this.publishTime,
|
||||
this.ctime,
|
||||
this.mtime,
|
||||
this.stats,
|
||||
this.attributes,
|
||||
this.words,
|
||||
this.originImageUrls,
|
||||
this.content,
|
||||
this.opus,
|
||||
this.dynIdStr,
|
||||
this.totalArtNum,
|
||||
});
|
||||
|
||||
int? id;
|
||||
Map? category;
|
||||
String? title;
|
||||
String? summary;
|
||||
String? bannerUrl;
|
||||
Author? author;
|
||||
int? publishTime;
|
||||
int? ctime;
|
||||
int? mtime;
|
||||
Map? stats;
|
||||
int? attributes;
|
||||
int? words;
|
||||
List<String>? originImageUrls;
|
||||
String? content;
|
||||
Opus? opus;
|
||||
String? dynIdStr;
|
||||
int? totalArtNum;
|
||||
|
||||
ReadInfo.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
category = json['category'];
|
||||
title = json['title'];
|
||||
summary = json['summary'];
|
||||
bannerUrl = json['banner_url'];
|
||||
author = Author.fromJson(json['author']);
|
||||
publishTime = json['publish_time'];
|
||||
ctime = json['ctime'];
|
||||
mtime = json['mtime'];
|
||||
stats = json['stats'];
|
||||
attributes = json['attributes'];
|
||||
words = json['words'];
|
||||
if (json['origin_image_urls'] != null) {
|
||||
originImageUrls = <String>[];
|
||||
json['origin_image_urls'].forEach((v) {
|
||||
originImageUrls!.add(v);
|
||||
});
|
||||
}
|
||||
content = json['content'];
|
||||
opus = json['opus'] != null ? Opus.fromJson(json['opus']) : null;
|
||||
dynIdStr = json['dyn_id_str'];
|
||||
totalArtNum = json['total_art_num'];
|
||||
}
|
||||
}
|
||||
|
||||
class Author {
|
||||
Author({
|
||||
this.mid,
|
||||
this.name,
|
||||
this.face,
|
||||
this.vip,
|
||||
this.fans,
|
||||
this.level,
|
||||
});
|
||||
|
||||
int? mid;
|
||||
String? name;
|
||||
String? face;
|
||||
Vip? vip;
|
||||
int? fans;
|
||||
int? level;
|
||||
|
||||
Author.fromJson(Map<String, dynamic> json) {
|
||||
mid = json['mid'];
|
||||
name = json['name'];
|
||||
face = json['face'];
|
||||
vip = json['vip'] != null ? Vip.fromJson(json['vip']) : null;
|
||||
fans = json['fans'];
|
||||
level = json['level'];
|
||||
}
|
||||
}
|
||||
|
||||
class Opus {
|
||||
// "opus_id": 976625853207150600,
|
||||
// "opus_source": 2,
|
||||
// "title": "真的很想骂人 但又没什么好骂的",
|
||||
// "content": {
|
||||
// "paragraphs": [{
|
||||
// "para_type": 1,
|
||||
// "text": {
|
||||
// "nodes": [{
|
||||
// "node_type": 1,
|
||||
// "word": {
|
||||
// "words": "21年玩到今年4月的号没了 ow1的时候45的号 玩了三年 后面第9赛季一个英杰5的号(虽然是偷的 但我任何违规行为都没有还是给我封了) 最近玩的号叫velleity 只和队友打天梯以及训练赛 又没了 连带着我一个一把没玩过只玩过一场训练赛的小号也没了 实在是无话可说了...",
|
||||
// "font_size": 17,
|
||||
// "style": {},
|
||||
// "font_level": "regular"
|
||||
// }
|
||||
// }]
|
||||
// }
|
||||
// }, {
|
||||
// "para_type": 2,
|
||||
// "pic": {
|
||||
// "pics": [{
|
||||
// "url": "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fnew_dyn\u002Fba4e57459451fe74dcb70fd20bde9823316082117.jpg",
|
||||
// "width": 1600,
|
||||
// "height": 1000,
|
||||
// "size": 588.482421875
|
||||
// }],
|
||||
// "style": 1
|
||||
// }
|
||||
// }, {
|
||||
// "para_type": 1,
|
||||
// "text": {
|
||||
// "nodes": [{
|
||||
// "node_type": 1,
|
||||
// "word": {
|
||||
// "words": "\n",
|
||||
// "font_size": 17,
|
||||
// "style": {},
|
||||
// "font_level": "regular"
|
||||
// }
|
||||
// }]
|
||||
// }
|
||||
// }, {
|
||||
// "para_type": 2,
|
||||
// "pic": {
|
||||
// "pics": [{
|
||||
// "url": "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fnew_dyn\u002F0945be6b621091ddb8189482a87a36fb316082117.jpg",
|
||||
// "width": 1600,
|
||||
// "height": 1002,
|
||||
// "size": 665.7861328125
|
||||
// }],
|
||||
// "style": 1
|
||||
// }
|
||||
// }, {
|
||||
// "para_type": 1,
|
||||
// "text": {
|
||||
// "nodes": [{
|
||||
// "node_type": 1,
|
||||
// "word": {
|
||||
// "words": "\n",
|
||||
// "font_size": 17,
|
||||
// "style": {},
|
||||
// "font_level": "regular"
|
||||
// }
|
||||
// }]
|
||||
// }
|
||||
// }, {
|
||||
// "para_type": 2,
|
||||
// "pic": {
|
||||
// "pics": [{
|
||||
// "url": "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fnew_dyn\u002Ffa60649f8786578a764a1e68a2c5d23f316082117.jpg",
|
||||
// "width": 1600,
|
||||
// "height": 999,
|
||||
// "size": 332.970703125
|
||||
// }],
|
||||
// "style": 1
|
||||
// }
|
||||
// }, {
|
||||
// "para_type": 1,
|
||||
// "text": {
|
||||
// "nodes": [{
|
||||
// "node_type": 1,
|
||||
// "word": {
|
||||
// "words": "\n",
|
||||
// "font_size": 17,
|
||||
// "style": {},
|
||||
// "font_level": "regular"
|
||||
// }
|
||||
// }]
|
||||
// }
|
||||
// }]
|
||||
// },
|
||||
// "pub_info": {
|
||||
// "uid": 316082117,
|
||||
// "pub_time": 1726226826
|
||||
// },
|
||||
// "article": {
|
||||
// "category_id": 15,
|
||||
// "cover": [{
|
||||
// "url": "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fnew_dyn\u002Fbanner\u002Feb10074186a62f98c18e1b5b9deb38be316082117.png",
|
||||
// "width": 1071,
|
||||
// "height": 315,
|
||||
// "size": 225.625
|
||||
// }]
|
||||
// },
|
||||
// "version": {
|
||||
// "cvid": 38660379,
|
||||
// "version_id": 101683514411343360
|
||||
// }
|
||||
Opus({
|
||||
this.opusId,
|
||||
this.opusSource,
|
||||
this.title,
|
||||
this.content,
|
||||
});
|
||||
|
||||
int? opusId;
|
||||
int? opusSource;
|
||||
String? title;
|
||||
Content? content;
|
||||
|
||||
Opus.fromJson(Map<String, dynamic> json) {
|
||||
opusId = json['opus_id'];
|
||||
opusSource = json['opus_source'];
|
||||
title = json['title'];
|
||||
content =
|
||||
json['content'] != null ? Content.fromJson(json['content']) : null;
|
||||
}
|
||||
}
|
||||
|
||||
class Content {
|
||||
Content({
|
||||
this.paragraphs,
|
||||
});
|
||||
|
||||
List<ModuleParagraph>? paragraphs;
|
||||
|
||||
Content.fromJson(Map<String, dynamic> json) {
|
||||
if (json['paragraphs'] != null) {
|
||||
paragraphs = <ModuleParagraph>[];
|
||||
json['paragraphs'].forEach((v) {
|
||||
paragraphs!.add(ModuleParagraph.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
26
lib/models/sponsor_block/action_type.dart
Normal file
26
lib/models/sponsor_block/action_type.dart
Normal file
@ -0,0 +1,26 @@
|
||||
// 片段类型枚举
|
||||
enum ActionType {
|
||||
skip,
|
||||
mute,
|
||||
full,
|
||||
poi,
|
||||
chapter,
|
||||
}
|
||||
|
||||
extension ActionTypeExtension on ActionType {
|
||||
String get value => [
|
||||
'skip',
|
||||
'mute',
|
||||
'full',
|
||||
'poi',
|
||||
'chapter',
|
||||
][index];
|
||||
|
||||
String get label => [
|
||||
'跳过',
|
||||
'静音',
|
||||
'完整观看',
|
||||
'亮点',
|
||||
'章节切换',
|
||||
][index];
|
||||
}
|
43
lib/models/sponsor_block/segment.dart
Normal file
43
lib/models/sponsor_block/segment.dart
Normal file
@ -0,0 +1,43 @@
|
||||
import 'action_type.dart';
|
||||
import 'segment_type.dart';
|
||||
|
||||
class SegmentDataModel {
|
||||
final SegmentType? category;
|
||||
final ActionType? actionType;
|
||||
final List? segment;
|
||||
final String? uuid;
|
||||
final num? videoDuration;
|
||||
final int? locked;
|
||||
final int? votes;
|
||||
final String? description;
|
||||
// 是否已经跳过
|
||||
bool isSkip = false;
|
||||
|
||||
SegmentDataModel({
|
||||
this.category,
|
||||
this.actionType,
|
||||
this.segment,
|
||||
this.uuid,
|
||||
this.videoDuration,
|
||||
this.locked,
|
||||
this.votes,
|
||||
this.description,
|
||||
});
|
||||
|
||||
factory SegmentDataModel.fromJson(Map<String, dynamic> json) {
|
||||
return SegmentDataModel(
|
||||
category: SegmentType.values.firstWhere(
|
||||
(e) => e.value == json['category'],
|
||||
orElse: () => SegmentType.sponsor),
|
||||
actionType: ActionType.values.firstWhere(
|
||||
(e) => e.value == json['actionType'],
|
||||
orElse: () => ActionType.skip),
|
||||
segment: json['segment'],
|
||||
uuid: json['UUID'],
|
||||
videoDuration: json['videoDuration'],
|
||||
locked: json['locked'],
|
||||
votes: json['votes'],
|
||||
description: json['description'],
|
||||
);
|
||||
}
|
||||
}
|
46
lib/models/sponsor_block/segment_type.dart
Normal file
46
lib/models/sponsor_block/segment_type.dart
Normal file
@ -0,0 +1,46 @@
|
||||
// 片段类型枚举
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
enum SegmentType {
|
||||
sponsor,
|
||||
intro,
|
||||
outro,
|
||||
interaction,
|
||||
selfpromo,
|
||||
music_offtopic,
|
||||
preview,
|
||||
poi_highlight,
|
||||
filler,
|
||||
exclusive_access,
|
||||
chapter,
|
||||
}
|
||||
|
||||
extension SegmentTypeExtension on SegmentType {
|
||||
String get value => [
|
||||
'sponsor',
|
||||
'intro',
|
||||
'outro',
|
||||
'interaction',
|
||||
'selfpromo',
|
||||
'music_offtopic',
|
||||
'preview',
|
||||
'poi_highlight',
|
||||
'filler',
|
||||
'exclusive_access',
|
||||
'chapter',
|
||||
][index];
|
||||
|
||||
String get label => [
|
||||
'赞助',
|
||||
'开场介绍',
|
||||
'片尾致谢',
|
||||
'互动',
|
||||
'自我推广',
|
||||
'音乐',
|
||||
'预览',
|
||||
'亮点',
|
||||
'无效填充',
|
||||
'独家访问',
|
||||
'章节',
|
||||
][index];
|
||||
}
|
@ -39,11 +39,11 @@ class ModelResult {
|
||||
ModelResult.fromJson(Map<String, dynamic> json) {
|
||||
resultType = json['result_type'];
|
||||
summary = json['summary'];
|
||||
outline = json['result_type'] == 2
|
||||
? json['outline']
|
||||
outline = json['result_type'] == 0
|
||||
? <OutlineItem>[]
|
||||
: json['outline']
|
||||
.map<OutlineItem>((e) => OutlineItem.fromJson(e))
|
||||
.toList()
|
||||
: <OutlineItem>[];
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
276
lib/models/video/later.dart
Normal file
276
lib/models/video/later.dart
Normal file
@ -0,0 +1,276 @@
|
||||
class MediaVideoItemModel {
|
||||
MediaVideoItemModel({
|
||||
this.id,
|
||||
this.aid,
|
||||
this.offset,
|
||||
this.index,
|
||||
this.intro,
|
||||
this.attr,
|
||||
this.tid,
|
||||
this.copyRight,
|
||||
this.cntInfo,
|
||||
this.cover,
|
||||
this.duration,
|
||||
this.pubtime,
|
||||
this.likeState,
|
||||
this.favState,
|
||||
this.page,
|
||||
this.cid,
|
||||
this.pages,
|
||||
this.title,
|
||||
this.type,
|
||||
this.upper,
|
||||
this.link,
|
||||
this.bvid,
|
||||
this.shortLink,
|
||||
this.rights,
|
||||
this.elecInfo,
|
||||
this.coin,
|
||||
this.progressPercent,
|
||||
this.badge,
|
||||
this.forbidFav,
|
||||
this.moreType,
|
||||
this.businessOid,
|
||||
});
|
||||
|
||||
int? id;
|
||||
int? aid;
|
||||
int? offset;
|
||||
int? index;
|
||||
String? intro;
|
||||
int? attr;
|
||||
int? tid;
|
||||
int? copyRight;
|
||||
Map? cntInfo;
|
||||
String? cover;
|
||||
int? duration;
|
||||
int? pubtime;
|
||||
int? likeState;
|
||||
int? favState;
|
||||
int? page;
|
||||
int? cid;
|
||||
List<Page>? pages;
|
||||
String? title;
|
||||
int? type;
|
||||
Upper? upper;
|
||||
String? link;
|
||||
String? bvid;
|
||||
String? shortLink;
|
||||
Rights? rights;
|
||||
dynamic elecInfo;
|
||||
Coin? coin;
|
||||
double? progressPercent;
|
||||
dynamic badge;
|
||||
bool? forbidFav;
|
||||
int? moreType;
|
||||
int? businessOid;
|
||||
|
||||
factory MediaVideoItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
MediaVideoItemModel(
|
||||
id: json["id"],
|
||||
aid: json["id"],
|
||||
offset: json["offset"],
|
||||
index: json["index"],
|
||||
intro: json["intro"],
|
||||
attr: json["attr"],
|
||||
tid: json["tid"],
|
||||
copyRight: json["copy_right"],
|
||||
cntInfo: json["cnt_info"],
|
||||
cover: json["cover"],
|
||||
duration: json["duration"],
|
||||
pubtime: json["pubtime"],
|
||||
likeState: json["like_state"],
|
||||
favState: json["fav_state"],
|
||||
page: json["page"],
|
||||
cid: json["pages"] == null ? -1 : json["pages"].first['id'],
|
||||
// json["pages"] 可能为null
|
||||
pages: json["pages"] == null
|
||||
? []
|
||||
: List<Page>.from(json["pages"].map((x) => Page.fromJson(x))),
|
||||
title: json["title"],
|
||||
type: json["type"],
|
||||
upper: Upper.fromJson(json["upper"]),
|
||||
link: json["link"],
|
||||
bvid: json["bv_id"],
|
||||
shortLink: json["short_link"],
|
||||
rights: Rights.fromJson(json["rights"]),
|
||||
elecInfo: json["elec_info"],
|
||||
coin: Coin.fromJson(json["coin"]),
|
||||
progressPercent: json["progress_percent"].toDouble(),
|
||||
badge: json["badge"],
|
||||
forbidFav: json["forbid_fav"],
|
||||
moreType: json["more_type"],
|
||||
businessOid: json["business_oid"],
|
||||
);
|
||||
}
|
||||
|
||||
class Coin {
|
||||
Coin({
|
||||
this.maxNum,
|
||||
this.coinNumber,
|
||||
});
|
||||
|
||||
int? maxNum;
|
||||
int? coinNumber;
|
||||
|
||||
factory Coin.fromJson(Map<String, dynamic> json) => Coin(
|
||||
maxNum: json["max_num"],
|
||||
coinNumber: json["coin_number"],
|
||||
);
|
||||
}
|
||||
|
||||
class Page {
|
||||
Page({
|
||||
this.id,
|
||||
this.title,
|
||||
this.intro,
|
||||
this.duration,
|
||||
this.link,
|
||||
this.page,
|
||||
this.metas,
|
||||
this.from,
|
||||
this.dimension,
|
||||
});
|
||||
|
||||
int? id;
|
||||
String? title;
|
||||
String? intro;
|
||||
int? duration;
|
||||
String? link;
|
||||
int? page;
|
||||
List<Meta>? metas;
|
||||
String? from;
|
||||
Dimension? dimension;
|
||||
|
||||
factory Page.fromJson(Map<String, dynamic> json) => Page(
|
||||
id: json["id"],
|
||||
title: json["title"],
|
||||
intro: json["intro"],
|
||||
duration: json["duration"],
|
||||
link: json["link"],
|
||||
page: json["page"],
|
||||
metas: List<Meta>.from(json["metas"].map((x) => Meta.fromJson(x))),
|
||||
from: json["from"],
|
||||
dimension: Dimension.fromJson(json["dimension"]),
|
||||
);
|
||||
}
|
||||
|
||||
class Dimension {
|
||||
Dimension({
|
||||
this.width,
|
||||
this.height,
|
||||
this.rotate,
|
||||
});
|
||||
|
||||
int? width;
|
||||
int? height;
|
||||
int? rotate;
|
||||
|
||||
factory Dimension.fromJson(Map<String, dynamic> json) => Dimension(
|
||||
width: json["width"],
|
||||
height: json["height"],
|
||||
rotate: json["rotate"],
|
||||
);
|
||||
}
|
||||
|
||||
class Meta {
|
||||
Meta({
|
||||
this.quality,
|
||||
this.size,
|
||||
});
|
||||
|
||||
int? quality;
|
||||
int? size;
|
||||
|
||||
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
|
||||
quality: json["quality"],
|
||||
size: json["size"],
|
||||
);
|
||||
}
|
||||
|
||||
class Rights {
|
||||
Rights({
|
||||
this.bp,
|
||||
this.elec,
|
||||
this.download,
|
||||
this.movie,
|
||||
this.pay,
|
||||
this.ugcPay,
|
||||
this.hd5,
|
||||
this.noReprint,
|
||||
this.autoplay,
|
||||
this.noBackground,
|
||||
});
|
||||
|
||||
int? bp;
|
||||
int? elec;
|
||||
int? download;
|
||||
int? movie;
|
||||
int? pay;
|
||||
int? ugcPay;
|
||||
int? hd5;
|
||||
int? noReprint;
|
||||
int? autoplay;
|
||||
int? noBackground;
|
||||
|
||||
factory Rights.fromJson(Map<String, dynamic> json) => Rights(
|
||||
bp: json["bp"],
|
||||
elec: json["elec"],
|
||||
download: json["download"],
|
||||
movie: json["movie"],
|
||||
pay: json["pay"],
|
||||
ugcPay: json["ugc_pay"],
|
||||
hd5: json["hd5"],
|
||||
noReprint: json["no_reprint"],
|
||||
autoplay: json["autoplay"],
|
||||
noBackground: json["no_background"],
|
||||
);
|
||||
}
|
||||
|
||||
class Upper {
|
||||
Upper({
|
||||
this.mid,
|
||||
this.name,
|
||||
this.face,
|
||||
this.followed,
|
||||
this.fans,
|
||||
this.vipType,
|
||||
this.vipStatue,
|
||||
this.vipDueDate,
|
||||
this.vipPayType,
|
||||
this.officialRole,
|
||||
this.officialTitle,
|
||||
this.officialDesc,
|
||||
this.displayName,
|
||||
});
|
||||
|
||||
int? mid;
|
||||
String? name;
|
||||
String? face;
|
||||
int? followed;
|
||||
int? fans;
|
||||
int? vipType;
|
||||
int? vipStatue;
|
||||
int? vipDueDate;
|
||||
int? vipPayType;
|
||||
int? officialRole;
|
||||
String? officialTitle;
|
||||
String? officialDesc;
|
||||
String? displayName;
|
||||
|
||||
factory Upper.fromJson(Map<String, dynamic> json) => Upper(
|
||||
mid: json["mid"],
|
||||
name: json["name"],
|
||||
face: json["face"],
|
||||
followed: json["followed"],
|
||||
fans: json["fans"],
|
||||
vipType: json["vip_type"],
|
||||
vipStatue: json["vip_statue"],
|
||||
vipDueDate: json["vip_due_date"],
|
||||
vipPayType: json["vip_pay_type"],
|
||||
officialRole: json["official_role"],
|
||||
officialTitle: json["official_title"],
|
||||
officialDesc: json["official_desc"],
|
||||
displayName: json["display_name"],
|
||||
);
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
class ReplyContent {
|
||||
ReplyContent({
|
||||
this.message,
|
||||
this.message2,
|
||||
this.atNameToMid, // @的用户的mid null
|
||||
this.members, // 被@的用户List 如果有的话 []
|
||||
this.emote, // 表情包 如果有的话 null
|
||||
@ -13,6 +14,7 @@ class ReplyContent {
|
||||
});
|
||||
|
||||
String? message;
|
||||
String? message2;
|
||||
Map? atNameToMid;
|
||||
List<MemberItemModel>? members;
|
||||
Map? emote;
|
||||
@ -24,10 +26,17 @@ class ReplyContent {
|
||||
Map? topicsMeta;
|
||||
|
||||
ReplyContent.fromJson(Map<String, dynamic> json) {
|
||||
message = json['message']
|
||||
message = message2 = json['message']
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'");
|
||||
.replaceAll(''', "'")
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
.replaceAll(' ', ' ');
|
||||
|
||||
atNameToMid = json['at_name_to_mid'] ?? {};
|
||||
members = json['members'] != null
|
||||
? json['members']
|
||||
@ -39,8 +48,8 @@ class ReplyContent {
|
||||
pictures = json['pictures'] ?? [];
|
||||
vote = json['vote'] ?? {};
|
||||
richText = json['rich_text'] ?? {};
|
||||
// 不包含@ 笔记 图片的时候,文字可折叠
|
||||
isText = atNameToMid!.isEmpty && vote!.isEmpty && pictures!.isEmpty;
|
||||
// 不包含@ 笔记的时候,文字可折叠
|
||||
isText = atNameToMid!.isEmpty && vote!.isEmpty;
|
||||
topicsMeta = json['topics_meta'] ?? {};
|
||||
}
|
||||
}
|
||||
|
@ -6,21 +6,21 @@ import 'upper.dart';
|
||||
|
||||
class ReplyData {
|
||||
ReplyData({
|
||||
this.page,
|
||||
this.cursor,
|
||||
this.config,
|
||||
this.replies,
|
||||
this.topReplies,
|
||||
this.upper,
|
||||
});
|
||||
|
||||
ReplyPage? page;
|
||||
ReplyCursor? cursor;
|
||||
ReplyConfig? config;
|
||||
late List<ReplyItemModel>? replies;
|
||||
late List<ReplyItemModel>? topReplies;
|
||||
ReplyUpper? upper;
|
||||
|
||||
ReplyData.fromJson(Map<String, dynamic> json) {
|
||||
page = ReplyPage.fromJson(json['page']);
|
||||
cursor = ReplyCursor.fromJson(json['cursor']);
|
||||
config = ReplyConfig.fromJson(json['config']);
|
||||
replies = json['replies'] != null
|
||||
? json['replies']
|
||||
@ -38,3 +38,100 @@ class ReplyData {
|
||||
upper = ReplyUpper.fromJson(json['upper']);
|
||||
}
|
||||
}
|
||||
|
||||
class ReplyCursor {
|
||||
ReplyCursor({
|
||||
this.isBegin,
|
||||
this.prev,
|
||||
this.next,
|
||||
this.isEnd,
|
||||
this.mode,
|
||||
this.modeText,
|
||||
this.allCount,
|
||||
this.supportMode,
|
||||
this.name,
|
||||
this.paginationReply,
|
||||
this.sessionId,
|
||||
});
|
||||
|
||||
bool? isBegin;
|
||||
int? prev;
|
||||
int? next;
|
||||
bool? isEnd;
|
||||
int? mode;
|
||||
String? modeText;
|
||||
int? allCount;
|
||||
List<int>? supportMode;
|
||||
String? name;
|
||||
PaginationReply? paginationReply;
|
||||
String? sessionId;
|
||||
|
||||
ReplyCursor.fromJson(Map<String, dynamic> json) {
|
||||
isBegin = json['is_begin'];
|
||||
prev = json['prev'];
|
||||
next = json['next'];
|
||||
isEnd = json['is_end'];
|
||||
mode = json['mode'];
|
||||
modeText = json['mode_text'];
|
||||
allCount = json['all_count'] ?? 0;
|
||||
supportMode = json['support_mode'].cast<int>();
|
||||
name = json['name'];
|
||||
paginationReply = json['pagination_reply'] != null
|
||||
? PaginationReply.fromJson(json['pagination_reply'])
|
||||
: null;
|
||||
sessionId = json['session_id'];
|
||||
}
|
||||
}
|
||||
|
||||
class PaginationReply {
|
||||
PaginationReply({
|
||||
this.nextOffset,
|
||||
this.prevOffset,
|
||||
});
|
||||
String? nextOffset;
|
||||
String? prevOffset;
|
||||
PaginationReply.fromJson(Map<String, dynamic> json) {
|
||||
nextOffset = json['next_offset'];
|
||||
prevOffset = json['prev_offset'];
|
||||
}
|
||||
}
|
||||
|
||||
class ReplyReplyData {
|
||||
ReplyReplyData({
|
||||
this.page,
|
||||
this.config,
|
||||
this.replies,
|
||||
this.root,
|
||||
this.topReplies,
|
||||
this.upper,
|
||||
});
|
||||
|
||||
ReplyPage? page;
|
||||
ReplyConfig? config;
|
||||
late List<ReplyItemModel>? replies;
|
||||
ReplyItemModel? root;
|
||||
late List<ReplyItemModel>? topReplies;
|
||||
ReplyUpper? upper;
|
||||
|
||||
ReplyReplyData.fromJson(Map<String, dynamic> json) {
|
||||
page = ReplyPage.fromJson(json['page']);
|
||||
config = ReplyConfig.fromJson(json['config']);
|
||||
replies = json['replies'] != null
|
||||
? json['replies']
|
||||
.map<ReplyItemModel>(
|
||||
(item) => ReplyItemModel.fromJson(item, json['upper']['mid']))
|
||||
.toList()
|
||||
: [];
|
||||
root = json['root'] != null
|
||||
? ReplyItemModel.fromJson(json['root'], false)
|
||||
: null;
|
||||
topReplies = json['top_replies'] != null
|
||||
? json['top_replies']
|
||||
.map<ReplyItemModel>((item) => ReplyItemModel.fromJson(
|
||||
item, json['upper']['mid'],
|
||||
isTopStatus: true))
|
||||
.toList()
|
||||
: [];
|
||||
upper = ReplyUpper.fromJson(json['upper']);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ class ReplyItemModel {
|
||||
this.parent,
|
||||
this.dialog,
|
||||
this.count,
|
||||
this.rcount,
|
||||
this.floor,
|
||||
this.state,
|
||||
this.fansgrade,
|
||||
@ -41,6 +42,7 @@ class ReplyItemModel {
|
||||
int? parent;
|
||||
int? dialog;
|
||||
int? count;
|
||||
int? rcount;
|
||||
int? floor;
|
||||
int? state;
|
||||
int? fansgrade;
|
||||
@ -72,6 +74,7 @@ class ReplyItemModel {
|
||||
parent = json['parent'];
|
||||
dialog = json['dialog'];
|
||||
count = json['count'];
|
||||
rcount = json['rcount'] ?? 0;
|
||||
floor = json['floor'];
|
||||
state = json['state'];
|
||||
fansgrade = json['fansgrade'];
|
||||
@ -122,6 +125,7 @@ class ReplyControl {
|
||||
this.upLike,
|
||||
this.isShow,
|
||||
this.entryText,
|
||||
this.entryTextNum,
|
||||
this.titleText,
|
||||
this.time,
|
||||
this.location,
|
||||
@ -132,6 +136,7 @@ class ReplyControl {
|
||||
bool? upLike;
|
||||
bool? isShow;
|
||||
String? entryText;
|
||||
int? entryTextNum;
|
||||
String? titleText;
|
||||
String? time;
|
||||
String? location;
|
||||
@ -152,6 +157,10 @@ class ReplyControl {
|
||||
}
|
||||
|
||||
entryText = json['sub_reply_entry_text'];
|
||||
// 正则匹配
|
||||
entryTextNum = json['sub_reply_entry_text'] != null
|
||||
? int.parse(RegExp(r"\d+").stringMatch(json['sub_reply_entry_text']!)!)
|
||||
: 0;
|
||||
titleText = json['sub_reply_title_text'];
|
||||
time = json['time_desc'];
|
||||
location = json['location'] != null ? json['location'].split(':')[1] : '';
|
||||
|
@ -29,7 +29,7 @@ class ReplyMember {
|
||||
avatar = json['avatar'];
|
||||
level = json['level_info']['current_level'];
|
||||
pendant = Pendant.fromJson(json['pendant']);
|
||||
officialVerify = json['officia_verify'];
|
||||
officialVerify = json['official_verify'];
|
||||
vip = json['vip'];
|
||||
fansDetail = json['fans_detail'];
|
||||
userSailing = json['user_sailing'] != null
|
||||
|
17
lib/models/video/tags.dart
Normal file
17
lib/models/video/tags.dart
Normal file
@ -0,0 +1,17 @@
|
||||
class VideoTagItem {
|
||||
String? tagName;
|
||||
int? tagId;
|
||||
int? tagType;
|
||||
|
||||
VideoTagItem({
|
||||
this.tagName,
|
||||
this.tagId,
|
||||
this.tagType,
|
||||
});
|
||||
|
||||
VideoTagItem.fromJson(Map<String, dynamic> json) {
|
||||
tagName = json['tag_name'];
|
||||
tagId = json['tag_id'];
|
||||
tagType = json['type'];
|
||||
}
|
||||
}
|
@ -377,6 +377,7 @@ class Part {
|
||||
int? page;
|
||||
String? from;
|
||||
String? pagePart;
|
||||
String? title;
|
||||
int? duration;
|
||||
String? vid;
|
||||
String? weblink;
|
||||
@ -389,6 +390,7 @@ class Part {
|
||||
this.page,
|
||||
this.from,
|
||||
this.pagePart,
|
||||
this.title,
|
||||
this.duration,
|
||||
this.vid,
|
||||
this.weblink,
|
||||
@ -406,6 +408,7 @@ class Part {
|
||||
page = json["page"];
|
||||
from = json["from"];
|
||||
pagePart = json["part"];
|
||||
title = json["part"];
|
||||
duration = json["duration"];
|
||||
vid = json["vid"];
|
||||
weblink = json["weblink"];
|
||||
@ -638,6 +641,7 @@ class EpisodeItem {
|
||||
this.page,
|
||||
this.bvid,
|
||||
this.cover,
|
||||
this.pages,
|
||||
});
|
||||
int? seasonId;
|
||||
int? sectionId;
|
||||
@ -649,6 +653,10 @@ class EpisodeItem {
|
||||
Part? page;
|
||||
String? bvid;
|
||||
String? cover;
|
||||
int? pubdate;
|
||||
int? duration;
|
||||
Stat? stat;
|
||||
List<Page>? pages;
|
||||
|
||||
EpisodeItem.fromJson(Map<String, dynamic> json) {
|
||||
seasonId = json['season_id'];
|
||||
@ -661,6 +669,10 @@ class EpisodeItem {
|
||||
page = Part.fromJson(json['page']);
|
||||
bvid = json['bvid'];
|
||||
cover = json['arc']['pic'];
|
||||
pubdate = json['arc']['pubdate'];
|
||||
duration = json['arc']['duration'];
|
||||
stat = Stat.fromJson(json['arc']['stat']);
|
||||
pages = json['pages'].map<Page>((e) => Page.fromJson(e)).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -703,3 +715,18 @@ class Vip {
|
||||
status = json['status'];
|
||||
}
|
||||
}
|
||||
|
||||
class Page {
|
||||
Page({
|
||||
this.cid,
|
||||
this.page,
|
||||
});
|
||||
|
||||
int? cid;
|
||||
int? page;
|
||||
|
||||
Page.fromJson(Map<String, dynamic> json) {
|
||||
cid = json['cid'];
|
||||
page = json['page'];
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/github/latest.dart';
|
||||
import 'package:pilipala/plugin/pl_gallery/index.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../utils/cache_manage.dart';
|
||||
@ -38,9 +39,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
TextStyle subTitleStyle =
|
||||
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('关于', style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
appBar: AppBar(title: const Text('关于')),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
@ -124,7 +123,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
onTap: () => _aboutController.webSiteUrl(),
|
||||
title: const Text('访问官网'),
|
||||
trailing: Text(
|
||||
'https://pilipalanet.mysxl.cn',
|
||||
'https://pilipala.life',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
),
|
||||
@ -168,7 +167,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
onTap: () => _aboutController.tgChanel(),
|
||||
title: const Text('TG频道'),
|
||||
trailing: Text(
|
||||
'https://t.me/+lm_oOVmF0RJiODk1',
|
||||
'https://t.me/+1DFtqS6usUM5MDNl',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
),
|
||||
@ -295,7 +294,7 @@ class AboutController extends GetxController {
|
||||
displayTime: const Duration(milliseconds: 500),
|
||||
).then(
|
||||
(value) => launchUrl(
|
||||
Uri.parse('https://www.123pan.com/s/9sVqVv-flu0A.html'),
|
||||
Uri.parse('https://www.123684.com/s/9sVqVv-DEZ0A'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
),
|
||||
);
|
||||
@ -321,35 +320,41 @@ class AboutController extends GetxController {
|
||||
// tg频道
|
||||
tgChanel() {
|
||||
Clipboard.setData(
|
||||
const ClipboardData(text: 'https://t.me/+lm_oOVmF0RJiODk1'),
|
||||
const ClipboardData(text: 'https://t.me/+1DFtqS6usUM5MDNl'),
|
||||
);
|
||||
SmartDialog.showToast(
|
||||
'已复制,即将在浏览器打开',
|
||||
displayTime: const Duration(milliseconds: 500),
|
||||
).then(
|
||||
(value) => launchUrl(
|
||||
Uri.parse('https://t.me/+lm_oOVmF0RJiODk1'),
|
||||
Uri.parse('https://t.me/+1DFtqS6usUM5MDNl'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
aPay() {
|
||||
try {
|
||||
launchUrl(
|
||||
Uri.parse(
|
||||
'alipayqr://platformapi/startapp?saId=10000007&qrcode=https://qr.alipay.com/fkx14623ddwl1ping3ddd73'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
const List<String> sources = [
|
||||
'assets/images/pay/wechat.png',
|
||||
'assets/images/pay/alipay.jpg'
|
||||
];
|
||||
Navigator.of(Get.context!).push(
|
||||
HeroDialogRoute<void>(
|
||||
builder: (BuildContext context) => InteractiveviewerGallery(
|
||||
sources: sources,
|
||||
initIndex: 0,
|
||||
itemBuilder: (context, index, isFocus, enablePageView) =>
|
||||
Image.asset(sources[index]),
|
||||
actionType: const [ImgActionType.save],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 官网
|
||||
webSiteUrl() {
|
||||
launchUrl(
|
||||
Uri.parse('https://pilipalanet.mysxl.cn'),
|
||||
Uri.parse('https://pilipala.life'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
}
|
||||
|
@ -3,25 +3,27 @@ import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/bangumi.dart';
|
||||
import 'package:pilipala/models/bangumi/list.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
class BangumiController extends GetxController {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
RxList<BangumiListItemModel> bangumiList = <BangumiListItemModel>[].obs;
|
||||
RxList<BangumiListItemModel> bangumiFollowList = <BangumiListItemModel>[].obs;
|
||||
RxInt total = 0.obs;
|
||||
int _currentPage = 1;
|
||||
bool isLoadingMore = true;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
RxBool userLogin = false.obs;
|
||||
late int mid;
|
||||
var userInfo;
|
||||
UserInfoData? userInfo;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
if (userInfo != null) {
|
||||
mid = userInfo.mid;
|
||||
mid = userInfo!.mid!;
|
||||
}
|
||||
userLogin.value = userInfo != null;
|
||||
}
|
||||
@ -54,9 +56,10 @@ class BangumiController extends GetxController {
|
||||
if (userInfo == null) {
|
||||
return;
|
||||
}
|
||||
var result = await BangumiHttp.bangumiFollow(mid: userInfo.mid);
|
||||
var result = await BangumiHttp.getRecentBangumi(mid: userInfo!.mid!);
|
||||
if (result['status']) {
|
||||
bangumiFollowList.value = result['data'].list;
|
||||
total.value = result['data'].total;
|
||||
} else {}
|
||||
return result;
|
||||
}
|
||||
|
@ -2,11 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/bangumi.dart';
|
||||
import 'package:pilipala/http/constants.dart';
|
||||
import 'package:pilipala/http/search.dart';
|
||||
import 'package:pilipala/http/video.dart';
|
||||
import 'package:pilipala/models/bangumi/info.dart';
|
||||
import 'package:pilipala/models/user/fav_folder.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply/index.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||
@ -23,7 +25,7 @@ class BangumiIntroController extends GetxController {
|
||||
// 视频bvid
|
||||
String bvid = Get.parameters['bvid']!;
|
||||
var seasonId = Get.parameters['seasonId'] != null
|
||||
? int.parse(Get.parameters['seasonId']!)
|
||||
? int.tryParse(Get.parameters['seasonId']!)
|
||||
: null;
|
||||
var epId = Get.parameters['epId'] != null
|
||||
? int.tryParse(Get.parameters['epId']!)
|
||||
@ -47,33 +49,40 @@ class BangumiIntroController extends GetxController {
|
||||
RxBool hasCoin = false.obs;
|
||||
// 是否收藏
|
||||
RxBool hasFav = false.obs;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
bool userLogin = false;
|
||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||
List addMediaIdsNew = [];
|
||||
List delMediaIdsNew = [];
|
||||
// 关注状态 默认未关注
|
||||
RxMap followStatus = {}.obs;
|
||||
// 追番状态 1想看 2在看 3已看
|
||||
RxBool isFollowed = false.obs;
|
||||
RxInt followStatus = 1.obs;
|
||||
int _tempThemeValue = -1;
|
||||
var userInfo;
|
||||
UserInfoData? userInfo;
|
||||
PersistentBottomSheetController? bottomSheetController;
|
||||
List<Map<String, dynamic>> followStatusList = [
|
||||
{'title': '标记为 「想看」', 'status': 1},
|
||||
{'title': '标记为 「在看」', 'status': 2},
|
||||
{'title': '标记为 「已看」', 'status': 3},
|
||||
{'title': '取消追番', 'status': -1},
|
||||
];
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
print('bangumi: ${Get.parameters.toString()}');
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
userLogin = userInfo != null;
|
||||
if (userLogin && seasonId != null) {
|
||||
bangumiStatus();
|
||||
}
|
||||
}
|
||||
|
||||
// 获取番剧简介&选集
|
||||
Future queryBangumiIntro() async {
|
||||
if (userLogin) {
|
||||
// 获取点赞状态
|
||||
queryHasLikeVideo();
|
||||
// 获取投币状态
|
||||
queryHasCoinVideo();
|
||||
// 获取收藏状态
|
||||
queryHasFavVideo();
|
||||
// 获取点赞投币收藏状态
|
||||
bangumiActionStatus();
|
||||
}
|
||||
var result = await SearchHttp.bangumiInfo(seasonId: seasonId, epId: epId);
|
||||
if (result['status']) {
|
||||
@ -83,26 +92,15 @@ class BangumiIntroController extends GetxController {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 获取点赞状态
|
||||
Future queryHasLikeVideo() async {
|
||||
var result = await VideoHttp.hasLikeVideo(bvid: bvid);
|
||||
// data num 被点赞标志 0:未点赞 1:已点赞
|
||||
hasLike.value = result["data"] == 1 ? true : false;
|
||||
}
|
||||
|
||||
// 获取投币状态
|
||||
Future queryHasCoinVideo() async {
|
||||
var result = await VideoHttp.hasCoinVideo(bvid: bvid);
|
||||
hasCoin.value = result["data"]['multiply'] == 0 ? false : true;
|
||||
}
|
||||
|
||||
// 获取收藏状态
|
||||
Future queryHasFavVideo() async {
|
||||
var result = await VideoHttp.hasFavVideo(aid: IdUtils.bv2av(bvid));
|
||||
// 获取番剧点赞投币收藏状态
|
||||
Future bangumiActionStatus() async {
|
||||
var result = await BangumiHttp.bangumiActionStatus(epId: epId!);
|
||||
if (result['status']) {
|
||||
hasFav.value = result["data"]['favoured'];
|
||||
hasLike.value = result['data']['like'] == 1;
|
||||
hasCoin.value = result['data']['coin_number'] != 0;
|
||||
hasFav.value = result['data']['favorite'] == 1;
|
||||
} else {
|
||||
hasFav.value = false;
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +108,7 @@ class BangumiIntroController extends GetxController {
|
||||
Future actionLikeVideo() async {
|
||||
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
|
||||
if (result['status']) {
|
||||
SmartDialog.showToast(!hasLike.value ? '点赞成功 👍' : '取消赞');
|
||||
SmartDialog.showToast(!hasLike.value ? '点赞成功' : '取消赞');
|
||||
hasLike.value = !hasLike.value;
|
||||
bangumiDetail.value.stat!['likes'] =
|
||||
bangumiDetail.value.stat!['likes'] + (!hasLike.value ? 1 : -1);
|
||||
@ -147,7 +145,7 @@ class BangumiIntroController extends GetxController {
|
||||
var res = await VideoHttp.coinVideo(
|
||||
bvid: bvid, multiply: _tempThemeValue);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast('投币成功 👏');
|
||||
SmartDialog.showToast('投币成功');
|
||||
hasCoin.value = true;
|
||||
bangumiDetail.value.stat!['coins'] =
|
||||
bangumiDetail.value.stat!['coins'] +
|
||||
@ -185,9 +183,11 @@ class BangumiIntroController extends GetxController {
|
||||
addMediaIdsNew = [];
|
||||
delMediaIdsNew = [];
|
||||
// 重新获取收藏状态
|
||||
queryHasFavVideo();
|
||||
SmartDialog.showToast('✅ 操作成功');
|
||||
bangumiActionStatus();
|
||||
SmartDialog.showToast('操作成功');
|
||||
Get.back();
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,21 +239,28 @@ class BangumiIntroController extends GetxController {
|
||||
|
||||
// 追番
|
||||
Future bangumiAdd() async {
|
||||
var result =
|
||||
await VideoHttp.bangumiAdd(seasonId: bangumiDetail.value.seasonId);
|
||||
var result = await VideoHttp.bangumiAdd(
|
||||
seasonId: seasonId ?? bangumiDetail.value.seasonId);
|
||||
if (result['status']) {
|
||||
followStatus.value = 2;
|
||||
isFollowed.value = true;
|
||||
}
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
|
||||
// 取消追番
|
||||
Future bangumiDel() async {
|
||||
var result =
|
||||
await VideoHttp.bangumiDel(seasonId: bangumiDetail.value.seasonId);
|
||||
var result = await VideoHttp.bangumiDel(
|
||||
seasonId: seasonId ?? bangumiDetail.value.seasonId);
|
||||
if (result['status']) {
|
||||
isFollowed.value = false;
|
||||
}
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
|
||||
Future queryVideoInFolder() async {
|
||||
var result = await VideoHttp.videoInFolder(
|
||||
mid: userInfo.mid, rid: IdUtils.bv2av(bvid));
|
||||
mid: userInfo!.mid!, rid: IdUtils.bv2av(bvid));
|
||||
if (result['status']) {
|
||||
favFolderData.value = result['data'];
|
||||
}
|
||||
@ -302,18 +309,48 @@ class BangumiIntroController extends GetxController {
|
||||
episodes: episodes,
|
||||
currentCid: videoDetailCtr.cid.value,
|
||||
dataType: dataType,
|
||||
context: Get.context!,
|
||||
sheetHeight: Get.size.height,
|
||||
isFullScreen: true,
|
||||
changeFucCall: (item, index) {
|
||||
changeSeasonOrbangu(item.bvid, item.cid, item.aid, item.cover);
|
||||
SmartDialog.dismiss();
|
||||
},
|
||||
).buildShowContent(Get.context!),
|
||||
).buildShowContent(),
|
||||
);
|
||||
}
|
||||
|
||||
hiddenEpisodeBottomSheet() {
|
||||
bottomSheetController?.close();
|
||||
}
|
||||
|
||||
// 获取追番状态
|
||||
Future bangumiStatus() async {
|
||||
var result = await BangumiHttp.bangumiStatus(seasonId: seasonId!);
|
||||
if (result['status']) {
|
||||
followStatus.value = result['data']['followStatus'];
|
||||
isFollowed.value = result['data']['isFollowed'];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// 更新追番状态
|
||||
Future updateBangumiStatus(int status) async {
|
||||
Get.back();
|
||||
if (status == -1) {
|
||||
bangumiDel();
|
||||
} else {
|
||||
var result = await BangumiHttp.bangumiStatus(seasonId: seasonId!);
|
||||
if (result['status']) {
|
||||
followStatus.value = status;
|
||||
final title = followStatusList.firstWhere(
|
||||
(e) => e['status'] == status,
|
||||
orElse: () => {'title': '未知状态'},
|
||||
)['title'];
|
||||
SmartDialog.showToast('追番状态$title');
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import 'package:pilipala/pages/bangumi/widgets/bangumi_panel.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/fav_panel.dart';
|
||||
import 'package:pilipala/plugin/pl_gallery/index.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import '../../../common/widgets/http_error.dart';
|
||||
@ -115,7 +116,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
String heroTag = Get.arguments['heroTag'];
|
||||
late final BangumiIntroController bangumiIntroController;
|
||||
late final VideoDetailController videoDetailCtr;
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box localCache = GStorage.localCache;
|
||||
late double sheetHeight;
|
||||
int? cid;
|
||||
bool isProcessing = false;
|
||||
@ -146,17 +147,34 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
}
|
||||
|
||||
// 收藏
|
||||
showFavBottomSheet() {
|
||||
if (bangumiIntroController.userInfo.mid == null) {
|
||||
showFavBottomSheet() async {
|
||||
if (bangumiIntroController.userInfo?.mid == null) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
final mediaQueryData = MediaQuery.of(context);
|
||||
final contentHeight = mediaQueryData.size.height - kToolbarHeight;
|
||||
final double initialChildSize =
|
||||
(contentHeight - Get.width * 9 / 16) / contentHeight;
|
||||
await showModalBottomSheet(
|
||||
context: Get.context!,
|
||||
useSafeArea: true,
|
||||
isScrollControlled: true,
|
||||
builder: (BuildContext context) {
|
||||
return FavPanel(ctr: bangumiIntroController);
|
||||
return DraggableScrollableSheet(
|
||||
initialChildSize: initialChildSize,
|
||||
minChildSize: 0,
|
||||
maxChildSize: 1,
|
||||
snap: true,
|
||||
expand: false,
|
||||
snapSizes: [initialChildSize],
|
||||
builder: (BuildContext context, ScrollController scrollController) {
|
||||
return FavPanel(
|
||||
ctr: bangumiIntroController,
|
||||
scrollController: scrollController,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -188,10 +206,24 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 105,
|
||||
height: 160,
|
||||
src: widget.bangumiDetail!.cover!,
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
HeroDialogRoute<void>(
|
||||
builder: (BuildContext context) =>
|
||||
InteractiveviewerGallery(
|
||||
sources: [widget.bangumiDetail!.cover!],
|
||||
initIndex: 0,
|
||||
onPageChanged: (int pageIndex) {},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: NetworkImgLayer(
|
||||
width: 115,
|
||||
height: 115 / 0.75,
|
||||
src: widget.bangumiDetail!.cover!,
|
||||
),
|
||||
),
|
||||
PBadge(
|
||||
text:
|
||||
@ -207,106 +239,65 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () => showIntroDetail(),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: SizedBox(
|
||||
height: 158,
|
||||
child: Column(
|
||||
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(
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(
|
||||
EdgeInsets.zero),
|
||||
backgroundColor:
|
||||
MaterialStateProperty.resolveWith(
|
||||
(Set<MaterialState> states) {
|
||||
return t.colorScheme.primaryContainer
|
||||
.withOpacity(0.7);
|
||||
}),
|
||||
),
|
||||
onPressed: () =>
|
||||
bangumiIntroController.bangumiAdd(),
|
||||
icon: Icon(
|
||||
Icons.favorite_border_rounded,
|
||||
color: t.colorScheme.primary,
|
||||
size: 22,
|
||||
height: 115 / 0.75,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(6, 4, 6, 6),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.bangumiDetail!.title!,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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: 20),
|
||||
Obx(
|
||||
() => BangumiStatusWidget(
|
||||
ctr: bangumiIntroController,
|
||||
isFollowed:
|
||||
bangumiIntroController.isFollowed.value,
|
||||
),
|
||||
),
|
||||
),
|
||||
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: 4),
|
||||
Row(
|
||||
children: [
|
||||
StatView(
|
||||
view: widget.bangumiDetail!.stat!['views'],
|
||||
size: 'medium',
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
danmu: widget.bangumiDetail!.stat!['danmakus'],
|
||||
size: 'medium',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'简介:${widget.bangumiDetail!.evaluate!}',
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: t.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -396,3 +387,97 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 追番状态
|
||||
class BangumiStatusWidget extends StatelessWidget {
|
||||
final BangumiIntroController ctr;
|
||||
final bool isFollowed;
|
||||
|
||||
const BangumiStatusWidget({
|
||||
Key? key,
|
||||
required this.ctr,
|
||||
required this.isFollowed,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
void updateFollowStatus() {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
builder: (context) {
|
||||
return morePanel(context, ctr);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return Obx(
|
||||
() => SizedBox(
|
||||
width: 34,
|
||||
height: 34,
|
||||
child: IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
backgroundColor:
|
||||
MaterialStateProperty.resolveWith((Set<MaterialState> states) {
|
||||
return ctr.isFollowed.value
|
||||
? colorScheme.primaryContainer.withOpacity(0.7)
|
||||
: colorScheme.outlineVariant.withOpacity(0.7);
|
||||
}),
|
||||
),
|
||||
onPressed:
|
||||
isFollowed ? () => updateFollowStatus() : () => ctr.bangumiAdd(),
|
||||
icon: Icon(
|
||||
ctr.isFollowed.value
|
||||
? Icons.favorite
|
||||
: Icons.favorite_border_rounded,
|
||||
color: ctr.isFollowed.value
|
||||
? colorScheme.primary
|
||||
: colorScheme.outline,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget morePanel(BuildContext context, BangumiIntroController ctr) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
...ctr.followStatusList
|
||||
.map(
|
||||
(e) => ListTile(
|
||||
onTap: () => ctr.updateBangumiStatus(e['status']),
|
||||
selected: ctr.followStatus == e['status'],
|
||||
title: Text(e['title']),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
Box localCache = GStrorage.localCache;
|
||||
Box localCache = GStorage.localCache;
|
||||
late double sheetHeight;
|
||||
|
||||
class IntroDetail extends StatelessWidget {
|
||||
@ -60,13 +60,11 @@ class IntroDetail extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
StatView(
|
||||
theme: 'gray',
|
||||
view: bangumiDetail!.stat!['views'],
|
||||
size: 'medium',
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
theme: 'gray',
|
||||
danmu: bangumiDetail!.stat!['danmakus'],
|
||||
size: 'medium',
|
||||
),
|
||||
|
@ -76,9 +76,14 @@ class _BangumiPageState extends State<BangumiPage>
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'最近追番',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
Obx(
|
||||
() => 0 != _bangumidController.total.value
|
||||
? Text(
|
||||
'我的追番(${_bangumidController.total.value})',
|
||||
style:
|
||||
Theme.of(context).textTheme.titleMedium,
|
||||
)
|
||||
: const SizedBox(),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
@ -96,7 +101,8 @@ class _BangumiPageState extends State<BangumiPage>
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 268,
|
||||
height: Get.size.width / 3 / 0.75 +
|
||||
MediaQuery.textScalerOf(context).scale(50.0),
|
||||
child: FutureBuilder(
|
||||
future: _futureBuilderFutureFollow,
|
||||
builder:
|
||||
@ -117,7 +123,6 @@ class _BangumiPageState extends State<BangumiPage>
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
width: Get.size.width / 3,
|
||||
height: 254,
|
||||
margin: EdgeInsets.only(
|
||||
left: StyleString.safeSpace,
|
||||
right: index ==
|
||||
@ -183,8 +188,10 @@ class _BangumiPageState extends State<BangumiPage>
|
||||
return HttpError(
|
||||
errMsg: data['msg'],
|
||||
fn: () {
|
||||
_futureBuilderFuture =
|
||||
_bangumidController.queryBangumiListFeed();
|
||||
setState(() {
|
||||
_futureBuilderFuture =
|
||||
_bangumidController.queryBangumiListFeed();
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -208,8 +215,8 @@ class _BangumiPageState extends State<BangumiPage>
|
||||
crossAxisSpacing: StyleString.cardSpace,
|
||||
// 列数
|
||||
crossAxisCount: 3,
|
||||
mainAxisExtent: Get.size.width / 3 / 0.65 +
|
||||
MediaQuery.textScalerOf(context).scale(32.0),
|
||||
mainAxisExtent: Get.size.width / 3 / 0.75 +
|
||||
MediaQuery.textScalerOf(context).scale(42.0),
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
|
@ -5,9 +5,9 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/models/bangumi/info.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
import '../../../common/pages_bottom_sheet.dart';
|
||||
import '../../../models/common/video_episode_type.dart';
|
||||
import '../introduction/controller.dart';
|
||||
@ -37,14 +37,13 @@ class BangumiPanel extends StatefulWidget {
|
||||
class _BangumiPanelState extends State<BangumiPanel> {
|
||||
late RxInt currentIndex = (-1).obs;
|
||||
final ScrollController listViewScrollCtr = ScrollController();
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
dynamic userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
UserInfoData? userInfo;
|
||||
// 默认未开通
|
||||
int vipStatus = 0;
|
||||
late int cid;
|
||||
String heroTag = Get.arguments['heroTag'];
|
||||
late final VideoDetailController videoDetailCtr;
|
||||
final ItemScrollController itemScrollController = ItemScrollController();
|
||||
late PersistentBottomSheetController? _bottomSheetController;
|
||||
|
||||
@override
|
||||
@ -65,7 +64,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
/// 获取大会员状态
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
if (userInfo != null) {
|
||||
vipStatus = userInfo.vipStatus;
|
||||
vipStatus = userInfo!.vipStatus!;
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,9 +85,11 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
item.aid,
|
||||
item.cover,
|
||||
);
|
||||
if (_bottomSheetController != null) {
|
||||
_bottomSheetController?.close();
|
||||
}
|
||||
try {
|
||||
if (_bottomSheetController != null) {
|
||||
_bottomSheetController?.close();
|
||||
}
|
||||
} catch (_) {}
|
||||
currentIndex.value = i;
|
||||
scrollToIndex();
|
||||
}
|
||||
@ -149,7 +150,6 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
changeFucCall: changeFucCall,
|
||||
sheetHeight: widget.sheetHeight,
|
||||
dataType: VideoEpidoesType.bangumiEpisode,
|
||||
context: context,
|
||||
).show(context);
|
||||
},
|
||||
child: Text(
|
||||
@ -174,59 +174,60 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
return Container(
|
||||
width: 150,
|
||||
margin: const EdgeInsets.only(right: 10),
|
||||
child: Material(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: InkWell(
|
||||
onTap: () => changeFucCall(page, i),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 10,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
if (isSelected) ...<Widget>[
|
||||
Image.asset('assets/images/live.png',
|
||||
color: primary, height: 12),
|
||||
const SizedBox(width: 6)
|
||||
],
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
onTap: () => changeFucCall(page, i),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 10,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
if (isSelected) ...<Widget>[
|
||||
Image.asset('assets/images/live.png',
|
||||
color: primary, height: 12),
|
||||
const SizedBox(width: 6)
|
||||
],
|
||||
Text(
|
||||
'第${i + 1}话',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: isSelected ? primary : onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
if (page.badge != null) ...[
|
||||
const Spacer(),
|
||||
Text(
|
||||
'第${i + 1}话',
|
||||
page.badge!,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: isSelected ? primary : onSurface,
|
||||
fontSize: 12,
|
||||
color: primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
if (page.badge != null) ...[
|
||||
const Spacer(),
|
||||
Text(
|
||||
page.badge!,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: primary,
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
page.longTitle!,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: isSelected ? primary : onSurface,
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
page.longTitle!,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: isSelected ? primary : onSurface,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)
|
||||
],
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -25,6 +25,7 @@ class BangumiCardV extends StatelessWidget {
|
||||
RoutePush.bangumiPush(
|
||||
bangumiItem.seasonId,
|
||||
null,
|
||||
progressIndex: bangumiItem.progressIndex,
|
||||
heroTag: heroTag,
|
||||
);
|
||||
},
|
||||
@ -37,7 +38,7 @@ class BangumiCardV extends StatelessWidget {
|
||||
StyleString.imgRadius,
|
||||
),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 0.65,
|
||||
aspectRatio: 0.75,
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
final double maxWidth = boxConstraints.maxWidth;
|
||||
final double maxHeight = boxConstraints.maxHeight;
|
||||
|
@ -22,7 +22,7 @@ class _BlackListPageState extends State<BlackListPage> {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
Future? _futureBuilderFuture;
|
||||
bool _isLoadingMore = false;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -55,14 +55,9 @@ class _BlackListPageState extends State<BlackListPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Obx(
|
||||
() => Text(
|
||||
'黑名单管理 - ${_blackListController.total.value}',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
'黑名单管理 ${_blackListController.total.value == 0 ? '' : '- ${_blackListController.total.value}'}',
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -76,14 +71,20 @@ class _BlackListPageState extends State<BlackListPage> {
|
||||
if (data['status']) {
|
||||
List<BlackListItem> list = _blackListController.blackList;
|
||||
return Obx(
|
||||
() => list.length == 1
|
||||
? const SizedBox()
|
||||
() => list.isEmpty
|
||||
? HttpError(
|
||||
errMsg: '你没有拉黑任何人哦~_~',
|
||||
fn: () => {},
|
||||
isInSliver: false,
|
||||
)
|
||||
: ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount: list.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ListTile(
|
||||
onTap: () {},
|
||||
onTap: () => Get.toNamed(
|
||||
'/member?mid=${list[index].mid}',
|
||||
arguments: {'face': list[index].face}),
|
||||
leading: NetworkImgLayer(
|
||||
width: 45,
|
||||
height: 45,
|
||||
@ -115,13 +116,10 @@ class _BlackListPageState extends State<BlackListPage> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return CustomScrollView(
|
||||
slivers: [
|
||||
HttpError(
|
||||
errMsg: data['msg'],
|
||||
fn: () => _blackListController.queryBlacklist(),
|
||||
)
|
||||
],
|
||||
return HttpError(
|
||||
errMsg: data['msg'],
|
||||
fn: () => _blackListController.queryBlacklist(),
|
||||
isInSliver: false,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
@ -32,7 +32,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
|
||||
late PlDanmakuController _plDanmakuController;
|
||||
DanmakuController? _controller;
|
||||
// bool danmuPlayStatus = true;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
late bool enableShowDanmaku;
|
||||
late List blockTypes;
|
||||
late double showArea;
|
||||
|
@ -10,6 +10,7 @@ import 'package:pilipala/models/common/dynamics_type.dart';
|
||||
import 'package:pilipala/models/dynamics/result.dart';
|
||||
import 'package:pilipala/models/dynamics/up.dart';
|
||||
import 'package:pilipala/models/live/item.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import 'package:pilipala/utils/route_push.dart';
|
||||
@ -50,11 +51,11 @@ class DynamicsController extends GetxController {
|
||||
];
|
||||
bool flag = false;
|
||||
RxInt initialValue = 0.obs;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
RxBool userLogin = false.obs;
|
||||
var userInfo;
|
||||
UserInfoData? userInfo;
|
||||
RxBool isLoadingDynamic = false.obs;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@ -146,20 +147,26 @@ class DynamicsController extends GetxController {
|
||||
/// 专栏文章查看
|
||||
case 'DYNAMIC_TYPE_ARTICLE':
|
||||
String title = item.modules.moduleDynamic.major.opus.title;
|
||||
String url = item.modules.moduleDynamic.major.opus.jumpUrl;
|
||||
if (url.contains('opus') || url.contains('read')) {
|
||||
String jumpUrl = item.modules.moduleDynamic.major.opus.jumpUrl;
|
||||
String url =
|
||||
jumpUrl.startsWith('//') ? jumpUrl.split('//').last : jumpUrl;
|
||||
if (jumpUrl.contains('opus') || jumpUrl.contains('read')) {
|
||||
RegExp digitRegExp = RegExp(r'\d+');
|
||||
Iterable<Match> matches = digitRegExp.allMatches(url);
|
||||
Iterable<Match> matches = digitRegExp.allMatches(jumpUrl);
|
||||
String number = matches.first.group(0)!;
|
||||
if (url.contains('read')) {
|
||||
number = 'cv$number';
|
||||
if (jumpUrl.contains('read')) {
|
||||
Get.toNamed('/read', parameters: {
|
||||
'title': title,
|
||||
'id': number,
|
||||
'articleType': url.split('/')[1]
|
||||
});
|
||||
} else {
|
||||
Get.toNamed('/opus', parameters: {
|
||||
'title': title,
|
||||
'id': number,
|
||||
'articleType': 'opus'
|
||||
});
|
||||
}
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
'url': url.startsWith('//') ? url.split('//').last : url,
|
||||
'title': title,
|
||||
'id': number,
|
||||
'dynamicType': url.split('//').last.split('/')[1]
|
||||
});
|
||||
} else {
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
@ -240,7 +247,7 @@ class DynamicsController extends GetxController {
|
||||
}
|
||||
upData.value.upList!.insertAll(0, [
|
||||
UpItem(face: '', uname: '全部动态', mid: -1),
|
||||
UpItem(face: userInfo.face, uname: '我', mid: userInfo.mid),
|
||||
UpItem(face: userInfo!.face, uname: '我', mid: userInfo!.mid),
|
||||
]);
|
||||
}
|
||||
return res;
|
||||
|
@ -14,7 +14,7 @@ class DynamicDetailController extends GetxController {
|
||||
int? type;
|
||||
dynamic item;
|
||||
int? floor;
|
||||
int currentPage = 0;
|
||||
String nextOffset = "";
|
||||
bool isLoadingMore = false;
|
||||
RxString noMore = ''.obs;
|
||||
RxList<ReplyItemModel> replyList = <ReplyItemModel>[].obs;
|
||||
@ -24,8 +24,9 @@ class DynamicDetailController extends GetxController {
|
||||
ReplySortType _sortType = ReplySortType.time;
|
||||
RxString sortTypeTitle = ReplySortType.time.titles.obs;
|
||||
RxString sortTypeLabel = ReplySortType.time.labels.obs;
|
||||
Box setting = GStrorage.setting;
|
||||
Box setting = GStorage.setting;
|
||||
RxInt replyReqCode = 200.obs;
|
||||
bool isEnd = false;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@ -36,38 +37,42 @@ class DynamicDetailController extends GetxController {
|
||||
acount.value =
|
||||
int.parse(item!.modules!.moduleStat!.comment!.count ?? '0');
|
||||
}
|
||||
int deaultReplySortIndex =
|
||||
int defaultReplySortIndex =
|
||||
setting.get(SettingBoxKey.replySortType, defaultValue: 0);
|
||||
if (deaultReplySortIndex == 2) {
|
||||
if (defaultReplySortIndex == 2) {
|
||||
setting.put(SettingBoxKey.replySortType, 0);
|
||||
deaultReplySortIndex = 0;
|
||||
defaultReplySortIndex = 0;
|
||||
}
|
||||
_sortType = ReplySortType.values[deaultReplySortIndex];
|
||||
_sortType = ReplySortType.values[defaultReplySortIndex];
|
||||
sortTypeTitle.value = _sortType.titles;
|
||||
sortTypeLabel.value = _sortType.labels;
|
||||
}
|
||||
|
||||
Future queryReplyList({reqType = 'init'}) async {
|
||||
if (isLoadingMore || noMore.value == '没有更多了' || isEnd) {
|
||||
return;
|
||||
}
|
||||
isLoadingMore = true;
|
||||
if (reqType == 'init') {
|
||||
currentPage = 0;
|
||||
nextOffset = '';
|
||||
noMore.value = '';
|
||||
}
|
||||
var res = await ReplyHttp.replyList(
|
||||
oid: oid!,
|
||||
pageNum: currentPage + 1,
|
||||
nextOffset: nextOffset,
|
||||
type: type!,
|
||||
sort: _sortType.index,
|
||||
);
|
||||
if (res['status']) {
|
||||
List<ReplyItemModel> replies = res['data'].replies;
|
||||
acount.value = res['data'].page.acount;
|
||||
isEnd = res['data'].cursor.isEnd ?? false;
|
||||
acount.value = res['data'].cursor.allCount;
|
||||
nextOffset = res['data'].cursor.paginationReply.nextOffset ?? "";
|
||||
if (replies.isNotEmpty) {
|
||||
currentPage++;
|
||||
noMore.value = '加载中...';
|
||||
if (replies.length < 20) {
|
||||
noMore.value = '没有更多了';
|
||||
}
|
||||
noMore.value = isEnd ? '没有更多了' : '加载中...';
|
||||
} else {
|
||||
noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了';
|
||||
noMore.value =
|
||||
replyList.isEmpty && nextOffset == "" ? '还没有评论' : '没有更多了';
|
||||
}
|
||||
if (reqType == 'init') {
|
||||
// 添加置顶回复
|
||||
@ -113,4 +118,20 @@ class DynamicDetailController extends GetxController {
|
||||
var res = await HtmlHttp.reqHtml(id, 'opus');
|
||||
oid = res['commentId'];
|
||||
}
|
||||
|
||||
// 上拉加载
|
||||
Future onLoad() async {
|
||||
queryReplyList(reqType: 'onLoad');
|
||||
}
|
||||
|
||||
Future removeReply(int? rpid, int? frpid) async {
|
||||
// 移除一楼评论
|
||||
if (rpid != null) {
|
||||
replyList.removeWhere((item) {
|
||||
return item.rpid == rpid;
|
||||
});
|
||||
}
|
||||
|
||||
/// TODO 移除二楼评论
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,9 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
with TickerProviderStateMixin {
|
||||
late DynamicDetailController _dynamicDetailController;
|
||||
late AnimationController fabAnimationCtr;
|
||||
Future? _futureBuilderFuture;
|
||||
late StreamController<bool> titleStreamC; // appBar title
|
||||
late Future _futureBuilderFuture;
|
||||
late StreamController<bool> titleStreamC =
|
||||
StreamController<bool>.broadcast(); // appBar title
|
||||
late ScrollController scrollController;
|
||||
bool _visibleTitle = false;
|
||||
String? action;
|
||||
@ -48,7 +49,6 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
super.initState();
|
||||
// floor 1原创 2转发
|
||||
init();
|
||||
titleStreamC = StreamController<bool>();
|
||||
if (action == 'comment') {
|
||||
_visibleTitle = true;
|
||||
titleStreamC.add(true);
|
||||
@ -111,14 +111,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
int rpid = replyItem.rpid!;
|
||||
Get.to(
|
||||
() => Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
centerTitle: false,
|
||||
title: Text(
|
||||
'评论详情',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
appBar: AppBar(title: const Text('评论详情')),
|
||||
body: VideoReplyReplyPanel(
|
||||
oid: oid,
|
||||
rpid: rpid,
|
||||
@ -140,7 +133,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
if (scrollController.position.pixels >=
|
||||
scrollController.position.maxScrollExtent - 300) {
|
||||
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
||||
_dynamicDetailController.queryReplyList(reqType: 'onLoad');
|
||||
_dynamicDetailController.onLoad();
|
||||
});
|
||||
}
|
||||
|
||||
@ -192,10 +185,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 1,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: StreamBuilder(
|
||||
stream: titleStreamC.stream,
|
||||
initialData: false,
|
||||
@ -278,8 +268,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
future: _futureBuilderFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
Map data = snapshot.data as Map;
|
||||
if (snapshot.data['status']) {
|
||||
Map? data = snapshot.data;
|
||||
if (data != null && snapshot.data['status']) {
|
||||
RxList<ReplyItemModel> replyList =
|
||||
_dynamicDetailController.replyList;
|
||||
// 请求成功
|
||||
@ -335,6 +325,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
.replies!
|
||||
.add(replyItem);
|
||||
},
|
||||
onDelete:
|
||||
_dynamicDetailController.removeReply,
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -345,8 +337,11 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
} else {
|
||||
// 请求错误
|
||||
return HttpError(
|
||||
errMsg: data['msg'],
|
||||
fn: () => setState(() {}),
|
||||
errMsg: data?['msg'] ?? '请求异常',
|
||||
fn: () => setState(() {
|
||||
_futureBuilderFuture =
|
||||
_dynamicDetailController.queryReplyList();
|
||||
}),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
310
lib/pages/dynamics/forward/index.dart
Normal file
310
lib/pages/dynamics/forward/index.dart
Normal file
@ -0,0 +1,310 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/http/dynamics.dart';
|
||||
import 'package:pilipala/models/dynamics/result.dart';
|
||||
|
||||
import '../widgets/rich_node_panel.dart';
|
||||
|
||||
class DynamicForwardPage extends StatefulWidget {
|
||||
const DynamicForwardPage({
|
||||
super.key,
|
||||
this.item,
|
||||
this.mid,
|
||||
this.cb,
|
||||
});
|
||||
|
||||
final DynamicItemModel? item;
|
||||
final int? mid;
|
||||
final Function()? cb;
|
||||
|
||||
@override
|
||||
State<DynamicForwardPage> createState() => _DynamicForwardPageState();
|
||||
}
|
||||
|
||||
class _DynamicForwardPageState extends State<DynamicForwardPage> {
|
||||
final TextEditingController _inputController = TextEditingController();
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
RxBool isExpand = false.obs;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_focusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void dynamicForward(String type) async {
|
||||
String dynamicId = widget.item!.idStr!;
|
||||
var res = await DynamicsHttp.dynamicCreate(
|
||||
dynIdStr: dynamicId,
|
||||
mid: widget.mid!,
|
||||
rawText: type == 'quickForward' ? '' : _inputController.text,
|
||||
scene: 4,
|
||||
);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast('转发成功');
|
||||
widget.cb?.call();
|
||||
_onClose();
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
void _onClose() async {
|
||||
_focusNode.unfocus();
|
||||
await Future.delayed(const Duration(milliseconds: 120));
|
||||
Get.back();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(
|
||||
() {
|
||||
final EdgeInsetsGeometry padding = EdgeInsets.fromLTRB(
|
||||
isExpand.value ? 10 : 16,
|
||||
10,
|
||||
isExpand.value ? 12 : 12,
|
||||
0,
|
||||
);
|
||||
return AnimatedSize(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
onEnd: () => isExpand.value ? _focusNode.requestFocus() : null,
|
||||
child: Column(
|
||||
mainAxisSize: isExpand.value ? MainAxisSize.max : MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: padding,
|
||||
child: isExpand.value ? _topBarExpand() : _topBar(),
|
||||
),
|
||||
isExpand.value ? _contentExpand() : _content(),
|
||||
dynamicPreview(),
|
||||
if (!isExpand.value) ..._bottomBar(),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 转发动态预览
|
||||
Widget dynamicPreview() {
|
||||
ItemModulesModel? modules = widget.item!.modules;
|
||||
final String type = widget.item!.type!;
|
||||
String? cover = modules?.moduleAuthor?.face;
|
||||
switch (type) {
|
||||
/// 图文动态
|
||||
case 'DYNAMIC_TYPE_DRAW':
|
||||
cover = modules?.moduleDynamic?.major?.opus?.pics?.first.url;
|
||||
|
||||
/// 投稿
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
cover = modules?.moduleDynamic?.major?.archive?.cover;
|
||||
|
||||
/// 转发的动态
|
||||
case 'DYNAMIC_TYPE_FORWARD':
|
||||
String forwardType = widget.item!.orig!.type!;
|
||||
switch (forwardType) {
|
||||
/// 图文动态
|
||||
case 'DYNAMIC_TYPE_DRAW':
|
||||
cover = modules?.moduleDynamic?.major?.opus?.pics?.first.url;
|
||||
|
||||
/// 投稿
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
cover = modules?.moduleDynamic?.major?.archive?.cover;
|
||||
|
||||
/// 番剧
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
cover = modules?.moduleDynamic?.major?.pgc?.cover;
|
||||
// 专栏文章
|
||||
case 'DYNAMIC_TYPE_ARTICLE':
|
||||
// 番剧
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
// 纯文字动态
|
||||
case 'DYNAMIC_TYPE_WORD':
|
||||
// 直播
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
// 合集查看
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
cover = '';
|
||||
|
||||
default:
|
||||
cover = '';
|
||||
}
|
||||
|
||||
// 专栏文章
|
||||
case 'DYNAMIC_TYPE_ARTICLE':
|
||||
// 番剧
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
// 纯文字动态
|
||||
case 'DYNAMIC_TYPE_WORD':
|
||||
// 直播
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
// 合集查看
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
// 番剧查看
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
cover = '';
|
||||
default:
|
||||
cover = '';
|
||||
}
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 98,
|
||||
margin: const EdgeInsets.fromLTRB(12, 0, 12, 14),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
width: 4,
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.8)),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'@${widget.item!.modules!.moduleAuthor!.name}',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
src: cover ?? '',
|
||||
width: 45,
|
||||
height: 45,
|
||||
radius: 6,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text.rich(
|
||||
richNode(widget.item, context),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// Text(data)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 未展开时的顶部
|
||||
Widget _topBar() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
'转发动态',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => dynamicForward('quickForward'),
|
||||
child: const Text('快速转发'),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 展开时的顶部
|
||||
Widget _topBarExpand() {
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: _onClose,
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => dynamicForward('forward'),
|
||||
child: const Text('转发'),
|
||||
),
|
||||
],
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'转发动态',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 未展开时的底部
|
||||
List<Widget> _bottomBar() {
|
||||
return [
|
||||
const Divider(thickness: 0.1, height: 1),
|
||||
ListTile(
|
||||
onTap: () => Get.back(),
|
||||
minLeadingWidth: 0,
|
||||
dense: true,
|
||||
title: Text(
|
||||
'取消',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).padding.bottom,
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
// 未展开时的内容区
|
||||
Widget _content() {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
isExpand.value = true;
|
||||
},
|
||||
behavior: HitTestBehavior.translucent,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.fromLTRB(16, 10, 10, 16),
|
||||
child: Text(
|
||||
'说点什么吧',
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 展开时的内容区
|
||||
Widget _contentExpand() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 10, 16, 0),
|
||||
child: TextField(
|
||||
maxLines: null,
|
||||
minLines: 3,
|
||||
focusNode: _focusNode,
|
||||
controller: _inputController,
|
||||
decoration: const InputDecoration(
|
||||
border: InputBorder.none,
|
||||
hintText: '说点什么吧',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@ import 'package:pilipala/common/skeleton/dynamic_card.dart';
|
||||
import 'package:pilipala/common/widgets/http_error.dart';
|
||||
import 'package:pilipala/common/widgets/no_data.dart';
|
||||
import 'package:pilipala/models/dynamics/result.dart';
|
||||
import 'package:pilipala/plugin/pl_popup/index.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/main_stream.dart';
|
||||
import 'package:pilipala/utils/route_push.dart';
|
||||
@ -18,7 +17,6 @@ import 'package:pilipala/utils/storage.dart';
|
||||
import '../mine/controller.dart';
|
||||
import 'controller.dart';
|
||||
import 'widgets/dynamic_panel.dart';
|
||||
import 'up_dynamic/route_panel.dart';
|
||||
import 'widgets/up_panel.dart';
|
||||
|
||||
class DynamicsPage extends StatefulWidget {
|
||||
@ -34,7 +32,7 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
final MineController mineController = Get.put(MineController());
|
||||
late Future _futureBuilderFuture;
|
||||
late Future _futureBuilderFutureUp;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
late ScrollController scrollController;
|
||||
|
||||
@override
|
||||
@ -80,8 +78,6 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
title: SizedBox(
|
||||
height: 34,
|
||||
child: Stack(
|
||||
@ -90,32 +86,34 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Obx(() {
|
||||
if (_dynamicsController.mid.value != -1 &&
|
||||
_dynamicsController.upInfo.value.uname != null) {
|
||||
return SizedBox(
|
||||
height: 36,
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder:
|
||||
(Widget child, Animation<double> animation) {
|
||||
return ScaleTransition(
|
||||
scale: animation, child: child);
|
||||
},
|
||||
child: Text(
|
||||
'${_dynamicsController.upInfo.value.uname!}的动态',
|
||||
key: ValueKey<String>(
|
||||
_dynamicsController.upInfo.value.uname!),
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelLarge!
|
||||
.fontSize,
|
||||
)),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final mid = _dynamicsController.mid.value;
|
||||
final uname = _dynamicsController.upInfo.value.uname;
|
||||
|
||||
if (mid == -1 || uname == null) {
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
height: 36,
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder:
|
||||
(Widget child, Animation<double> animation) {
|
||||
return ScaleTransition(
|
||||
scale: animation, child: child);
|
||||
},
|
||||
child: Text(
|
||||
'$uname的动态',
|
||||
key: ValueKey<String>(uname),
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelLarge!
|
||||
.fontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
Obx(
|
||||
() => _dynamicsController.userLogin.value
|
||||
@ -206,16 +204,7 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
return Obx(
|
||||
() => UpPanel(
|
||||
upData: _dynamicsController.upData.value,
|
||||
onClickUpCb: (data) {
|
||||
// _dynamicsController.onTapUp(data);
|
||||
Navigator.push(
|
||||
context,
|
||||
PlPopupRoute(
|
||||
child: OverlayPanel(
|
||||
ctr: _dynamicsController, upInfo: data),
|
||||
),
|
||||
);
|
||||
},
|
||||
dynamicsController: _dynamicsController,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
@ -3,20 +3,19 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/http/dynamics.dart';
|
||||
import 'package:pilipala/models/dynamics/result.dart';
|
||||
import 'package:pilipala/pages/dynamics/index.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:status_bar_control/status_bar_control.dart';
|
||||
import 'rich_node_panel.dart';
|
||||
import '../forward/index.dart';
|
||||
|
||||
class ActionPanel extends StatefulWidget {
|
||||
const ActionPanel({
|
||||
super.key,
|
||||
required this.item,
|
||||
});
|
||||
// ignore: prefer_typing_uninitialized_variables
|
||||
|
||||
final DynamicItemModel item;
|
||||
|
||||
@override
|
||||
@ -32,9 +31,6 @@ class _ActionPanelState extends State<ActionPanel>
|
||||
RxDouble height = 0.0.obs;
|
||||
RxBool isExpand = false.obs;
|
||||
late double statusHeight;
|
||||
TextEditingController _inputController = TextEditingController();
|
||||
FocusNode myFocusNode = FocusNode();
|
||||
String _inputText = '';
|
||||
|
||||
void Function()? handleState(Future Function() action) {
|
||||
return isProcessing
|
||||
@ -60,7 +56,7 @@ class _ActionPanelState extends State<ActionPanel>
|
||||
// 动态点赞
|
||||
Future onLikeDynamic() async {
|
||||
feedBack();
|
||||
var item = widget.item!;
|
||||
var item = widget.item;
|
||||
String dynamicId = item.idStr!;
|
||||
// 1 已点赞 2 不喜欢 0 未操作
|
||||
Like like = item.modules!.moduleStat!.like!;
|
||||
@ -87,300 +83,38 @@ class _ActionPanelState extends State<ActionPanel>
|
||||
}
|
||||
}
|
||||
|
||||
// 转发动态预览
|
||||
Widget dynamicPreview() {
|
||||
ItemModulesModel? modules = widget.item.modules;
|
||||
final String type = widget.item.type!;
|
||||
String? cover = modules?.moduleAuthor?.face;
|
||||
switch (type) {
|
||||
/// 图文动态
|
||||
case 'DYNAMIC_TYPE_DRAW':
|
||||
cover = modules?.moduleDynamic?.major?.opus?.pics?.first.url;
|
||||
|
||||
/// 投稿
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
cover = modules?.moduleDynamic?.major?.archive?.cover;
|
||||
|
||||
/// 转发的动态
|
||||
case 'DYNAMIC_TYPE_FORWARD':
|
||||
String forwardType = widget.item.orig!.type!;
|
||||
switch (forwardType) {
|
||||
/// 图文动态
|
||||
case 'DYNAMIC_TYPE_DRAW':
|
||||
cover = modules?.moduleDynamic?.major?.opus?.pics?.first.url;
|
||||
|
||||
/// 投稿
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
cover = modules?.moduleDynamic?.major?.archive?.cover;
|
||||
|
||||
/// 专栏文章
|
||||
case 'DYNAMIC_TYPE_ARTICLE':
|
||||
cover = '';
|
||||
|
||||
/// 番剧
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
cover = '';
|
||||
|
||||
/// 纯文字动态
|
||||
case 'DYNAMIC_TYPE_WORD':
|
||||
cover = '';
|
||||
|
||||
/// 直播
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
cover = '';
|
||||
|
||||
/// 合集查看
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
cover = '';
|
||||
|
||||
/// 番剧
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
cover = modules?.moduleDynamic?.major?.pgc?.cover;
|
||||
|
||||
default:
|
||||
cover = '';
|
||||
}
|
||||
|
||||
/// 专栏文章
|
||||
case 'DYNAMIC_TYPE_ARTICLE':
|
||||
cover = '';
|
||||
|
||||
/// 番剧
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
cover = '';
|
||||
|
||||
/// 纯文字动态
|
||||
case 'DYNAMIC_TYPE_WORD':
|
||||
cover = '';
|
||||
|
||||
/// 直播
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
cover = '';
|
||||
|
||||
/// 合集查看
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
cover = '';
|
||||
|
||||
/// 番剧查看
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
cover = '';
|
||||
|
||||
default:
|
||||
cover = '';
|
||||
}
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 95,
|
||||
margin: const EdgeInsets.fromLTRB(12, 0, 12, 14),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
width: 4,
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.8)),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'@${widget.item.modules!.moduleAuthor!.name}',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
src: cover ?? '',
|
||||
width: 34,
|
||||
height: 34,
|
||||
type: 'emote',
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text.rich(
|
||||
style: const TextStyle(height: 0),
|
||||
richNode(widget.item, context),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// Text(data)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 动态转发
|
||||
void forwardHandler() async {
|
||||
final userInfo = _dynamicsController.userInfo;
|
||||
if (userInfo == null) {
|
||||
SmartDialog.showToast('请先登录');
|
||||
return;
|
||||
}
|
||||
int mid = userInfo.mid!;
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
enableDrag: false,
|
||||
enableDrag: true,
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
builder: (context) {
|
||||
return Obx(
|
||||
() => AnimatedContainer(
|
||||
duration: Durations.medium1,
|
||||
onEnd: () async {
|
||||
if (isExpand.value) {
|
||||
await Future.delayed(const Duration(milliseconds: 80));
|
||||
myFocusNode.requestFocus();
|
||||
}
|
||||
},
|
||||
height: height.value + MediaQuery.of(context).padding.bottom,
|
||||
child: Column(
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: Durations.medium1,
|
||||
height: isExpand.value ? statusHeight : 0,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
isExpand.value ? 10 : 16,
|
||||
10,
|
||||
isExpand.value ? 14 : 12,
|
||||
0,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (isExpand.value) ...[
|
||||
IconButton(
|
||||
onPressed: () => togglePanelState(false),
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
Text(
|
||||
'转发动态',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(fontWeight: FontWeight.bold),
|
||||
)
|
||||
] else ...[
|
||||
const Text(
|
||||
'转发动态',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
)
|
||||
],
|
||||
isExpand.value
|
||||
? FilledButton(
|
||||
onPressed: () => dynamicForward('forward'),
|
||||
child: const Text('转发'),
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text('立即转发'),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
if (!isExpand.value) ...[
|
||||
GestureDetector(
|
||||
onTap: () => togglePanelState(true),
|
||||
behavior: HitTestBehavior.translucent,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 10, 14),
|
||||
child: Text(
|
||||
'说点什么吧',
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
),
|
||||
] else ...[
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 10, 16, 0),
|
||||
child: TextField(
|
||||
maxLines: 5,
|
||||
focusNode: myFocusNode,
|
||||
controller: _inputController,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_inputText = value;
|
||||
});
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
border: InputBorder.none,
|
||||
hintText: '说点什么吧',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
dynamicPreview(),
|
||||
if (!isExpand.value) ...[
|
||||
const Divider(thickness: 0.1, height: 1),
|
||||
ListTile(
|
||||
onTap: () => Get.back(),
|
||||
minLeadingWidth: 0,
|
||||
dense: true,
|
||||
title: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
return DynamicForwardPage(
|
||||
item: widget.item,
|
||||
mid: mid,
|
||||
cb: () => setState(() {
|
||||
stat.forward!.count =
|
||||
(int.parse(stat.forward!.count ?? '0') + 1).toString();
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
togglePanelState(status) {
|
||||
if (!status) {
|
||||
Get.back();
|
||||
height.value = defaultHeight;
|
||||
_inputText = '';
|
||||
_inputController.clear();
|
||||
} else {
|
||||
height.value = Get.size.height;
|
||||
}
|
||||
isExpand.value = !(isExpand.value);
|
||||
}
|
||||
|
||||
dynamicForward(String type) async {
|
||||
String dynamicId = widget.item.idStr!;
|
||||
var res = await DynamicsHttp.dynamicCreate(
|
||||
dynIdStr: dynamicId,
|
||||
mid: _dynamicsController.userInfo.mid,
|
||||
rawText: _inputText,
|
||||
scene: 4,
|
||||
);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast(type == 'forward' ? '转发成功' : '发布成功');
|
||||
togglePanelState(false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
myFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var color = Theme.of(context).colorScheme.outline;
|
||||
var primary = Theme.of(context).colorScheme.primary;
|
||||
height.value = defaultHeight;
|
||||
print('height.value: ${height.value}');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
|
@ -1,5 +1,4 @@
|
||||
// 内容
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
@ -166,31 +165,6 @@ class _ContentState extends State<Content> {
|
||||
builder: (BuildContext context) => InteractiveviewerGallery(
|
||||
sources: picList,
|
||||
initIndex: initIndex,
|
||||
itemBuilder: (
|
||||
BuildContext context,
|
||||
int index,
|
||||
bool isFocus,
|
||||
bool enablePageView,
|
||||
) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
if (enablePageView) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
child: Center(
|
||||
child: Hero(
|
||||
tag: picList[index],
|
||||
child: CachedNetworkImage(
|
||||
fadeInDuration: const Duration(milliseconds: 0),
|
||||
imageUrl: picList[index],
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
onPageChanged: (int pageIndex) {},
|
||||
),
|
||||
),
|
||||
|
@ -66,76 +66,85 @@ Widget liveRcmdPanel(item, context, {floor = 1}) {
|
||||
},
|
||||
child: LayoutBuilder(builder: (context, box) {
|
||||
double width = box.maxWidth;
|
||||
return Stack(
|
||||
children: [
|
||||
Hero(
|
||||
tag: liveRcmd.roomId.toString(),
|
||||
child: NetworkImgLayer(
|
||||
type: floor == 1 ? 'emote' : null,
|
||||
width: width,
|
||||
height: width / StyleString.aspectRatio,
|
||||
src: item.modules.moduleDynamic.major.liveRcmd.cover,
|
||||
),
|
||||
),
|
||||
PBadge(
|
||||
text: watchedShow['text_large'],
|
||||
top: 6,
|
||||
right: 56,
|
||||
bottom: null,
|
||||
left: null,
|
||||
type: 'gray',
|
||||
),
|
||||
PBadge(
|
||||
text: liveStatus == 1 ? '直播中' : '直播结束',
|
||||
top: 6,
|
||||
right: 6,
|
||||
bottom: null,
|
||||
left: null,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 80,
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 10, 10),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
Colors.transparent,
|
||||
Colors.black45,
|
||||
],
|
||||
),
|
||||
borderRadius: floor == 1
|
||||
? null
|
||||
: const BorderRadius.all(Radius.circular(6))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
DefaultTextStyle.merge(
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.fontSize,
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(item.modules.moduleDynamic.major.liveRcmd
|
||||
.areaName ??
|
||||
''),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
return Container(
|
||||
margin: floor == 1
|
||||
? const EdgeInsets.only(
|
||||
left: StyleString.safeSpace, right: StyleString.safeSpace)
|
||||
: EdgeInsets.zero,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(StyleString.imgRadius)),
|
||||
child: Stack(
|
||||
children: [
|
||||
Hero(
|
||||
tag: liveRcmd.roomId.toString(),
|
||||
child: NetworkImgLayer(
|
||||
type: floor == 1 ? 'emote' : null,
|
||||
width: width,
|
||||
height: width / StyleString.aspectRatio,
|
||||
src: item.modules.moduleDynamic.major.liveRcmd.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
PBadge(
|
||||
text: watchedShow['text_large'],
|
||||
top: 8.0,
|
||||
right: 62.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
type: 'gray',
|
||||
),
|
||||
PBadge(
|
||||
text: liveStatus == 1 ? '直播中' : '直播结束',
|
||||
top: 8.0,
|
||||
right: 10.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 80,
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 10, 10),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
Colors.transparent,
|
||||
Colors.black45,
|
||||
],
|
||||
),
|
||||
borderRadius: floor == 1
|
||||
? null
|
||||
: const BorderRadius.all(Radius.circular(6))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
DefaultTextStyle.merge(
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.fontSize,
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(item.modules.moduleDynamic.major.liveRcmd
|
||||
.areaName ??
|
||||
''),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
@ -12,31 +11,6 @@ void onPreviewImg(currentUrl, picList, initIndex, context) {
|
||||
builder: (BuildContext context) => InteractiveviewerGallery(
|
||||
sources: picList,
|
||||
initIndex: initIndex,
|
||||
itemBuilder: (
|
||||
BuildContext context,
|
||||
int index,
|
||||
bool isFocus,
|
||||
bool enablePageView,
|
||||
) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
if (enablePageView) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
child: Center(
|
||||
child: Hero(
|
||||
tag: picList[index],
|
||||
child: CachedNetworkImage(
|
||||
fadeInDuration: const Duration(milliseconds: 0),
|
||||
imageUrl: picList[index],
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
onPageChanged: (int pageIndex) {},
|
||||
),
|
||||
),
|
||||
|
@ -4,17 +4,22 @@ import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/models/dynamics/up.dart';
|
||||
import 'package:pilipala/models/live/item.dart';
|
||||
import 'package:pilipala/plugin/pl_popup/index.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import '../controller.dart';
|
||||
import '../up_dynamic/route_panel.dart';
|
||||
|
||||
class UpPanel extends StatefulWidget {
|
||||
final FollowUpModel upData;
|
||||
final Function? onClickUpCb;
|
||||
final DynamicsController dynamicsController;
|
||||
|
||||
const UpPanel({
|
||||
super.key,
|
||||
required this.upData,
|
||||
this.onClickUpCb,
|
||||
required this.dynamicsController,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -23,7 +28,7 @@ class UpPanel extends StatefulWidget {
|
||||
|
||||
class _UpPanelState extends State<UpPanel> {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
int currentMid = -1;
|
||||
RxInt currentMid = (-1).obs;
|
||||
late double contentWidth = 56;
|
||||
List<UpItem> upList = [];
|
||||
List<LiveUserItem> liveList = [];
|
||||
@ -37,26 +42,44 @@ class _UpPanelState extends State<UpPanel> {
|
||||
}
|
||||
|
||||
void onClickUp(data, i) {
|
||||
currentMid = data.mid;
|
||||
widget.onClickUpCb?.call(data);
|
||||
// int liveLen = liveList.length;
|
||||
// int upLen = upList.length;
|
||||
// double itemWidth = contentWidth + itemPadding.horizontal;
|
||||
// double screenWidth = MediaQuery.sizeOf(context).width;
|
||||
// double moveDistance = 0.0;
|
||||
// if (itemWidth * (upList.length + liveList.length) <= screenWidth) {
|
||||
// } else if ((upLen - i - 0.5) * itemWidth > screenWidth / 2) {
|
||||
// moveDistance = (i + liveLen + 0.5) * itemWidth + 46 - screenWidth / 2;
|
||||
// } else {
|
||||
// moveDistance = (upLen + liveLen) * itemWidth + 46 - screenWidth;
|
||||
// }
|
||||
// data.hasUpdate = false;
|
||||
// scrollController.animateTo(
|
||||
// moveDistance,
|
||||
// duration: const Duration(milliseconds: 200),
|
||||
// curve: Curves.linear,
|
||||
// );
|
||||
// setState(() {});
|
||||
currentMid.value = data.mid;
|
||||
Navigator.push(
|
||||
context,
|
||||
PlPopupRoute(
|
||||
child: OverlayPanel(
|
||||
ctr: widget.dynamicsController,
|
||||
upInfo: data,
|
||||
),
|
||||
),
|
||||
).then((value) => {currentMid.value = -1});
|
||||
}
|
||||
|
||||
void onClickUpAni(data, i) {
|
||||
final screenWidth = MediaQuery.sizeOf(context).width;
|
||||
final itemWidth = contentWidth + itemPadding.horizontal;
|
||||
final liveLen = liveList.length;
|
||||
final upLen = upList.length;
|
||||
|
||||
currentMid.value = data.mid;
|
||||
widget.dynamicsController.onTapUp(data);
|
||||
|
||||
double moveDistance = 0.0;
|
||||
final totalItemsWidth = itemWidth * (upLen + liveLen);
|
||||
|
||||
if (totalItemsWidth > screenWidth) {
|
||||
if ((upLen - i - 0.5) * itemWidth > screenWidth / 2) {
|
||||
moveDistance = (i + liveLen + 0.5) * itemWidth + 46 - screenWidth / 2;
|
||||
} else {
|
||||
moveDistance = totalItemsWidth + 46 - screenWidth;
|
||||
}
|
||||
}
|
||||
|
||||
data.hasUpdate = false;
|
||||
scrollController.animateTo(
|
||||
moveDistance,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -144,14 +167,17 @@ class _UpPanelState extends State<UpPanel> {
|
||||
}
|
||||
|
||||
Widget upItemBuild(data, i) {
|
||||
bool isCurrent = currentMid == data.mid || currentMid == -1;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
feedBack();
|
||||
if (data.type == 'up') {
|
||||
EasyThrottle.throttle('follow', const Duration(milliseconds: 300),
|
||||
() {
|
||||
onClickUp(data, i);
|
||||
if (GlobalDataCache().enableDynamicSwitch) {
|
||||
onClickUp(data, i);
|
||||
} else {
|
||||
onClickUpAni(data, i);
|
||||
}
|
||||
});
|
||||
} else if (data.type == 'live') {
|
||||
LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
@ -177,60 +203,66 @@ class _UpPanelState extends State<UpPanel> {
|
||||
},
|
||||
child: Padding(
|
||||
padding: itemPadding,
|
||||
child: AnimatedOpacity(
|
||||
opacity: isCurrent ? 1 : 0.3,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOut,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Badge(
|
||||
smallSize: 8,
|
||||
label: data.type == 'live' ? const Text('Live') : null,
|
||||
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
alignment: data.type == 'live'
|
||||
? AlignmentDirectional.topCenter
|
||||
: AlignmentDirectional.topEnd,
|
||||
padding: const EdgeInsets.only(left: 6, right: 6),
|
||||
isLabelVisible: data.type == 'live' ||
|
||||
(data.type == 'up' && (data.hasUpdate ?? false)),
|
||||
backgroundColor: data.type == 'live'
|
||||
? Theme.of(context).colorScheme.secondaryContainer
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
child: data.face != ''
|
||||
? NetworkImgLayer(
|
||||
width: 50,
|
||||
height: 50,
|
||||
src: data.face,
|
||||
type: 'avatar',
|
||||
)
|
||||
: const CircleAvatar(
|
||||
radius: 25,
|
||||
backgroundImage: AssetImage(
|
||||
'assets/images/noface.jpeg',
|
||||
child: Obx(
|
||||
() => AnimatedOpacity(
|
||||
opacity: currentMid.value == data.mid || currentMid.value == -1
|
||||
? 1
|
||||
: 0.3,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOut,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Badge(
|
||||
smallSize: 8,
|
||||
label: data.type == 'live' ? const Text('Live') : null,
|
||||
textColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
alignment: data.type == 'live'
|
||||
? AlignmentDirectional.topCenter
|
||||
: AlignmentDirectional.topEnd,
|
||||
padding: const EdgeInsets.only(left: 6, right: 6),
|
||||
isLabelVisible: data.type == 'live' ||
|
||||
(data.type == 'up' && (data.hasUpdate ?? false)),
|
||||
backgroundColor: data.type == 'live'
|
||||
? Theme.of(context).colorScheme.secondaryContainer
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
child: data.face != ''
|
||||
? NetworkImgLayer(
|
||||
width: 50,
|
||||
height: 50,
|
||||
src: data.face,
|
||||
type: 'avatar',
|
||||
)
|
||||
: const CircleAvatar(
|
||||
radius: 25,
|
||||
backgroundImage: AssetImage(
|
||||
'assets/images/noface.jpeg',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: SizedBox(
|
||||
width: contentWidth,
|
||||
child: Text(
|
||||
data.uname,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: currentMid == data.mid
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: SizedBox(
|
||||
width: contentWidth,
|
||||
child: Text(
|
||||
data.uname,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: currentMid.value == data.mid
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.fontSize),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -78,72 +78,83 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
|
||||
],
|
||||
LayoutBuilder(builder: (context, box) {
|
||||
double width = box.maxWidth;
|
||||
return Stack(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
type: floor == 1 ? 'emote' : null,
|
||||
width: width,
|
||||
height: width / StyleString.aspectRatio,
|
||||
src: content.cover,
|
||||
),
|
||||
if (content.badge != null && type == 'pgc')
|
||||
PBadge(
|
||||
text: content.badge['text'],
|
||||
top: 8.0,
|
||||
right: 10.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
return Container(
|
||||
margin: floor == 1
|
||||
? const EdgeInsets.only(
|
||||
left: StyleString.safeSpace, right: StyleString.safeSpace)
|
||||
: EdgeInsets.zero,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(StyleString.imgRadius)),
|
||||
child: Stack(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
type: floor == 1 ? 'emote' : null,
|
||||
width: width,
|
||||
height: width / StyleString.aspectRatio,
|
||||
src: content.cover,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 80,
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 10, 10),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
Colors.transparent,
|
||||
Colors.black54,
|
||||
],
|
||||
),
|
||||
borderRadius: floor == 1
|
||||
? null
|
||||
: const BorderRadius.all(Radius.circular(6))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
DefaultTextStyle.merge(
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(content.durationText ?? ''),
|
||||
if (content.durationText != null)
|
||||
const SizedBox(width: 10),
|
||||
Text(content.stat.play + '次围观'),
|
||||
const SizedBox(width: 10),
|
||||
Text(content.stat.danmaku + '条弹幕')
|
||||
if (content.badge != null && content.badge['text'] != null)
|
||||
PBadge(
|
||||
text: content.badge['text'],
|
||||
top: 8.0,
|
||||
right: 10.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 80,
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 10, 10),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
Colors.transparent,
|
||||
Colors.black54,
|
||||
],
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
'assets/images/play.png',
|
||||
width: 60,
|
||||
height: 60,
|
||||
),
|
||||
],
|
||||
borderRadius: floor == 1
|
||||
? null
|
||||
: const BorderRadius.all(Radius.circular(6))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
DefaultTextStyle.merge(
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.fontSize,
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(content.durationText ?? ''),
|
||||
if (content.durationText != null)
|
||||
const SizedBox(width: 10),
|
||||
Text(content.stat.play + '次围观'),
|
||||
const SizedBox(width: 10),
|
||||
Text(content.stat.danmaku + '条弹幕')
|
||||
],
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
'assets/images/play.png',
|
||||
width: 60,
|
||||
height: 60,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 6),
|
||||
|
@ -3,17 +3,18 @@ import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/fan.dart';
|
||||
import 'package:pilipala/models/fans/result.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
class FansController extends GetxController {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
int pn = 1;
|
||||
int ps = 20;
|
||||
int total = 0;
|
||||
RxList<FansItemModel> fansList = <FansItemModel>[].obs;
|
||||
late int mid;
|
||||
late String name;
|
||||
var userInfo;
|
||||
UserInfoData? userInfo;
|
||||
RxString loadingText = '加载中...'.obs;
|
||||
RxBool isOwner = false.obs;
|
||||
|
||||
@ -23,9 +24,9 @@ class FansController extends GetxController {
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
mid = Get.parameters['mid'] != null
|
||||
? int.parse(Get.parameters['mid']!)
|
||||
: userInfo.mid;
|
||||
isOwner.value = mid == userInfo.mid;
|
||||
name = Get.parameters['name'] ?? userInfo.uname;
|
||||
: userInfo!.mid!;
|
||||
isOwner.value = mid == userInfo?.mid;
|
||||
name = Get.parameters['name'] ?? userInfo?.uname ?? '';
|
||||
}
|
||||
|
||||
Future queryFans(type) async {
|
||||
@ -49,7 +50,6 @@ class FansController extends GetxController {
|
||||
} else if (type == 'onLoad') {
|
||||
fansList.addAll(res['data'].list);
|
||||
}
|
||||
print(total);
|
||||
if ((pn == 1 && total < ps) || res['data'].list.isEmpty) {
|
||||
loadingText.value = '没有更多了';
|
||||
}
|
||||
|
@ -49,13 +49,8 @@ class _FansPageState extends State<FansPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text(
|
||||
_fansController.isOwner.value ? '我的粉丝' : '${_fansController.name}的粉丝',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
body: RefreshIndicator(
|
||||
@ -105,7 +100,12 @@ class _FansPageState extends State<FansPage> {
|
||||
} else {
|
||||
return HttpError(
|
||||
errMsg: data['msg'],
|
||||
fn: () => _fansController.queryFans('init'),
|
||||
fn: () {
|
||||
setState(() {
|
||||
_futureBuilderFuture = _fansController.queryFans('init');
|
||||
});
|
||||
},
|
||||
isInSliver: false,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
@ -11,7 +11,7 @@ class FavController extends GetxController {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||
RxList<FavFolderItemData> favFolderList = <FavFolderItemData>[].obs;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box userInfoCache = GStorage.userInfo;
|
||||
UserInfoData? userInfo;
|
||||
int currentPage = 1;
|
||||
int pageSize = 60;
|
||||
|
@ -40,11 +40,8 @@ class _FavPageState extends State<FavPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Obx(() => Text(
|
||||
'${_favController.isOwner.value ? '我' : 'Ta'}的收藏',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
)),
|
||||
actions: [
|
||||
Obx(() => !_favController.isOwner.value
|
||||
@ -55,6 +52,22 @@ class _FavPageState extends State<FavPage> {
|
||||
tooltip: 'Ta的订阅',
|
||||
)
|
||||
: const SizedBox.shrink()),
|
||||
|
||||
// 新建收藏夹
|
||||
Obx(() => _favController.isOwner.value
|
||||
? IconButton(
|
||||
onPressed: () async {
|
||||
await Get.toNamed('/favEdit');
|
||||
_favController.hasMore.value = true;
|
||||
_favController.currentPage = 1;
|
||||
setState(() {
|
||||
_futureBuilderFuture = _favController.queryFavFolder();
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.add_outlined),
|
||||
tooltip: '新建收藏夹',
|
||||
)
|
||||
: const SizedBox.shrink()),
|
||||
IconButton(
|
||||
onPressed: () => Get.toNamed(
|
||||
'/favSearch?searchType=1&mediaId=${_favController.favFolderData.value.list!.first.id}'),
|
||||
@ -63,56 +76,64 @@ class _FavPageState extends State<FavPage> {
|
||||
const SizedBox(width: 14),
|
||||
],
|
||||
),
|
||||
body: FutureBuilder(
|
||||
future: _futureBuilderFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
Map? data = snapshot.data;
|
||||
if (data != null && data['status']) {
|
||||
return Obx(
|
||||
() => ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount: _favController.favFolderList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return FavItem(
|
||||
favFolderItem: _favController.favFolderList[index],
|
||||
isOwner: _favController.isOwner.value,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return CustomScrollView(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
HttpError(
|
||||
errMsg: data?['msg'] ?? '请求异常',
|
||||
btnText: data?['code'] == -101 ? '去登录' : null,
|
||||
fn: () {
|
||||
if (data?['code'] == -101) {
|
||||
RoutePush.loginRedirectPush();
|
||||
} else {
|
||||
setState(() {
|
||||
_futureBuilderFuture =
|
||||
_favController.queryFavFolder();
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// 骨架屏
|
||||
return ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
itemCount: 10,
|
||||
);
|
||||
}
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
_favController.hasMore.value = true;
|
||||
_favController.currentPage = 1;
|
||||
setState(() {
|
||||
_futureBuilderFuture = _favController.queryFavFolder(type: 'init');
|
||||
});
|
||||
},
|
||||
child: _buildBody(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody() {
|
||||
return FutureBuilder(
|
||||
future: _futureBuilderFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
Map? data = snapshot.data;
|
||||
if (data != null && data['status']) {
|
||||
return Obx(
|
||||
() => ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount: _favController.favFolderList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return FavItem(
|
||||
favFolderItem: _favController.favFolderList[index],
|
||||
isOwner: _favController.isOwner.value,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return HttpError(
|
||||
errMsg: data?['msg'] ?? '请求异常',
|
||||
btnText: data?['code'] == -101 ? '去登录' : null,
|
||||
fn: () {
|
||||
if (data?['code'] == -101) {
|
||||
RoutePush.loginRedirectPush();
|
||||
} else {
|
||||
setState(() {
|
||||
_futureBuilderFuture = _favController.queryFavFolder();
|
||||
});
|
||||
}
|
||||
},
|
||||
isInSliver: false,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// 骨架屏
|
||||
return ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
itemCount: 10,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/utils/logic_utils.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
class FavItem extends StatelessWidget {
|
||||
@ -74,7 +75,7 @@ class VideoContent extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(10, 2, 6, 0),
|
||||
padding: const EdgeInsets.fromLTRB(10, 2, 6, 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@ -94,6 +95,15 @@ class VideoContent extends StatelessWidget {
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
LogicUtils.isPublic(favFolderItem.attr) ? '公开' : '私密',
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -6,24 +6,27 @@ import 'package:pilipala/http/video.dart';
|
||||
import 'package:pilipala/models/user/fav_detail.dart';
|
||||
import 'package:pilipala/models/user/fav_folder.dart';
|
||||
import 'package:pilipala/pages/fav/index.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
class FavDetailController extends GetxController {
|
||||
FavFolderItemData? item;
|
||||
Rx<FavDetailData> favDetailData = FavDetailData().obs;
|
||||
RxString title = ''.obs;
|
||||
|
||||
int? mediaId;
|
||||
late String heroTag;
|
||||
int currentPage = 1;
|
||||
bool isLoadingMore = false;
|
||||
RxMap favInfo = {}.obs;
|
||||
RxList favList = [].obs;
|
||||
RxList<FavDetailItemData> favList = <FavDetailItemData>[].obs;
|
||||
RxString loadingText = '加载中...'.obs;
|
||||
RxInt mediaCount = 0.obs;
|
||||
late String isOwner;
|
||||
late bool hasMore = true;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
item = Get.arguments;
|
||||
title.value = item!.title!;
|
||||
if (Get.parameters.keys.isNotEmpty) {
|
||||
mediaId = int.parse(Get.parameters['mediaId']!);
|
||||
heroTag = Get.parameters['heroTag']!;
|
||||
@ -33,7 +36,7 @@ class FavDetailController extends GetxController {
|
||||
}
|
||||
|
||||
Future<dynamic> queryUserFavFolderDetail({type = 'init'}) async {
|
||||
if (type == 'onLoad' && favList.length >= mediaCount.value) {
|
||||
if (type == 'onLoad' && !hasMore) {
|
||||
loadingText.value = '没有更多了';
|
||||
return;
|
||||
}
|
||||
@ -45,17 +48,18 @@ class FavDetailController extends GetxController {
|
||||
);
|
||||
if (res['status']) {
|
||||
favInfo.value = res['data'].info;
|
||||
hasMore = res['data'].hasMore;
|
||||
if (currentPage == 1 && type == 'init') {
|
||||
favList.value = res['data'].medias;
|
||||
mediaCount.value = res['data'].info['media_count'];
|
||||
} else if (type == 'onLoad') {
|
||||
favList.addAll(res['data'].medias);
|
||||
}
|
||||
if (favList.length >= mediaCount.value) {
|
||||
if (!hasMore) {
|
||||
loadingText.value = '没有更多了';
|
||||
}
|
||||
currentPage += 1;
|
||||
}
|
||||
currentPage += 1;
|
||||
isLoadingMore = false;
|
||||
return res;
|
||||
}
|
||||
@ -115,4 +119,37 @@ class FavDetailController extends GetxController {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
onEditFavFolder() async {
|
||||
var res = await Get.toNamed(
|
||||
'/favEdit',
|
||||
arguments: {
|
||||
'mediaId': mediaId.toString(),
|
||||
'title': item!.title,
|
||||
'intro': item!.intro,
|
||||
'cover': item!.cover,
|
||||
'privacy': [22, 0].contains(item!.attr) ? 0 : 1,
|
||||
},
|
||||
);
|
||||
title.value = res['title'];
|
||||
print(title);
|
||||
}
|
||||
|
||||
Future toViewPlayAll() async {
|
||||
final FavDetailItemData firstItem = favList.first;
|
||||
final String heroTag = Utils.makeHeroTag(firstItem.bvid);
|
||||
Get.toNamed(
|
||||
'/video?bvid=${firstItem.bvid}&cid=${firstItem.cid}',
|
||||
arguments: {
|
||||
'videoItem': firstItem,
|
||||
'heroTag': heroTag,
|
||||
'sourceType': 'fav',
|
||||
'mediaId': favInfo['id'],
|
||||
'oid': firstItem.id,
|
||||
'favTitle': favInfo['title'],
|
||||
'favInfo': favInfo,
|
||||
'count': favInfo['media_count'],
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
late final ScrollController _controller = ScrollController();
|
||||
final FavDetailController _favDetailController =
|
||||
Get.put(FavDetailController());
|
||||
late StreamController<bool> titleStreamC; // a
|
||||
late StreamController<bool> titleStreamC =
|
||||
StreamController<bool>.broadcast(); // a
|
||||
Future? _futureBuilderFuture;
|
||||
late String mediaId;
|
||||
|
||||
@ -31,7 +32,6 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
super.initState();
|
||||
mediaId = Get.parameters['mediaId']!;
|
||||
_futureBuilderFuture = _favDetailController.queryUserFavFolderDetail();
|
||||
titleStreamC = StreamController<bool>();
|
||||
_controller.addListener(
|
||||
() {
|
||||
if (_controller.offset > 160) {
|
||||
@ -80,9 +80,11 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_favDetailController.item!.title!,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
Obx(
|
||||
() => Text(
|
||||
_favDetailController.title.value,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'共${_favDetailController.mediaCount}条视频',
|
||||
@ -106,6 +108,11 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
position: PopupMenuPosition.under,
|
||||
onSelected: (String type) {},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||
PopupMenuItem<String>(
|
||||
onTap: () => _favDetailController.onEditFavFolder(),
|
||||
value: 'edit',
|
||||
child: const Text('编辑收藏夹'),
|
||||
),
|
||||
PopupMenuItem<String>(
|
||||
onTap: () => _favDetailController.onDelFavFolder(),
|
||||
value: 'pause',
|
||||
@ -151,14 +158,16 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_favDetailController.item!.title!,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.fontSize,
|
||||
fontWeight: FontWeight.bold),
|
||||
Obx(
|
||||
() => Text(
|
||||
_favDetailController.title.value,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.fontSize,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
@ -184,7 +193,9 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
padding: const EdgeInsets.only(top: 15, bottom: 8, left: 14),
|
||||
child: Obx(
|
||||
() => Text(
|
||||
'共${_favDetailController.mediaCount}条视频',
|
||||
_favDetailController.mediaCount > 0
|
||||
? '共${_favDetailController.mediaCount}条视频'
|
||||
: '',
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
@ -206,7 +217,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
List favList = _favDetailController.favList;
|
||||
return Obx(
|
||||
() => favList.isEmpty
|
||||
? const SliverToBoxAdapter(child: SizedBox())
|
||||
? const NoData()
|
||||
: SliverList(
|
||||
delegate:
|
||||
SliverChildBuilderDelegate((context, index) {
|
||||
@ -238,23 +249,34 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).padding.bottom + 60,
|
||||
height: MediaQuery.of(context).padding.bottom + 90,
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Center(
|
||||
child: Obx(
|
||||
() => Text(
|
||||
_favDetailController.loadingText.value,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontSize: 13),
|
||||
),
|
||||
),
|
||||
child: Obx(() {
|
||||
final mediaCount = _favDetailController.mediaCount;
|
||||
final loadingText = _favDetailController.loadingText.value;
|
||||
final textColor = Theme.of(context).colorScheme.outline;
|
||||
|
||||
return Text(
|
||||
mediaCount > 0 ? loadingText : '',
|
||||
style: TextStyle(color: textColor, fontSize: 13),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
floatingActionButton: Obx(
|
||||
() => _favDetailController.mediaCount > 0
|
||||
? FloatingActionButton.extended(
|
||||
onPressed: _favDetailController.toViewPlayAll,
|
||||
label: const Text('播放全部'),
|
||||
icon: const Icon(Icons.playlist_play),
|
||||
)
|
||||
: const SizedBox(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -203,13 +203,9 @@ class VideoContent extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: Row(
|
||||
children: [
|
||||
StatView(
|
||||
theme: 'gray',
|
||||
view: videoItem.cntInfo['play'],
|
||||
),
|
||||
StatView(view: videoItem.cntInfo['play']),
|
||||
const SizedBox(width: 8),
|
||||
StatDanMu(
|
||||
theme: 'gray', danmu: videoItem.cntInfo['danmaku']),
|
||||
StatDanMu(danmu: videoItem.cntInfo['danmaku']),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
|
77
lib/pages/fav_edit/controller.dart
Normal file
77
lib/pages/fav_edit/controller.dart
Normal file
@ -0,0 +1,77 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/fav.dart';
|
||||
|
||||
class FavEditController extends GetxController {
|
||||
final GlobalKey formKey = GlobalKey<FormState>();
|
||||
final TextEditingController titleController = TextEditingController();
|
||||
final TextEditingController contentController = TextEditingController();
|
||||
|
||||
final FocusNode titleTextFieldNode = FocusNode();
|
||||
final FocusNode contentTextFieldNode = FocusNode();
|
||||
|
||||
// 默认新建
|
||||
RxString type = 'add'.obs;
|
||||
|
||||
String? mediaId;
|
||||
String cover = ''; // 封面
|
||||
String title = ''; // 名称
|
||||
String intro = ''; // 简介
|
||||
RxInt privacy = 0.obs; // 是否公开 0公开 1私密
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
var args = Get.arguments;
|
||||
if (args != null) {
|
||||
type.value = 'edit';
|
||||
mediaId = args['mediaId'];
|
||||
title = args['title'];
|
||||
intro = args['intro'];
|
||||
cover = args['cover'];
|
||||
privacy.value = args['privacy'];
|
||||
titleController.text = title;
|
||||
contentController.text = intro;
|
||||
}
|
||||
}
|
||||
|
||||
void onSubmit() async {
|
||||
// 表单验证
|
||||
if ((formKey.currentState as FormState).validate()) {
|
||||
if (type.value == 'edit') {
|
||||
await editFolder();
|
||||
} else {
|
||||
await addFolder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> editFolder() async {
|
||||
var res = await FavHttp.editFolder(
|
||||
title: title,
|
||||
intro: intro,
|
||||
mediaId: mediaId!,
|
||||
cover: cover,
|
||||
);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast('编辑成功');
|
||||
Get.back(result: {'title': title});
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> addFolder() async {
|
||||
var res = await FavHttp.addFolder(
|
||||
title: title,
|
||||
intro: intro,
|
||||
);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast('新建成功');
|
||||
Get.back();
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
library media;
|
||||
library fav_edit;
|
||||
|
||||
export './controller.dart';
|
||||
export './view.dart';
|
108
lib/pages/fav_edit/view.dart
Normal file
108
lib/pages/fav_edit/view.dart
Normal file
@ -0,0 +1,108 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'controller.dart';
|
||||
|
||||
class FavEditPage extends StatefulWidget {
|
||||
const FavEditPage({super.key});
|
||||
|
||||
@override
|
||||
State<FavEditPage> createState() => _FavEditPageState();
|
||||
}
|
||||
|
||||
class _FavEditPageState extends State<FavEditPage> {
|
||||
final FavEditController _favEditController = Get.put(FavEditController());
|
||||
String title = '';
|
||||
String content = '';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Obx(
|
||||
() => _favEditController.type.value == 'add'
|
||||
? Text(
|
||||
'新建收藏夹',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
)
|
||||
: Text(
|
||||
'编辑收藏夹',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Obx(
|
||||
() => _favEditController.privacy.value == 0
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
_favEditController.privacy.value = 1;
|
||||
},
|
||||
icon: const Icon(Icons.lock_open_outlined))
|
||||
: IconButton(
|
||||
onPressed: () {
|
||||
_favEditController.privacy.value = 0;
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.lock_outlined,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
)),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _favEditController.onSubmit, child: const Text('保存')),
|
||||
const SizedBox(width: 14),
|
||||
],
|
||||
),
|
||||
body: Form(
|
||||
key: _favEditController.formKey, //设置globalKey,用于后面获取FormState
|
||||
autovalidateMode: AutovalidateMode.disabled,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 10, 14, 5),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Theme.of(context).dividerColor.withOpacity(0.2),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: TextFormField(
|
||||
autofocus: true,
|
||||
controller: _favEditController.titleController,
|
||||
focusNode: _favEditController.titleTextFieldNode,
|
||||
decoration: const InputDecoration(
|
||||
hintText: "收藏夹名称",
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
),
|
||||
// 校验标题
|
||||
validator: (v) {
|
||||
return v!.trim().isNotEmpty ? null : "请输入收藏夹名称";
|
||||
},
|
||||
onChanged: (val) {
|
||||
_favEditController.title = val;
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 14, vertical: 5),
|
||||
child: TextFormField(
|
||||
controller: _favEditController.contentController,
|
||||
minLines: 1,
|
||||
maxLines: 5,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '输入收藏夹简介', border: InputBorder.none),
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
onChanged: (val) {
|
||||
_favEditController.intro = val;
|
||||
},
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user