fix: 用户页异常&头像渲染、搜索建议词
This commit is contained in:
@ -14,7 +14,7 @@ class MemberController extends GetxController {
|
||||
late int mid;
|
||||
Rx<MemberInfoModel> memberInfo = MemberInfoModel().obs;
|
||||
Map? userStat;
|
||||
String? face;
|
||||
RxString face = ''.obs;
|
||||
String? heroTag;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
late int ownerMid;
|
||||
@ -30,7 +30,7 @@ class MemberController extends GetxController {
|
||||
mid = int.parse(Get.parameters['mid']!);
|
||||
userInfo = userInfoCache.get('userInfoCache');
|
||||
ownerMid = userInfo != null ? userInfo.mid : -1;
|
||||
face = Get.arguments['face'] ?? '';
|
||||
face.value = Get.arguments['face'] ?? '';
|
||||
heroTag = Get.arguments['heroTag'] ?? '';
|
||||
relationSearch();
|
||||
}
|
||||
@ -41,6 +41,7 @@ class MemberController extends GetxController {
|
||||
var res = await MemberHttp.memberInfo(mid: mid);
|
||||
if (res['status']) {
|
||||
memberInfo.value = res['data'];
|
||||
face.value = res['data'].face;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -118,7 +119,7 @@ class MemberController extends GetxController {
|
||||
? '关注'
|
||||
: attribute.value == 2
|
||||
? '已关注'
|
||||
: attribute.value == 2
|
||||
: attribute.value == 6
|
||||
? '已互粉'
|
||||
: '已拉黑';
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/pages/member/archive/view.dart';
|
||||
import 'package:pilipala/pages/member/dynamic/index.dart';
|
||||
import 'package:pilipala/pages/member/index.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import 'widgets/profile.dart';
|
||||
|
||||
@ -30,7 +31,8 @@ class _MemberPageState extends State<MemberPage>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
heroTag = Get.arguments['heroTag'];
|
||||
heroTag =
|
||||
Get.arguments['heroTag'] ?? Utils.makeHeroTag(Get.parameters['mid']);
|
||||
_memberController = Get.put(MemberController(), tag: heroTag);
|
||||
_tabController = TabController(length: 3, vsync: this, initialIndex: 2);
|
||||
_futureBuilderFuture = _memberController.getInfo();
|
||||
@ -80,11 +82,13 @@ class _MemberPageState extends State<MemberPage>
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 35,
|
||||
height: 35,
|
||||
type: 'avatar',
|
||||
src: _memberController.face ?? '',
|
||||
Obx(
|
||||
() => NetworkImgLayer(
|
||||
width: 35,
|
||||
height: 35,
|
||||
type: 'avatar',
|
||||
src: _memberController.face.value,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Obx(
|
||||
@ -145,34 +149,38 @@ class _MemberPageState extends State<MemberPage>
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Stack(
|
||||
children: [
|
||||
if (_memberController.face != null)
|
||||
Positioned.fill(
|
||||
bottom: 10,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.fitWidth,
|
||||
image: NetworkImage(_memberController.face!),
|
||||
alignment: Alignment.topCenter,
|
||||
isAntiAlias: true,
|
||||
),
|
||||
),
|
||||
foregroundDecoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context)
|
||||
.colorScheme
|
||||
.background
|
||||
.withOpacity(0.44),
|
||||
Theme.of(context).colorScheme.background,
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
stops: const [0.0, 0.46],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => _memberController.face.value != ''
|
||||
? Positioned.fill(
|
||||
bottom: 10,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.fitWidth,
|
||||
image: NetworkImage(
|
||||
_memberController.face.value),
|
||||
alignment: Alignment.topCenter,
|
||||
isAntiAlias: true,
|
||||
),
|
||||
),
|
||||
foregroundDecoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context)
|
||||
.colorScheme
|
||||
.background
|
||||
.withOpacity(0.44),
|
||||
Theme.of(context).colorScheme.background,
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
stops: const [0.0, 0.46],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
|
@ -22,7 +22,7 @@ Widget profile(ctr, {loadingStatus = false}) {
|
||||
width: 90,
|
||||
height: 90,
|
||||
type: 'avatar',
|
||||
src: !loadingStatus ? memberInfo.face : ctr.face,
|
||||
src: !loadingStatus ? memberInfo.face : ctr.face.value,
|
||||
),
|
||||
if (!loadingStatus &&
|
||||
memberInfo.liveRoom != null &&
|
||||
|
@ -105,7 +105,7 @@ class SSearchController extends GetxController {
|
||||
Future querySearchSuggest(String value) async {
|
||||
var result = await SearchHttp.searchSuggest(term: value);
|
||||
if (result['status']) {
|
||||
if (result['data'].isNotEmpty) {
|
||||
if (result['data'] is SearchSuggestModel) {
|
||||
searchSuggestList.value = result['data'].tag;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user