Browse Source

safety

master
fmk 3 years ago
parent
commit
044677b931
  1. 2
      lib/home/points_mall_page.dart
  2. 72
      lib/integral/integral_page.dart
  3. 170
      lib/mine/vip_card_page.dart
  4. 27
      lib/mine/vip_detail_page.dart
  5. 3
      lib/utils/location.dart
  6. 2
      lib/utils/painter_bg.dart
  7. 2
      lib/view_widget/custom_image.dart

2
lib/home/points_mall_page.dart

@ -245,7 +245,7 @@ class _PointsMallPage extends State<PointsMallPage>
onTap: (index) {
categoryId = gooodsCategorys[index].id;
pageNum = 1;
creditGoods();
setState(() {});;
},
),
),

72
lib/integral/integral_page.dart

@ -132,12 +132,13 @@ class _IntegralPage extends State<IntegralPage> {
Widget integralTask() {
return Container(
width: double.infinity,
width: MediaQuery.of(context).size.width - 32,
height: 300.h,
margin: EdgeInsets.all(16),
padding: EdgeInsets.fromLTRB(10.w, 20.h, 10.w, 20.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
@ -162,9 +163,8 @@ class _IntegralPage extends State<IntegralPage> {
),
),
),
Container(
child: AspectRatio(
aspectRatio: 1.5,
Expanded(
child: Container(
child: Swiper(
loop: false,
physics: BouncingScrollPhysics(),
@ -190,7 +190,8 @@ class _IntegralPage extends State<IntegralPage> {
(signInfo.taskList.length % 3 > 0 ? 1 : 0)))
: 1),
),
),
flex: 1,
)
],
),
);
@ -293,10 +294,10 @@ class _IntegralPage extends State<IntegralPage> {
backgroup: task.limitDay == (task.complateNum ?? task.conplateNum)
? Color(0xFFA0A0A0)
: Color(0xFF32A060),
radius: 12,
radius: 12.w,
fontSize: 14.sp,
fontWeight: FontWeight.bold,
padding: EdgeInsets.fromLTRB(12.w, 4.h, 12.w, 4.h),
padding: EdgeInsets.symmetric(vertical: 4.h, horizontal: 12.w),
),
],
),
@ -306,7 +307,7 @@ class _IntegralPage extends State<IntegralPage> {
Widget signInItem(position) {
if (position == 6) {
return Container(
padding: EdgeInsets.all(6),
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xFFF0F0F2),
borderRadius: BorderRadius.circular(4),
@ -317,7 +318,7 @@ class _IntegralPage extends State<IntegralPage> {
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
@ -328,11 +329,9 @@ class _IntegralPage extends State<IntegralPage> {
fontWeight: MyFontWeight.medium,
),
),
SizedBox(
height: 10.h,
),
Container(
alignment: Alignment.center,
height: 30.h,
child: Text(
S.of(context).shenmijifendali,
style: TextStyle(
@ -342,6 +341,14 @@ class _IntegralPage extends State<IntegralPage> {
),
),
),
Text(
"",
style: TextStyle(
color: Color(0xFF353535),
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
],
),
flex: 1,
@ -350,8 +357,8 @@ class _IntegralPage extends State<IntegralPage> {
alignment: Alignment.center,
child: Image.asset(
"assets/image/icon_gold_blessing.png",
width: 59,
height: 59,
width: 59.w,
height: 59.h,
),
),
],
@ -388,8 +395,8 @@ class _IntegralPage extends State<IntegralPage> {
alignment: Alignment.center,
child: Image.asset(
"assets/image/icon_gold_coin.png",
width: 30,
height: 30,
width: 30.w,
height: 30.h,
),
),
Container(
@ -404,13 +411,14 @@ class _IntegralPage extends State<IntegralPage> {
? "+${signInfo.rewardList[position]}"
: "+10",
style: TextStyle(
color: (signInfo != null &&
signInfo.signInList != null &&
signInfo.signInList.length > position)
? Colors.white
: Color(0xFF727272),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular),
color: (signInfo != null &&
signInfo.signInList != null &&
signInfo.signInList.length > position)
? Colors.white
: Color(0xFF727272),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
),
],
@ -424,7 +432,7 @@ class _IntegralPage extends State<IntegralPage> {
return Container(
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h),
padding: EdgeInsets.fromLTRB(20.w, 20.h, 20.w, 20.h),
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
@ -467,9 +475,9 @@ class _IntegralPage extends State<IntegralPage> {
crossAxisCount: 4,
shrinkWrap: true,
itemCount: 7,
mainAxisSpacing: 8.h,
crossAxisSpacing: 18.w,
padding: EdgeInsets.only(bottom: 32.h),
mainAxisSpacing: 8,
crossAxisSpacing: 18,
padding: EdgeInsets.only(bottom: 32),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return signInItem(position);
@ -483,8 +491,8 @@ class _IntegralPage extends State<IntegralPage> {
child: Container(
alignment: Alignment.center,
child: RoundButton(
width: 106,
height: 34,
width: 106.w,
height: 34.h,
text: (signInfo != null && signInfo.todayHasSignin)
? S.of(context).yiqiandao
: S.of(context).lijiqiandao,
@ -494,8 +502,8 @@ class _IntegralPage extends State<IntegralPage> {
: Color(0xFF32A060),
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
padding: EdgeInsets.fromLTRB(16.w, 6.h, 16.w, 6.h),
radius: 4,
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h),
radius: 4.w,
),
),
),

170
lib/mine/vip_card_page.dart

@ -32,7 +32,8 @@ class _VipCardPage extends State<VipCardPage> {
_refreshController = RefreshController();
SharedPreferences.getInstance().then((value) {
apiService = ApiService(Dio(), context: context, token: value.getString("token"));
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
queryVipCard();
});
}
@ -40,7 +41,8 @@ class _VipCardPage extends State<VipCardPage> {
List<VipCard> coupons = [];
queryVipCard() async {
BaseData<List<VipCard>> baseData = await apiService.vipList({}).catchError((error) {
BaseData<List<VipCard>> baseData =
await apiService.vipList({}).catchError((error) {
_refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
@ -70,24 +72,27 @@ class _VipCardPage extends State<VipCardPage> {
controller: _refreshController,
onRefresh: queryVipCard,
physics: BouncingScrollPhysics(),
child: (coupons != null && coupons.length > 0) ? ListView.builder(
padding: EdgeInsets.symmetric(vertical: 8.h),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/vip_details_page',
arguments: {"id": coupons[position].id});
},
child: vipCardItem(coupons[position]),
);
},
itemCount: coupons != null ? coupons.length : 0,
) : NoDataView(
isShowBtn: false,
text: "还没有会员卡~",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h),
),
child: (coupons != null && coupons.length > 0)
? ListView.builder(
padding: EdgeInsets.symmetric(vertical: 8.h),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
Navigator.of(context).pushNamed(
'/router/vip_details_page',
arguments: {"id": coupons[position].id});
},
child: vipCardItem(coupons[position]),
);
},
itemCount: coupons != null ? coupons.length : 0,
)
: NoDataView(
isShowBtn: false,
text: "还没有会员卡~",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h),
),
),
),
);
@ -107,18 +112,19 @@ class _VipCardPage extends State<VipCardPage> {
Widget vipCardItem(VipCard vipCard) {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h),
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],),
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child: Stack(
children: [
Positioned(
@ -144,7 +150,9 @@ class _VipCardPage extends State<VipCardPage> {
Row(
children: [
MImage(
(vipCard?.storeList?.length ?? 0) > 0 ? vipCard.storeList[0].logo : "",
(vipCard?.storeList?.length ?? 0) > 0
? vipCard.storeList[0].logo
: "",
width: 54,
height: 54,
fit: BoxFit.cover,
@ -185,16 +193,18 @@ class _VipCardPage extends State<VipCardPage> {
],
),
Text.rich(
TextSpan(children: [
TextSpan(
text:S.of(context).huiyuanka,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.black,
TextSpan(
children: [
TextSpan(
text: S.of(context).huiyuanka,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.black,
),
),
),
],),
],
),
textDirection: TextDirection.ltr,
),
],
@ -214,16 +224,18 @@ class _VipCardPage extends State<VipCardPage> {
size: 24,
),
Text.rich(
TextSpan(children: [
TextSpan(
text:S.of(context).chakanxiangqing,
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.bold,
color: Colors.black,
TextSpan(
children: [
TextSpan(
text: S.of(context).chakanxiangqing,
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
],),
],
),
),
],
),
@ -237,41 +249,47 @@ class _VipCardPage extends State<VipCardPage> {
Expanded(
flex: 1,
child: Text.rich(
TextSpan(children: [
TextSpan(
children: [
TextSpan(
text: "No.${vipCard.id}",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
],
),
),
),
Text.rich(
TextSpan(
children: [
TextSpan(
text: "No.${vipCard.id}",
text: S.of(context).youxiaoqixian,
style: TextStyle(
fontSize: 14.sp,
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
color: Color(0Xff353535),
),
),
],),
],
),
),
Text.rich(
TextSpan(children: [
TextSpan(
text: S.of(context).youxiaoqixian,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0Xff353535),
),
),
],),
),
Text.rich(
TextSpan(children: [
TextSpan(
text: S.of(context).changqiyouxiao,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0Xff353535),
TextSpan(
children: [
TextSpan(
text: S.of(context).changqiyouxiao,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0Xff353535),
),
),
),
],),
],
),
),
],
),

