Merge branch 'main' into feature-liveRoomRender
This commit is contained in:
47
README.md
47
README.md
@ -26,15 +26,50 @@
|
|||||||
Xcode 13.4 不支持**auto_orientation**,请注释相关代码
|
Xcode 13.4 不支持**auto_orientation**,请注释相关代码
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
[✓] Flutter (Channel stable, 3.16.5, on macOS 14.1.2 23B92 darwin-arm64, locale
|
[!] Flutter (Channel [user-branch], 3.19.6, on macOS 14.6.1 23G93 darwin-arm64,
|
||||||
zh-Hans-CN)
|
locale zh-Hans-CN)
|
||||||
|
! Flutter version 3.19.6 on channel [user-branch] at
|
||||||
|
/Users/rr/Documents/sdk/flutter
|
||||||
|
Currently on an unknown channel. Run `flutter channel` to switch to an
|
||||||
|
official channel.
|
||||||
|
If that doesn't fix the issue, reinstall Flutter by following instructions
|
||||||
|
at https://flutter.dev/docs/get-started/install.
|
||||||
|
! Upstream repository unknown source is not a standard remote.
|
||||||
|
Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss
|
||||||
|
this error.
|
||||||
|
• Framework revision 54e66469a9 (8 months ago), 2024-04-17 13:08:03 -0700
|
||||||
|
• Engine revision c4cd48e186
|
||||||
|
• Dart version 3.3.4
|
||||||
|
• DevTools version 2.31.1
|
||||||
|
• Pub download mirror https://pub.flutter-io.cn
|
||||||
|
• Flutter download mirror https://storage.flutter-io.cn
|
||||||
|
• If those were intentional, you can disregard the above warnings; however
|
||||||
|
it is recommended to use "git" directly to perform update checks and
|
||||||
|
upgrades.
|
||||||
|
|
||||||
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
|
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
|
||||||
|
• Android SDK at /Users/rr/Library/Android/sdk
|
||||||
|
• Platform android-34, build-tools 34.0.0
|
||||||
|
• Java binary at: /Applications/Android
|
||||||
|
Studio.app/Contents/jbr/Contents/Home/bin/java
|
||||||
|
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
|
||||||
|
• All Android licenses accepted.
|
||||||
|
|
||||||
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
|
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
|
||||||
|
• Xcode at /Applications/Xcode.app/Contents/Developer
|
||||||
|
• Build 15C65
|
||||||
|
• CocoaPods version 1.14.3
|
||||||
|
|
||||||
[✓] Chrome - develop for the web
|
[✓] Chrome - develop for the web
|
||||||
[✓] Android Studio (version 2022.3)
|
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
|
||||||
[✓] VS Code (version 1.87.2)
|
|
||||||
[✓] Connected device (3 available)
|
[✓] Android Studio (version 2024.2)
|
||||||
[✓] Network resources
|
• Android Studio at /Applications/Android Studio.app/Contents
|
||||||
|
• Flutter plugin can be installed from:
|
||||||
|
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
|
||||||
|
• Dart plugin can be installed from:
|
||||||
|
🔨 https://plugins.jetbrains.com/plugin/6351-dart
|
||||||
|
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,9 @@
|
|||||||
|
plugins {
|
||||||
|
id "com.android.application"
|
||||||
|
id "kotlin-android"
|
||||||
|
id "dev.flutter.flutter-gradle-plugin"
|
||||||
|
}
|
||||||
|
|
||||||
def localProperties = new Properties()
|
def localProperties = new Properties()
|
||||||
def localPropertiesFile = rootProject.file('local.properties')
|
def localPropertiesFile = rootProject.file('local.properties')
|
||||||
if (localPropertiesFile.exists()) {
|
if (localPropertiesFile.exists()) {
|
||||||
@ -6,10 +12,6 @@ if (localPropertiesFile.exists()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
|
||||||
if (flutterRoot == null) {
|
|
||||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
|
||||||
}
|
|
||||||
|
|
||||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||||
if (flutterVersionCode == null) {
|
if (flutterVersionCode == null) {
|
||||||
@ -21,9 +23,6 @@ if (flutterVersionName == null) {
|
|||||||
flutterVersionName = '1.0'
|
flutterVersionName = '1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file('key.properties')
|
def keystorePropertiesFile = rootProject.file('key.properties')
|
||||||
def keystoreProperties = new Properties()
|
def keystoreProperties = new Properties()
|
||||||
@ -37,8 +36,9 @@ def _keyAlias = System.getenv("KEY_ALIAS") ?: keystoreProperties["keyAlias"]
|
|||||||
def _keyPassword = System.getenv("KEY_PASSWORD") ?: keystoreProperties["keyPassword"]
|
def _keyPassword = System.getenv("KEY_PASSWORD") ?: keystoreProperties["keyPassword"]
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
namespace "com.guozhigq.pilipala"
|
||||||
compileSdkVersion flutter.compileSdkVersion
|
compileSdkVersion flutter.compileSdkVersion
|
||||||
ndkVersion flutter.ndkVersion
|
ndkVersion "27.0.12077973"
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
@ -91,9 +91,6 @@ flutter {
|
|||||||
source '../..'
|
source '../..'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
}
|
|
||||||
|
|
||||||
ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3]
|
ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3]
|
||||||
import com.android.build.OutputFile
|
import com.android.build.OutputFile
|
||||||
|
|||||||
4
android/app/proguard-rules.pro
vendored
Normal file
4
android/app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# missing R8 error
|
||||||
|
-dontwarn javax.annotation.Nullable
|
||||||
|
-dontwarn org.conscrypt.Conscrypt
|
||||||
|
-dontwarn org.conscrypt.OpenSSLProvider
|
||||||
@ -1,15 +1,3 @@
|
|||||||
buildscript {
|
|
||||||
ext.kotlin_version = '1.9.0'
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:7.2.0'
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
@ -20,6 +8,15 @@ allprojects {
|
|||||||
|
|
||||||
rootProject.buildDir = '../build'
|
rootProject.buildDir = '../build'
|
||||||
subprojects {
|
subprojects {
|
||||||
|
afterEvaluate { project ->
|
||||||
|
if (project.hasProperty('android')) {
|
||||||
|
project.android {
|
||||||
|
if (namespace == null) {
|
||||||
|
namespace project.group
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||||
}
|
}
|
||||||
subprojects {
|
subprojects {
|
||||||
|
|||||||
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
|
||||||
|
|||||||
@ -1,11 +1,25 @@
|
|||||||
include ':app'
|
pluginManagement {
|
||||||
|
def flutterSdkPath = {
|
||||||
|
def properties = new Properties()
|
||||||
|
file("local.properties").withInputStream { properties.load(it) }
|
||||||
|
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||||
|
return flutterSdkPath
|
||||||
|
}()
|
||||||
|
|
||||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||||
def properties = new Properties()
|
|
||||||
|
|
||||||
assert localPropertiesFile.exists()
|
repositories {
|
||||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
plugins {
|
||||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
id "com.android.application" version "8.7.2" apply false
|
||||||
|
id "org.jetbrains.kotlin.android" version "1.9.0" apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
include ":app"
|
||||||
BIN
assets/images/video/dlna.png
Executable file
BIN
assets/images/video/dlna.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/images/video/fullscreen.png
Executable file
BIN
assets/images/video/fullscreen.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 274 B |
BIN
assets/images/video/fullscreen_exit.png
Executable file
BIN
assets/images/video/fullscreen_exit.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 246 B |
BIN
assets/images/video/pip.png
Executable file
BIN
assets/images/video/pip.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@ -98,7 +98,8 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
with TickerProviderStateMixin {
|
with TickerProviderStateMixin {
|
||||||
final ScrollController _listScrollController = ScrollController();
|
final ScrollController _listScrollController = ScrollController();
|
||||||
late ListObserverController _listObserverController;
|
late ListObserverController _listObserverController;
|
||||||
final ScrollController _scrollController = ScrollController();
|
late GridObserverController _gridObserverController;
|
||||||
|
final ScrollController _gridScrollController = ScrollController();
|
||||||
late int currentIndex;
|
late int currentIndex;
|
||||||
TabController? tabController;
|
TabController? tabController;
|
||||||
List<ListObserverController>? _listObserverControllerList;
|
List<ListObserverController>? _listObserverControllerList;
|
||||||
@ -163,6 +164,9 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
_gridObserverController =
|
||||||
|
GridObserverController(controller: _gridScrollController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,25 +182,19 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
isFixedHeight: true,
|
isFixedHeight: true,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
_listObserverControllerList![widget.currentEpisodeIndex!]
|
_listObserverControllerList![widget.currentEpisodeIndex ?? 0]
|
||||||
.initialIndexModel = ObserverIndexPositionModel(
|
.initialIndexModel = ObserverIndexPositionModel(
|
||||||
index: currentIndex,
|
index: currentIndex,
|
||||||
isFixedHeight: true,
|
isFixedHeight: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
_gridObserverController.initialIndexModel = ObserverIndexPositionModel(
|
||||||
|
index: currentIndex,
|
||||||
|
isFixedHeight: false,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取订阅状态
|
// 获取订阅状态
|
||||||
@ -236,7 +234,9 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
try {
|
try {
|
||||||
_listObserverController.controller?.dispose();
|
_listObserverController.controller?.dispose();
|
||||||
|
_gridObserverController.controller?.dispose();
|
||||||
_listScrollController.dispose();
|
_listScrollController.dispose();
|
||||||
|
_gridScrollController.dispose();
|
||||||
for (var element in _listObserverControllerList!) {
|
for (var element in _listObserverControllerList!) {
|
||||||
element.controller?.dispose();
|
element.controller?.dispose();
|
||||||
}
|
}
|
||||||
@ -303,8 +303,10 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
: Padding(
|
: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 12.0), // 设置左右间距为12
|
horizontal: 12.0), // 设置左右间距为12
|
||||||
|
child: GridViewObserver(
|
||||||
|
controller: _gridObserverController,
|
||||||
child: GridView.count(
|
child: GridView.count(
|
||||||
controller: _scrollController,
|
controller: _gridScrollController,
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
crossAxisSpacing: StyleString.safeSpace,
|
crossAxisSpacing: StyleString.safeSpace,
|
||||||
childAspectRatio: 2.6,
|
childAspectRatio: 2.6,
|
||||||
@ -326,6 +328,7 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -775,11 +778,16 @@ class UgcSeasonBuild extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (ugcSeason.intro != null && ugcSeason.intro != '') ...[
|
if (ugcSeason.intro != null && ugcSeason.intro != '') ...[
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 6),
|
||||||
Text(
|
Container(
|
||||||
|
constraints: const BoxConstraints(maxHeight: 100),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Text(
|
||||||
ugcSeason.intro!,
|
ugcSeason.intro!,
|
||||||
style: TextStyle(color: outline, fontSize: 12),
|
style: TextStyle(color: outline, fontSize: 12),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text.rich(
|
Text.rich(
|
||||||
|
|||||||
25
lib/common/widgets/drag_handle.dart
Normal file
25
lib/common/widgets/drag_handle.dart
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class DragHandle extends StatelessWidget {
|
||||||
|
const DragHandle({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: Navigator.of(context).pop,
|
||||||
|
child: SizedBox(
|
||||||
|
height: 36,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 32,
|
||||||
|
height: 4,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,12 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/http/member.dart';
|
import 'package:pilipala/http/member.dart';
|
||||||
import 'package:pilipala/models/member/tags.dart';
|
import 'package:pilipala/models/member/tags.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
|
||||||
|
|
||||||
class GroupPanel extends StatefulWidget {
|
class GroupPanel extends StatefulWidget {
|
||||||
final int? mid;
|
final int? mid;
|
||||||
@ -18,7 +16,6 @@ class GroupPanel extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _GroupPanelState extends State<GroupPanel> {
|
class _GroupPanelState extends State<GroupPanel> {
|
||||||
final Box<dynamic> localCache = GStorage.localCache;
|
|
||||||
late Future _futureBuilderFuture;
|
late Future _futureBuilderFuture;
|
||||||
late List<MemberTagItemModel> tagsList;
|
late List<MemberTagItemModel> tagsList;
|
||||||
bool showDefault = true;
|
bool showDefault = true;
|
||||||
@ -137,7 +134,7 @@ class _GroupPanelState extends State<GroupPanel> {
|
|||||||
left: 20,
|
left: 20,
|
||||||
right: 20,
|
right: 20,
|
||||||
top: 12,
|
top: 12,
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 12,
|
bottom: MediaQuery.paddingOf(context).bottom + 12,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
@ -5,6 +5,8 @@ import 'package:pilipala/plugin/pl_gallery/hero_dialog_route.dart';
|
|||||||
import 'package:pilipala/plugin/pl_gallery/interactiveviewer_gallery.dart';
|
import 'package:pilipala/plugin/pl_gallery/interactiveviewer_gallery.dart';
|
||||||
import 'package:pilipala/utils/highlight.dart';
|
import 'package:pilipala/utils/highlight.dart';
|
||||||
|
|
||||||
|
import '../../utils/global_data_cache.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class HtmlRender extends StatelessWidget {
|
class HtmlRender extends StatelessWidget {
|
||||||
const HtmlRender({
|
const HtmlRender({
|
||||||
@ -41,6 +43,8 @@ class HtmlRender extends StatelessWidget {
|
|||||||
TagExtension(
|
TagExtension(
|
||||||
tagsToExtend: <String>{'img'},
|
tagsToExtend: <String>{'img'},
|
||||||
builder: (ExtensionContext extensionContext) {
|
builder: (ExtensionContext extensionContext) {
|
||||||
|
int defaultImgQuality = 10;
|
||||||
|
defaultImgQuality = GlobalDataCache.imgQuality;
|
||||||
try {
|
try {
|
||||||
final Map<String, dynamic> attributes =
|
final Map<String, dynamic> attributes =
|
||||||
extensionContext.attributes;
|
extensionContext.attributes;
|
||||||
@ -99,13 +103,13 @@ class HtmlRender extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: CachedNetworkImage(imageUrl: imgUrl),
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
imageUrl: '$imgUrl@${defaultImgQuality}q.webp',
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
// return NetworkImgLayer(
|
|
||||||
// width: isEmote ? 22 : Get.size.width - 24,
|
|
||||||
// height: isEmote ? 22 : 200,
|
|
||||||
// src: imgUrl,
|
|
||||||
// );
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
@ -138,6 +142,14 @@ class HtmlRender extends StatelessWidget {
|
|||||||
textAlign: TextAlign.justify,
|
textAlign: TextAlign.justify,
|
||||||
),
|
),
|
||||||
'img': Style(margin: Margins.only(top: 4, bottom: 4)),
|
'img': Style(margin: Margins.only(top: 4, bottom: 4)),
|
||||||
|
'figcaption': Style(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
margin: Margins.only(top: 8, bottom: 20),
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
),
|
||||||
|
'figure': Style(
|
||||||
|
margin: Margins.zero,
|
||||||
|
),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import '../../http/video.dart';
|
|||||||
import '../../utils/utils.dart';
|
import '../../utils/utils.dart';
|
||||||
import '../constants.dart';
|
import '../constants.dart';
|
||||||
import 'badge.dart';
|
import 'badge.dart';
|
||||||
|
import 'drag_handle.dart';
|
||||||
import 'network_img_layer.dart';
|
import 'network_img_layer.dart';
|
||||||
import 'stat/danmu.dart';
|
import 'stat/danmu.dart';
|
||||||
import 'stat/view.dart';
|
import 'stat/view.dart';
|
||||||
@ -373,27 +374,12 @@ class MorePanel extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
onTap: () => Get.back(),
|
|
||||||
child: Container(
|
|
||||||
height: 35,
|
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
width: 32,
|
|
||||||
height: 3,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async => await menuActionHandler('block'),
|
onTap: () async => await menuActionHandler('block'),
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:pilipala/utils/feed_back.dart';
|
|||||||
import 'package:pilipala/utils/image_save.dart';
|
import 'package:pilipala/utils/image_save.dart';
|
||||||
import 'package:pilipala/utils/route_push.dart';
|
import 'package:pilipala/utils/route_push.dart';
|
||||||
import '../../models/model_rec_video_item.dart';
|
import '../../models/model_rec_video_item.dart';
|
||||||
|
import 'drag_handle.dart';
|
||||||
import 'stat/danmu.dart';
|
import 'stat/danmu.dart';
|
||||||
import 'stat/view.dart';
|
import 'stat/view.dart';
|
||||||
import '../../http/dynamics.dart';
|
import '../../http/dynamics.dart';
|
||||||
@ -368,27 +369,12 @@ class MorePanel extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
onTap: () => Get.back(),
|
|
||||||
child: Container(
|
|
||||||
height: 35,
|
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
width: 32,
|
|
||||||
height: 3,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async => await menuActionHandler('block'),
|
onTap: () async => await menuActionHandler('block'),
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
|
|||||||
@ -626,4 +626,7 @@ class Api {
|
|||||||
/// 修复标题和海报
|
/// 修复标题和海报
|
||||||
// /api/view?id=${aid} /all/video/av${aid} /video/av${aid}/
|
// /api/view?id=${aid} /all/video/av${aid} /video/av${aid}/
|
||||||
static const String fixTitleAndPic = '${HttpString.biliplusBaseUrl}/api/view';
|
static const String fixTitleAndPic = '${HttpString.biliplusBaseUrl}/api/view';
|
||||||
|
|
||||||
|
/// 专栏详情
|
||||||
|
static const String opusDetail = '/x/polymer/web-dynamic/v1/opus/detail';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -215,4 +215,25 @@ class DynamicsHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future opusDetail({
|
||||||
|
required int opusId,
|
||||||
|
}) async {
|
||||||
|
var res = await Request().get(
|
||||||
|
Api.opusDetail,
|
||||||
|
data: {'id': opusId},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': res.data['data'],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
// ignore_for_file: avoid_print
|
// ignore_for_file: avoid_print
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:developer';
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:cookie_jar/cookie_jar.dart';
|
import 'package:cookie_jar/cookie_jar.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:dio/io.dart';
|
import 'package:dio/io.dart';
|
||||||
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
|
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/user/info.dart';
|
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import '../utils/storage.dart';
|
import '../utils/storage.dart';
|
||||||
import '../utils/utils.dart';
|
import '../utils/utils.dart';
|
||||||
@ -39,18 +37,7 @@ class Request {
|
|||||||
dio.interceptors.add(cookieManager);
|
dio.interceptors.add(cookieManager);
|
||||||
final List<Cookie> cookie = await cookieManager.cookieJar
|
final List<Cookie> cookie = await cookieManager.cookieJar
|
||||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||||
final UserInfoData? userInfo = userInfoCache.get('userInfoCache');
|
final userInfo = userInfoCache.get('userInfoCache');
|
||||||
if (userInfo != null && userInfo.mid != null) {
|
|
||||||
final List<Cookie> cookie2 = await cookieManager.cookieJar
|
|
||||||
.loadForRequest(Uri.parse(HttpString.tUrl));
|
|
||||||
if (cookie2.isEmpty) {
|
|
||||||
try {
|
|
||||||
await Request().get(HttpString.tUrl);
|
|
||||||
} catch (e) {
|
|
||||||
log("setCookie, ${e.toString()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setOptionsHeaders(userInfo, userInfo != null && userInfo.mid != null);
|
setOptionsHeaders(userInfo, userInfo != null && userInfo.mid != null);
|
||||||
String baseUrlType = 'default';
|
String baseUrlType = 'default';
|
||||||
if (setting.get(SettingBoxKey.enableGATMode, defaultValue: false)) {
|
if (setting.get(SettingBoxKey.enableGATMode, defaultValue: false)) {
|
||||||
@ -69,10 +56,10 @@ class Request {
|
|||||||
static Future<String> getCsrf() async {
|
static Future<String> getCsrf() async {
|
||||||
List<Cookie> cookies = await cookieManager.cookieJar
|
List<Cookie> cookies = await cookieManager.cookieJar
|
||||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||||
String token = '';
|
String token = cookies
|
||||||
if (cookies.where((e) => e.name == 'bili_jct').isNotEmpty) {
|
.firstWhere((e) => e.name == 'bili_jct',
|
||||||
token = cookies.firstWhere((e) => e.name == 'bili_jct').value;
|
orElse: () => Cookie('bili_jct', ''))
|
||||||
}
|
.value;
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:pilipala/utils/login.dart';
|
// import 'package:pilipala/utils/login.dart';
|
||||||
|
|
||||||
class ApiInterceptor extends Interceptor {
|
class ApiInterceptor extends Interceptor {
|
||||||
@override
|
@override
|
||||||
@ -19,9 +19,9 @@ class ApiInterceptor extends Interceptor {
|
|||||||
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
||||||
try {
|
try {
|
||||||
// 在响应之后处理数据
|
// 在响应之后处理数据
|
||||||
if (response.data is Map && response.data['code'] == -101) {
|
// if (response.data is Map && response.data['code'] == -101) {
|
||||||
LoginUtils.loginOut();
|
// LoginUtils.loginOut();
|
||||||
}
|
// }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
print('ApiInterceptor: $err');
|
print('ApiInterceptor: $err');
|
||||||
}
|
}
|
||||||
@ -39,6 +39,8 @@ class ApiInterceptor extends Interceptor {
|
|||||||
SmartDialog.showToast(
|
SmartDialog.showToast(
|
||||||
await dioError(err),
|
await dioError(err),
|
||||||
displayType: SmartToastType.onlyRefresh,
|
displayType: SmartToastType.onlyRefresh,
|
||||||
|
displayTime: const Duration(seconds: 1),
|
||||||
|
debounce: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
super.onError(err, handler);
|
super.onError(err, handler);
|
||||||
@ -62,7 +64,7 @@ class ApiInterceptor extends Interceptor {
|
|||||||
return '发送请求超时,请检查网络设置';
|
return '发送请求超时,请检查网络设置';
|
||||||
case DioExceptionType.unknown:
|
case DioExceptionType.unknown:
|
||||||
final String res = await checkConnect();
|
final String res = await checkConnect();
|
||||||
return '$res,网络异常!';
|
return '$res ${error.error}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -216,6 +216,21 @@ class BuildMainApp extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Box setting = GStorage.setting;
|
||||||
|
|
||||||
|
/// 纯黑模式主题配置
|
||||||
|
ColorScheme? pureDarkColorScheme;
|
||||||
|
final bool enablePureBlack =
|
||||||
|
setting.get(SettingBoxKey.enablePureBlack, defaultValue: false);
|
||||||
|
if (enablePureBlack) {
|
||||||
|
pureDarkColorScheme = darkColorScheme.copyWith(
|
||||||
|
background: Colors.black,
|
||||||
|
surface: Colors.black,
|
||||||
|
onPrimary: Colors.black,
|
||||||
|
onSecondary: Colors.black,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
final SnackBarThemeData snackBarTheme = SnackBarThemeData(
|
final SnackBarThemeData snackBarTheme = SnackBarThemeData(
|
||||||
actionTextColor: lightColorScheme.primary,
|
actionTextColor: lightColorScheme.primary,
|
||||||
backgroundColor: lightColorScheme.secondaryContainer,
|
backgroundColor: lightColorScheme.secondaryContainer,
|
||||||
@ -255,13 +270,13 @@ class BuildMainApp extends StatelessWidget {
|
|||||||
title: 'PiliPala',
|
title: 'PiliPala',
|
||||||
theme: buildThemeData(
|
theme: buildThemeData(
|
||||||
currentThemeValue == ThemeType.dark
|
currentThemeValue == ThemeType.dark
|
||||||
? darkColorScheme
|
? pureDarkColorScheme ?? darkColorScheme
|
||||||
: lightColorScheme,
|
: lightColorScheme,
|
||||||
),
|
),
|
||||||
darkTheme: buildThemeData(
|
darkTheme: buildThemeData(
|
||||||
currentThemeValue == ThemeType.light
|
currentThemeValue == ThemeType.light
|
||||||
? lightColorScheme
|
? lightColorScheme
|
||||||
: darkColorScheme,
|
: pureDarkColorScheme ?? darkColorScheme,
|
||||||
),
|
),
|
||||||
localizationsDelegates: const [
|
localizationsDelegates: const [
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
|||||||
@ -84,10 +84,7 @@ Widget highlightText(String str) {
|
|||||||
String remainingText = str.substring(currentIndex);
|
String remainingText = str.substring(currentIndex);
|
||||||
|
|
||||||
// 将剩余的普通文本部分添加到 children 列表中
|
// 将剩余的普通文本部分添加到 children 列表中
|
||||||
children.add(TextSpan(
|
children.add(TextSpan(text: remainingText));
|
||||||
text: remainingText,
|
|
||||||
style: DefaultTextStyle.of(Get.context!).style,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用 Text.rich 创建包含高亮显示的富文本小部件,并返回
|
// 使用 Text.rich 创建包含高亮显示的富文本小部件,并返回
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/badge.dart';
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
@ -445,27 +446,12 @@ class BangumiStatusWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget morePanel(BuildContext context, BangumiIntroController ctr) {
|
Widget morePanel(BuildContext context, BangumiIntroController ctr) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
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
|
...ctr.followStatusList
|
||||||
.map(
|
.map(
|
||||||
(e) => ListTile(
|
(e) => ListTile(
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
@ -23,28 +24,14 @@ class IntroDetail extends StatelessWidget {
|
|||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
);
|
);
|
||||||
return Container(
|
return Container(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
|
||||||
height: sheetHeight,
|
height: sheetHeight,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
const DragHandle(),
|
||||||
height: 35,
|
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
width: 32,
|
|
||||||
height: 3,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSecondaryContainer
|
|
||||||
.withOpacity(0.5),
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -113,6 +100,7 @@ class IntroDetail extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -117,20 +117,23 @@ class DynamicsController extends GetxController {
|
|||||||
/// 点击评论action 直接查看评论
|
/// 点击评论action 直接查看评论
|
||||||
if (action == 'comment') {
|
if (action == 'comment') {
|
||||||
Get.toNamed('/dynamicDetail',
|
Get.toNamed('/dynamicDetail',
|
||||||
arguments: {'item': item, 'floor': floor, 'action': action});
|
arguments: {'item': item, 'floor': floor, 'action': action},
|
||||||
|
preventDuplicates: false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (item!.type) {
|
switch (item!.type) {
|
||||||
/// 转发的动态
|
/// 转发的动态
|
||||||
case 'DYNAMIC_TYPE_FORWARD':
|
case 'DYNAMIC_TYPE_FORWARD':
|
||||||
Get.toNamed('/dynamicDetail',
|
Get.toNamed('/dynamicDetail',
|
||||||
arguments: {'item': item, 'floor': floor});
|
arguments: {'item': item, 'floor': floor},
|
||||||
|
preventDuplicates: false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/// 图文动态查看
|
/// 图文动态查看
|
||||||
case 'DYNAMIC_TYPE_DRAW':
|
case 'DYNAMIC_TYPE_DRAW':
|
||||||
Get.toNamed('/dynamicDetail',
|
Get.toNamed('/dynamicDetail',
|
||||||
arguments: {'item': item, 'floor': floor});
|
arguments: {'item': item, 'floor': floor},
|
||||||
|
preventDuplicates: false);
|
||||||
break;
|
break;
|
||||||
case 'DYNAMIC_TYPE_AV':
|
case 'DYNAMIC_TYPE_AV':
|
||||||
String bvid = item.modules.moduleDynamic.major.archive.bvid;
|
String bvid = item.modules.moduleDynamic.major.archive.bvid;
|
||||||
@ -188,7 +191,8 @@ class DynamicsController extends GetxController {
|
|||||||
case 'DYNAMIC_TYPE_WORD':
|
case 'DYNAMIC_TYPE_WORD':
|
||||||
print('纯文本');
|
print('纯文本');
|
||||||
Get.toNamed('/dynamicDetail',
|
Get.toNamed('/dynamicDetail',
|
||||||
arguments: {'item': item, 'floor': floor});
|
arguments: {'item': item, 'floor': floor},
|
||||||
|
preventDuplicates: false);
|
||||||
break;
|
break;
|
||||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||||
DynamicLiveModel liveRcmd = item.modules.moduleDynamic.major.liveRcmd;
|
DynamicLiveModel liveRcmd = item.modules.moduleDynamic.major.liveRcmd;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/html.dart';
|
import 'package:pilipala/http/dynamics.dart';
|
||||||
import 'package:pilipala/http/reply.dart';
|
import 'package:pilipala/http/reply.dart';
|
||||||
import 'package:pilipala/models/common/reply_sort_type.dart';
|
import 'package:pilipala/models/common/reply_sort_type.dart';
|
||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
@ -12,6 +12,7 @@ class DynamicDetailController extends GetxController {
|
|||||||
DynamicDetailController(this.oid, this.type);
|
DynamicDetailController(this.oid, this.type);
|
||||||
int? oid;
|
int? oid;
|
||||||
int? type;
|
int? type;
|
||||||
|
int? opusId;
|
||||||
dynamic item;
|
dynamic item;
|
||||||
int? floor;
|
int? floor;
|
||||||
String nextOffset = "";
|
String nextOffset = "";
|
||||||
@ -56,6 +57,12 @@ class DynamicDetailController extends GetxController {
|
|||||||
if (reqType == 'init') {
|
if (reqType == 'init') {
|
||||||
nextOffset = '';
|
nextOffset = '';
|
||||||
noMore.value = '';
|
noMore.value = '';
|
||||||
|
if (opusId != null && oid == 0) {
|
||||||
|
var res = await DynamicsHttp.opusDetail(opusId: opusId!);
|
||||||
|
if (res['status']) {
|
||||||
|
oid = int.parse(res['data']['item']['basic']['comment_id_str']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var res = await ReplyHttp.replyList(
|
var res = await ReplyHttp.replyList(
|
||||||
oid: oid!,
|
oid: oid!,
|
||||||
@ -110,15 +117,12 @@ class DynamicDetailController extends GetxController {
|
|||||||
sortTypeTitle.value = _sortType.titles;
|
sortTypeTitle.value = _sortType.titles;
|
||||||
sortTypeLabel.value = _sortType.labels;
|
sortTypeLabel.value = _sortType.labels;
|
||||||
replyList.clear();
|
replyList.clear();
|
||||||
|
noMore.value = '';
|
||||||
|
isLoadingMore = false;
|
||||||
|
isEnd = false;
|
||||||
queryReplyList(reqType: 'init');
|
queryReplyList(reqType: 'init');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据jumpUrl获取动态html
|
|
||||||
reqHtmlByOpusId(int id) async {
|
|
||||||
var res = await HtmlHttp.reqHtml(id, 'opus');
|
|
||||||
oid = res['commentId'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 上拉加载
|
// 上拉加载
|
||||||
Future onLoad() async {
|
Future onLoad() async {
|
||||||
queryReplyList(reqType: 'onLoad');
|
queryReplyList(reqType: 'onLoad');
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import '../../../models/video/reply/item.dart';
|
|||||||
import '../widgets/dynamic_panel.dart';
|
import '../widgets/dynamic_panel.dart';
|
||||||
|
|
||||||
class DynamicDetailPage extends StatefulWidget {
|
class DynamicDetailPage extends StatefulWidget {
|
||||||
// const DynamicDetailPage({super.key});
|
|
||||||
const DynamicDetailPage({Key? key}) : super(key: key);
|
const DynamicDetailPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -90,20 +89,22 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
_dynamicDetailController = Get.put(
|
_dynamicDetailController = Get.put(
|
||||||
DynamicDetailController(oid, replyType),
|
DynamicDetailController(oid, replyType),
|
||||||
tag: opusId.toString());
|
tag: opusId.toString());
|
||||||
await _dynamicDetailController.reqHtmlByOpusId(opusId!);
|
_dynamicDetailController.opusId = opusId;
|
||||||
setState(() {});
|
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
oid = moduleDynamic.major!.draw!.id!;
|
oid = moduleDynamic.major!.draw!.id!;
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (err) {
|
||||||
|
print('err:${err.toString()}');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isOpusId) {
|
if (!isOpusId) {
|
||||||
_dynamicDetailController =
|
_dynamicDetailController =
|
||||||
Get.put(DynamicDetailController(oid, replyType), tag: oid.toString());
|
Get.put(DynamicDetailController(oid, replyType), tag: oid.toString());
|
||||||
}
|
|
||||||
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 查看二级评论
|
// 查看二级评论
|
||||||
void replyReply(replyItem, currentReply, loadMore) {
|
void replyReply(replyItem, currentReply, loadMore) {
|
||||||
@ -132,7 +133,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
// 分页加载
|
// 分页加载
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 300) {
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
EasyThrottle.throttle('replyList', const Duration(seconds: 2), () {
|
||||||
_dynamicDetailController.onLoad();
|
_dynamicDetailController.onLoad();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:easy_debounce/easy_throttle.dart';
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -61,6 +63,7 @@ class _OverlayPanelState extends State<OverlayPanel>
|
|||||||
|
|
||||||
void onClickUp(data, i, {type = 'click'}) {
|
void onClickUp(data, i, {type = 'click'}) {
|
||||||
if (type == 'click') {
|
if (type == 'click') {
|
||||||
|
data.hasUpdate = false;
|
||||||
pageController.jumpToPage(i);
|
pageController.jumpToPage(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,11 +84,11 @@ class _OverlayPanelState extends State<OverlayPanel>
|
|||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 8.0, sigmaY: 8.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
TabBar(
|
||||||
height: 50,
|
|
||||||
child: TabBar(
|
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
automaticIndicatorColorAdjustment: false,
|
automaticIndicatorColorAdjustment: false,
|
||||||
@ -106,7 +109,6 @@ class _OverlayPanelState extends State<OverlayPanel>
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PageView.builder(
|
child: PageView.builder(
|
||||||
itemCount: upList.length,
|
itemCount: upList.length,
|
||||||
@ -119,13 +121,15 @@ class _OverlayPanelState extends State<OverlayPanel>
|
|||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
child: UpDyanmicsPage(upInfo: upList[index], ctr: widget.ctr),
|
child:
|
||||||
|
UpDyanmicsPage(upInfo: upList[index], ctr: widget.ctr),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,8 +143,8 @@ class _OverlayPanelState extends State<OverlayPanel>
|
|||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
scale: currentMid == data.mid ? 1 : 0.9,
|
scale: currentMid == data.mid ? 1 : 0.9,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
width: contentWidth,
|
width: 46,
|
||||||
height: contentWidth,
|
height: 46,
|
||||||
src: data.face,
|
src: data.face,
|
||||||
type: 'avatar',
|
type: 'avatar',
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
@ -108,28 +109,12 @@ class MorePanel extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
// clipBehavior: Clip.hardEdge,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
onTap: () => Get.back(),
|
|
||||||
child: Container(
|
|
||||||
height: 35,
|
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
width: 32,
|
|
||||||
height: 3,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -44,6 +44,7 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
|
|
||||||
void onClickUp(data, i) {
|
void onClickUp(data, i) {
|
||||||
currentMid.value = data.mid;
|
currentMid.value = data.mid;
|
||||||
|
data.hasUpdate = false;
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
PlPopupRoute(
|
PlPopupRoute(
|
||||||
|
|||||||
@ -134,8 +134,9 @@ class FavDetailController extends GetxController {
|
|||||||
'privacy': [22, 0].contains(item!.attr) ? 0 : 1,
|
'privacy': [22, 0].contains(item!.attr) ? 0 : 1,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
if (res != null) {
|
||||||
title.value = res['title'];
|
title.value = res['title'];
|
||||||
print(title);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future toViewPlayAll() async {
|
Future toViewPlayAll() async {
|
||||||
|
|||||||
@ -53,6 +53,7 @@ class FavEditController extends GetxController {
|
|||||||
intro: intro,
|
intro: intro,
|
||||||
mediaId: mediaId!,
|
mediaId: mediaId!,
|
||||||
cover: cover,
|
cover: cover,
|
||||||
|
privacy: privacy.value,
|
||||||
);
|
);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast('编辑成功');
|
SmartDialog.showToast('编辑成功');
|
||||||
@ -74,4 +75,14 @@ class FavEditController extends GetxController {
|
|||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void togglePrivacy() {
|
||||||
|
if (privacy.value == 0) {
|
||||||
|
privacy.value = 1;
|
||||||
|
SmartDialog.showToast('设置为私密后,只有自己可见');
|
||||||
|
} else {
|
||||||
|
privacy.value = 0;
|
||||||
|
SmartDialog.showToast('设置为公开后,所有人可见');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,31 +21,22 @@ class _FavEditPageState extends State<FavEditPage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Obx(
|
title: Obx(
|
||||||
() => _favEditController.type.value == 'add'
|
() => _favEditController.type.value == 'add'
|
||||||
? Text(
|
? const Text('新建收藏夹')
|
||||||
'新建收藏夹',
|
: const Text('编辑收藏夹'),
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
)
|
|
||||||
: Text(
|
|
||||||
'编辑收藏夹',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
Obx(
|
Obx(
|
||||||
() => _favEditController.privacy.value == 0
|
() => IconButton(
|
||||||
? IconButton(
|
onPressed: _favEditController.togglePrivacy,
|
||||||
onPressed: () {
|
|
||||||
_favEditController.privacy.value = 1;
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.lock_open_outlined))
|
|
||||||
: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
_favEditController.privacy.value = 0;
|
|
||||||
},
|
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.lock_outlined,
|
_favEditController.privacy.value == 0
|
||||||
color: Theme.of(context).colorScheme.error,
|
? Icons.lock_open_outlined
|
||||||
)),
|
: Icons.lock_outlined,
|
||||||
|
color: _favEditController.privacy.value == 0
|
||||||
|
? null
|
||||||
|
: Theme.of(context).colorScheme.error,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: _favEditController.onSubmit, child: const Text('保存')),
|
onPressed: _favEditController.onSubmit, child: const Text('保存')),
|
||||||
|
|||||||
@ -3,8 +3,8 @@ import 'package:get/get.dart';
|
|||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/models/follow/result.dart';
|
import 'package:pilipala/models/follow/result.dart';
|
||||||
import 'package:pilipala/pages/follow/index.dart';
|
import 'package:pilipala/pages/follow/index.dart';
|
||||||
import 'package:pilipala/pages/video/detail/introduction/widgets/group_panel.dart';
|
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
import 'package:pilipala/utils/follow.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class FollowItem extends StatelessWidget {
|
class FollowItem extends StatelessWidget {
|
||||||
@ -47,28 +47,11 @@ class FollowItem extends StatelessWidget {
|
|||||||
height: 34,
|
height: 34,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await showModalBottomSheet(
|
int followStatus = await FollowUtils(
|
||||||
context: context,
|
context: context,
|
||||||
useSafeArea: true,
|
followStatus: 2,
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return DraggableScrollableSheet(
|
|
||||||
initialChildSize: 0.6,
|
|
||||||
minChildSize: 0,
|
|
||||||
maxChildSize: 1,
|
|
||||||
snap: true,
|
|
||||||
expand: false,
|
|
||||||
snapSizes: const [0.6],
|
|
||||||
builder: (BuildContext context,
|
|
||||||
ScrollController scrollController) {
|
|
||||||
return GroupPanel(
|
|
||||||
mid: item.mid!,
|
mid: item.mid!,
|
||||||
scrollController: scrollController,
|
).showFollowSheet();
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
||||||
|
|||||||
@ -122,6 +122,7 @@ class LaterController extends GetxController {
|
|||||||
'heroTag': heroTag,
|
'heroTag': heroTag,
|
||||||
'sourceType': 'watchLater',
|
'sourceType': 'watchLater',
|
||||||
'count': laterList.length,
|
'count': laterList.length,
|
||||||
|
'mediaId': userInfo!.mid,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class LiveRoomController extends GetxController {
|
|||||||
Request.getBuvid().then((value) => buvid = value);
|
Request.getBuvid().then((value) => buvid = value);
|
||||||
}
|
}
|
||||||
// CDN优化
|
// CDN优化
|
||||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: false);
|
||||||
final userInfo = userInfoCache.get('userInfoCache');
|
final userInfo = userInfoCache.get('userInfoCache');
|
||||||
if (userInfo != null && userInfo.mid != null) {
|
if (userInfo != null && userInfo.mid != null) {
|
||||||
userId = userInfo.mid;
|
userId = userInfo.mid;
|
||||||
|
|||||||
@ -1,14 +1,19 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:cookie_jar/cookie_jar.dart';
|
||||||
|
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
|
||||||
import 'package:encrypt/encrypt.dart';
|
import 'package:encrypt/encrypt.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/http/constants.dart';
|
||||||
|
import 'package:pilipala/http/index.dart';
|
||||||
import 'package:pilipala/http/login.dart';
|
import 'package:pilipala/http/login.dart';
|
||||||
import 'package:gt3_flutter_plugin/gt3_flutter_plugin.dart';
|
import 'package:gt3_flutter_plugin/gt3_flutter_plugin.dart';
|
||||||
import 'package:pilipala/models/login/index.dart';
|
import 'package:pilipala/models/login/index.dart';
|
||||||
import 'package:pilipala/utils/login.dart';
|
import 'package:pilipala/utils/login.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class LoginPageController extends GetxController {
|
class LoginPageController extends GetxController {
|
||||||
final GlobalKey mobFormKey = GlobalKey<FormState>();
|
final GlobalKey mobFormKey = GlobalKey<FormState>();
|
||||||
@ -341,4 +346,32 @@ class LoginPageController extends GetxController {
|
|||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cookie登录
|
||||||
|
Future loginInByCookie({
|
||||||
|
required String cookiesStr,
|
||||||
|
String domain = HttpString.baseUrl,
|
||||||
|
}) async {
|
||||||
|
final List<String> cookiesStrList = cookiesStr.split('; ');
|
||||||
|
final List<Cookie> cookiesList = cookiesStrList.map((cookie) {
|
||||||
|
final cookieArr = cookie.split('=');
|
||||||
|
return Cookie(cookieArr[0], cookieArr[1]);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
final String cookiePath = await Utils.getCookiePath();
|
||||||
|
final cookieJar = PersistCookieJar(
|
||||||
|
ignoreExpires: true,
|
||||||
|
storage: FileStorage(cookiePath),
|
||||||
|
);
|
||||||
|
CookieManager cookieManager = CookieManager(cookieJar);
|
||||||
|
Request.cookieManager = cookieManager;
|
||||||
|
await Request.cookieManager.cookieJar
|
||||||
|
.saveFromResponse(Uri.parse(HttpString.baseUrl), cookiesList);
|
||||||
|
try {
|
||||||
|
Request.dio.options.headers['cookie'] = cookiesStr;
|
||||||
|
} catch (err) {
|
||||||
|
debugPrint(err.toString());
|
||||||
|
}
|
||||||
|
LoginUtils.confirmLogin('', null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,36 +14,8 @@ class LoginPage extends StatefulWidget {
|
|||||||
class _LoginPageState extends State<LoginPage> {
|
class _LoginPageState extends State<LoginPage> {
|
||||||
final LoginPageController _loginPageCtr = Get.put(LoginPageController());
|
final LoginPageController _loginPageCtr = Get.put(LoginPageController());
|
||||||
|
|
||||||
@override
|
// 浏览器登录
|
||||||
void dispose() {
|
void loginInByWeb() {
|
||||||
_loginPageCtr.validTimer?.cancel();
|
|
||||||
_loginPageCtr.timer?.cancel();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
leading: Obx(
|
|
||||||
() => _loginPageCtr.currentIndex.value == 0
|
|
||||||
? IconButton(
|
|
||||||
onPressed: () async {
|
|
||||||
_loginPageCtr.mobTextFieldNode.unfocus();
|
|
||||||
await Future.delayed(const Duration(milliseconds: 200));
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.close_outlined),
|
|
||||||
)
|
|
||||||
: IconButton(
|
|
||||||
onPressed: () => _loginPageCtr.previousPage(),
|
|
||||||
icon: const Icon(Icons.arrow_back),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
tooltip: '浏览器打开',
|
|
||||||
onPressed: () {
|
|
||||||
Get.offNamed(
|
Get.offNamed(
|
||||||
'/webview',
|
'/webview',
|
||||||
parameters: {
|
parameters: {
|
||||||
@ -52,17 +24,14 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
'pageTitle': '登录bilibili',
|
'pageTitle': '登录bilibili',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
icon: const Icon(Icons.language, size: 20),
|
|
||||||
),
|
// 二维码方式登录
|
||||||
IconButton(
|
void loginInByWebQrcode() {
|
||||||
tooltip: '二维码登录',
|
|
||||||
onPressed: () {
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return StatefulBuilder(
|
return StatefulBuilder(builder: (context, StateSetter setState) {
|
||||||
builder: (context, StateSetter setState) {
|
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Row(
|
title: Row(
|
||||||
children: [
|
children: [
|
||||||
@ -84,8 +53,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _loginPageCtr.getWebQrcode(),
|
future: _loginPageCtr.getWebQrcode(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState ==
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
ConnectionState.done) {
|
|
||||||
if (snapshot.data == null) {
|
if (snapshot.data == null) {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
@ -122,10 +90,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
'检查登录状态',
|
'检查登录状态',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: Theme.of(context)
|
fontSize: Theme.of(context).textTheme.titleMedium!.fontSize,
|
||||||
.textTheme
|
|
||||||
.titleMedium!
|
|
||||||
.fontSize,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -136,7 +101,97 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
).then((value) {
|
).then((value) {
|
||||||
_loginPageCtr.validTimer!.cancel();
|
_loginPageCtr.validTimer!.cancel();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// cookie登录
|
||||||
|
// cookie登录
|
||||||
|
void loginInByCookie() async {
|
||||||
|
var cookies = '';
|
||||||
|
final outline = Theme.of(context).colorScheme.outline;
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('Cookie登录'),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Text('请将主站cookie粘贴到下方输入框中,点击「确认」即可完成登录。(记得清空粘贴板~)'),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
TextField(
|
||||||
|
minLines: 1,
|
||||||
|
maxLines: 3,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'cookie',
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(6.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onChanged: (e) => cookies = e,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: Navigator.of(context).pop,
|
||||||
|
child: Text('取消', style: TextStyle(color: outline))),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (cookies.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await _loginPageCtr.loginInByCookie(cookiesStr: cookies);
|
||||||
|
if (context.mounted) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
child: const Text('确认'))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_loginPageCtr.validTimer?.cancel();
|
||||||
|
_loginPageCtr.timer?.cancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
leading: Obx(
|
||||||
|
() => _loginPageCtr.currentIndex.value == 0
|
||||||
|
? IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
_loginPageCtr.mobTextFieldNode.unfocus();
|
||||||
|
await Future.delayed(const Duration(milliseconds: 200));
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.close_outlined),
|
||||||
|
)
|
||||||
|
: IconButton(
|
||||||
|
onPressed: () => _loginPageCtr.previousPage(),
|
||||||
|
icon: const Icon(Icons.arrow_back),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
tooltip: '浏览器打开',
|
||||||
|
onPressed: loginInByWeb,
|
||||||
|
icon: const Icon(Icons.language, size: 20),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
tooltip: 'cookie登录',
|
||||||
|
onPressed: loginInByCookie,
|
||||||
|
icon: const Icon(Icons.cookie_outlined, size: 20),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
tooltip: '二维码登录',
|
||||||
|
onPressed: loginInByWebQrcode,
|
||||||
icon: const Icon(Icons.qr_code, size: 20),
|
icon: const Icon(Icons.qr_code, size: 20),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 22),
|
const SizedBox(width: 22),
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/http/member.dart';
|
import 'package:pilipala/http/member.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/http/video.dart';
|
|
||||||
import 'package:pilipala/models/member/archive.dart';
|
import 'package:pilipala/models/member/archive.dart';
|
||||||
import 'package:pilipala/models/member/coin.dart';
|
import 'package:pilipala/models/member/coin.dart';
|
||||||
import 'package:pilipala/models/member/info.dart';
|
import 'package:pilipala/models/member/info.dart';
|
||||||
import 'package:pilipala/models/member/like.dart';
|
import 'package:pilipala/models/member/like.dart';
|
||||||
import 'package:pilipala/models/user/info.dart';
|
import 'package:pilipala/models/user/info.dart';
|
||||||
|
import 'package:pilipala/utils/follow.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
@ -29,6 +28,12 @@ class MemberController extends GetxController {
|
|||||||
RxList<MemberCoinsDataModel> recentCoinsList = <MemberCoinsDataModel>[].obs;
|
RxList<MemberCoinsDataModel> recentCoinsList = <MemberCoinsDataModel>[].obs;
|
||||||
RxList<MemberLikeDataModel> recentLikeList = <MemberLikeDataModel>[].obs;
|
RxList<MemberLikeDataModel> recentLikeList = <MemberLikeDataModel>[].obs;
|
||||||
RxBool isOwner = false.obs;
|
RxBool isOwner = false.obs;
|
||||||
|
final Map<int, String> attributeTextMap = {
|
||||||
|
1: '悄悄关注',
|
||||||
|
2: '已关注',
|
||||||
|
6: '已互粉',
|
||||||
|
128: '已拉黑',
|
||||||
|
};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -85,11 +90,12 @@ class MemberController extends GetxController {
|
|||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (attribute.value == 128) {
|
attribute.value = await FollowUtils(
|
||||||
modifyRelation('block');
|
context: Get.context!,
|
||||||
} else {
|
followStatus: attribute.value,
|
||||||
modifyRelation('follow');
|
mid: mid,
|
||||||
}
|
).showFollowSheet();
|
||||||
|
attributeText.value = attributeTextMap[attribute.value] ?? '关注';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关系查询
|
// 关系查询
|
||||||
@ -99,16 +105,10 @@ class MemberController extends GetxController {
|
|||||||
var res = await UserHttp.hasFollow(mid);
|
var res = await UserHttp.hasFollow(mid);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
attribute.value = res['data']['attribute'];
|
attribute.value = res['data']['attribute'];
|
||||||
final Map<int, String> attributeTextMap = {
|
|
||||||
1: '悄悄关注',
|
|
||||||
2: '已关注',
|
|
||||||
6: '已互关',
|
|
||||||
128: '已拉黑',
|
|
||||||
};
|
|
||||||
attributeText.value = attributeTextMap[attribute.value] ?? '关注';
|
|
||||||
if (res['data']['special'] == 1) {
|
if (res['data']['special'] == 1) {
|
||||||
attributeText.value = '特别关注';
|
attributeText.value = '特别关注';
|
||||||
}
|
}
|
||||||
|
attributeText.value = attributeTextMap[attribute.value] ?? '关注';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,66 +118,15 @@ class MemberController extends GetxController {
|
|||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
modifyRelation('block');
|
final String actionType = attribute.value == 128 ? 'remove' : 'block';
|
||||||
}
|
attribute.value = await FollowUtils(
|
||||||
|
|
||||||
// 合并关注/取关和拉黑逻辑
|
|
||||||
Future modifyRelation(String actionType) async {
|
|
||||||
String contentText;
|
|
||||||
int act;
|
|
||||||
if (actionType == 'follow') {
|
|
||||||
contentText = memberInfo.value.isFollowed! ? '确定取消关注UP主?' : '确定关注UP主?';
|
|
||||||
act = memberInfo.value.isFollowed! ? 2 : 1;
|
|
||||||
} else if (actionType == 'block') {
|
|
||||||
contentText = attribute.value != 128 ? '确定拉黑UP主?' : '确定从黑名单移除UP主?';
|
|
||||||
act = attribute.value != 128 ? 5 : 6;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
showDialog(
|
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (BuildContext context) {
|
followStatus: attribute.value,
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('提示'),
|
|
||||||
content: Text(contentText),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: Text(
|
|
||||||
'点错了',
|
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
var res = await VideoHttp.relationMod(
|
|
||||||
mid: mid,
|
mid: mid,
|
||||||
act: act,
|
).modifyRelationFetch(actionType, isDirect: true);
|
||||||
reSrc: 11,
|
if (attribute.value != -1) {
|
||||||
);
|
attributeText.value = attributeTextMap[attribute.value] ?? '关注';
|
||||||
SmartDialog.dismiss();
|
|
||||||
if (res['status']) {
|
|
||||||
if (actionType == 'follow') {
|
|
||||||
memberInfo.value.isFollowed = !memberInfo.value.isFollowed!;
|
|
||||||
} else if (actionType == 'block') {
|
|
||||||
attribute.value = attribute.value != 128 ? 128 : 0;
|
|
||||||
attributeText.value = attribute.value == 128 ? '已拉黑' : '关注';
|
|
||||||
memberInfo.value.isFollowed = false;
|
|
||||||
}
|
}
|
||||||
relationSearch();
|
|
||||||
if (context.mounted) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
memberInfo.update((val) {});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const Text('确定'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void shareUser() {
|
void shareUser() {
|
||||||
|
|||||||
@ -37,6 +37,7 @@ class MemberSearchController extends GetxController {
|
|||||||
} else {
|
} else {
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
|
loadingStatus.value = 'init';
|
||||||
}
|
}
|
||||||
|
|
||||||
void onChange(value) {
|
void onChange(value) {
|
||||||
@ -76,7 +77,7 @@ class MemberSearchController extends GetxController {
|
|||||||
archivePn += 1;
|
archivePn += 1;
|
||||||
hasRequest = true;
|
hasRequest = true;
|
||||||
}
|
}
|
||||||
// loadingStatus.value = 'finish';
|
loadingStatus.value = 'finish';
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/models/read/opus.dart';
|
import 'package:pilipala/models/read/opus.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'text_helper.dart';
|
import 'text_helper.dart';
|
||||||
|
|
||||||
@ -26,17 +27,19 @@ class _OpusPageState extends State<OpusPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: _buildAppBar(),
|
appBar: _buildAppBar(),
|
||||||
body: SingleChildScrollView(
|
body: CustomScrollView(
|
||||||
controller: controller.scrollController,
|
controller: controller.scrollController,
|
||||||
child: Column(
|
slivers: [
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
SliverList(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
delegate: SliverChildListDelegate(
|
||||||
children: [
|
[
|
||||||
_buildTitle(),
|
_buildTitle(),
|
||||||
_buildFutureContent(),
|
_buildFutureContent(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:pilipala/models/read/opus.dart';
|
|||||||
import 'package:pilipala/models/read/read.dart';
|
import 'package:pilipala/models/read/read.dart';
|
||||||
import 'package:pilipala/pages/opus/text_helper.dart';
|
import 'package:pilipala/pages/opus/text_helper.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
|
|
||||||
class ReadPage extends StatefulWidget {
|
class ReadPage extends StatefulWidget {
|
||||||
@ -38,17 +39,19 @@ class _ReadPageState extends State<ReadPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: _buildAppBar(),
|
appBar: _buildAppBar(),
|
||||||
body: SingleChildScrollView(
|
body: CustomScrollView(
|
||||||
controller: controller.scrollController,
|
controller: controller.scrollController,
|
||||||
child: Column(
|
slivers: [
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
SliverList(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
delegate: SliverChildListDelegate(
|
||||||
children: [
|
[
|
||||||
_buildTitle(),
|
_buildTitle(),
|
||||||
_buildFutureContent(),
|
_buildFutureContent(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
late int defaultFullScreenMode;
|
late int defaultFullScreenMode;
|
||||||
late int defaultBtmProgressBehavior;
|
late int defaultBtmProgressBehavior;
|
||||||
late String defaultAoOutput;
|
late String defaultAoOutput;
|
||||||
|
late String hardwareDecodeFormat;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -49,6 +50,8 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
defaultValue: BtmProgresBehavior.values.first.code);
|
defaultValue: BtmProgresBehavior.values.first.code);
|
||||||
defaultAoOutput =
|
defaultAoOutput =
|
||||||
setting.get(SettingBoxKey.defaultAoOutput, defaultValue: '0');
|
setting.get(SettingBoxKey.defaultAoOutput, defaultValue: '0');
|
||||||
|
hardwareDecodeFormat = setting.get(SettingBoxKey.hardwareDecodeFormat,
|
||||||
|
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -92,7 +95,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
title: 'CDN优化',
|
title: 'CDN优化',
|
||||||
subTitle: '使用优质CDN线路',
|
subTitle: '使用优质CDN线路',
|
||||||
setKey: SettingBoxKey.enableCDN,
|
setKey: SettingBoxKey.enableCDN,
|
||||||
defaultVal: true,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '自动播放',
|
title: '自动播放',
|
||||||
@ -294,6 +297,34 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
dense: false,
|
||||||
|
title: Text('硬解方式', style: titleStyle),
|
||||||
|
subtitle: Text(
|
||||||
|
'当前硬解方式(--hwdec):$hardwareDecodeFormat',
|
||||||
|
style: subTitleStyle,
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
String? result = await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return SelectDialog<String>(
|
||||||
|
title: '硬解方式',
|
||||||
|
value: hardwareDecodeFormat,
|
||||||
|
values: ['no', 'auto-safe', 'auto', 'yes', 'auto-copy']
|
||||||
|
.map((e) {
|
||||||
|
return {'title': e, 'value': e};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
setting.put(SettingBoxKey.hardwareDecodeFormat, result);
|
||||||
|
hardwareDecodeFormat = result;
|
||||||
|
GlobalDataCache.hardwareDecodeFormat = result;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text('默认全屏方式', style: titleStyle),
|
title: Text('默认全屏方式', style: titleStyle),
|
||||||
|
|||||||
@ -249,6 +249,15 @@ class _StyleSettingState extends State<StyleSetting> {
|
|||||||
'当前模式:${settingController.themeType.value.description}',
|
'当前模式:${settingController.themeType.value.description}',
|
||||||
style: subTitleStyle)),
|
style: subTitleStyle)),
|
||||||
),
|
),
|
||||||
|
SetSwitchItem(
|
||||||
|
title: '纯黑模式',
|
||||||
|
subTitle: '深色模式时使用纯黑色背景,适用于OLED屏幕',
|
||||||
|
setKey: SettingBoxKey.enablePureBlack,
|
||||||
|
defaultVal: false,
|
||||||
|
callFn: (bool val) => {
|
||||||
|
if (val && Get.isDarkMode) {Get.appUpdate()}
|
||||||
|
},
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
onTap: () => settingController.setDynamicBadgeMode(context),
|
onTap: () => settingController.setDynamicBadgeMode(context),
|
||||||
|
|||||||
@ -116,6 +116,7 @@ class VideoDetailController extends GetxController
|
|||||||
BottomControlType.time,
|
BottomControlType.time,
|
||||||
BottomControlType.space,
|
BottomControlType.space,
|
||||||
BottomControlType.fit,
|
BottomControlType.fit,
|
||||||
|
BottomControlType.speed,
|
||||||
BottomControlType.fullscreen,
|
BottomControlType.fullscreen,
|
||||||
].obs;
|
].obs;
|
||||||
RxDouble sheetHeight = 0.0.obs;
|
RxDouble sheetHeight = 0.0.obs;
|
||||||
@ -168,7 +169,7 @@ class VideoDetailController extends GetxController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CDN优化
|
// CDN优化
|
||||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: false);
|
||||||
// 预设的画质
|
// 预设的画质
|
||||||
cacheVideoQa = setting.get(SettingBoxKey.defaultVideoQa);
|
cacheVideoQa = setting.get(SettingBoxKey.defaultVideoQa);
|
||||||
// 预设的解码格式
|
// 预设的解码格式
|
||||||
@ -486,7 +487,7 @@ class VideoDetailController extends GetxController
|
|||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
if (result['data'].subtitles.isNotEmpty) {
|
if (result['data'].subtitles.isNotEmpty) {
|
||||||
subtitles = result['data'].subtitles;
|
subtitles = result['data'].subtitles;
|
||||||
getDanmaku(subtitles);
|
getSubtitleContent(subtitles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
headerControl = HeaderControl(
|
headerControl = HeaderControl(
|
||||||
@ -500,8 +501,8 @@ class VideoDetailController extends GetxController
|
|||||||
plPlayerController.setHeaderControl(headerControl);
|
plPlayerController.setHeaderControl(headerControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取弹幕
|
// 获取字幕
|
||||||
Future getDanmaku(List subtitles) async {
|
Future getSubtitleContent(List subtitles) async {
|
||||||
if (subtitles.isNotEmpty) {
|
if (subtitles.isNotEmpty) {
|
||||||
for (var i in subtitles) {
|
for (var i in subtitles) {
|
||||||
final Map<String, dynamic> res = await VideoHttp.getSubtitleContent(
|
final Map<String, dynamic> res = await VideoHttp.getSubtitleContent(
|
||||||
@ -623,10 +624,8 @@ class VideoDetailController extends GetxController
|
|||||||
}
|
}
|
||||||
|
|
||||||
void toggeleWatchLaterVisible(bool val) {
|
void toggeleWatchLaterVisible(bool val) {
|
||||||
if (sourceType.value == 'watchLater' ||
|
if (['watchLater', 'fav', 'up_archive'].contains(sourceType.value)) {
|
||||||
sourceType.value == 'fav' ||
|
isWatchLaterVisible.value = val;
|
||||||
sourceType.value == 'up_archive') {
|
|
||||||
isWatchLaterVisible.value = !isWatchLaterVisible.value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import 'package:pilipala/pages/video/detail/controller.dart';
|
|||||||
import 'package:pilipala/pages/video/detail/reply/index.dart';
|
import 'package:pilipala/pages/video/detail/reply/index.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
import 'package:pilipala/utils/follow.dart';
|
||||||
import 'package:pilipala/utils/global_data_cache.dart';
|
import 'package:pilipala/utils/global_data_cache.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
@ -26,7 +27,6 @@ import '../../../../common/pages_bottom_sheet.dart';
|
|||||||
import '../../../../models/common/video_episode_type.dart';
|
import '../../../../models/common/video_episode_type.dart';
|
||||||
import '../../../../utils/drawer.dart';
|
import '../../../../utils/drawer.dart';
|
||||||
import '../related/index.dart';
|
import '../related/index.dart';
|
||||||
import 'widgets/group_panel.dart';
|
|
||||||
|
|
||||||
class VideoIntroController extends GetxController {
|
class VideoIntroController extends GetxController {
|
||||||
VideoIntroController({required this.bvid});
|
VideoIntroController({required this.bvid});
|
||||||
@ -50,7 +50,7 @@ class VideoIntroController extends GetxController {
|
|||||||
List addMediaIdsNew = [];
|
List addMediaIdsNew = [];
|
||||||
List delMediaIdsNew = [];
|
List delMediaIdsNew = [];
|
||||||
// 关注状态 默认未关注
|
// 关注状态 默认未关注
|
||||||
RxMap followStatus = {}.obs;
|
RxInt followStatus = (-1).obs;
|
||||||
RxInt lastPlayCid = 0.obs;
|
RxInt lastPlayCid = 0.obs;
|
||||||
UserInfoData? userInfo;
|
UserInfoData? userInfo;
|
||||||
RxList<VideoTagItem> videoTags = <VideoTagItem>[].obs;
|
RxList<VideoTagItem> videoTags = <VideoTagItem>[].obs;
|
||||||
@ -66,6 +66,8 @@ class VideoIntroController extends GetxController {
|
|||||||
late bool enableRelatedVideo;
|
late bool enableRelatedVideo;
|
||||||
UgcSeason? ugcSeason;
|
UgcSeason? ugcSeason;
|
||||||
RxList<Part> pages = <Part>[].obs;
|
RxList<Part> pages = <Part>[].obs;
|
||||||
|
// 默认原创视频
|
||||||
|
int copyright = 1;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -88,15 +90,15 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取视频简介&分p
|
// 获取视频简介&分p
|
||||||
Future queryVideoIntro({cover}) async {
|
Future queryVideoIntro({String? cover, String? type, int? cid}) async {
|
||||||
var result = await VideoHttp.videoIntro(bvid: bvid);
|
var result = await VideoHttp.videoIntro(bvid: bvid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
videoDetail.value = result['data']!;
|
videoDetail.value = result['data']!;
|
||||||
ugcSeason = result['data']!.ugcSeason;
|
ugcSeason = result['data']!.ugcSeason;
|
||||||
pages.value = result['data']!.pages!;
|
pages.value = result['data']!.pages!;
|
||||||
lastPlayCid.value = videoDetail.value.cid!;
|
copyright = result['data']!.copyright!;
|
||||||
if (pages.isNotEmpty) {
|
if (type == null) {
|
||||||
lastPlayCid.value = pages.first.cid!;
|
lastPlayCid.value = cid ?? videoDetail.value.cid!;
|
||||||
}
|
}
|
||||||
final VideoDetailController videoDetailCtr =
|
final VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: heroTag);
|
Get.find<VideoDetailController>(tag: heroTag);
|
||||||
@ -216,7 +218,7 @@ class VideoIntroController extends GetxController {
|
|||||||
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 24),
|
contentPadding: const EdgeInsets.fromLTRB(0, 12, 0, 24),
|
||||||
content: Column(
|
content: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [1, 2]
|
children: (copyright == 2 ? [1] : [1, 2])
|
||||||
.map(
|
.map(
|
||||||
(e) => ListTile(
|
(e) => ListTile(
|
||||||
title: Padding(
|
title: Padding(
|
||||||
@ -335,113 +337,23 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
var result = await VideoHttp.hasFollow(mid: videoDetail.value.owner!.mid!);
|
var result = await VideoHttp.hasFollow(mid: videoDetail.value.owner!.mid!);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
followStatus.value = result['data'];
|
followStatus.value = result['data']['attribute'];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关注/取关up
|
// 关注/取关up
|
||||||
Future actionRelationMod() async {
|
Future actionRelationMod(BuildContext context) async {
|
||||||
feedBack();
|
feedBack();
|
||||||
if (userInfo == null) {
|
if (userInfo == null) {
|
||||||
SmartDialog.showToast('账号未登录');
|
SmartDialog.showToast('账号未登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int currentStatus = followStatus['attribute'];
|
followStatus.value = await FollowUtils(
|
||||||
if (currentStatus == 128) {
|
context: context,
|
||||||
modifyRelation('block', currentStatus);
|
followStatus: followStatus.value,
|
||||||
} else {
|
mid: videoDetail.value.owner!.mid!,
|
||||||
modifyRelation('follow', currentStatus);
|
).showFollowSheet();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 操作用户关系
|
|
||||||
Future modifyRelation(String actionType, int currentStatus) async {
|
|
||||||
final int mid = videoDetail.value.owner!.mid!;
|
|
||||||
String contentText;
|
|
||||||
int act;
|
|
||||||
if (actionType == 'follow') {
|
|
||||||
contentText = currentStatus != 0 ? '确定取消关注UP主?' : '确定关注UP主?';
|
|
||||||
act = currentStatus != 0 ? 2 : 1;
|
|
||||||
} else if (actionType == 'block') {
|
|
||||||
contentText = '确定从黑名单移除UP主?';
|
|
||||||
act = 6;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
showDialog(
|
|
||||||
context: Get.context!,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
final Color outline = Theme.of(Get.context!).colorScheme.outline;
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('提示'),
|
|
||||||
content: Text(contentText),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: Navigator.of(context).pop,
|
|
||||||
child: Text('点错了', style: TextStyle(color: outline)),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => modifyRelationFetch(
|
|
||||||
context,
|
|
||||||
mid,
|
|
||||||
act,
|
|
||||||
currentStatus,
|
|
||||||
actionType,
|
|
||||||
),
|
|
||||||
child: const Text('确定'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 操作用户关系Future
|
|
||||||
Future modifyRelationFetch(
|
|
||||||
BuildContext context,
|
|
||||||
mid,
|
|
||||||
act,
|
|
||||||
currentStatus,
|
|
||||||
actionType,
|
|
||||||
) async {
|
|
||||||
var res = await VideoHttp.relationMod(mid: mid, act: act, reSrc: 11);
|
|
||||||
if (context.mounted) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
if (res['status']) {
|
|
||||||
if (actionType == 'follow') {
|
|
||||||
final Map<int, int> statusMap = {
|
|
||||||
0: 2,
|
|
||||||
2: 0,
|
|
||||||
};
|
|
||||||
late int actionStatus;
|
|
||||||
actionStatus = statusMap[currentStatus] ?? 0;
|
|
||||||
followStatus['attribute'] = actionStatus;
|
|
||||||
if (currentStatus == 0 && Get.context!.mounted) {
|
|
||||||
ScaffoldMessenger.of(Get.context!).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: const Text('关注成功'),
|
|
||||||
duration: const Duration(seconds: 2),
|
|
||||||
action: SnackBarAction(
|
|
||||||
label: '设置分组',
|
|
||||||
onPressed: setFollowGroup,
|
|
||||||
),
|
|
||||||
showCloseIcon: true,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
SmartDialog.showToast('取消关注成功');
|
|
||||||
}
|
|
||||||
} else if (actionType == 'block') {
|
|
||||||
followStatus['attribute'] = 0;
|
|
||||||
SmartDialog.showToast('取消拉黑成功');
|
|
||||||
}
|
|
||||||
followStatus.refresh();
|
|
||||||
} else {
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改分P或番剧分集
|
// 修改分P或番剧分集
|
||||||
@ -482,7 +394,8 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
this.bvid = bvid;
|
this.bvid = bvid;
|
||||||
await queryVideoIntro(cover: cover);
|
// 点击切换时,优先取当前cid
|
||||||
|
await queryVideoIntro(cover: cover, cid: cid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startTimer() {
|
void startTimer() {
|
||||||
@ -523,7 +436,7 @@ class VideoIntroController extends GetxController {
|
|||||||
Get.find<VideoDetailController>(tag: heroTag);
|
Get.find<VideoDetailController>(tag: heroTag);
|
||||||
|
|
||||||
/// 优先稍后再看、收藏夹
|
/// 优先稍后再看、收藏夹
|
||||||
if (videoDetailCtr.isWatchLaterVisible.value) {
|
if (videoDetailCtr.sourceType.value != 'normal') {
|
||||||
episodes.addAll(videoDetailCtr.mediaList);
|
episodes.addAll(videoDetailCtr.mediaList);
|
||||||
} else if (videoDetail.value.ugcSeason != null) {
|
} else if (videoDetail.value.ugcSeason != null) {
|
||||||
final UgcSeason ugcSeason = videoDetail.value.ugcSeason!;
|
final UgcSeason ugcSeason = videoDetail.value.ugcSeason!;
|
||||||
@ -565,33 +478,33 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置关注分组
|
// 设置关注分组
|
||||||
void setFollowGroup() async {
|
// void setFollowGroup() async {
|
||||||
final mediaQueryData = MediaQuery.of(Get.context!);
|
// final mediaQueryData = MediaQuery.of(Get.context!);
|
||||||
final contentHeight = mediaQueryData.size.height - kToolbarHeight;
|
// final contentHeight = mediaQueryData.size.height - kToolbarHeight;
|
||||||
final double initialChildSize =
|
// final double initialChildSize =
|
||||||
(contentHeight - Get.width * 9 / 16) / contentHeight;
|
// (contentHeight - Get.width * 9 / 16) / contentHeight;
|
||||||
await showModalBottomSheet(
|
// await showModalBottomSheet(
|
||||||
context: Get.context!,
|
// context: Get.context!,
|
||||||
useSafeArea: true,
|
// useSafeArea: true,
|
||||||
isScrollControlled: true,
|
// isScrollControlled: true,
|
||||||
builder: (BuildContext context) {
|
// builder: (BuildContext context) {
|
||||||
return DraggableScrollableSheet(
|
// return DraggableScrollableSheet(
|
||||||
initialChildSize: initialChildSize,
|
// initialChildSize: initialChildSize,
|
||||||
minChildSize: 0,
|
// minChildSize: 0,
|
||||||
maxChildSize: 1,
|
// maxChildSize: 1,
|
||||||
snap: true,
|
// snap: true,
|
||||||
expand: false,
|
// expand: false,
|
||||||
snapSizes: [initialChildSize],
|
// snapSizes: [initialChildSize],
|
||||||
builder: (BuildContext context, ScrollController scrollController) {
|
// builder: (BuildContext context, ScrollController scrollController) {
|
||||||
return GroupPanel(
|
// return GroupPanel(
|
||||||
mid: videoDetail.value.owner!.mid!,
|
// mid: videoDetail.value.owner!.mid!,
|
||||||
scrollController: scrollController,
|
// scrollController: scrollController,
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
// ai总结
|
// ai总结
|
||||||
Future aiConclusion() async {
|
Future aiConclusion() async {
|
||||||
@ -617,6 +530,7 @@ class VideoIntroController extends GetxController {
|
|||||||
// 播放器底栏 选集 回调
|
// 播放器底栏 选集 回调
|
||||||
void showEposideHandler() {
|
void showEposideHandler() {
|
||||||
late List episodes;
|
late List episodes;
|
||||||
|
int currentEpisodeIndex = 0;
|
||||||
VideoEpidoesType dataType = VideoEpidoesType.videoEpisode;
|
VideoEpidoesType dataType = VideoEpidoesType.videoEpisode;
|
||||||
if (videoDetail.value.ugcSeason != null) {
|
if (videoDetail.value.ugcSeason != null) {
|
||||||
dataType = VideoEpidoesType.videoEpisode;
|
dataType = VideoEpidoesType.videoEpisode;
|
||||||
@ -625,6 +539,7 @@ class VideoIntroController extends GetxController {
|
|||||||
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||||
for (int j = 0; j < episodesList.length; j++) {
|
for (int j = 0; j < episodesList.length; j++) {
|
||||||
if (episodesList[j].cid == lastPlayCid.value) {
|
if (episodesList[j].cid == lastPlayCid.value) {
|
||||||
|
currentEpisodeIndex = i;
|
||||||
episodes = episodesList;
|
episodes = episodesList;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -644,6 +559,7 @@ class VideoIntroController extends GetxController {
|
|||||||
sheetHeight: Get.size.height,
|
sheetHeight: Get.size.height,
|
||||||
isFullScreen: true,
|
isFullScreen: true,
|
||||||
ugcSeason: ugcSeason,
|
ugcSeason: ugcSeason,
|
||||||
|
currentEpisodeIndex: currentEpisodeIndex,
|
||||||
changeFucCall: (item, index) {
|
changeFucCall: (item, index) {
|
||||||
if (dataType == VideoEpidoesType.videoEpisode) {
|
if (dataType == VideoEpidoesType.videoEpisode) {
|
||||||
changeSeasonOrbangu(
|
changeSeasonOrbangu(
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/skeleton/video_intro.dart';
|
import 'package:pilipala/common/skeleton/video_intro.dart';
|
||||||
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
@ -17,6 +18,7 @@ import 'package:pilipala/models/video_detail_res.dart';
|
|||||||
import 'package:pilipala/pages/video/detail/introduction/controller.dart';
|
import 'package:pilipala/pages/video/detail/introduction/controller.dart';
|
||||||
import 'package:pilipala/pages/video/detail/widgets/ai_detail.dart';
|
import 'package:pilipala/pages/video/detail/widgets/ai_detail.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
import 'package:pilipala/utils/follow.dart';
|
||||||
import 'package:pilipala/utils/global_data_cache.dart';
|
import 'package:pilipala/utils/global_data_cache.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
@ -57,7 +59,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
|||||||
heroTag = Get.arguments['heroTag'];
|
heroTag = Get.arguments['heroTag'];
|
||||||
videoIntroController =
|
videoIntroController =
|
||||||
Get.put(VideoIntroController(bvid: widget.bvid), tag: heroTag);
|
Get.put(VideoIntroController(bvid: widget.bvid), tag: heroTag);
|
||||||
_futureBuilderFuture = videoIntroController.queryVideoIntro();
|
_futureBuilderFuture = videoIntroController.queryVideoIntro(type: 'init');
|
||||||
videoIntroController.videoDetail.listen((value) {
|
videoIntroController.videoDetail.listen((value) {
|
||||||
videoDetail = value;
|
videoDetail = value;
|
||||||
});
|
});
|
||||||
@ -264,6 +266,26 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ThemeData t = Theme.of(context);
|
final ThemeData t = Theme.of(context);
|
||||||
final Color outline = t.colorScheme.outline;
|
final Color outline = t.colorScheme.outline;
|
||||||
|
const TextStyle titleStyle = TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
);
|
||||||
|
|
||||||
|
TextSpan titltWidget = TextSpan(
|
||||||
|
children: [
|
||||||
|
WidgetSpan(
|
||||||
|
child: Visibility(
|
||||||
|
visible: widget.videoDetail!.copyright == 2,
|
||||||
|
child: const PBadge(text: '转载', type: 'color'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const TextSpan(text: ' '),
|
||||||
|
TextSpan(
|
||||||
|
text: widget.videoDetail!.title!,
|
||||||
|
style: titleStyle,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
return SliverPadding(
|
return SliverPadding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: StyleString.safeSpace,
|
left: StyleString.safeSpace,
|
||||||
@ -285,25 +307,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
},
|
},
|
||||||
child: ExpandablePanel(
|
child: ExpandablePanel(
|
||||||
controller: _expandableCtr,
|
controller: _expandableCtr,
|
||||||
collapsed: Text(
|
collapsed: Text.rich(softWrap: true, maxLines: 2, titltWidget),
|
||||||
widget.videoDetail!.title!,
|
expanded: Text.rich(softWrap: true, maxLines: 10, titltWidget),
|
||||||
softWrap: true,
|
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
expanded: Text(
|
|
||||||
widget.videoDetail!.title!,
|
|
||||||
softWrap: true,
|
|
||||||
maxLines: 10,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
theme: const ExpandableThemeData(
|
theme: const ExpandableThemeData(
|
||||||
animationDuration: Duration(milliseconds: 300),
|
animationDuration: Duration(milliseconds: 300),
|
||||||
scrollAnimationDuration: Duration(milliseconds: 300),
|
scrollAnimationDuration: Duration(milliseconds: 300),
|
||||||
@ -454,14 +459,14 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
Obx(
|
Obx(
|
||||||
() {
|
() {
|
||||||
final int attr =
|
final int attr =
|
||||||
videoIntroController.followStatus['attribute'] ?? 0;
|
videoIntroController.followStatus.value;
|
||||||
return videoIntroController.followStatus.isEmpty
|
return attr == -1
|
||||||
? const SizedBox()
|
? const SizedBox()
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
height: 32,
|
height: 32,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed:
|
onPressed: () => videoIntroController
|
||||||
videoIntroController.actionRelationMod,
|
.actionRelationMod(context),
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 8,
|
left: 8,
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class SeasonPanel extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SeasonPanelState extends State<SeasonPanel> {
|
class _SeasonPanelState extends State<SeasonPanel> {
|
||||||
late List<EpisodeItem> episodes;
|
List<EpisodeItem>? episodes;
|
||||||
late int cid;
|
late int cid;
|
||||||
late RxInt currentIndex = (-1).obs;
|
late RxInt currentIndex = (-1).obs;
|
||||||
final String heroTag = Get.arguments['heroTag'];
|
final String heroTag = Get.arguments['heroTag'];
|
||||||
@ -42,23 +42,14 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
||||||
|
|
||||||
/// 根据 cid 找到对应集,找到对应 episodes
|
/// 根据 cid 找到对应集,找到对应 episodes
|
||||||
final List<SectionItem> sections = widget.ugcSeason.sections!;
|
getCurrentEpisodeIndex();
|
||||||
for (int i = 0; i < sections.length; i++) {
|
|
||||||
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
|
||||||
for (int j = 0; j < episodesList.length; j++) {
|
|
||||||
if (episodesList[j].cid == cid) {
|
|
||||||
currentEpisodeIndex = i;
|
|
||||||
episodes = episodesList;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 取对应 season_id 的 episodes
|
/// 取对应 season_id 的 episodes
|
||||||
getCurrentIndex();
|
getCurrentIndex();
|
||||||
_videoDetailController.cid.listen((int p0) {
|
_videoDetailController.cid.listen((int p0) {
|
||||||
cid = p0;
|
cid = p0;
|
||||||
getCurrentIndex();
|
getCurrentIndex();
|
||||||
|
getCurrentEpisodeIndex();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +66,10 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
|
|
||||||
// 获取currentIndex
|
// 获取currentIndex
|
||||||
void getCurrentIndex() {
|
void getCurrentIndex() {
|
||||||
currentIndex.value = episodes.indexWhere((EpisodeItem e) => e.cid == cid);
|
if (episodes != null) {
|
||||||
|
currentIndex.value =
|
||||||
|
episodes!.indexWhere((EpisodeItem e) => e.cid == cid);
|
||||||
|
}
|
||||||
final List<SectionItem> sections = widget.ugcSeason.sections!;
|
final List<SectionItem> sections = widget.ugcSeason.sections!;
|
||||||
if (sections.length == 1 && sections.first.type == 1) {
|
if (sections.length == 1 && sections.first.type == 1) {
|
||||||
final List<EpisodeItem> episodesList = sections.first.episodes!;
|
final List<EpisodeItem> episodesList = sections.first.episodes!;
|
||||||
@ -83,6 +77,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
for (int j = 0; j < episodesList[i].pages!.length; j++) {
|
for (int j = 0; j < episodesList[i].pages!.length; j++) {
|
||||||
if (episodesList[i].pages![j].cid == cid) {
|
if (episodesList[i].pages![j].cid == cid) {
|
||||||
currentIndex.value = i;
|
currentIndex.value = i;
|
||||||
|
episodes = episodesList;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,6 +85,21 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取currentEpisodeIndex
|
||||||
|
void getCurrentEpisodeIndex() {
|
||||||
|
final List<SectionItem> sections = widget.ugcSeason.sections!;
|
||||||
|
for (int i = 0; i < sections.length; i++) {
|
||||||
|
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||||
|
for (int j = 0; j < episodesList.length; j++) {
|
||||||
|
if (episodesList[j].cid == cid) {
|
||||||
|
currentEpisodeIndex = i;
|
||||||
|
episodes = episodesList;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget buildEpisodeListItem(
|
Widget buildEpisodeListItem(
|
||||||
EpisodeItem episode,
|
EpisodeItem episode,
|
||||||
int index,
|
int index,
|
||||||
@ -137,7 +147,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
widget.videoIntroCtr.bottomSheetController =
|
widget.videoIntroCtr.bottomSheetController =
|
||||||
_bottomSheetController = EpisodeBottomSheet(
|
_bottomSheetController = EpisodeBottomSheet(
|
||||||
currentCid: cid,
|
currentCid: cid,
|
||||||
episodes: episodes,
|
episodes: episodes!,
|
||||||
changeFucCall: changeFucCall,
|
changeFucCall: changeFucCall,
|
||||||
sheetHeight: widget.sheetHeight,
|
sheetHeight: widget.sheetHeight,
|
||||||
dataType: VideoEpidoesType.videoEpisode,
|
dataType: VideoEpidoesType.videoEpisode,
|
||||||
@ -165,7 +175,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Obx(() => Text(
|
Obx(() => Text(
|
||||||
'${currentIndex.value + 1}/${episodes.length}',
|
'${currentIndex.value + 1}/${episodes!.length}',
|
||||||
style: Theme.of(context).textTheme.labelMedium,
|
style: Theme.of(context).textTheme.labelMedium,
|
||||||
)),
|
)),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
|
|||||||
@ -70,6 +70,13 @@ class VideoReplyController extends GetxController {
|
|||||||
isEnd = res['data'].cursor.isEnd ?? false;
|
isEnd = res['data'].cursor.isEnd ?? false;
|
||||||
nextOffset = res['data'].cursor.paginationReply.nextOffset ?? "";
|
nextOffset = res['data'].cursor.paginationReply.nextOffset ?? "";
|
||||||
if (replies.isNotEmpty) {
|
if (replies.isNotEmpty) {
|
||||||
|
/// 临时修复
|
||||||
|
final bool flag = replyList
|
||||||
|
.any((ReplyItemModel reply) => reply.rpid == replies.first.rpid);
|
||||||
|
if (replies.length == 1 && flag && type == 'onLoad') {
|
||||||
|
replies.clear();
|
||||||
|
isEnd = true;
|
||||||
|
}
|
||||||
noMore.value = isEnd ? '没有更多了' : '加载中...';
|
noMore.value = isEnd ? '没有更多了' : '加载中...';
|
||||||
} else {
|
} else {
|
||||||
noMore.value =
|
noMore.value =
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/widgets/badge.dart';
|
import 'package:pilipala/common/widgets/badge.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/http/reply.dart';
|
import 'package:pilipala/http/reply.dart';
|
||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
@ -1117,27 +1118,12 @@ class MorePanel extends StatelessWidget {
|
|||||||
ColorScheme colorScheme = Theme.of(context).colorScheme;
|
ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||||
TextTheme textTheme = Theme.of(context).textTheme;
|
TextTheme textTheme = Theme.of(context).textTheme;
|
||||||
Color errorColor = colorScheme.error;
|
Color errorColor = colorScheme.error;
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
onTap: () => Get.back(),
|
|
||||||
child: Container(
|
|
||||||
height: 35,
|
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
width: 32,
|
|
||||||
height: 3,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: colorScheme.outline,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async => await menuActionHandler('copyAll'),
|
onTap: () async => await menuActionHandler('copyAll'),
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||||
import 'package:floating/floating.dart';
|
import 'package:floating/floating.dart';
|
||||||
@ -76,7 +77,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
getStatusHeight();
|
getStatusHeight();
|
||||||
heroTag = Get.arguments['heroTag'];
|
heroTag = Get.arguments['heroTag'];
|
||||||
vdCtr = Get.put(VideoDetailController(), tag: heroTag);
|
vdCtr = Get.put(VideoDetailController(), tag: heroTag);
|
||||||
vdCtr.sheetHeight.value = localCache.get('sheetHeight');
|
vdCtr.sheetHeight.value = GlobalDataCache.sheetHeight;
|
||||||
videoIntroController = Get.put(
|
videoIntroController = Get.put(
|
||||||
VideoIntroController(bvid: Get.parameters['bvid']!),
|
VideoIntroController(bvid: Get.parameters['bvid']!),
|
||||||
tag: heroTag);
|
tag: heroTag);
|
||||||
@ -206,12 +207,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
vdCtr.bottomList.insert(3, BottomControlType.episode);
|
vdCtr.bottomList.insert(3, BottomControlType.episode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
vdCtr.toggeleWatchLaterVisible(false);
|
||||||
} else {
|
} else {
|
||||||
if (vdCtr.bottomList.contains(BottomControlType.episode)) {
|
if (vdCtr.bottomList.contains(BottomControlType.episode)) {
|
||||||
vdCtr.bottomList.removeAt(3);
|
vdCtr.bottomList.removeAt(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vdCtr.toggeleWatchLaterVisible(!isFullScreen);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,8 +224,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
void _extendNestCtrListener() {
|
void _extendNestCtrListener() {
|
||||||
final double offset = _extendNestCtr.position.pixels;
|
final double offset = _extendNestCtr.position.pixels;
|
||||||
if (vdCtr.videoDirection.value == 'horizontal') {
|
if (vdCtr.videoDirection.value == 'horizontal') {
|
||||||
vdCtr.sheetHeight.value =
|
vdCtr.sheetHeight.value = max(GlobalDataCache.sheetHeight,
|
||||||
Get.size.height - videoHeight - statusBarHeight + offset;
|
Get.size.height - videoHeight - statusBarHeight + offset);
|
||||||
appbarStream.add(offset);
|
appbarStream.add(offset);
|
||||||
} else {
|
} else {
|
||||||
if (offset > (Get.size.width * 22 / 16 - videoHeight)) {
|
if (offset > (Get.size.width * 22 / 16 - videoHeight)) {
|
||||||
@ -502,7 +503,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final sizeContext = MediaQuery.sizeOf(context);
|
final sizeContext = MediaQuery.sizeOf(context);
|
||||||
final _context = MediaQuery.of(context);
|
final orientation = MediaQuery.orientationOf(context);
|
||||||
late final double verticalHeight = sizeContext.width * 22 / 16;
|
late final double verticalHeight = sizeContext.width * 22 / 16;
|
||||||
late double defaultVideoHeight = vdCtr.videoDirection.value == 'vertical'
|
late double defaultVideoHeight = vdCtr.videoDirection.value == 'vertical'
|
||||||
? verticalHeight
|
? verticalHeight
|
||||||
@ -517,12 +518,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 竖屏
|
// 竖屏
|
||||||
final bool isPortrait = _context.orientation == Orientation.portrait;
|
final bool isPortrait = orientation == Orientation.portrait;
|
||||||
// 横屏
|
// 横屏
|
||||||
final bool isLandscape = _context.orientation == Orientation.landscape;
|
final bool isLandscape = orientation == Orientation.landscape;
|
||||||
final Rx<bool> isFullScreen = plPlayerController?.isFullScreen ?? false.obs;
|
final Rx<bool> isFullScreen = plPlayerController?.isFullScreen ?? false.obs;
|
||||||
// 全屏时高度撑满
|
// 全屏时高度撑满
|
||||||
if (isLandscape || isFullScreen.value == true) {
|
if (isLandscape || isFullScreen.value) {
|
||||||
videoHeight.value = Get.size.height;
|
videoHeight.value = Get.size.height;
|
||||||
enterFullScreen();
|
enterFullScreen();
|
||||||
} else {
|
} else {
|
||||||
@ -554,6 +555,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
playerController: plPlayerController!,
|
playerController: plPlayerController!,
|
||||||
),
|
),
|
||||||
bottomList: vdCtr.bottomList,
|
bottomList: vdCtr.bottomList,
|
||||||
|
fullScreenCb: (bool status) {
|
||||||
|
if (vdCtr.videoDirection.value == 'vertical') {
|
||||||
|
videoHeight.value = status ? Get.size.height : verticalHeight;
|
||||||
|
}
|
||||||
|
},
|
||||||
showEposideCb: () => vdCtr.videoType == SearchType.video
|
showEposideCb: () => vdCtr.videoType == SearchType.video
|
||||||
? videoIntroController.showEposideHandler()
|
? videoIntroController.showEposideHandler()
|
||||||
: bangumiIntroController.showEposideHandler(),
|
: bangumiIntroController.showEposideHandler(),
|
||||||
@ -629,10 +635,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget childWhenDisabled = SafeArea(
|
Widget childWhenDisabled = SafeArea(
|
||||||
top: MediaQuery.of(context).orientation == Orientation.portrait &&
|
top: isPortrait && isFullScreen.value,
|
||||||
plPlayerController?.isFullScreen.value == true,
|
bottom: isPortrait && isFullScreen.value,
|
||||||
bottom: MediaQuery.of(context).orientation == Orientation.portrait &&
|
|
||||||
plPlayerController?.isFullScreen.value == true,
|
|
||||||
left: false,
|
left: false,
|
||||||
right: false,
|
right: false,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
@ -655,22 +659,25 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
return <Widget>[
|
return <Widget>[
|
||||||
Obx(
|
Obx(
|
||||||
() {
|
() {
|
||||||
final Orientation orientation =
|
final bool isLandscape =
|
||||||
MediaQuery.of(context).orientation;
|
MediaQuery.orientationOf(context) ==
|
||||||
|
Orientation.landscape;
|
||||||
final bool isFullScreen =
|
final bool isFullScreen =
|
||||||
plPlayerController?.isFullScreen.value == true;
|
plPlayerController?.isFullScreen.value ?? false;
|
||||||
final double expandedHeight =
|
|
||||||
orientation == Orientation.landscape || isFullScreen
|
late double expandedHeight;
|
||||||
? (MediaQuery.sizeOf(context).height -
|
if (isLandscape || isFullScreen) {
|
||||||
(orientation == Orientation.landscape
|
|
||||||
? 0
|
|
||||||
: MediaQuery.of(context).padding.top))
|
|
||||||
: videoHeight.value;
|
|
||||||
if (orientation == Orientation.landscape ||
|
|
||||||
isFullScreen) {
|
|
||||||
enterFullScreen();
|
enterFullScreen();
|
||||||
|
expandedHeight = (MediaQuery.sizeOf(context).height -
|
||||||
|
(isLandscape
|
||||||
|
? 0
|
||||||
|
: MediaQuery.paddingOf(context).top));
|
||||||
} else {
|
} else {
|
||||||
exitFullScreen();
|
exitFullScreen();
|
||||||
|
if (vdCtr.videoDirection.value == 'vertical') {
|
||||||
|
videoHeight.value = verticalHeight;
|
||||||
|
}
|
||||||
|
expandedHeight = videoHeight.value;
|
||||||
}
|
}
|
||||||
return SliverAppBar(
|
return SliverAppBar(
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
@ -680,18 +687,26 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
forceElevated: innerBoxIsScrolled,
|
forceElevated: innerBoxIsScrolled,
|
||||||
expandedHeight: expandedHeight,
|
expandedHeight: expandedHeight,
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: SizedBox.expand(
|
||||||
background: PopScope(
|
child: PopScope(
|
||||||
canPop:
|
canPop: !isFullScreen,
|
||||||
plPlayerController?.isFullScreen.value != true,
|
|
||||||
onPopInvoked: (bool didPop) {
|
onPopInvoked: (bool didPop) {
|
||||||
if (plPlayerController?.isFullScreen.value ==
|
if (plPlayerController != null) {
|
||||||
true) {
|
if (plPlayerController!.controlsLock.value) {
|
||||||
|
plPlayerController!.onLockControl(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isFullScreen) {
|
||||||
plPlayerController!
|
plPlayerController!
|
||||||
.triggerFullScreen(status: false);
|
.triggerFullScreen(status: false);
|
||||||
|
if (vdCtr.videoDirection.value ==
|
||||||
|
'vertical') {
|
||||||
|
videoHeight.value = verticalHeight;
|
||||||
}
|
}
|
||||||
if (MediaQuery.of(context).orientation ==
|
}
|
||||||
Orientation.landscape) {
|
}
|
||||||
|
|
||||||
|
if (isLandscape) {
|
||||||
verticalScreen();
|
verticalScreen();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -736,9 +751,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
|
|
||||||
/// 不收回
|
/// 不收回
|
||||||
pinnedHeaderSliverHeightBuilder: () {
|
pinnedHeaderSliverHeightBuilder: () {
|
||||||
return MediaQuery.of(context).orientation ==
|
return isLandscape || isFullScreen.value
|
||||||
Orientation.landscape ||
|
|
||||||
plPlayerController?.isFullScreen.value == true
|
|
||||||
? MediaQuery.sizeOf(context).height
|
? MediaQuery.sizeOf(context).height
|
||||||
: playerStatus.value != PlayerStatus.playing
|
: playerStatus.value != PlayerStatus.playing
|
||||||
? kToolbarHeight
|
? kToolbarHeight
|
||||||
@ -820,9 +833,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
/// 稍后再看列表
|
/// 稍后再看列表
|
||||||
Obx(
|
Obx(
|
||||||
() => Visibility(
|
() => Visibility(
|
||||||
visible: vdCtr.sourceType.value == 'watchLater' ||
|
visible: ['watchLater', 'fav', 'up_archive']
|
||||||
vdCtr.sourceType.value == 'fav' ||
|
.contains(vdCtr.sourceType.value),
|
||||||
vdCtr.sourceType.value == 'up_archive',
|
|
||||||
child: AnimatedPositioned(
|
child: AnimatedPositioned(
|
||||||
duration: const Duration(milliseconds: 400),
|
duration: const Duration(milliseconds: 400),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
import 'package:pilipala/models/video/ai.dart';
|
import 'package:pilipala/models/video/ai.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/utils/global_data_cache.dart';
|
import 'package:pilipala/utils/global_data_cache.dart';
|
||||||
@ -17,13 +18,15 @@ class AiDetail extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
height: GlobalDataCache.sheetHeight,
|
height: GlobalDataCache.sheetHeight,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildHeader(context),
|
const DragHandle(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if (modelResult!.summary != '') ...[
|
if (modelResult!.summary != '') ...[
|
||||||
@ -35,25 +38,12 @@ class AiDetail extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildHeader(BuildContext context) {
|
|
||||||
return Center(
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).hintColor,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
|
||||||
),
|
|
||||||
height: 4,
|
|
||||||
width: 40,
|
|
||||||
margin: const EdgeInsets.symmetric(vertical: 16),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildSummaryText(String summary) {
|
Widget _buildSummaryText(String summary) {
|
||||||
return SelectableText(
|
return SelectableText(
|
||||||
summary,
|
summary,
|
||||||
|
|||||||
@ -7,7 +7,9 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:marquee/marquee.dart';
|
||||||
import 'package:ns_danmaku/ns_danmaku.dart';
|
import 'package:ns_danmaku/ns_danmaku.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/models/video/play/quality.dart';
|
import 'package:pilipala/models/video/play/quality.dart';
|
||||||
import 'package:pilipala/models/video/play/url.dart';
|
import 'package:pilipala/models/video/play/url.dart';
|
||||||
@ -56,11 +58,12 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
final Box<dynamic> localCache = GStorage.localCache;
|
final Box<dynamic> localCache = GStorage.localCache;
|
||||||
final Box<dynamic> videoStorage = GStorage.video;
|
final Box<dynamic> videoStorage = GStorage.video;
|
||||||
late List<double> speedsList;
|
late List<double> speedsList;
|
||||||
double buttonSpace = 8;
|
double buttonSpace = 4;
|
||||||
RxBool isFullScreen = false.obs;
|
RxBool isFullScreen = false.obs;
|
||||||
late String heroTag;
|
late String heroTag;
|
||||||
late VideoIntroController videoIntroController;
|
late VideoIntroController videoIntroController;
|
||||||
late VideoDetailData videoDetail;
|
late VideoDetailData videoDetail;
|
||||||
|
DateTime initialTime = DateTime.now();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -102,50 +105,11 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
margin: const EdgeInsets.all(12),
|
margin: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
const DragHandle(),
|
||||||
height: 35,
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
width: 32,
|
|
||||||
height: 3,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSecondaryContainer
|
|
||||||
.withOpacity(0.5),
|
|
||||||
borderRadius:
|
|
||||||
const BorderRadius.all(Radius.circular(3))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
// ListTile(
|
|
||||||
// onTap: () {},
|
|
||||||
// dense: true,
|
|
||||||
// enabled: false,
|
|
||||||
// leading:
|
|
||||||
// const Icon(Icons.network_cell_outlined, size: 20),
|
|
||||||
// title: Text('省流模式', style: titleStyle),
|
|
||||||
// subtitle: Text('低画质 | 减少视频缓存', style: subTitleStyle),
|
|
||||||
// trailing: Transform.scale(
|
|
||||||
// scale: 0.75,
|
|
||||||
// child: Switch(
|
|
||||||
// thumbIcon: MaterialStateProperty.resolveWith<Icon?>(
|
|
||||||
// (Set<MaterialState> states) {
|
|
||||||
// if (states.isNotEmpty &&
|
|
||||||
// states.first == MaterialState.selected) {
|
|
||||||
// return const Icon(Icons.done);
|
|
||||||
// }
|
|
||||||
// return null; // All other states will use the default thumbIcon.
|
|
||||||
// }),
|
|
||||||
// value: false,
|
|
||||||
// onChanged: (value) => {},
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final res = await UserHttp.toViewLater(
|
final res = await UserHttp.toViewLater(
|
||||||
@ -486,65 +450,6 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 选择倍速
|
|
||||||
void showSetSpeedSheet() {
|
|
||||||
final double currentSpeed = widget.controller!.playbackSpeed;
|
|
||||||
showDialog(
|
|
||||||
context: Get.context!,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('播放速度'),
|
|
||||||
content: StatefulBuilder(
|
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
|
||||||
return Wrap(
|
|
||||||
spacing: 8,
|
|
||||||
runSpacing: 2,
|
|
||||||
children: [
|
|
||||||
for (final double i in speedsList) ...<Widget>[
|
|
||||||
if (i == currentSpeed) ...<Widget>[
|
|
||||||
FilledButton(
|
|
||||||
onPressed: () async {
|
|
||||||
// setState(() => currentSpeed = i),
|
|
||||||
await widget.controller!.setPlaybackSpeed(i);
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: Text(i.toString()),
|
|
||||||
),
|
|
||||||
] else ...[
|
|
||||||
FilledButton.tonal(
|
|
||||||
onPressed: () async {
|
|
||||||
// setState(() => currentSpeed = i),
|
|
||||||
await widget.controller!.setPlaybackSpeed(i);
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: Text(i.toString()),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Get.back(),
|
|
||||||
child: Text(
|
|
||||||
'取消',
|
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
await widget.controller!.setDefaultSpeed();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: const Text('默认速度'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 选择画质
|
/// 选择画质
|
||||||
void showSetVideoQa() {
|
void showSetVideoQa() {
|
||||||
final List<FormatItem> videoFormat = videoInfo.supportFormats!;
|
final List<FormatItem> videoFormat = videoInfo.supportFormats!;
|
||||||
@ -1144,6 +1049,16 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stream<DateTime> _getTimeStream() {
|
||||||
|
return Stream.periodic(const Duration(seconds: 60), (count) {
|
||||||
|
return DateTime.now();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
String _formatTime(DateTime dateTime) {
|
||||||
|
return '${dateTime.hour}:${dateTime.minute < 10 ? '0${dateTime.minute}' : dateTime.minute}';
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _ = widget.controller!;
|
final _ = widget.controller!;
|
||||||
@ -1153,13 +1068,58 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
);
|
);
|
||||||
final bool isLandscape =
|
final bool isLandscape =
|
||||||
MediaQuery.of(context).orientation == Orientation.landscape;
|
MediaQuery.of(context).orientation == Orientation.landscape;
|
||||||
return AppBar(
|
return Padding(
|
||||||
backgroundColor: Colors.transparent,
|
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||||
foregroundColor: Colors.white,
|
child: Column(
|
||||||
primary: false,
|
mainAxisSize: MainAxisSize.min,
|
||||||
automaticallyImplyLeading: false,
|
children: [
|
||||||
titleSpacing: 14,
|
if (isFullScreen.value && isLandscape) ...[
|
||||||
title: Row(
|
Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(width: 40),
|
||||||
|
if (videoIntroController.isShowOnlineTotal)
|
||||||
|
Text(
|
||||||
|
'${videoIntroController.total.value}人正在看',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: StreamBuilder<DateTime>(
|
||||||
|
stream: _getTimeStream(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.hasData) {
|
||||||
|
String currentTime = _formatTime(snapshot.data!);
|
||||||
|
return Text(
|
||||||
|
currentTime,
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
);
|
||||||
|
} else if (snapshot.connectionState ==
|
||||||
|
ConnectionState.waiting) {
|
||||||
|
// 如果Stream还未发出数据,先显示初始获取的时间
|
||||||
|
String currentTime = _formatTime(initialTime);
|
||||||
|
return Text(
|
||||||
|
currentTime,
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
|
||||||
|
/// TODO 网络&电量
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
@ -1187,31 +1147,31 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
if (isFullScreen.value &&
|
if (isFullScreen.value &&
|
||||||
isLandscape &&
|
isLandscape &&
|
||||||
widget.videoType == SearchType.video) ...[
|
widget.videoType == SearchType.video) ...[
|
||||||
Column(
|
Expanded(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: LayoutBuilder(builder: (context, constraints) {
|
||||||
children: [
|
return SizedBox(
|
||||||
ConstrainedBox(
|
width: constraints.maxWidth,
|
||||||
constraints: const BoxConstraints(maxWidth: 200),
|
height: 25,
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => Text(
|
() => Marquee(
|
||||||
videoIntroController.videoDetail.value.title ?? '',
|
text: videoIntroController.videoDetail.value.title ??
|
||||||
style: const TextStyle(
|
'',
|
||||||
color: Colors.white,
|
style: const TextStyle(fontSize: 16),
|
||||||
fontSize: 16,
|
scrollAxis: Axis.horizontal,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
blankSpace: constraints.maxWidth,
|
||||||
|
velocity: 100,
|
||||||
|
pauseAfterRound: const Duration(seconds: 1),
|
||||||
|
startPadding: 0,
|
||||||
|
accelerationDuration: const Duration(seconds: 1),
|
||||||
|
accelerationCurve: Curves.linear,
|
||||||
|
decelerationDuration: const Duration(seconds: 1),
|
||||||
|
decelerationCurve: Curves.easeOut,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
if (videoIntroController.isShowOnlineTotal)
|
|
||||||
Text(
|
|
||||||
'${videoIntroController.total.value}人正在看',
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
] else ...[
|
] else ...[
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
@ -1222,7 +1182,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
fuc: () async {
|
fuc: () async {
|
||||||
// 销毁播放器实例
|
// 销毁播放器实例
|
||||||
await widget.controller!.dispose(type: 'all');
|
await widget.controller!.dispose(type: 'all');
|
||||||
if (mounted) {
|
if (context.mounted) {
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
context, (Route<dynamic> route) => route.isFirst);
|
context, (Route<dynamic> route) => route.isFirst);
|
||||||
}
|
}
|
||||||
@ -1230,21 +1190,9 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
// ComBtn(
|
|
||||||
// icon: const Icon(
|
|
||||||
// FontAwesomeIcons.cropSimple,
|
|
||||||
// size: 15,
|
|
||||||
// color: Colors.white,
|
|
||||||
// ),
|
|
||||||
// fuc: () => _.screenshot(),
|
|
||||||
// ),
|
|
||||||
if (GlobalDataCache.enableDlna) ...[
|
if (GlobalDataCache.enableDlna) ...[
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: Image.asset('assets/images/video/dlna.png', width: 19),
|
||||||
Icons.cast,
|
|
||||||
size: 19,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
fuc: () async {
|
fuc: () async {
|
||||||
showDialog<void>(
|
showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
@ -1255,7 +1203,10 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
SizedBox(width: buttonSpace),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/// 弹幕开关(全屏时)
|
||||||
if (isFullScreen.value) ...[
|
if (isFullScreen.value) ...[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 56,
|
width: 56,
|
||||||
@ -1271,6 +1222,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(width: buttonSpace),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 34,
|
width: 34,
|
||||||
height: 34,
|
height: 34,
|
||||||
@ -1292,8 +1244,10 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
SizedBox(width: buttonSpace),
|
SizedBox(width: buttonSpace),
|
||||||
|
],
|
||||||
|
|
||||||
|
/// pip
|
||||||
if (Platform.isAndroid) ...<Widget>[
|
if (Platform.isAndroid) ...<Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 34,
|
width: 34,
|
||||||
@ -1313,14 +1267,15 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
if (canUsePiP) {
|
if (canUsePiP) {
|
||||||
final Rational aspectRatio = Rational(
|
final Rational aspectRatio = Rational(
|
||||||
widget.videoDetailCtr!.data.dash!.video!.first.width!,
|
widget.videoDetailCtr!.data.dash!.video!.first.width!,
|
||||||
widget.videoDetailCtr!.data.dash!.video!.first.height!,
|
widget
|
||||||
|
.videoDetailCtr!.data.dash!.video!.first.height!,
|
||||||
);
|
);
|
||||||
await widget.floating!.enable(aspectRatio: aspectRatio);
|
await widget.floating!.enable(aspectRatio: aspectRatio);
|
||||||
} else {}
|
} else {}
|
||||||
},
|
},
|
||||||
icon: const Icon(
|
icon: Image.asset(
|
||||||
Icons.picture_in_picture_outlined,
|
'assets/images/video/pip.png',
|
||||||
size: 19,
|
width: 19,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1329,43 +1284,29 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
],
|
],
|
||||||
|
|
||||||
/// 字幕
|
/// 字幕
|
||||||
if (widget.showSubtitleBtn)
|
if (widget.showSubtitleBtn) ...[
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: Icon(
|
||||||
Icons.closed_caption_off,
|
FontAwesomeIcons.closedCaptioning,
|
||||||
size: 22,
|
size: 16,
|
||||||
color: Colors.white,
|
color: Colors.white.withOpacity(0.9),
|
||||||
),
|
),
|
||||||
fuc: () => showSubtitleDialog(),
|
fuc: () => showSubtitleDialog(),
|
||||||
),
|
),
|
||||||
SizedBox(width: buttonSpace),
|
SizedBox(width: buttonSpace),
|
||||||
Obx(
|
],
|
||||||
() => SizedBox(
|
|
||||||
width: 45,
|
|
||||||
height: 34,
|
|
||||||
child: TextButton(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
||||||
),
|
|
||||||
onPressed: () => showSetSpeedSheet(),
|
|
||||||
child: Text(
|
|
||||||
'${_.playbackSpeed}X',
|
|
||||||
style: textStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: buttonSpace),
|
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.more_vert_outlined,
|
Icons.more_vert_outlined,
|
||||||
size: 18,
|
size: 19,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
fuc: () => showSettingSheet(),
|
fuc: () => showSettingSheet(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,10 +85,13 @@ class _MediaListPanelState extends State<MediaListPanel> {
|
|||||||
AppBar(
|
AppBar(
|
||||||
toolbarHeight: 45,
|
toolbarHeight: 45,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
title: Text(
|
title: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 12),
|
||||||
|
child: Text(
|
||||||
widget.panelTitle ?? '稍后再看',
|
widget.panelTitle ?? '稍后再看',
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.close, size: 20),
|
icon: const Icon(Icons.close, size: 20),
|
||||||
|
|||||||
@ -45,6 +45,7 @@ class WhisperController extends GetxController {
|
|||||||
if (isLoading) return;
|
if (isLoading) return;
|
||||||
var res = await MsgHttp.sessionList(
|
var res = await MsgHttp.sessionList(
|
||||||
endTs: type == 'onLoad' ? sessionList.last.sessionTs : null);
|
endTs: type == 'onLoad' ? sessionList.last.sessionTs : null);
|
||||||
|
try {
|
||||||
if (res['status'] &&
|
if (res['status'] &&
|
||||||
res['data'].sessionList != null &&
|
res['data'].sessionList != null &&
|
||||||
res['data'].sessionList.isNotEmpty) {
|
res['data'].sessionList.isNotEmpty) {
|
||||||
@ -75,6 +76,13 @@ class WhisperController extends GetxController {
|
|||||||
sessionList.value = res['data'].sessionList;
|
sessionList.value = res['data'].sessionList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
res = {
|
||||||
|
'status': false,
|
||||||
|
'message': err.toString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,24 @@ class _WhisperPageState extends State<WhisperPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('消息')),
|
appBar: AppBar(
|
||||||
|
title: const Text('消息'),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.open_in_browser_rounded,
|
||||||
|
color: Theme.of(context).colorScheme.primary),
|
||||||
|
tooltip: '用浏览器打开',
|
||||||
|
onPressed: () {
|
||||||
|
Get.toNamed('/webview', parameters: {
|
||||||
|
'url': 'https://message.bilibili.com',
|
||||||
|
'type': 'whisper',
|
||||||
|
'pageTitle': '消息中心',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12)
|
||||||
|
],
|
||||||
|
),
|
||||||
body: RefreshIndicator(
|
body: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
_whisperController.unread();
|
_whisperController.unread();
|
||||||
|
|||||||
@ -101,25 +101,11 @@ class _WhisperDetailPageState extends State<WhisperDetailPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
automaticallyImplyLeading: false,
|
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
width: double.infinity,
|
width: double.maxFinite,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
|
||||||
width: 34,
|
|
||||||
height: 34,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () => Get.back(),
|
|
||||||
icon: Icon(
|
|
||||||
Icons.arrow_back_ios,
|
|
||||||
size: 18,
|
|
||||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
feedBack();
|
feedBack();
|
||||||
|
|||||||
@ -521,6 +521,7 @@ class SystemNotice extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Map content = item.content ?? '';
|
Map content = item.content ?? '';
|
||||||
|
Color primary = Theme.of(context).colorScheme.primary;
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
@ -557,12 +558,35 @@ class SystemNotice extends StatelessWidget {
|
|||||||
.labelSmall!
|
.labelSmall!
|
||||||
.copyWith(color: Theme.of(context).colorScheme.outline),
|
.copyWith(color: Theme.of(context).colorScheme.outline),
|
||||||
),
|
),
|
||||||
Divider(
|
Divider(color: primary.withOpacity(0.05)),
|
||||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.05),
|
SelectableText(content['text']),
|
||||||
|
if (content['jump_text'] != null &&
|
||||||
|
content['jump_uri'] != null) ...[
|
||||||
|
Divider(color: primary.withOpacity(0.05)),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.toNamed('/webview', parameters: {
|
||||||
|
'url': content['jump_uri'],
|
||||||
|
'type': 'url',
|
||||||
|
'pageTitle': content['jump_text'] == ''
|
||||||
|
? '查看详情'
|
||||||
|
: content['jump_text'],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor:
|
||||||
|
MaterialStateProperty.resolveWith((states) {
|
||||||
|
return primary.withAlpha(20);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
SelectableText(
|
child: Text(content['jump_text'] == ''
|
||||||
content['text'],
|
? '查看详情'
|
||||||
)
|
: content['jump_text']),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
import 'package:pilipala/utils/download.dart';
|
import 'package:pilipala/utils/download.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
import 'package:status_bar_control/status_bar_control.dart';
|
import 'package:status_bar_control/status_bar_control.dart';
|
||||||
@ -234,7 +234,8 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InteractiveViewerBoundary(
|
return Stack(children: [
|
||||||
|
InteractiveViewerBoundary(
|
||||||
controller: _transformationController,
|
controller: _transformationController,
|
||||||
boundaryWidth: MediaQuery.of(context).size.width,
|
boundaryWidth: MediaQuery.of(context).size.width,
|
||||||
onScaleChanged: _onScaleChanged,
|
onScaleChanged: _onScaleChanged,
|
||||||
@ -243,8 +244,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
onNoBoundaryHit: _onNoBoundaryHit,
|
onNoBoundaryHit: _onNoBoundaryHit,
|
||||||
maxScale: widget.maxScale,
|
maxScale: widget.maxScale,
|
||||||
minScale: widget.minScale,
|
minScale: widget.minScale,
|
||||||
child: Stack(children: [
|
child: CustomDismissible(
|
||||||
CustomDismissible(
|
|
||||||
onDismissed: () {
|
onDismissed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
widget.onDismissed?.call(_pageController!.page!.floor());
|
widget.onDismissed?.call(_pageController!.page!.floor());
|
||||||
@ -275,6 +275,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
@ -287,10 +288,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [
|
colors: [Colors.transparent, Colors.black.withOpacity(0.3)],
|
||||||
Colors.transparent,
|
|
||||||
Colors.black.withOpacity(0.3)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
@ -320,8 +318,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]),
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 图片分享
|
// 图片分享
|
||||||
@ -426,29 +423,13 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
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))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
..._buildListTitles(),
|
..._buildListTitles(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'dart:typed_data';
|
|||||||
|
|
||||||
import 'package:easy_debounce/easy_throttle.dart';
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
|
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
@ -80,7 +81,7 @@ class PlPlayerController {
|
|||||||
final Rx<bool> _subTitleOpen = false.obs;
|
final Rx<bool> _subTitleOpen = false.obs;
|
||||||
final Rx<int> _subTitleCode = (-1).obs;
|
final Rx<int> _subTitleCode = (-1).obs;
|
||||||
// 默认投稿视频格式
|
// 默认投稿视频格式
|
||||||
static Rx<String> _videoType = 'archive'.obs;
|
static String _videoType = 'archive';
|
||||||
|
|
||||||
final Rx<String> _direction = 'horizontal'.obs;
|
final Rx<String> _direction = 'horizontal'.obs;
|
||||||
|
|
||||||
@ -113,19 +114,19 @@ class PlPlayerController {
|
|||||||
// final Durations durations;
|
// final Durations durations;
|
||||||
|
|
||||||
List<Map<String, dynamic>> videoFitType = [
|
List<Map<String, dynamic>> videoFitType = [
|
||||||
{'attr': BoxFit.contain, 'desc': '包含'},
|
{'attr': BoxFit.contain, 'desc': '自动'},
|
||||||
{'attr': BoxFit.cover, 'desc': '覆盖'},
|
{'attr': BoxFit.cover, 'desc': '铺满'},
|
||||||
{'attr': BoxFit.fill, 'desc': '填充'},
|
{'attr': BoxFit.fill, 'desc': '填满'},
|
||||||
{'attr': BoxFit.fitHeight, 'desc': '高度适应'},
|
{'attr': BoxFit.fitHeight, 'desc': '等高'},
|
||||||
{'attr': BoxFit.fitWidth, 'desc': '宽度适应'},
|
{'attr': BoxFit.fitWidth, 'desc': '等宽'},
|
||||||
{'attr': BoxFit.scaleDown, 'desc': '缩小适应'},
|
{'attr': BoxFit.scaleDown, 'desc': '缩放'},
|
||||||
|
{'attr': BoxFit.none, 'desc': '原始'},
|
||||||
];
|
];
|
||||||
|
|
||||||
PreferredSizeWidget? headerControl;
|
PreferredSizeWidget? headerControl;
|
||||||
PreferredSizeWidget? bottomControl;
|
PreferredSizeWidget? bottomControl;
|
||||||
Widget? danmuWidget;
|
Widget? danmuWidget;
|
||||||
RxList subtitles = [].obs;
|
RxList subtitles = [].obs;
|
||||||
String videoType = 'archive';
|
|
||||||
|
|
||||||
/// 数据加载监听
|
/// 数据加载监听
|
||||||
Stream<DataStatus> get onDataStatusChanged => dataStatus.status.stream;
|
Stream<DataStatus> get onDataStatusChanged => dataStatus.status.stream;
|
||||||
@ -223,7 +224,7 @@ class PlPlayerController {
|
|||||||
Rx<int> get playerCount => _playerCount;
|
Rx<int> get playerCount => _playerCount;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Rx<String> get videoType => _videoType;
|
String get videoType => _videoType;
|
||||||
|
|
||||||
/// 弹幕开关
|
/// 弹幕开关
|
||||||
Rx<bool> isOpenDanmu = false.obs;
|
Rx<bool> isOpenDanmu = false.obs;
|
||||||
@ -277,7 +278,7 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 添加一个私有构造函数
|
// 添加一个私有构造函数
|
||||||
PlPlayerController._internal(this.videoType) {
|
PlPlayerController._internal() {
|
||||||
isOpenDanmu.value = GlobalDataCache.isOpenDanmu;
|
isOpenDanmu.value = GlobalDataCache.isOpenDanmu;
|
||||||
blockTypes = GlobalDataCache.blockTypes;
|
blockTypes = GlobalDataCache.blockTypes;
|
||||||
showArea = GlobalDataCache.showArea;
|
showArea = GlobalDataCache.showArea;
|
||||||
@ -304,11 +305,11 @@ class PlPlayerController {
|
|||||||
String videoType = 'archive',
|
String videoType = 'archive',
|
||||||
}) {
|
}) {
|
||||||
// 如果实例尚未创建,则创建一个新实例
|
// 如果实例尚未创建,则创建一个新实例
|
||||||
_instance ??= PlPlayerController._internal(videoType);
|
_instance ??= PlPlayerController._internal();
|
||||||
if (videoType != 'none') {
|
if (videoType != 'none') {
|
||||||
_instance!._playerCount.value += 1;
|
_instance!._playerCount.value += 1;
|
||||||
_videoType.value = videoType;
|
|
||||||
}
|
}
|
||||||
|
_videoType = videoType;
|
||||||
return _instance!;
|
return _instance!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,6 +471,7 @@ class PlPlayerController {
|
|||||||
configuration: VideoControllerConfiguration(
|
configuration: VideoControllerConfiguration(
|
||||||
enableHardwareAcceleration: enableHA,
|
enableHardwareAcceleration: enableHA,
|
||||||
androidAttachSurfaceAfterVideoParameters: false,
|
androidAttachSurfaceAfterVideoParameters: false,
|
||||||
|
hwdec: enableHA ? GlobalDataCache.hardwareDecodeFormat : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -827,48 +829,54 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Toggle Change the videofit accordingly
|
/// Toggle Change the videofit accordingly
|
||||||
void toggleVideoFit() {
|
void toggleVideoFit(String toggleType) {
|
||||||
|
if (toggleType == 'press') {
|
||||||
|
final String videoFitDEsc = _videoFitDesc.value;
|
||||||
|
final int index = videoFitType.indexWhere(
|
||||||
|
(element) => element['desc'] == videoFitDEsc,
|
||||||
|
);
|
||||||
|
final int newIndex = index + 1 >= videoFitType.length ? 0 : index + 1;
|
||||||
|
_videoFit.value = videoFitType[newIndex]['attr'];
|
||||||
|
_videoFitDesc.value = videoFitType[newIndex]['desc'];
|
||||||
|
setVideoFit();
|
||||||
|
SmartDialog.showToast('画面比例:${videoFitType[newIndex]['desc']}');
|
||||||
|
} else {
|
||||||
|
void onPressed(item) {
|
||||||
|
_videoFit.value = item['attr'];
|
||||||
|
_videoFitDesc.value = item['desc'];
|
||||||
|
setVideoFit();
|
||||||
|
Navigator.of(Get.context!).pop();
|
||||||
|
}
|
||||||
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('画面比例'),
|
title: const Text('画面比例'),
|
||||||
content: StatefulBuilder(builder: (context, StateSetter setState) {
|
content: Wrap(
|
||||||
return Wrap(
|
|
||||||
alignment: WrapAlignment.start,
|
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 2,
|
runSpacing: 2,
|
||||||
children: [
|
children: [
|
||||||
for (var i in videoFitType) ...[
|
for (var i in videoFitType) ...[
|
||||||
if (_videoFit.value == i['attr']) ...[
|
if (_videoFit.value == i['attr']) ...[
|
||||||
FilledButton(
|
FilledButton(
|
||||||
onPressed: () async {
|
onPressed: () => onPressed(i),
|
||||||
_videoFit.value = i['attr'];
|
|
||||||
_videoFitDesc.value = i['desc'];
|
|
||||||
setVideoFit();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: Text(i['desc']),
|
child: Text(i['desc']),
|
||||||
),
|
),
|
||||||
] else ...[
|
] else ...[
|
||||||
FilledButton.tonal(
|
FilledButton.tonal(
|
||||||
onPressed: () async {
|
onPressed: () => onPressed(i),
|
||||||
_videoFit.value = i['attr'];
|
|
||||||
_videoFitDesc.value = i['desc'];
|
|
||||||
setVideoFit();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: Text(i['desc']),
|
child: Text(i['desc']),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
);
|
),
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// 缓存fit
|
/// 缓存fit
|
||||||
Future<void> setVideoFit() async {
|
Future<void> setVideoFit() async {
|
||||||
@ -908,7 +916,7 @@ class PlPlayerController {
|
|||||||
if (videoType == 'live') {
|
if (videoType == 'live') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (controlsLock.value) {
|
if (_controlsLock.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_doubleSpeedStatus.value = val;
|
_doubleSpeedStatus.value = val;
|
||||||
@ -1084,6 +1092,7 @@ class PlPlayerController {
|
|||||||
videoFitChangedTimer?.cancel();
|
videoFitChangedTimer?.cancel();
|
||||||
// _position.close();
|
// _position.close();
|
||||||
_playerEventSubs?.cancel();
|
_playerEventSubs?.cancel();
|
||||||
|
_controlsLock.value = false;
|
||||||
// _sliderPosition.close();
|
// _sliderPosition.close();
|
||||||
// _sliderTempPosition.close();
|
// _sliderTempPosition.close();
|
||||||
// _isSliderMoving.close();
|
// _isSliderMoving.close();
|
||||||
|
|||||||
@ -301,16 +301,22 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
|
|
||||||
/// 画面比例
|
/// 画面比例
|
||||||
BottomControlType.fit: SizedBox(
|
BottomControlType.fit: SizedBox(
|
||||||
|
width: 45,
|
||||||
height: 30,
|
height: 30,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => _.toggleVideoFit(),
|
onPressed: () => _.toggleVideoFit('press'),
|
||||||
|
onLongPress: () => _.toggleVideoFit('longPress'),
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
),
|
),
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
_.videoFitDEsc.value,
|
_.videoFitDEsc.value,
|
||||||
style: const TextStyle(color: Colors.white, fontSize: 13),
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -320,29 +326,49 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
BottomControlType.speed: SizedBox(
|
BottomControlType.speed: SizedBox(
|
||||||
width: 45,
|
width: 45,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: TextButton(
|
child: PopupMenuButton<double>(
|
||||||
style: ButtonStyle(
|
tooltip: '更改播放速度',
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
onSelected: (double value) {
|
||||||
|
_.setPlaybackSpeed(value);
|
||||||
|
},
|
||||||
|
initialValue: _.playbackSpeed,
|
||||||
|
color: Colors.black.withOpacity(0.8),
|
||||||
|
itemBuilder: (BuildContext context) {
|
||||||
|
return _.speedsList.map((double speed) {
|
||||||
|
return PopupMenuItem<double>(
|
||||||
|
height: 40,
|
||||||
|
padding: const EdgeInsets.only(left: 20),
|
||||||
|
value: speed,
|
||||||
|
child: Text(
|
||||||
|
'${speed}x',
|
||||||
|
style: textStyle.copyWith(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
);
|
||||||
|
}).toList();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 45,
|
||||||
|
height: 34,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
margin: const EdgeInsets.only(right: 4),
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
'${_.playbackSpeed.toString()}X',
|
'${_.playbackSpeed.toString()}x',
|
||||||
style: textStyle,
|
style: textStyle.copyWith(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
/// 字幕
|
|
||||||
/// 全屏
|
/// 全屏
|
||||||
BottomControlType.fullscreen: ComBtn(
|
BottomControlType.fullscreen: ComBtn(
|
||||||
icon: Obx(
|
icon: Obx(
|
||||||
() => Icon(
|
() => Image.asset(
|
||||||
_.isFullScreen.value
|
_.isFullScreen.value
|
||||||
? FontAwesomeIcons.compress
|
? 'assets/images/video/fullscreen_exit.png'
|
||||||
: FontAwesomeIcons.expand,
|
: 'assets/images/video/fullscreen.png',
|
||||||
size: 15,
|
width: 19,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -359,6 +385,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
BottomControlType.time,
|
BottomControlType.time,
|
||||||
BottomControlType.space,
|
BottomControlType.space,
|
||||||
BottomControlType.fit,
|
BottomControlType.fit,
|
||||||
|
BottomControlType.speed,
|
||||||
BottomControlType.fullscreen,
|
BottomControlType.fullscreen,
|
||||||
];
|
];
|
||||||
for (var i = 0; i < userSpecifyItem.length; i++) {
|
for (var i = 0; i < userSpecifyItem.length; i++) {
|
||||||
@ -416,7 +443,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
);
|
);
|
||||||
return Stack(
|
return ClipRect(
|
||||||
|
child: Stack(
|
||||||
fit: StackFit.passthrough,
|
fit: StackFit.passthrough,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Obx(
|
Obx(
|
||||||
@ -692,7 +720,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
_brightnessValue.value - delta / level;
|
_brightnessValue.value - delta / level;
|
||||||
final double result = brightness.clamp(0.0, 1.0);
|
final double result = brightness.clamp(0.0, 1.0);
|
||||||
setBrightness(result);
|
setBrightness(result);
|
||||||
} else if (isUsingFullScreenGestures(tapPosition, sectionWidth)) {
|
} else if (isUsingFullScreenGestures(
|
||||||
|
tapPosition, sectionWidth)) {
|
||||||
// 全屏
|
// 全屏
|
||||||
final double dy = details.delta.dy;
|
final double dy = details.delta.dy;
|
||||||
const double threshold = 7.0; // 滑动阈值
|
const double threshold = 7.0; // 滑动阈值
|
||||||
@ -739,9 +768,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
// 头部、底部控制条
|
// 头部、底部控制条
|
||||||
Obx(
|
Obx(
|
||||||
() => Column(
|
() => Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
if (widget.headerControl != null || _.headerControl != null)
|
if (widget.headerControl != null ||
|
||||||
ClipRect(
|
_.headerControl != null) ...[
|
||||||
|
Flexible(
|
||||||
child: AppBarAni(
|
child: AppBarAni(
|
||||||
controller: animationController,
|
controller: animationController,
|
||||||
visible: !_.controlsLock.value && _.showControls.value,
|
visible: !_.controlsLock.value && _.showControls.value,
|
||||||
@ -749,8 +780,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
child: widget.headerControl ?? _.headerControl!,
|
child: widget.headerControl ?? _.headerControl!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
] else ...[
|
||||||
ClipRect(
|
const SizedBox.shrink()
|
||||||
|
],
|
||||||
|
Flexible(
|
||||||
|
flex: _.videoType == 'live' ? 0 : 1,
|
||||||
child: AppBarAni(
|
child: AppBarAni(
|
||||||
controller: animationController,
|
controller: animationController,
|
||||||
visible: !_.controlsLock.value && _.showControls.value,
|
visible: !_.controlsLock.value && _.showControls.value,
|
||||||
@ -807,8 +841,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
total: Duration(seconds: max),
|
total: Duration(seconds: max),
|
||||||
progressBarColor: colorTheme,
|
progressBarColor: colorTheme,
|
||||||
baseBarColor: Colors.white.withOpacity(0.2),
|
baseBarColor: Colors.white.withOpacity(0.2),
|
||||||
bufferedBarColor:
|
bufferedBarColor: Colors.white.withOpacity(0.6),
|
||||||
Theme.of(context).colorScheme.primary.withOpacity(0.4),
|
|
||||||
timeLabelLocation: TimeLabelLocation.none,
|
timeLabelLocation: TimeLabelLocation.none,
|
||||||
thumbColor: colorTheme,
|
thumbColor: colorTheme,
|
||||||
barHeight: 3,
|
barHeight: 3,
|
||||||
@ -898,6 +931,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
onSubmittedcb: _handleSubmittedCallback,
|
onSubmittedcb: _handleSubmittedCallback,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'progress_bar.dart';
|
||||||
|
|
||||||
class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
||||||
final PlPlayerController? controller;
|
final PlPlayerController? controller;
|
||||||
@ -20,55 +18,18 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Color colorTheme = Theme.of(context).colorScheme.primary;
|
return Padding(
|
||||||
final _ = controller!;
|
padding: const EdgeInsets.symmetric(horizontal: 18),
|
||||||
return Container(
|
|
||||||
color: Colors.transparent,
|
|
||||||
height: 90,
|
|
||||||
padding: const EdgeInsets.only(left: 18, right: 18),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Obx(
|
Padding(
|
||||||
() {
|
padding: const EdgeInsets.fromLTRB(7, 0, 7, 4),
|
||||||
final int value = _.sliderPositionSeconds.value;
|
child: ProgressBarWidget(controller: controller!),
|
||||||
final int max = _.durationSeconds.value;
|
|
||||||
final int buffer = _.bufferedSeconds.value;
|
|
||||||
if (value > max || max <= 0) {
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 7, right: 7, bottom: 6),
|
|
||||||
child: ProgressBar(
|
|
||||||
progress: Duration(seconds: value),
|
|
||||||
buffered: Duration(seconds: buffer),
|
|
||||||
total: Duration(seconds: max),
|
|
||||||
progressBarColor: colorTheme,
|
|
||||||
baseBarColor: Colors.white.withOpacity(0.2),
|
|
||||||
bufferedBarColor: colorTheme.withOpacity(0.4),
|
|
||||||
timeLabelLocation: TimeLabelLocation.none,
|
|
||||||
thumbColor: colorTheme,
|
|
||||||
barHeight: 3.5,
|
|
||||||
thumbRadius: 7,
|
|
||||||
onDragStart: (duration) {
|
|
||||||
feedBack();
|
|
||||||
_.onChangedSliderStart();
|
|
||||||
},
|
|
||||||
onDragUpdate: (duration) {
|
|
||||||
_.onUpdatedSliderProgress(duration.timeStamp);
|
|
||||||
},
|
|
||||||
onSeek: (duration) {
|
|
||||||
_.onChangedSliderEnd();
|
|
||||||
_.onChangedSlider(duration.inSeconds.toDouble());
|
|
||||||
_.seekTo(Duration(seconds: duration.inSeconds),
|
|
||||||
type: 'slider');
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
);
|
Row(children: buildBottomControl!),
|
||||||
},
|
const SizedBox(height: 6),
|
||||||
),
|
|
||||||
Row(children: [...buildBottomControl!]),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
52
lib/plugin/pl_player/widgets/progress_bar.dart
Normal file
52
lib/plugin/pl_player/widgets/progress_bar.dart
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||||
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
|
||||||
|
class ProgressBarWidget extends StatelessWidget {
|
||||||
|
final PlPlayerController controller;
|
||||||
|
|
||||||
|
const ProgressBarWidget({
|
||||||
|
required this.controller,
|
||||||
|
Key? key,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Obx(() {
|
||||||
|
Color colorTheme = Theme.of(context).colorScheme.primary;
|
||||||
|
final _ = controller;
|
||||||
|
final int value = _.sliderPositionSeconds.value;
|
||||||
|
final int max = _.durationSeconds.value;
|
||||||
|
final int buffer = _.bufferedSeconds.value;
|
||||||
|
if (value > max || max <= 0) {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
return ProgressBar(
|
||||||
|
progress: Duration(seconds: value),
|
||||||
|
buffered: Duration(seconds: buffer),
|
||||||
|
total: Duration(seconds: max),
|
||||||
|
progressBarColor: colorTheme,
|
||||||
|
baseBarColor: Colors.white.withOpacity(0.2),
|
||||||
|
bufferedBarColor: Colors.white.withOpacity(0.6),
|
||||||
|
timeLabelLocation: TimeLabelLocation.none,
|
||||||
|
thumbColor: colorTheme,
|
||||||
|
barHeight: 3.5,
|
||||||
|
thumbRadius: 7,
|
||||||
|
onDragStart: (duration) {
|
||||||
|
feedBack();
|
||||||
|
_.onChangedSliderStart();
|
||||||
|
},
|
||||||
|
onDragUpdate: (duration) {
|
||||||
|
_.onUpdatedSliderProgress(duration.timeStamp);
|
||||||
|
},
|
||||||
|
onSeek: (duration) {
|
||||||
|
_.onChangedSliderEnd();
|
||||||
|
_.onChangedSlider(duration.inSeconds.toDouble());
|
||||||
|
_.seekTo(Duration(seconds: duration.inSeconds), type: 'slider');
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
207
lib/utils/follow.dart
Normal file
207
lib/utils/follow.dart
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
|
import 'package:pilipala/common/widgets/group_panel.dart';
|
||||||
|
import 'package:pilipala/http/video.dart';
|
||||||
|
import 'package:pilipala/utils/global_data_cache.dart';
|
||||||
|
|
||||||
|
class FollowUtils {
|
||||||
|
final BuildContext context;
|
||||||
|
final int followStatus;
|
||||||
|
final int mid;
|
||||||
|
|
||||||
|
FollowUtils({
|
||||||
|
required this.context,
|
||||||
|
required this.followStatus,
|
||||||
|
required this.mid,
|
||||||
|
});
|
||||||
|
|
||||||
|
// static final Map<int, Map<String, dynamic>> followMap = {
|
||||||
|
// // 未关注
|
||||||
|
// 0: {
|
||||||
|
// 'desc': '确定关注UP主?',
|
||||||
|
// // 1 关注 5 拉黑
|
||||||
|
// 'act': 1,
|
||||||
|
// },
|
||||||
|
// // 已关注
|
||||||
|
// 2: {
|
||||||
|
// 'desc': '确定取消关注UP主?',
|
||||||
|
// 'act': 2,
|
||||||
|
// },
|
||||||
|
// // 已互粉
|
||||||
|
// 6: {
|
||||||
|
// 'desc': '确定取消关注UP主?',
|
||||||
|
// 'act': 2,
|
||||||
|
// },
|
||||||
|
// // 已拉黑
|
||||||
|
// 128: {
|
||||||
|
// 'desc': '确定从黑名单移除UP主?',
|
||||||
|
// 'act': 6,
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
|
||||||
|
static final Map<String, Map<String, dynamic>> actionTypeMap = {
|
||||||
|
'remove': {
|
||||||
|
'desc': '确定从黑名单移除UP主?',
|
||||||
|
'tips': '已从黑名单移除',
|
||||||
|
'act': 6,
|
||||||
|
'followStatus': 0,
|
||||||
|
},
|
||||||
|
'unFollow': {
|
||||||
|
'desc': '确定取消关注UP主?',
|
||||||
|
'tips': '已取消关注',
|
||||||
|
'act': 2,
|
||||||
|
'followStatus': 0,
|
||||||
|
},
|
||||||
|
'follow': {
|
||||||
|
'desc': '确定关注UP主?',
|
||||||
|
'tips': '关注成功',
|
||||||
|
'act': 1,
|
||||||
|
'followStatus': 2,
|
||||||
|
},
|
||||||
|
'block': {
|
||||||
|
'desc': '确定拉黑UP主?',
|
||||||
|
'tips': '已拉黑',
|
||||||
|
'act': 5,
|
||||||
|
'followStatus': 128,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Future<int> showFollowSheet() async {
|
||||||
|
var res = await showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (context) {
|
||||||
|
return Padding(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const DragHandle(),
|
||||||
|
if (followStatus == 128) ...[
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.remove_circle_outline_rounded),
|
||||||
|
onTap: () => modifyRelation('remove'),
|
||||||
|
title: const Text('从黑名单移除'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if ([2, 6].contains(followStatus)) ...[
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.group_add_outlined),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
setFollowGroup();
|
||||||
|
},
|
||||||
|
title: const Text('设置分组'),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.heart_broken_outlined),
|
||||||
|
onTap: () => modifyRelation('unFollow'),
|
||||||
|
title: const Text('取消关注'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (followStatus == 0) ...[
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.favorite_border_rounded),
|
||||||
|
onTap: () => modifyRelation('follow'),
|
||||||
|
title: const Text('关注up主'),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.block_rounded),
|
||||||
|
onTap: () => modifyRelation('block'),
|
||||||
|
title: const Text('拉黑up主'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return res ?? followStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 操作用户关系
|
||||||
|
Future modifyRelation(String actionType) async {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
final Color outline = Theme.of(context).colorScheme.outline;
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: Text(actionTypeMap[actionType]!['desc']),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: Navigator.of(context).pop,
|
||||||
|
child: Text('点错了', style: TextStyle(color: outline)),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => modifyRelationFetch(actionType),
|
||||||
|
child: const Text('确定'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 操作用户关系Future
|
||||||
|
Future<int> modifyRelationFetch(String actionType, {bool? isDirect}) async {
|
||||||
|
if (isDirect != true) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
SmartDialog.showLoading(msg: '请求中');
|
||||||
|
var res = await VideoHttp.relationMod(
|
||||||
|
mid: mid,
|
||||||
|
act: actionTypeMap[actionType]!['act'],
|
||||||
|
reSrc: 11,
|
||||||
|
);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
if (res['status']) {
|
||||||
|
final int newFollowStatus = actionTypeMap[actionType]!['followStatus'];
|
||||||
|
SmartDialog.showToast(actionTypeMap[actionType]!['tips']);
|
||||||
|
if (context.mounted) {
|
||||||
|
if (isDirect != true) {
|
||||||
|
Navigator.of(context).pop(newFollowStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newFollowStatus;
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
if (context.mounted && isDirect != true) {
|
||||||
|
Navigator.of(context).pop(-1);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置分组
|
||||||
|
Future setFollowGroup() async {
|
||||||
|
final size = MediaQuery.sizeOf(context);
|
||||||
|
final contentHeight = size.height - kToolbarHeight;
|
||||||
|
final double initialChildSize =
|
||||||
|
(contentHeight - size.width * 9 / 16) / contentHeight;
|
||||||
|
await showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
useSafeArea: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return DraggableScrollableSheet(
|
||||||
|
initialChildSize: initialChildSize,
|
||||||
|
minChildSize: 0,
|
||||||
|
maxChildSize: 1,
|
||||||
|
snap: true,
|
||||||
|
expand: false,
|
||||||
|
snapSizes: [initialChildSize],
|
||||||
|
builder: (BuildContext context, ScrollController scrollController) {
|
||||||
|
return GroupPanel(
|
||||||
|
mid: GlobalDataCache.userInfo!.mid!,
|
||||||
|
scrollController: scrollController,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:io';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/user/info.dart';
|
import 'package:pilipala/models/user/info.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||||
@ -55,6 +56,8 @@ class GlobalDataCache {
|
|||||||
static late bool enableDynamicSwitch;
|
static late bool enableDynamicSwitch;
|
||||||
// 投屏开关
|
// 投屏开关
|
||||||
static bool enableDlna = false;
|
static bool enableDlna = false;
|
||||||
|
// 硬件解码格式
|
||||||
|
static late String hardwareDecodeFormat;
|
||||||
// sponsorBlock开关
|
// sponsorBlock开关
|
||||||
static bool enableSponsorBlock = false;
|
static bool enableSponsorBlock = false;
|
||||||
// 视频评论开关
|
// 视频评论开关
|
||||||
@ -127,6 +130,10 @@ class GlobalDataCache {
|
|||||||
enableDynamicSwitch =
|
enableDynamicSwitch =
|
||||||
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
||||||
enableDlna = settingBox.get(SettingBoxKey.enableDlna, defaultValue: false);
|
enableDlna = settingBox.get(SettingBoxKey.enableDlna, defaultValue: false);
|
||||||
|
hardwareDecodeFormat = settingBox.get(SettingBoxKey.hardwareDecodeFormat,
|
||||||
|
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
|
||||||
|
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
||||||
|
enableDlna = settingBox.get(SettingBoxKey.enableDlna, defaultValue: false);
|
||||||
enableSponsorBlock =
|
enableSponsorBlock =
|
||||||
settingBox.get(SettingBoxKey.enableSponsorBlock, defaultValue: false);
|
settingBox.get(SettingBoxKey.enableSponsorBlock, defaultValue: false);
|
||||||
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import 'package:pilipala/http/user.dart';
|
|||||||
import 'package:pilipala/pages/dynamics/index.dart';
|
import 'package:pilipala/pages/dynamics/index.dart';
|
||||||
import 'package:pilipala/pages/home/index.dart';
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
import 'package:pilipala/pages/mine/index.dart';
|
import 'package:pilipala/pages/mine/index.dart';
|
||||||
import 'package:pilipala/utils/cookie.dart';
|
|
||||||
import 'package:pilipala/utils/global_data_cache.dart';
|
import 'package:pilipala/utils/global_data_cache.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
@ -68,7 +67,6 @@ class LoginUtils {
|
|||||||
content = '${content + url}; \n';
|
content = '${content + url}; \n';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await SetCookie.onSet();
|
|
||||||
final result = await UserHttp.userInfo();
|
final result = await UserHttp.userInfo();
|
||||||
if (result['status'] && result['data'].isLogin) {
|
if (result['status'] && result['data'].isLogin) {
|
||||||
SmartDialog.showToast('登录成功');
|
SmartDialog.showToast('登录成功');
|
||||||
|
|||||||
@ -117,6 +117,7 @@ class SettingBoxKey {
|
|||||||
defaultHomePage = 'defaultHomePage',
|
defaultHomePage = 'defaultHomePage',
|
||||||
enableRelatedVideo = 'enableRelatedVideo',
|
enableRelatedVideo = 'enableRelatedVideo',
|
||||||
enableDlna = 'enableDlna',
|
enableDlna = 'enableDlna',
|
||||||
|
hardwareDecodeFormat = 'hardwareDecodeFormat',
|
||||||
enableSponsorBlock = 'enableSponsorBlock',
|
enableSponsorBlock = 'enableSponsorBlock',
|
||||||
enableComment = 'enableComment';
|
enableComment = 'enableComment';
|
||||||
|
|
||||||
@ -136,7 +137,8 @@ class SettingBoxKey {
|
|||||||
enableGradientBg = 'enableGradientBg',
|
enableGradientBg = 'enableGradientBg',
|
||||||
enableDynamicSwitch = 'enableDynamicSwitch',
|
enableDynamicSwitch = 'enableDynamicSwitch',
|
||||||
navBarSort = 'navBarSort',
|
navBarSort = 'navBarSort',
|
||||||
actionTypeSort = 'actionTypeSort';
|
actionTypeSort = 'actionTypeSort',
|
||||||
|
enablePureBlack = 'enablePureBlack';
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocalCacheKey {
|
class LocalCacheKey {
|
||||||
|
|||||||
28
pubspec.lock
28
pubspec.lock
@ -85,10 +85,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: audio_service
|
name: audio_service
|
||||||
sha256: "4547c312a94f9cb2c48b60823fb190767cbd63454a83c73049384d5d3cba4650"
|
sha256: "9dd5ba7e77567b290c35908b1950d61485b4dfdd3a0ac398e98cfeec04651b75"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.18.13"
|
version: "0.18.15"
|
||||||
audio_service_platform_interface:
|
audio_service_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -101,18 +101,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: audio_service_web
|
name: audio_service_web
|
||||||
sha256: "9d7d5ae5f98a5727f2580fad73062f2484f400eef6cef42919413268e62a363e"
|
sha256: "4cdc2127cd4562b957fb49227dc58e3303fafb09bde2573bc8241b938cf759d9"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.2"
|
version: "0.1.3"
|
||||||
audio_session:
|
audio_session:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: audio_session
|
name: audio_session
|
||||||
sha256: "6fdf255ed3af86535c96452c33ecff1245990bb25a605bfb1958661ccc3d467f"
|
sha256: "343e83bc7809fbda2591a49e525d6b63213ade10c76f15813be9aed6657b3261"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.18"
|
version: "0.1.21"
|
||||||
audio_video_progress_bar:
|
audio_video_progress_bar:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -497,6 +497,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.2.1"
|
version: "6.2.1"
|
||||||
|
fading_edge_scrollview:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: fading_edge_scrollview
|
||||||
|
sha256: c25c2231652ce774cc31824d0112f11f653881f43d7f5302c05af11942052031
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.0"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -990,6 +998,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.0"
|
version: "6.1.0"
|
||||||
|
marquee:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: marquee
|
||||||
|
sha256: "4b5243d2804373bdc25fc93d42c3b402d6ec1f4ee8d0bb72276edd04ae7addb8"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.3"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -89,8 +89,8 @@ dependencies:
|
|||||||
media_kit_libs_video: ^1.0.4
|
media_kit_libs_video: ^1.0.4
|
||||||
|
|
||||||
# 媒体通知
|
# 媒体通知
|
||||||
audio_service: ^0.18.13
|
audio_service: ^0.18.15
|
||||||
audio_session: ^0.1.18
|
audio_session: ^0.1.21
|
||||||
|
|
||||||
# 音量、亮度、屏幕控制
|
# 音量、亮度、屏幕控制
|
||||||
flutter_volume_controller: ^1.3.2
|
flutter_volume_controller: ^1.3.2
|
||||||
@ -152,6 +152,8 @@ dependencies:
|
|||||||
re_highlight: ^0.0.3
|
re_highlight: ^0.0.3
|
||||||
# 图片选择器
|
# 图片选择器
|
||||||
image_picker: ^1.1.2
|
image_picker: ^1.1.2
|
||||||
|
# 跑马灯
|
||||||
|
marquee: ^2.2.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user