mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 限制横版卡片内容高度,避免特定设备显示超出范围,修复更新弹窗
This commit is contained in:
@@ -159,8 +159,11 @@ class VideoContent extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
videoItem.title as String,
|
videoItem.title as String,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: Theme.of(context).textTheme.bodyMedium!.fontSize,
|
||||||
|
height: 1.4,
|
||||||
|
letterSpacing: 0.3,
|
||||||
),
|
),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
@@ -175,6 +178,8 @@ class VideoContent extends StatelessWidget {
|
|||||||
text: i['text'] as String,
|
text: i['text'] as String,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.bodyMedium!.fontSize,
|
||||||
letterSpacing: 0.3,
|
letterSpacing: 0.3,
|
||||||
color: i['type'] == 'em'
|
color: i['type'] == 'em'
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
@@ -204,24 +209,19 @@ class VideoContent extends StatelessWidget {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// const SizedBox(height: 4),
|
// const SizedBox(height: 4),
|
||||||
if (showPubdate)
|
if (showOwner || showPubdate)
|
||||||
Text(
|
Expanded(
|
||||||
Utils.dateFormat(videoItem.pubdate!),
|
flex: 0,
|
||||||
|
child: Text(
|
||||||
|
"${showPubdate ? Utils.dateFormat(videoItem.pubdate!, formatType: 'day') + ' ' : ''} ${showOwner ? videoItem.owner.name : ''}",
|
||||||
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 11, color: Theme.of(context).colorScheme.outline),
|
fontSize: 11,
|
||||||
),
|
height: 1,
|
||||||
if (showOwner)
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
videoItem.owner.name as String,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize:
|
|
||||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -237,7 +237,6 @@ class VideoContent extends StatelessWidget {
|
|||||||
theme: 'gray',
|
theme: 'gray',
|
||||||
danmu: videoItem.stat.danmaku as int,
|
danmu: videoItem.stat.danmaku as int,
|
||||||
),
|
),
|
||||||
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (source == 'normal')
|
if (source == 'normal')
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|||||||
@@ -96,11 +96,21 @@ class Utils {
|
|||||||
if (formatType == 'detail') {
|
if (formatType == 'detail') {
|
||||||
currentYearStr = 'MM-DD hh:mm';
|
currentYearStr = 'MM-DD hh:mm';
|
||||||
lastYearStr = 'YY-MM-DD hh:mm';
|
lastYearStr = 'YY-MM-DD hh:mm';
|
||||||
|
return CustomStamp_str(
|
||||||
|
timestamp: timeStamp, date: lastYearStr, toInt: false);
|
||||||
|
} else if (formatType == 'day') {
|
||||||
|
if (distance <= 43200) {
|
||||||
return CustomStamp_str(
|
return CustomStamp_str(
|
||||||
timestamp: timeStamp,
|
timestamp: timeStamp,
|
||||||
date: lastYearStr,
|
date: 'hh:mm',
|
||||||
toInt: false,
|
toInt: true,
|
||||||
formatType: formatType);
|
);
|
||||||
|
}
|
||||||
|
return CustomStamp_str(
|
||||||
|
timestamp: timeStamp,
|
||||||
|
date: 'YY-MM-DD',
|
||||||
|
toInt: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (distance <= 60) {
|
if (distance <= 60) {
|
||||||
return '刚刚';
|
return '刚刚';
|
||||||
@@ -111,25 +121,19 @@ class Utils {
|
|||||||
} else if (DateTime.fromMillisecondsSinceEpoch(time * 1000).year ==
|
} else if (DateTime.fromMillisecondsSinceEpoch(time * 1000).year ==
|
||||||
DateTime.fromMillisecondsSinceEpoch(timeStamp * 1000).year) {
|
DateTime.fromMillisecondsSinceEpoch(timeStamp * 1000).year) {
|
||||||
return CustomStamp_str(
|
return CustomStamp_str(
|
||||||
timestamp: timeStamp,
|
timestamp: timeStamp, date: currentYearStr, toInt: false);
|
||||||
date: currentYearStr,
|
|
||||||
toInt: false,
|
|
||||||
formatType: formatType);
|
|
||||||
} else {
|
} else {
|
||||||
return CustomStamp_str(
|
return CustomStamp_str(
|
||||||
timestamp: timeStamp,
|
timestamp: timeStamp, date: lastYearStr, toInt: false);
|
||||||
date: lastYearStr,
|
|
||||||
toInt: false,
|
|
||||||
formatType: formatType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 时间戳转时间
|
// 时间戳转时间
|
||||||
static String CustomStamp_str(
|
static String CustomStamp_str({
|
||||||
{int? timestamp, // 为空则显示当前时间
|
int? timestamp, // 为空则显示当前时间
|
||||||
String? date, // 显示格式,比如:'YY年MM月DD日 hh:mm:ss'
|
String? date, // 显示格式,比如:'YY年MM月DD日 hh:mm:ss'
|
||||||
bool toInt = true, // 去除0开头
|
bool toInt = true, // 去除0开头
|
||||||
String? formatType}) {
|
}) {
|
||||||
timestamp ??= (DateTime.now().millisecondsSinceEpoch / 1000).round();
|
timestamp ??= (DateTime.now().millisecondsSinceEpoch / 1000).round();
|
||||||
String timeStr =
|
String timeStr =
|
||||||
(DateTime.fromMillisecondsSinceEpoch(timestamp * 1000)).toString();
|
(DateTime.fromMillisecondsSinceEpoch(timestamp * 1000)).toString();
|
||||||
@@ -159,10 +163,6 @@ class Utils {
|
|||||||
return timeStr;
|
return timeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (formatType == 'list' && int.parse(DD) > DateTime.now().day - 2) {
|
|
||||||
// return '昨天';
|
|
||||||
// }
|
|
||||||
|
|
||||||
date = date
|
date = date
|
||||||
.replaceAll('YY', YY)
|
.replaceAll('YY', YY)
|
||||||
.replaceAll('MM', MM)
|
.replaceAll('MM', MM)
|
||||||
@@ -229,7 +229,8 @@ class Utils {
|
|||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
buildNumber = buildNumber.substring(0, buildNumber.length - 1);
|
buildNumber = buildNumber.substring(0, buildNumber.length - 1);
|
||||||
}
|
}
|
||||||
bool isUpdate = Utils.needUpdate("v${currentInfo.version}+$buildNumber", data.tagName!);
|
bool isUpdate =
|
||||||
|
Utils.needUpdate("${currentInfo.version}+$buildNumber", data.tagName!);
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
SmartDialog.show(
|
SmartDialog.show(
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
@@ -336,11 +337,13 @@ class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static String generateRandomString(int minLength, int maxLength) {
|
static String generateRandomString(int minLength, int maxLength) {
|
||||||
const String printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#\$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ ';
|
const String printable =
|
||||||
|
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#\$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ ';
|
||||||
|
|
||||||
var random = Random();
|
var random = Random();
|
||||||
int length = minLength + random.nextInt(maxLength - minLength + 1);
|
int length = minLength + random.nextInt(maxLength - minLength + 1);
|
||||||
return List<String>.generate(length, (index) => printable[random.nextInt(printable.length)]).join();
|
return List<String>.generate(
|
||||||
|
length, (index) => printable[random.nextInt(printable.length)]).join();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String base64EncodeRandomString(int minLength, int maxLength) {
|
static String base64EncodeRandomString(int minLength, int maxLength) {
|
||||||
|
|||||||
Reference in New Issue
Block a user