mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-20 16:18:39 +00:00
custom angle degree
Closes #2140 Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import 'dart:io';
|
import 'dart:io' show Platform;
|
||||||
|
|
||||||
import 'package:PiliPlus/common/widgets/custom_icon.dart';
|
import 'package:PiliPlus/common/widgets/custom_icon.dart';
|
||||||
import 'package:PiliPlus/models/common/super_chat_type.dart';
|
import 'package:PiliPlus/models/common/super_chat_type.dart';
|
||||||
@@ -7,6 +7,7 @@ import 'package:PiliPlus/pages/main/controller.dart';
|
|||||||
import 'package:PiliPlus/pages/setting/models/model.dart';
|
import 'package:PiliPlus/pages/setting/models/model.dart';
|
||||||
import 'package:PiliPlus/pages/setting/pages/fullscreen_sc_size.dart';
|
import 'package:PiliPlus/pages/setting/pages/fullscreen_sc_size.dart';
|
||||||
import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
|
import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
|
||||||
|
import 'package:PiliPlus/pages/setting/widgets/slider_dialog.dart';
|
||||||
import 'package:PiliPlus/plugin/pl_player/models/bottom_progress_behavior.dart';
|
import 'package:PiliPlus/plugin/pl_player/models/bottom_progress_behavior.dart';
|
||||||
import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
|
import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
|
||||||
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||||
@@ -42,6 +43,13 @@ List<SettingsModel> get playSettings => [
|
|||||||
title: '倍速设置',
|
title: '倍速设置',
|
||||||
subtitle: '设置视频播放速度',
|
subtitle: '设置视频播放速度',
|
||||||
),
|
),
|
||||||
|
if (Platform.isAndroid)
|
||||||
|
NormalModel(
|
||||||
|
onTap: _showAngleDegreesDialog,
|
||||||
|
leading: const Icon(MdiIcons.angleAcute),
|
||||||
|
title: '倾斜角度阈值',
|
||||||
|
getSubtitle: () => '当前:「${Pref.angleDegrees}°」',
|
||||||
|
),
|
||||||
const SwitchModel(
|
const SwitchModel(
|
||||||
title: '自动播放',
|
title: '自动播放',
|
||||||
subtitle: '进入详情页自动播放',
|
subtitle: '进入详情页自动播放',
|
||||||
@@ -346,3 +354,25 @@ Future<void> _showProgressBehaviorDialog(
|
|||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _showAngleDegreesDialog(
|
||||||
|
BuildContext context,
|
||||||
|
VoidCallback setState,
|
||||||
|
) async {
|
||||||
|
final res = await showDialog<double>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => SliderDialog(
|
||||||
|
title: '倾斜角度阈值',
|
||||||
|
min: 10.0,
|
||||||
|
max: 90.0,
|
||||||
|
divisions: 90,
|
||||||
|
precise: 0,
|
||||||
|
value: Pref.angleDegrees.toDouble(),
|
||||||
|
suffix: '°',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (res != null) {
|
||||||
|
await GStorage.setting.put(SettingBoxKey.angleDegrees, res.toInt());
|
||||||
|
setState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -570,6 +570,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
.onOrientationChanged(
|
.onOrientationChanged(
|
||||||
useSensor: Platform.isAndroid,
|
useSensor: Platform.isAndroid,
|
||||||
checkIsAutoRotate: checkIsAutoRotate,
|
checkIsAutoRotate: checkIsAutoRotate,
|
||||||
|
angleDegrees: Platform.isAndroid ? Pref.angleDegrees : null,
|
||||||
)
|
)
|
||||||
.listen(_onOrientationChanged);
|
.listen(_onOrientationChanged);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,8 @@ abstract final class SettingBoxKey {
|
|||||||
showDynDispute = 'showDynDispute',
|
showDynDispute = 'showDynDispute',
|
||||||
touchSlopH = 'touchSlopH',
|
touchSlopH = 'touchSlopH',
|
||||||
floatingNavBar = 'floatingNavBar',
|
floatingNavBar = 'floatingNavBar',
|
||||||
removeSafeArea = 'removeSafeArea';
|
removeSafeArea = 'removeSafeArea',
|
||||||
|
angleDegrees = 'angleDegrees';
|
||||||
|
|
||||||
static const String minimizeOnExit = 'minimizeOnExit',
|
static const String minimizeOnExit = 'minimizeOnExit',
|
||||||
windowSize = 'windowSize',
|
windowSize = 'windowSize',
|
||||||
|
|||||||
@@ -982,4 +982,7 @@ abstract final class Pref {
|
|||||||
|
|
||||||
static bool get removeSafeArea =>
|
static bool get removeSafeArea =>
|
||||||
_setting.get(SettingBoxKey.removeSafeArea, defaultValue: false);
|
_setting.get(SettingBoxKey.removeSafeArea, defaultValue: false);
|
||||||
|
|
||||||
|
static int get angleDegrees =>
|
||||||
|
_setting.get(SettingBoxKey.angleDegrees, defaultValue: 30);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1252,7 +1252,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: master
|
ref: master
|
||||||
resolved-ref: a987a459f17af0002397e49800ba4f68912b375c
|
resolved-ref: "9cbe7c07a697a199b36ab050248091a3aab8dd3f"
|
||||||
url: "https://github.com/bggRGjQaUbCoE/flutter_native_device_orientation.git"
|
url: "https://github.com/bggRGjQaUbCoE/flutter_native_device_orientation.git"
|
||||||
source: git
|
source: git
|
||||||
version: "2.0.5"
|
version: "2.0.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user