27
lib/mine/vip_detail_page.dart

@ -1,6 +1,7 @@
import 'package:barcode_widget/barcode_widget.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/order_info.dart';
@ -43,6 +44,11 @@ class _VipDetailPage extends State<VipDetailPage> {
vipDetail("", "");
startLocation();
}
startLocation() async {
EasyLoading.show(status: S.current.zhengzaijiazai);
Location.getInstance()
.aMapFlutterLocation
.onResultCallback()
@ -50,15 +56,18 @@ class _VipDetailPage extends State<VipDetailPage> {
if (event != null &&
event["latitude"] != null &&
event["longitude"] != null) {
SharedPreferences.getInstance().then((value) {
apiService = ApiService(Dio(),
context: context, token: value.getString("token"));
vipDetail(event["latitude"], event["longitude"]);
});
vipDetail(event["latitude"], event["longitude"]);
} else {
EasyLoading.dismiss();
}
});
Location.getInstance().prepareLoc();
Location.getInstance().startLocation(context);
Location.getInstance().startLocation(context).then((value) {
if (!value) {
EasyLoading.dismiss();
refreshController.refreshFailed();
}
});
}
VipCard vipCard;
@ -66,6 +75,9 @@ class _VipDetailPage extends State<VipDetailPage> {
int current = 1;
vipDetail(latitude, longitude) async {
final SharedPreferences value = await SharedPreferences.getInstance();
if(apiService == null)
apiService = ApiService(Dio(), context: context, token: value.getString("token"));
BaseData<VipCard> baseData = await apiService.vipDetail({
"id": widget.arguments["id"],
"latitude": "$latitude",
@ -74,10 +86,11 @@ class _VipDetailPage extends State<VipDetailPage> {
if (baseData != null && baseData.isSuccess) {
vipCard = baseData.data;
refreshController.loadComplete();
setState(() {});
} else {
refreshController.loadFailed();
}
print("object:object");
setState(() {});
}
@override

3
lib/utils/location.dart

@ -74,7 +74,8 @@ class Location {
}
void stopLocation() {
aMapFlutterLocation.stopLocation();
if (aMapFlutterLocation != null)
aMapFlutterLocation.stopLocation();
}
enableLocation(context) {

2
lib/utils/painter_bg.dart

@ -15,6 +15,7 @@ class BgPainter extends CustomPainter {
void paint(Canvas canvas, Size size) {
Path path = Path();
// P0点 线
path.lineTo(0, 0);
path.lineTo(size.width, 0);
@ -23,6 +24,7 @@ class BgPainter extends CustomPainter {
path.close();
Paint paint = Paint()
..isAntiAlias = true
..color = bgColor
..style = PaintingStyle.fill;

2
lib/view_widget/custom_image.dart

@ -13,7 +13,7 @@ class MImage extends StatelessWidget {
final BoxFit fit;
final bool isCircle;
double scaleIndex = 2.5;
double scaleIndex = 3.5;
MImage(
this.src, {

Loading…
Cancel
Save