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