Compare commits

..

1 Commits

Author SHA1 Message Date
af1163f6e0 fix: 历史记录进度条 2024-03-30 22:17:37 +08:00
7 changed files with 75 additions and 62 deletions

View File

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

View File

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

View File

@ -258,24 +258,27 @@ class HistoryItem extends StatelessWidget {
), ),
), ),
), ),
Positioned( videoItem.progress != 0
left: 3, ? Positioned(
right: 3, left: 3,
bottom: 0, right: 3,
child: ClipRRect( bottom: 0,
borderRadius: BorderRadius.only( child: ClipRRect(
bottomLeft: borderRadius: BorderRadius.only(
Radius.circular(StyleString.imgRadius.x), bottomLeft: Radius.circular(
bottomRight: StyleString.imgRadius.x),
Radius.circular(StyleString.imgRadius.x), bottomRight: Radius.circular(
), StyleString.imgRadius.x),
child: LinearProgressIndicator( ),
value: videoItem.progress == -1 child: LinearProgressIndicator(
? 100 value: videoItem.progress == -1
: videoItem.progress / videoItem.duration, ? 100
), : videoItem.progress /
), videoItem.duration,
) ),
),
)
: const SizedBox()
], ],
), ),
VideoContent(videoItem: videoItem, ctr: ctr) VideoContent(videoItem: videoItem, ctr: ctr)

View File

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

View File

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

View File

@ -44,7 +44,6 @@ class _SelectDialogState<T> extends State<SelectDialog<T>> {
setState(() { setState(() {
_tempValue = value as T; _tempValue = value as T;
}); });
Navigator.pop(context, _tempValue);
}, },
), ),
] ]
@ -52,6 +51,19 @@ class _SelectDialogState<T> extends State<SelectDialog<T>> {
), ),
); );
}), }),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
TextButton(
onPressed: () => Navigator.pop(context, _tempValue),
child: const Text('确定'),
)
],
); );
} }
} }

View File

@ -208,16 +208,14 @@ class Utils {
static int findClosestNumber(int target, List<int> numbers) { static int findClosestNumber(int target, List<int> numbers) {
int minDiff = 127; int minDiff = 127;
int closestNumber = 0; // 初始化为0表示没有找到比目标值小的整数 late int closestNumber;
try { try {
for (int number in numbers) { for (int number in numbers) {
if (number < target) { int diff = (number - target).abs();
int diff = target - number; // 计算目标值与当前整数的差值
if (diff < minDiff) { if (diff < minDiff) {
minDiff = diff; minDiff = diff;
closestNumber = number; closestNumber = number;
}
} }
} }
} catch (_) {} } catch (_) {}