After Width: | Height: | Size: 196 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 853 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 6.4 KiB |
@ -0,0 +1,438 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/foundation.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/user_info.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/border_text.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class MineAttainmentPage extends StatefulWidget { |
||||
final Map<String, dynamic> arguments; |
||||
|
||||
MineAttainmentPage({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _MineAttainmentPage(); |
||||
} |
||||
} |
||||
|
||||
class _MineAttainmentPage extends State<MineAttainmentPage> { |
||||
ApiService apiService; |
||||
final RefreshController _refreshController = RefreshController(); |
||||
UserInfo userInfo; |
||||
var checkIndex = 1; |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
if (_refreshController != null) _refreshController.dispose(); |
||||
} |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
userInfo = widget.arguments["userInfo"]; |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container(decoration: BoxDecoration( |
||||
image: DecorationImage( |
||||
fit: BoxFit.fill, |
||||
image: AssetImage("assets/image/attainment_bj.png"), |
||||
), |
||||
),child:Scaffold( |
||||
backgroundColor: Colors.transparent, |
||||
appBar: MyAppBar( |
||||
title: "我的成就", |
||||
titleColor: Colors.black, |
||||
titleSize: 18.sp, |
||||
background: Colors.transparent, |
||||
leadingColor: Colors.black, |
||||
), |
||||
body: SingleChildScrollView( |
||||
physics: BouncingScrollPhysics(), |
||||
child: Column( |
||||
children: [ |
||||
SizedBox(height: 24), |
||||
MImage( |
||||
userInfo?.headimg ?? "", |
||||
isCircle: true, |
||||
width: 58, |
||||
height: 58, |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_user.png", |
||||
fadeSrc: "assets/image/default_user.png", |
||||
), |
||||
SizedBox(height: 8), |
||||
Text( |
||||
userInfo?.nickname ?? S.of(context).denglu, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
SizedBox(height: 28), |
||||
Container( |
||||
margin: EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), |
||||
padding: EdgeInsets.all(20), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
borderRadius: BorderRadius.all(Radius.circular(8)), |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
children: [ |
||||
Text( |
||||
"成就徽章", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF353535)), |
||||
), |
||||
SizedBox(width: 4), |
||||
Text( |
||||
"(", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 14, |
||||
color: Color(0xFF353535)), |
||||
), |
||||
Text( |
||||
"0", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 14, |
||||
color: Color(0xFF32A060)), |
||||
), |
||||
Text( |
||||
"/8)", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 14, |
||||
color: Color(0xFF353535)), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(height: 12), |
||||
attainmentBadge(), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
)), |
||||
); |
||||
} |
||||
|
||||
///成就徽章列表 |
||||
Widget attainmentBadge() { |
||||
return GridView.builder( |
||||
itemCount: 8, |
||||
shrinkWrap: true, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
//一行的Widget数量 |
||||
crossAxisCount: 3, |
||||
//水平子Widget之间间距 |
||||
crossAxisSpacing: 13, |
||||
//垂直子Widget之间间距 |
||||
mainAxisSpacing: 12, |
||||
//子Widget宽高比例 |
||||
childAspectRatio: AppUtils.textScale(context) > 1 |
||||
? (1 - ((AppUtils.textScale(context) - 1))) |
||||
: 0.85, |
||||
), |
||||
itemBuilder: (context, index) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
showDeleteDialog(); |
||||
}, |
||||
child: badgeItem(), |
||||
); |
||||
}, |
||||
); |
||||
} |
||||
|
||||
Widget badgeItem() { |
||||
return Container( |
||||
alignment: Alignment.center, |
||||
child: Column( |
||||
children: [ |
||||
// MImage( |
||||
// "assets/image/badge_img.png", |
||||
// width: 80, |
||||
// height: 80, |
||||
// fit: BoxFit.cover, |
||||
// errorSrc: "assets/image/default_1.png", |
||||
// fadeSrc: "assets/image/default_1.png", |
||||
// ), |
||||
Image.asset( |
||||
"assets/image/badge_img.png", |
||||
width: 80, |
||||
height: 80, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox( |
||||
height: 4.h, |
||||
), |
||||
Text( |
||||
"签到", |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
color: Color(0xFF181818), |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 12.sp, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///徽章成就弹窗 |
||||
showDeleteDialog() { |
||||
showDialog( |
||||
context: context, |
||||
builder: (context) { |
||||
return StatefulBuilder(builder: (context, state) { |
||||
return AlertDialog( |
||||
content: Container( |
||||
width: MediaQuery.of(context).size.width - 84, |
||||
height: 385.h, |
||||
child: Column( |
||||
// mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
// crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Row( |
||||
children: [ |
||||
Spacer(), |
||||
Image.asset( |
||||
"assets/image/icon_order_cancel.png", |
||||
width: 24, |
||||
height: 24, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Image.asset( |
||||
"assets/image/badge_img.png", |
||||
width: 150, |
||||
height: 150, |
||||
fit: BoxFit.cover, |
||||
), |
||||
Text( |
||||
"消费白银徽章", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF181818), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 6.h, |
||||
), |
||||
Text( |
||||
"再消费268.4元即可升级", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFFA3A3A3), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 4.h, |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"奖励:", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF515151)), |
||||
), |
||||
SizedBox(width: 8), |
||||
Image.asset( |
||||
"assets/image/icon_gold_coin.png", |
||||
width: 14, |
||||
height: 14, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(width: 4), |
||||
Text( |
||||
"+ 10", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF515151)), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(height: 5), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: () { |
||||
state(() { |
||||
checkIndex = 1; |
||||
}); |
||||
}, |
||||
child: Column( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/qt_badge.png", |
||||
width: checkIndex != 1 ? 30 : 55, |
||||
height: checkIndex != 1 ? 30 : 55, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(height: 10), |
||||
Text( |
||||
"青铜", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFFA3A3A3), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: 35.w, |
||||
height: 2.h, |
||||
decoration: new BoxDecoration( |
||||
color: Color(0xFFE1F2F7), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: () { |
||||
state(() { |
||||
checkIndex = 2; |
||||
}); |
||||
}, |
||||
child: Column( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/by_badge.png", |
||||
width: checkIndex != 2 ? 35 : 65, |
||||
height: checkIndex != 2 ? 35 : 65, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(height: 10), |
||||
Text( |
||||
"白银", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFFA3A3A3), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: 35.w, |
||||
height: 2.h, |
||||
decoration: new BoxDecoration( |
||||
color: Color(0xFFE1F2F7), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: () { |
||||
state(() { |
||||
checkIndex = 3; |
||||
}); |
||||
}, |
||||
child: Column( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/hj_badge.png", |
||||
width: checkIndex != 3 ? 35 : 65, |
||||
height: checkIndex != 3 ? 35 : 65, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(height: 10), |
||||
Text( |
||||
"黄金", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFFA3A3A3), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: 35.w, |
||||
height: 2.h, |
||||
decoration: new BoxDecoration( |
||||
color: Color(0xFFE1F2F7), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: () { |
||||
state(() { |
||||
checkIndex = 4; |
||||
}); |
||||
}, |
||||
child: Column( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/qt_badge.png", |
||||
width: checkIndex != 4 ? 35 : 65, |
||||
height: checkIndex != 4 ? 35 : 65, |
||||
fit: BoxFit.cover, |
||||
), |
||||
SizedBox(height: 10), |
||||
Text( |
||||
"铂金", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFFA3A3A3), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
}); |
||||
}, |
||||
); |
||||
} |
||||
} |