mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: member page: show live status
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -52,6 +52,7 @@ class Data {
|
||||
@JsonKey(name: 'digital_button')
|
||||
dynamic digitalButton;
|
||||
dynamic entry;
|
||||
dynamic live;
|
||||
|
||||
Data({
|
||||
this.relation,
|
||||
@@ -77,6 +78,7 @@ class Data {
|
||||
this.nftFaceButton,
|
||||
this.digitalButton,
|
||||
this.entry,
|
||||
this.live,
|
||||
});
|
||||
|
||||
factory Data.fromJson(Map<String, dynamic> json) => _$DataFromJson(json);
|
||||
|
||||
@@ -61,6 +61,7 @@ Data _$DataFromJson(Map<String, dynamic> json) => Data(
|
||||
nftFaceButton: json['nft_face_button'],
|
||||
digitalButton: json['digital_button'],
|
||||
entry: json['entry'],
|
||||
live: json['live'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
|
||||
|
||||
@@ -38,6 +38,8 @@ class MemberControllerNew extends CommonController
|
||||
queryData();
|
||||
}
|
||||
|
||||
dynamic live;
|
||||
|
||||
@override
|
||||
bool customHandleResponse(Success response) {
|
||||
username = response.response?.card?.name ?? '';
|
||||
@@ -46,6 +48,7 @@ class MemberControllerNew extends CommonController
|
||||
? 2
|
||||
: response.response?.relation ?? 1;
|
||||
tab2 = response.response.tab2;
|
||||
live = response.response?.live;
|
||||
if (tab2 != null && tab2!.isNotEmpty) {
|
||||
if (!response.response.tab.toJson().values.contains(true) &&
|
||||
tab2!.first.param == 'home') {
|
||||
|
||||
@@ -317,6 +317,7 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
card: userState.response.card,
|
||||
images: userState.response.images,
|
||||
onFollow: () => _userController.onFollow(context),
|
||||
live: _userController.live,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -18,6 +18,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
required this.relation,
|
||||
required this.isFollow,
|
||||
required this.onFollow,
|
||||
this.live,
|
||||
});
|
||||
|
||||
final bool isV;
|
||||
@@ -27,6 +28,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
final space.Card card;
|
||||
final space.Images images;
|
||||
final VoidCallback onFollow;
|
||||
final dynamic live;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -464,6 +466,47 @@ class UserInfoCard extends StatelessWidget {
|
||||
left: 80,
|
||||
child: _buildBadge(context),
|
||||
),
|
||||
if (live is Map && ((live['liveStatus'] as int?) ?? 0) == 1)
|
||||
Positioned(
|
||||
top: 180,
|
||||
left: 20,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
'/liveRoom?roomid=${live['roomid']}',
|
||||
arguments: {'heroTag': '${live['roomid']}'},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
width: 85,
|
||||
alignment: Alignment.center,
|
||||
child: Badge(
|
||||
label: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.equalizer_rounded,
|
||||
size: MediaQuery.textScalerOf(context).scale(16),
|
||||
),
|
||||
Text(
|
||||
'直播中',
|
||||
style: TextStyle(height: 1),
|
||||
)
|
||||
],
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 5,
|
||||
vertical: 1,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
textColor:
|
||||
Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.secondaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 120,
|
||||
top: 140,
|
||||
|
||||
Reference in New Issue
Block a user