mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: video: check title width
Closes #206 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -95,18 +95,6 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void didChangeDependencies() {
|
|
||||||
super.didChangeDependencies();
|
|
||||||
if (MediaQuery.of(context).orientation == Orientation.landscape &&
|
|
||||||
(isFullScreen || !horizontalScreen)) {
|
|
||||||
startClock();
|
|
||||||
} else {
|
|
||||||
clock?.cancel();
|
|
||||||
clock = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 设置面板
|
/// 设置面板
|
||||||
void showSettingSheet() {
|
void showSettingSheet() {
|
||||||
Utils.showFSSheet(
|
Utils.showFSSheet(
|
||||||
@@ -1820,33 +1808,66 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
LayoutBuilder(
|
||||||
constraints: BoxConstraints(maxHeight: 25),
|
builder: (context, constraints) {
|
||||||
child: Obx(
|
return Obx(
|
||||||
() => Marquee(
|
() {
|
||||||
text:
|
final textPainter = TextPainter(
|
||||||
videoIntroController.videoDetail.value.title!,
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
text: videoIntroController
|
||||||
color: Colors.white,
|
.videoDetail.value.title!,
|
||||||
fontSize: 16,
|
style: const TextStyle(
|
||||||
),
|
color: Colors.white,
|
||||||
scrollAxis: Axis.horizontal,
|
fontSize: 16,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
),
|
||||||
blankSpace: 200,
|
),
|
||||||
velocity: 40,
|
textDirection: TextDirection.ltr,
|
||||||
startAfter: const Duration(seconds: 1),
|
maxLines: 1,
|
||||||
showFadingOnlyWhenScrolling: true,
|
)..layout(maxWidth: constraints.maxWidth);
|
||||||
fadingEdgeStartFraction: 0,
|
if (textPainter.didExceedMaxLines) {
|
||||||
fadingEdgeEndFraction: 0.1,
|
return ConstrainedBox(
|
||||||
numberOfRounds: 1,
|
constraints: BoxConstraints(maxHeight: 25),
|
||||||
startPadding: 0,
|
child: Marquee(
|
||||||
accelerationDuration: const Duration(seconds: 1),
|
text: videoIntroController
|
||||||
accelerationCurve: Curves.linear,
|
.videoDetail.value.title!,
|
||||||
decelerationDuration:
|
style: const TextStyle(
|
||||||
const Duration(milliseconds: 500),
|
color: Colors.white,
|
||||||
decelerationCurve: Curves.easeOut,
|
fontSize: 16,
|
||||||
),
|
),
|
||||||
),
|
scrollAxis: Axis.horizontal,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
blankSpace: 200,
|
||||||
|
velocity: 40,
|
||||||
|
startAfter: const Duration(seconds: 1),
|
||||||
|
showFadingOnlyWhenScrolling: true,
|
||||||
|
fadingEdgeStartFraction: 0,
|
||||||
|
fadingEdgeEndFraction: 0.1,
|
||||||
|
numberOfRounds: 1,
|
||||||
|
startPadding: 0,
|
||||||
|
accelerationDuration:
|
||||||
|
const Duration(seconds: 1),
|
||||||
|
accelerationCurve: Curves.linear,
|
||||||
|
decelerationDuration:
|
||||||
|
const Duration(milliseconds: 500),
|
||||||
|
decelerationCurve: Curves.easeOut,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Text(
|
||||||
|
videoIntroController
|
||||||
|
.videoDetail.value.title!,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
textDirection: TextDirection.ltr,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
if (videoIntroController.isShowOnlineTotal)
|
if (videoIntroController.isShowOnlineTotal)
|
||||||
Obx(
|
Obx(
|
||||||
@@ -1863,22 +1884,26 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
)
|
)
|
||||||
else
|
else
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (MediaQuery.of(context).orientation ==
|
// show current datetime
|
||||||
Orientation.landscape &&
|
Obx(
|
||||||
(isFullScreen || !horizontalScreen)) ...[
|
() {
|
||||||
// const Spacer(),
|
if (MediaQuery.of(context).orientation ==
|
||||||
// show current datetime
|
Orientation.landscape &&
|
||||||
Obx(
|
(isFullScreen || !horizontalScreen)) {
|
||||||
() => Text(
|
startClock();
|
||||||
now.value,
|
return Text(
|
||||||
style: const TextStyle(
|
now.value,
|
||||||
color: Colors.white,
|
style: const TextStyle(
|
||||||
fontSize: 13,
|
color: Colors.white,
|
||||||
),
|
fontSize: 13,
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
const SizedBox(width: 15),
|
}
|
||||||
],
|
clock?.cancel();
|
||||||
|
clock = null;
|
||||||
|
return SizedBox.shrink();
|
||||||
|
},
|
||||||
|
),
|
||||||
// ComBtn(
|
// ComBtn(
|
||||||
// icon: const Icon(
|
// icon: const Icon(
|
||||||
// FontAwesomeIcons.cropSimple,
|
// FontAwesomeIcons.cropSimple,
|
||||||
|
|||||||
Reference in New Issue
Block a user