fix: 顶部播放控制条重载,界面尺寸微调

This commit is contained in:
orz12
2024-03-22 13:41:11 +08:00
parent 74ac540753
commit 9943cc099b

View File

@@ -57,6 +57,7 @@ class _HeaderControlState extends State<HeaderControl> {
late StreamSubscription<bool> fullScreenStatusListener;
late bool horizontalScreen;
RxString now = ''.obs;
late Timer clock;
@override
void initState() {
@@ -89,6 +90,7 @@ class _HeaderControlState extends State<HeaderControl> {
void dispose() {
widget.floating?.dispose();
fullScreenStatusListener.cancel();
clock.cancel();
super.dispose();
}
@@ -1040,11 +1042,11 @@ class _HeaderControlState extends State<HeaderControl> {
}
startClock() {
Timer.periodic(const Duration(seconds: 1), (Timer t) {
clock = Timer.periodic(const Duration(seconds: 1), (Timer t) {
if (!mounted) {
return;
}
now.value = DateTime.now().toString().split(' ')[1].substring(0, 8);
now.value = DateTime.now().toString().split(' ')[1].substring(0, 5);
});
}
@@ -1053,6 +1055,8 @@ class _HeaderControlState extends State<HeaderControl> {
final _ = widget.controller!;
// final bool isLandscape =
// MediaQuery.of(context).orientation == Orientation.landscape;
return LayoutBuilder(builder: (context, boxConstraints) {
return AppBar(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
@@ -1097,10 +1101,7 @@ class _HeaderControlState extends State<HeaderControl> {
children: [
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).orientation ==
Orientation.landscape
? 400
: 140,
maxWidth: boxConstraints.maxWidth / 2 - 60,
maxHeight: 25),
child: Marquee(
text: videoIntroController.videoDetail.value.title!,
@@ -1160,7 +1161,8 @@ class _HeaderControlState extends State<HeaderControl> {
MediaQuery.of(context).orientation ==
Orientation.landscape) ||
(!isFullScreen &&
MediaQuery.of(context).orientation == Orientation.landscape &&
MediaQuery.of(context).orientation ==
Orientation.landscape &&
!horizontalScreen)) ...[
// const Spacer(),
// show current datetime
@@ -1173,7 +1175,9 @@ class _HeaderControlState extends State<HeaderControl> {
),
),
),
const SizedBox(width: 15,),
const SizedBox(
width: 15,
),
],
// ComBtn(
// icon: const Icon(
@@ -1210,8 +1214,10 @@ class _HeaderControlState extends State<HeaderControl> {
),
onPressed: () {
_.isOpenDanmu.value = !_.isOpenDanmu.value;
setting.put(
SettingBoxKey.enableShowDanmaku, _.isOpenDanmu.value);
SmartDialog.showToast(
_.isOpenDanmu.value ? '已临时开启弹幕' : '已临时关闭弹幕',
"${_.isOpenDanmu.value ? '开启' : '关闭'}弹幕",
displayTime: const Duration(seconds: 1));
},
icon: Icon(
@@ -1271,6 +1277,7 @@ class _HeaderControlState extends State<HeaderControl> {
],
),
);
});
}
}