Browse Source

safety

master
fmk 3 years ago
parent
commit
110892e82e
  1. 1
      lib/mine/mine_page.dart
  2. 346
      lib/view_widget/mine_vip_view.dart

1
lib/mine/mine_page.dart

@ -154,6 +154,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
/// VIP等级信息
MineVipView(
tag: "vip",
ranks: ranks,
userInfo: userInfo,
rank: (userInfo != null)

346
lib/view_widget/mine_vip_view.dart

@ -21,7 +21,7 @@ class MineVipView extends StatelessWidget {
MineVipView({
this.vipLevel = 1,
this.ranks,
this.tag = "",
this.tag,
this.userInfo,
this.padding = 16,
this.curLevel = 1,
@ -113,200 +113,202 @@ class MineVipView extends StatelessWidget {
break;
}
}
return GestureDetector(
onTap: () {
if (userInfo != null) {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context)
.pushNamed('/router/mine_vip_level_page', arguments: {
"rankLevel": curLevel,
"createTime": (userInfo != null) ? "${userInfo.createTime}" : "",
"points": (userInfo != null) ? int.tryParse(userInfo.points) : 0,
});
});
}
},
child: Hero(
tag: tag,
child: Container(
margin: EdgeInsets.fromLTRB(padding.w, 16.h, padding.w, 8.h),
width: MediaQuery.of(context).size.width - 32.w,
height: (MediaQuery.of(context).size.width - 32.w) /
1.78 *
AppUtils.textScale(context),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: linearColor,
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
Widget widget = Container(
margin: EdgeInsets.fromLTRB(padding.w, 16.h, padding.w, 8.h),
width: MediaQuery.of(context).size.width - 32.w,
height: (MediaQuery.of(context).size.width - 32.w) /
1.78 *
AppUtils.textScale(context),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: linearColor,
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
child: Column(
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 86.w,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h),
decoration: BoxDecoration(
color: levelColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
),
),
child: Text(
topLeft,
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
Container(
height: 86.w,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h),
decoration: BoxDecoration(
color: levelColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
),
Container(
margin: EdgeInsets.only(left: 13.w),
child: Text(
levelText,
style: TextStyle(
color: textColor,
fontWeight: FontWeight.bold,
fontSize: 23.sp,
),
),
),
child: Text(
topLeft,
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.bold,
color: Colors.white,
),
],
),
),
),
Container(
margin: EdgeInsets.only(right: 11.w, bottom: 9.h),
child: Image.asset(
"assets/image/icon_mine_huixiang_logo.png",
width: 86.w,
height: 86.w,
fit: BoxFit.contain,
Container(
margin: EdgeInsets.only(left: 13.w),
child: Text(
levelText,
style: TextStyle(
color: textColor,
fontWeight: FontWeight.bold,
fontSize: 23.sp,
),
),
),
),
],
],
),
),
Expanded(
child: Container(
margin: EdgeInsets.only(
left: 13.w,
right: 12.w,
bottom: 12.h,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
Container(
margin: EdgeInsets.only(right: 11.w, bottom: 9.h),
child: Image.asset(
"assets/image/icon_mine_huixiang_logo.png",
width: 86.w,
height: 86.w,
fit: BoxFit.contain,
),
),
],
),
Expanded(
child: Container(
margin: EdgeInsets.only(
left: 13.w,
right: 12.w,
bottom: 12.h,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Expanded(
child: Text(
rank > rankMax
? S.of(context).dangqiandengji
: "${S.of(context).jifen_(rankMax - rank)} ${S.of(context).daoxiayidengji}",
overflow: TextOverflow.ellipsis,
Expanded(
child: Text(
rank > rankMax
? S.of(context).dangqiandengji
: "${S.of(context).jifen_(rankMax - rank)} ${S.of(context).daoxiayidengji}",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
fontWeight: FontWeight.w400,
fontSize: 14.sp,
),
),
flex: 1,
),
Text.rich(
TextSpan(
children: [
TextSpan(
text: "$rank",
style: TextStyle(
fontSize: 26.sp,
fontWeight: FontWeight.bold,
color: textColor,
fontWeight: FontWeight.w400,
fontSize: 14.sp,
),
),
flex: 1,
),
Text.rich(
TextSpan(
children: [
TextSpan(
text: "$rank",
style: TextStyle(
fontSize: 26.sp,
fontWeight: FontWeight.bold,
color: textColor,
),
if (rank <= rankMax)
TextSpan(
text: rankMax > 0 ? "/$rankMax" : "/0",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w400,
color: textColor,
),
if (rank <= rankMax)
TextSpan(
text: rankMax > 0 ? "/$rankMax" : "/0",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w400,
color: textColor,
),
),
],
),
),
],
),
],
),
),
Container(
height: 8.h,
child: ClipRRect(
borderRadius: BorderRadius.circular(6.5),
child: LinearProgressIndicator(
value: rankMax > 0 ? rank / rankMax : 0,
backgroundColor: Colors.white,
color: levelColor,
),
],
),
Container(
height: 8.h,
child: ClipRRect(
borderRadius: BorderRadius.circular(6.5),
child: LinearProgressIndicator(
value: rankMax > 0 ? rank / rankMax : 0,
backgroundColor: Colors.white,
color: levelColor,
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
S.of(context).kaitongriqi(
(createTime != null && createTime != "")
? createTime.split(" ")[0]
: "$createTime"),
style: TextStyle(
color: textColor,
fontWeight: FontWeight.w400,
fontSize: 12.sp,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
S.of(context).kaitongriqi(
(createTime != null && createTime != "")
? createTime.split(" ")[0]
: "$createTime"),
style: TextStyle(
color: textColor,
fontWeight: FontWeight.w400,
fontSize: 12.sp,
),
),
Icon(
Icons.qr_code,
size: 24,
color: Colors.white,
),
],
Icon(
Icons.qr_code,
size: 24,
color: Colors.white,
),
],
),
),
flex: 1,
],
),
],
),
flex: 1,
),
),
],
),
);
return GestureDetector(
onTap: () {
if (userInfo != null) {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context)
.pushNamed('/router/mine_vip_level_page', arguments: {
"rankLevel": curLevel,
"createTime": (userInfo != null) ? "${userInfo.createTime}" : "",
"points": (userInfo != null) ? int.tryParse(userInfo.points) : 0,
});
});
}
},
child: (tag == null || tag == "")
? widget
: Hero(tag: tag, child: widget),
);
}
}

Loading…
Cancel
Save