mod: 用户页面跳转直播
This commit is contained in:
@ -10,6 +10,7 @@ class MemberInfoModel {
|
||||
this.topPhoto,
|
||||
this.official,
|
||||
this.vip,
|
||||
this.liveRoom,
|
||||
});
|
||||
|
||||
int? mid;
|
||||
@ -29,13 +30,14 @@ class MemberInfoModel {
|
||||
name = json['name'];
|
||||
sex = json['sex'];
|
||||
face = json['face'];
|
||||
sign = json['sign'] == '' ? '该用户还没有签名' : json['sign'];
|
||||
sign = json['sign'] == '' ? '该用户还没有签名' : json['sign'].replaceAll('\n', '');
|
||||
level = json['level'];
|
||||
isFollowed = json['is_followed'];
|
||||
topPhoto = json['top_photo'];
|
||||
official = json['official'];
|
||||
vip = Vip.fromJson(json['vip']);
|
||||
liveRoom = LiveRoom.fromJson(json['live_room']);
|
||||
liveRoom =
|
||||
json['live_room'] != null ? LiveRoom.fromJson(json['live_room']) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,12 +82,12 @@ class LiveRoom {
|
||||
int? roundStatus;
|
||||
|
||||
LiveRoom.fromJson(Map<String, dynamic> json) {
|
||||
roomStatus = json['room_status'];
|
||||
liveStatus = json['live_status'];
|
||||
roomStatus = json['roomStatus'];
|
||||
liveStatus = json['liveStatus'];
|
||||
url = json['url'];
|
||||
title = json['title'];
|
||||
cover = json['cover'];
|
||||
roomId = json['room_id'];
|
||||
roundStatus = json['round_status'];
|
||||
roomId = json['roomid'];
|
||||
roundStatus = json['roundStatus'];
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class _UpPanelState extends State<UpPanel> {
|
||||
'roomid': data.roomId,
|
||||
});
|
||||
Get.toNamed(
|
||||
'/liveRoom?rooid=${data.roomId}',
|
||||
'/liveRoom?roomid=${data.roomId}',
|
||||
arguments: {'liveItem': liveItem},
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/member.dart';
|
||||
import 'package:pilipala/models/member/info.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/wbi_sign.dart';
|
||||
|
||||
class MemberController extends GetxController {
|
||||
@ -9,11 +11,14 @@ class MemberController extends GetxController {
|
||||
Map? userStat;
|
||||
String? face;
|
||||
String? heroTag;
|
||||
Box user = GStrorage.user;
|
||||
late int ownerMid;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
mid = int.parse(Get.parameters['mid']!);
|
||||
ownerMid = user.get(UserBoxKey.userMid);
|
||||
face = Get.arguments['face']!;
|
||||
heroTag = Get.arguments['heroTag']!;
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/models/live/item.dart';
|
||||
import 'package:pilipala/models/user/stat.dart';
|
||||
import 'package:pilipala/pages/member/index.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
@ -39,7 +42,7 @@ class _MemberPageState extends State<MemberPage>
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
expandedHeight: 300,
|
||||
expandedHeight: 320,
|
||||
actions: [
|
||||
IconButton(onPressed: () {}, icon: const Icon(Icons.more_vert)),
|
||||
const SizedBox(width: 4),
|
||||
@ -97,8 +100,6 @@ class _MemberPageState extends State<MemberPage>
|
||||
alignment: AlignmentDirectional.center,
|
||||
children: [
|
||||
Column(
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
@ -117,7 +118,24 @@ class _MemberPageState extends State<MemberPage>
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
const SizedBox(width: 2),
|
||||
if (_memberController
|
||||
.memberInfo.value.sex ==
|
||||
'女')
|
||||
const Icon(
|
||||
FontAwesomeIcons.venus,
|
||||
size: 14,
|
||||
color: Colors.pink,
|
||||
),
|
||||
if (_memberController
|
||||
.memberInfo.value.sex ==
|
||||
'男')
|
||||
const Icon(
|
||||
FontAwesomeIcons.mars,
|
||||
size: 14,
|
||||
color: Colors.blue,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Image.asset(
|
||||
'assets/images/lv/lv${_memberController.memberInfo.value.level}.png',
|
||||
height: 11,
|
||||
@ -159,14 +177,13 @@ class _MemberPageState extends State<MemberPage>
|
||||
.official!['title'] !=
|
||||
'') ...[
|
||||
const SizedBox(height: 6),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
_memberController
|
||||
Text.rich(
|
||||
maxLines: 2,
|
||||
TextSpan(
|
||||
text: _memberController
|
||||
.memberInfo
|
||||
.value
|
||||
.official![
|
||||
'role'] ==
|
||||
.official!['role'] ==
|
||||
1
|
||||
? '个人认证:'
|
||||
: '企业认证:',
|
||||
@ -174,25 +191,36 @@ class _MemberPageState extends State<MemberPage>
|
||||
color: Theme.of(context)
|
||||
.primaryColor,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_memberController.memberInfo
|
||||
.value.official!['title']!,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: _memberController
|
||||
.memberInfo
|
||||
.value
|
||||
.official!['title'],
|
||||
),
|
||||
],
|
||||
),
|
||||
softWrap: true,
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
if (_memberController
|
||||
.memberInfo.value.sign !=
|
||||
'')
|
||||
Text(
|
||||
SelectableRegion(
|
||||
magnifierConfiguration:
|
||||
const TextMagnifierConfiguration(),
|
||||
focusNode: FocusNode(),
|
||||
selectionControls:
|
||||
MaterialTextSelectionControls(),
|
||||
child: Text(
|
||||
_memberController
|
||||
.memberInfo.value.sign!,
|
||||
textAlign: TextAlign.left,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@ -261,9 +289,25 @@ class _MemberPageState extends State<MemberPage>
|
||||
? memberInfo.face
|
||||
: _memberController.face,
|
||||
),
|
||||
if (!loadingStatus &&
|
||||
memberInfo.liveRoom != null &&
|
||||
memberInfo.liveRoom.liveStatus == 1)
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 14,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
'title': memberInfo.liveRoom.title,
|
||||
'uname': memberInfo.name,
|
||||
'face': memberInfo.face,
|
||||
'roomid': memberInfo.liveRoom.roomId,
|
||||
});
|
||||
Get.toNamed(
|
||||
'/liveRoom?roomid=${memberInfo.liveRoom.roomId}',
|
||||
arguments: {'liveItem': liveItem},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(6, 2, 6, 2),
|
||||
decoration: BoxDecoration(
|
||||
@ -287,6 +331,7 @@ class _MemberPageState extends State<MemberPage>
|
||||
)
|
||||
]),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
@ -356,18 +401,23 @@ class _MemberPageState extends State<MemberPage>
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (_memberController.ownerMid != _memberController.mid) ...[
|
||||
Row(
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.only(left: 42, right: 42),
|
||||
foregroundColor: !loadingStatus && memberInfo.isFollowed
|
||||
? null
|
||||
foregroundColor:
|
||||
!loadingStatus && memberInfo.isFollowed
|
||||
? Theme.of(context).colorScheme.outline
|
||||
: Theme.of(context).colorScheme.onPrimary,
|
||||
backgroundColor: !loadingStatus && memberInfo.isFollowed
|
||||
backgroundColor: !loadingStatus &&
|
||||
memberInfo.isFollowed
|
||||
? Theme.of(context).colorScheme.onInverseSurface
|
||||
: Theme.of(context).colorScheme.primary, // 设置按钮背景色
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary, // 设置按钮背景色
|
||||
),
|
||||
child: Text(!loadingStatus && memberInfo.isFollowed
|
||||
? '取关'
|
||||
@ -385,6 +435,17 @@ class _MemberPageState extends State<MemberPage>
|
||||
)
|
||||
],
|
||||
)
|
||||
] else ...[
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.only(left: 80, right: 80),
|
||||
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
child: const Text('编辑资料'),
|
||||
)
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user