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