feat: 横屏全屏时也显示返回主页按钮

This commit is contained in:
orz12
2024-06-05 16:13:37 +08:00
parent 6c4c9fc17b
commit 08566dc40e

View File

@@ -1168,7 +1168,9 @@ class _HeaderControlState extends State<HeaderControl> {
final _ = widget.controller!;
// final bool isLandscape =
// MediaQuery.of(context).orientation == Orientation.landscape;
bool equivalentFullScreen = !isFullScreen &&
!horizontalScreen &&
MediaQuery.of(context).orientation == Orientation.landscape;
return LayoutBuilder(builder: (context, boxConstraints) {
return AppBar(
backgroundColor: Colors.transparent,
@@ -1203,12 +1205,29 @@ class _HeaderControlState extends State<HeaderControl> {
}
},
)),
if (!isFullScreen ||
MediaQuery.of(context).orientation != Orientation.portrait)
SizedBox(
width: 42,
height: 34,
child: IconButton(
tooltip: '返回主页',
icon: const Icon(
FontAwesomeIcons.house,
size: 15,
color: Colors.white,
),
onPressed: () async {
// 销毁播放器实例
// await widget.controller!.dispose(type: 'all');
if (mounted) {
Navigator.popUntil(
context, (Route<dynamic> route) => route.isFirst);
}
},
)),
if ((videoIntroController.videoDetail.value.title != null) &&
(isFullScreen ||
(!isFullScreen &&
MediaQuery.of(context).orientation ==
Orientation.landscape &&
!horizontalScreen))) ...[
(isFullScreen || equivalentFullScreen))
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -1248,35 +1267,9 @@ class _HeaderControlState extends State<HeaderControl> {
)
],
),
] else ...[
SizedBox(
width: 42,
height: 34,
child: IconButton(
tooltip: '返回主页',
icon: const Icon(
FontAwesomeIcons.house,
size: 15,
color: Colors.white,
),
onPressed: () async {
// 销毁播放器实例
// await widget.controller!.dispose(type: 'all');
if (mounted) {
Navigator.popUntil(
context, (Route<dynamic> route) => route.isFirst);
}
},
)),
],
const Spacer(),
if ((isFullScreen &&
MediaQuery.of(context).orientation ==
Orientation.landscape) ||
(!isFullScreen &&
MediaQuery.of(context).orientation ==
Orientation.landscape &&
!horizontalScreen)) ...[
if (MediaQuery.of(context).orientation == Orientation.landscape &&
(isFullScreen || !horizontalScreen)) ...[
// const Spacer(),
// show current datetime
Obx(