fix: 未登录访问up主页异常
This commit is contained in:
@ -290,7 +290,7 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
profile(_memberController),
|
ProfilePanel(ctr: _memberController),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@ -388,7 +388,7 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 骨架屏
|
// 骨架屏
|
||||||
return profile(_memberController, loadingStatus: true);
|
return ProfilePanel(ctr: _memberController, loadingStatus: true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@ -6,12 +6,23 @@ import 'package:pilipala/models/live/item.dart';
|
|||||||
import 'package:pilipala/models/member/info.dart';
|
import 'package:pilipala/models/member/info.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
Widget profile(ctr, {loadingStatus = false}) {
|
class ProfilePanel extends StatelessWidget {
|
||||||
|
final dynamic ctr;
|
||||||
|
final bool loadingStatus;
|
||||||
|
const ProfilePanel({
|
||||||
|
super.key,
|
||||||
|
required this.ctr,
|
||||||
|
this.loadingStatus = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
MemberInfoModel memberInfo = ctr.memberInfo.value;
|
MemberInfoModel memberInfo = ctr.memberInfo.value;
|
||||||
return Builder(
|
return Builder(
|
||||||
builder: ((context) {
|
builder: ((context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top - 20),
|
padding:
|
||||||
|
EdgeInsets.only(top: MediaQuery.of(context).padding.top - 20),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Hero(
|
Hero(
|
||||||
@ -118,9 +129,11 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
!loadingStatus
|
!loadingStatus
|
||||||
|
? ctr.userStat!['follower'] != null
|
||||||
? Utils.numFormat(
|
? Utils.numFormat(
|
||||||
ctr.userStat!['follower'],
|
ctr.userStat!['follower'],
|
||||||
)
|
)
|
||||||
|
: '-'
|
||||||
: '-',
|
: '-',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold)),
|
fontWeight: FontWeight.bold)),
|
||||||
@ -139,9 +152,11 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
!loadingStatus
|
!loadingStatus
|
||||||
|
? ctr.userStat!['likes'] != null
|
||||||
? Utils.numFormat(
|
? Utils.numFormat(
|
||||||
ctr.userStat!['likes'],
|
ctr.userStat!['likes'],
|
||||||
)
|
)
|
||||||
|
: '-'
|
||||||
: '-',
|
: '-',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold)),
|
fontWeight: FontWeight.bold)),
|
||||||
@ -159,7 +174,7 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
if (ctr.ownerMid != ctr.mid) ...[
|
if (ctr.ownerMid != ctr.mid && ctr.ownerMid != -1) ...[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Obx(
|
Obx(
|
||||||
@ -170,7 +185,9 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
foregroundColor: ctr.attribute.value == -1
|
foregroundColor: ctr.attribute.value == -1
|
||||||
? Colors.transparent
|
? Colors.transparent
|
||||||
: ctr.attribute.value != 0
|
: ctr.attribute.value != 0
|
||||||
? Theme.of(context).colorScheme.outline
|
? Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.outline
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.onPrimary,
|
.onPrimary,
|
||||||
@ -200,7 +217,8 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
] else ...[
|
],
|
||||||
|
if (ctr.ownerMid == ctr.mid && ctr.ownerMid != -1) ...[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
SmartDialog.showToast('功能开发中 💪');
|
SmartDialog.showToast('功能开发中 💪');
|
||||||
@ -209,10 +227,24 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
padding: const EdgeInsets.only(left: 80, right: 80),
|
padding: const EdgeInsets.only(left: 80, right: 80),
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
Theme.of(context).colorScheme.onPrimary,
|
Theme.of(context).colorScheme.onPrimary,
|
||||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
child: const Text('编辑资料'),
|
child: const Text('编辑资料'),
|
||||||
)
|
)
|
||||||
|
],
|
||||||
|
if (ctr.ownerMid == -1) ...[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {},
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.only(left: 80, right: 80),
|
||||||
|
foregroundColor:
|
||||||
|
Theme.of(context).colorScheme.outline,
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.onInverseSurface,
|
||||||
|
),
|
||||||
|
child: const Text('未登录'),
|
||||||
|
)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -222,4 +254,5 @@ Widget profile(ctr, {loadingStatus = false}) {
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user