opt pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-06 13:46:39 +08:00
parent b149ee4998
commit 4a00b45c5c
43 changed files with 261 additions and 227 deletions

View File

@@ -9,11 +9,15 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
class LiveHeaderControl extends StatelessWidget {
const LiveHeaderControl({
required this.title,
required this.upName,
required this.plPlayerController,
required this.onSendDanmaku,
super.key,
});
final String? title;
final String? upName;
final PlPlayerController plPlayerController;
final VoidCallback onSendDanmaku;
@@ -26,22 +30,41 @@ class LiveHeaderControl extends StatelessWidget {
automaticallyImplyLeading: false,
titleSpacing: 14,
title: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
width: 42,
height: 34,
child: IconButton(
tooltip: '发弹幕',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: onSendDanmaku,
icon: const Icon(
Icons.comment_outlined,
size: 19,
color: Colors.white,
if (title != null)
Expanded(
child: Column(
spacing: 5,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title!,
maxLines: 1,
style: const TextStyle(
fontSize: 15, height: 1, color: Colors.white),
),
if (plPlayerController.isFullScreen.value && upName != null)
Text(
upName!,
maxLines: 1,
style: const TextStyle(
fontSize: 12, height: 1, color: Colors.white),
),
],
),
)
else
const Spacer(),
IconButton(
tooltip: '发弹幕',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: onSendDanmaku,
icon: const Icon(
Icons.comment_outlined,
size: 18,
color: Colors.white,
),
),
Obx(
@@ -62,33 +85,28 @@ class LiveHeaderControl extends StatelessWidget {
),
const SizedBox(width: 10),
if (Platform.isAndroid) ...[
SizedBox(
width: 34,
height: 34,
child: IconButton(
tooltip: '画中画',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: () async {
try {
var floating = Floating();
if ((await floating.isPipAvailable) == true) {
plPlayerController.hiddenControls(false);
floating.enable(
plPlayerController.direction.value == 'vertical'
? const EnableManual(
aspectRatio: Rational.vertical())
: const EnableManual(),
);
}
} catch (_) {}
},
icon: const Icon(
Icons.picture_in_picture_outlined,
size: 18,
color: Colors.white,
),
IconButton(
tooltip: '画中画',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: () async {
try {
var floating = Floating();
if ((await floating.isPipAvailable) == true) {
plPlayerController.hiddenControls(false);
floating.enable(
plPlayerController.direction.value == 'vertical'
? const EnableManual(aspectRatio: Rational.vertical())
: const EnableManual(),
);
}
} catch (_) {}
},
icon: const Icon(
Icons.picture_in_picture_outlined,
size: 18,
color: Colors.white,
),
),
const SizedBox(width: 10),