feat: 推荐列表显示「已关注」标识
This commit is contained in:
@ -133,6 +133,25 @@ class VideoContent extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4)
|
||||
] else if (videoItem.isFollowed == 1) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(3, 1, 3, 1),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primaryContainer
|
||||
.withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(3)),
|
||||
child: Text(
|
||||
'已关注',
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4)
|
||||
],
|
||||
Expanded(
|
||||
child: LayoutBuilder(builder:
|
||||
|
@ -1,7 +1,3 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:pilipala/http/api.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/model_hot_video_item.dart';
|
||||
@ -19,7 +15,7 @@ class VideoHttp {
|
||||
var res = await Request().get(
|
||||
Api.recommendList,
|
||||
data: {
|
||||
'feed_version': 'V3',
|
||||
'feed_version': 'V4',
|
||||
'ps': ps,
|
||||
'fresh_idx': freshIdx,
|
||||
},
|
||||
@ -31,10 +27,10 @@ class VideoHttp {
|
||||
}
|
||||
return {'status': true, 'data': list};
|
||||
} else {
|
||||
return {'status': false, 'data': []};
|
||||
return {'status': false, 'data': [], 'msg': ''};
|
||||
}
|
||||
} catch (err) {
|
||||
return {'status': false, 'data': [], 'msg': err};
|
||||
return {'status': false, 'data': [], 'msg': err.toString()};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ class RecVideoItemModel {
|
||||
this.pubdate,
|
||||
this.owner,
|
||||
this.stat,
|
||||
this.isFollowed,
|
||||
this.rcmdReason,
|
||||
});
|
||||
|
||||
@ -27,6 +28,7 @@ class RecVideoItemModel {
|
||||
int? pubdate = -1;
|
||||
Owner? owner;
|
||||
Stat? stat;
|
||||
int? isFollowed;
|
||||
RcmdReason? rcmdReason;
|
||||
|
||||
RecVideoItemModel.fromJson(Map<String, dynamic> json) {
|
||||
@ -41,6 +43,7 @@ class RecVideoItemModel {
|
||||
pubdate = json["pubdate"];
|
||||
owner = Owner.fromJson(json["owner"]);
|
||||
stat = Stat.fromJson(json["stat"]);
|
||||
isFollowed = json["is_followed"] ?? 0;
|
||||
rcmdReason = json["rcmd_reason"] != null
|
||||
? RcmdReason.fromJson(json["rcmd_reason"])
|
||||
: RcmdReason(content: '');
|
||||
|
@ -25,6 +25,7 @@ class HomeController extends GetxController {
|
||||
freshIdx: _currentPage,
|
||||
);
|
||||
if (res['status']) {
|
||||
print('type: $type');
|
||||
if (type == 'init') {
|
||||
videoList.value = res['data'];
|
||||
} else if (type == 'onRefresh') {
|
||||
|
Reference in New Issue
Block a user