Compare commits

...

9 Commits
fix-pip ... fix

8 changed files with 108 additions and 53 deletions

View File

@ -34,6 +34,7 @@ void main() async {
.then((_) async {
await GStrorage.init();
await setupServiceLocator();
clearLogs();
Request();
await Request.setCookie();
RecommendFilter();

View File

@ -47,18 +47,23 @@ class Vip {
this.status,
this.dueDate,
this.label,
this.nicknameColor,
});
int? type;
int? status;
int? dueDate;
Map? label;
int? nicknameColor;
Vip.fromJson(Map<String, dynamic> json) {
type = json['type'];
status = json['status'];
dueDate = json['due_date'];
label = json['label'];
nicknameColor = json['nickname_color'] == ''
? null
: int.parse("0xFF${json['nickname_color'].replaceAll('#', '')}");
}
}

View File

@ -281,8 +281,8 @@ class _MemberPageState extends State<MemberPage>
future: _futureBuilderFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
Map data = snapshot.data!;
if (data['status']) {
Map? data = snapshot.data;
if (data != null && data['status']) {
return Obx(
() => Stack(
alignment: AlignmentDirectional.center,
@ -302,7 +302,14 @@ class _MemberPageState extends State<MemberPage>
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(fontWeight: FontWeight.bold),
.copyWith(
fontWeight: FontWeight.bold,
color: _memberController.memberInfo.value
.vip!.nicknameColor !=
null
? Color(_memberController.memberInfo
.value.vip!.nicknameColor!)
: null),
)),
const SizedBox(width: 2),
if (_memberController.memberInfo.value.sex == '')

View File

@ -18,45 +18,32 @@ class MemberSeasonsPanel extends StatelessWidget {
itemBuilder: (context, index) {
MemberSeasonsList item = data!.seasonsList![index];
return Padding(
padding: const EdgeInsets.only(bottom: 12, right: 4),
padding: const EdgeInsets.only(bottom: 12),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 12, left: 4),
child: Row(
children: [
Text(
item.meta!.name!,
maxLines: 1,
style: Theme.of(context).textTheme.titleSmall!,
),
const SizedBox(width: 10),
PBadge(
stack: 'relative',
size: 'small',
text: item.meta!.total.toString(),
),
const Spacer(),
SizedBox(
width: 35,
height: 35,
child: IconButton(
onPressed: () => Get.toNamed(
'/memberSeasons?mid=${item.meta!.mid}&seasonId=${item.meta!.seasonId}'),
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
icon: const Icon(
Icons.arrow_forward,
size: 20,
),
),
)
],
ListTile(
onTap: () => Get.toNamed(
'/memberSeasons?mid=${item.meta!.mid}&seasonId=${item.meta!.seasonId}'),
title: Text(
item.meta!.name!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.titleSmall!,
),
dense: true,
leading: PBadge(
stack: 'relative',
size: 'small',
text: item.meta!.total.toString(),
),
trailing: const Icon(
Icons.arrow_forward,
size: 20,
),
),
const SizedBox(height: 10),
LayoutBuilder(
builder: (context, boxConstraints) {
return GridView.builder(

View File

@ -91,7 +91,7 @@ class VideoDetailController extends GetxController
late bool enableCDN;
late int? cacheVideoQa;
late String cacheDecode;
late int cacheAudioQa;
late int defaultAudioQa;
PersistentBottomSheetController? replyReplyBottomSheetCtr;
RxList<SubTitileContentModel> subtitleContents =
@ -146,7 +146,7 @@ class VideoDetailController extends GetxController
// 预设的解码格式
cacheDecode = setting.get(SettingBoxKey.defaultDecode,
defaultValue: VideoDecodeFormats.values.last.code);
cacheAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
defaultAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
defaultValue: AudioQuality.hiRes.code);
oid.value = IdUtils.bv2av(Get.parameters['bvid']!);
getSubtitle();
@ -353,9 +353,9 @@ class VideoDetailController extends GetxController
if (audiosList.isNotEmpty) {
final List<int> numbers = audiosList.map((map) => map.id!).toList();
int closestNumber = Utils.findClosestNumber(cacheAudioQa, numbers);
if (!numbers.contains(cacheAudioQa) &&
numbers.any((e) => e > cacheAudioQa)) {
int closestNumber = Utils.findClosestNumber(defaultAudioQa, numbers);
if (!numbers.contains(defaultAudioQa) &&
numbers.any((e) => e > defaultAudioQa)) {
closestNumber = 30280;
}
firstAudio = audiosList.firstWhere((e) => e.id == closestNumber);

View File

@ -525,14 +525,18 @@ InlineSpan buildContent(
if (jumpUrlKeysList.isNotEmpty) {
patternStr += '|${jumpUrlKeysList.join('|')}';
}
RegExp bv23Regex = RegExp(r'https://b23\.tv/[a-zA-Z0-9]{7}');
final RegExp pattern = RegExp(patternStr);
List<String> matchedStrs = [];
void addPlainTextSpan(str) {
spanChilds.add(TextSpan(
spanChilds.add(
TextSpan(
text: str,
recognizer: TapGestureRecognizer()
..onTap = () =>
replyReply?.call(replyItem.root == 0 ? replyItem : fReplyItem)));
replyReply?.call(replyItem.root == 0 ? replyItem : fReplyItem),
),
);
}
// 分割文本并处理每个部分
@ -734,8 +738,36 @@ InlineSpan buildContent(
return '';
},
onNonMatch: (String nonMatchStr) {
addPlainTextSpan(nonMatchStr);
return nonMatchStr;
return nonMatchStr.splitMapJoin(
bv23Regex,
onMatch: (Match match) {
String matchStr = match[0]!;
spanChilds.add(
TextSpan(
text: ' $matchStr ',
style: isVideoPage
? TextStyle(
color: Theme.of(context).colorScheme.primary,
)
: null,
recognizer: TapGestureRecognizer()
..onTap = () => Get.toNamed(
'/webview',
parameters: {
'url': matchStr,
'type': 'url',
'pageTitle': matchStr
},
),
),
);
return '';
},
onNonMatch: (String nonMatchOtherStr) {
addPlainTextSpan(nonMatchOtherStr);
return nonMatchOtherStr;
},
);
},
);

View File

@ -142,9 +142,10 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
@override
Widget build(BuildContext context) {
double keyboardHeight = EdgeInsets.fromViewPadding(
double _keyboardHeight = EdgeInsets.fromViewPadding(
View.of(context).viewInsets, View.of(context).devicePixelRatio)
.bottom;
print('_keyboardHeight: $_keyboardHeight');
return Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
@ -235,7 +236,11 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
duration: const Duration(milliseconds: 300),
child: SizedBox(
width: double.infinity,
height: toolbarType == 'input' ? keyboardHeight : emoteHeight,
height: toolbarType == 'input'
? (_keyboardHeight > keyboardHeight
? _keyboardHeight
: keyboardHeight)
: emoteHeight,
child: EmotePanel(
onChoose: (package, emote) => onChooseEmote(package, emote),
),

View File

@ -51,7 +51,7 @@ class Utils {
}
if (time < 3600) {
if (time == 0) {
return time;
return '00:00';
}
final int minute = time ~/ 60;
final double res = time / 60;
@ -208,17 +208,35 @@ class Utils {
static int findClosestNumber(int target, List<int> numbers) {
int minDiff = 127;
late int closestNumber;
int closestNumber = 0; // 初始化为0表示没有找到比目标值小的整数
// 向下查找
try {
for (int number in numbers) {
int diff = (number - target).abs();
if (number < target) {
int diff = target - number; // 计算目标值与当前整数的差值
if (diff < minDiff) {
minDiff = diff;
closestNumber = number;
if (diff < minDiff) {
minDiff = diff;
closestNumber = number;
}
}
}
} catch (_) {}
// 向上查找
if (closestNumber == 0) {
try {
for (int number in numbers) {
int diff = (number - target).abs();
if (diff < minDiff) {
minDiff = diff;
closestNumber = number;
}
}
} catch (_) {}
}
return closestNumber;
}