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等级信息 /// VIP等级信息
MineVipView( MineVipView(
tag: "vip",
ranks: ranks, ranks: ranks,
userInfo: userInfo, userInfo: userInfo,
rank: (userInfo != null) rank: (userInfo != null)

346
lib/view_widget/mine_vip_view.dart

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