mod: 动态页面upPanel
This commit is contained in:
@ -2,15 +2,22 @@ class FollowUpModel {
|
|||||||
FollowUpModel({
|
FollowUpModel({
|
||||||
this.liveUsers,
|
this.liveUsers,
|
||||||
this.upList,
|
this.upList,
|
||||||
|
this.liveList,
|
||||||
});
|
});
|
||||||
|
|
||||||
LiveUsers? liveUsers;
|
LiveUsers? liveUsers;
|
||||||
List<UpItem>? upList;
|
List<UpItem>? upList;
|
||||||
|
List<LiveUserItem>? liveList;
|
||||||
|
|
||||||
FollowUpModel.fromJson(Map<String, dynamic> json) {
|
FollowUpModel.fromJson(Map<String, dynamic> json) {
|
||||||
liveUsers = json['live_users'] != null
|
liveUsers = json['live_users'] != null
|
||||||
? LiveUsers.fromJson(json['live_users'])
|
? LiveUsers.fromJson(json['live_users'])
|
||||||
: null;
|
: null;
|
||||||
|
liveList = json['live_users'] != null
|
||||||
|
? json['live_users']['items']
|
||||||
|
.map<LiveUserItem>((e) => LiveUserItem.fromJson(e))
|
||||||
|
.toList()
|
||||||
|
: [];
|
||||||
upList = json['up_list'] != null
|
upList = json['up_list'] != null
|
||||||
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
|
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
|
||||||
: [];
|
: [];
|
||||||
|
|||||||
@ -249,8 +249,8 @@ class DynamicsController extends GetxController {
|
|||||||
return {'status': false, 'msg': '账号未登录'};
|
return {'status': false, 'msg': '账号未登录'};
|
||||||
}
|
}
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
upData.value.upList = [];
|
upData.value.upList = <UpItem>[];
|
||||||
upData.value.liveUsers = LiveUsers();
|
upData.value.liveList = <LiveUserItem>[];
|
||||||
}
|
}
|
||||||
var res = await DynamicsHttp.followUp();
|
var res = await DynamicsHttp.followUp();
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
@ -271,7 +271,6 @@ class DynamicsController extends GetxController {
|
|||||||
|
|
||||||
onRefresh() async {
|
onRefresh() async {
|
||||||
page = 1;
|
page = 1;
|
||||||
print('onRefresh');
|
|
||||||
await queryFollowUp();
|
await queryFollowUp();
|
||||||
await queryFollowDynamic();
|
await queryFollowDynamic();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,8 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
upList = widget.upData!.upList!;
|
upList = widget.upData!.upList!;
|
||||||
if (widget.upData!.liveUsers != null) {
|
if (widget.upData!.liveList!.isNotEmpty) {
|
||||||
liveList = widget.upData!.liveUsers!.items!;
|
liveList = widget.upData!.liveList!;
|
||||||
}
|
}
|
||||||
upList.insert(
|
upList.insert(
|
||||||
0,
|
0,
|
||||||
@ -55,7 +55,7 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
floating: true,
|
floating: true,
|
||||||
pinned: false,
|
pinned: false,
|
||||||
delegate: _SliverHeaderDelegate(
|
delegate: _SliverHeaderDelegate(
|
||||||
height: 126,
|
height: liveList.isNotEmpty || upList.isNotEmpty ? 126 : 0,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -88,7 +88,9 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
Container(
|
Container(
|
||||||
height: 90,
|
height: 90,
|
||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.background,
|
||||||
child: Expanded(
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
@ -115,6 +117,8 @@ class _UpPanelState extends State<UpPanel> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 6,
|
height: 6,
|
||||||
|
|||||||
Reference in New Issue
Block a user