|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/user_info.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
class PointMallUser extends StatefulWidget {
|
|
|
|
final UserInfo userInfo;
|
|
|
|
|
|
|
|
PointMallUser(this.userInfo);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _PointMallUser();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _PointMallUser extends State<PointMallUser> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (value.getString("token") == null ||
|
|
|
|
value.getString("token") == "") {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/login_page', arguments: {"login": "login"});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.all(16),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
MImage(
|
|
|
|
widget.userInfo != null ? widget.userInfo.headimg : "",
|
|
|
|
width: 50,
|
|
|
|
height: 50,
|
|
|
|
isCircle: true,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
errorSrc: "assets/image/default_user.webp",
|
|
|
|
fadeSrc: "assets/image/default_user.webp",
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(left: 15.w),
|
|
|
|
height: 50.h,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
widget.userInfo == null
|
|
|
|
? Text(
|
|
|
|
S.of(context).denglu,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
widget.userInfo.nickname,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 4.w,
|
|
|
|
),
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/icon_user.webp",
|
|
|
|
width: 18.w,
|
|
|
|
height: 18.h,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 2.h,
|
|
|
|
),
|
|
|
|
widget.userInfo == null
|
|
|
|
? Text(
|
|
|
|
S.of(context).weidengluxinxi,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF2F2F2F),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Text(
|
|
|
|
widget.userInfo == null
|
|
|
|
? ""
|
|
|
|
: "NO.${widget.userInfo.vipNo}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF2F2F2F),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
flex: 1,
|
|
|
|
),
|
|
|
|
widget.userInfo == null
|
|
|
|
? Icon(
|
|
|
|
Icons.keyboard_arrow_right,
|
|
|
|
size: 20,
|
|
|
|
color: Colors.black,
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
margin: EdgeInsets.only(left: 15.w),
|
|
|
|
height: 50.h,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
S.of(context).yiyoujifen,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF4C4C4C),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 4.h,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
(widget.userInfo != null)
|
|
|
|
? "${widget.userInfo.points}"
|
|
|
|
: "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
color: Color(0xFFF8BA61),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|