|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/login_tips_dialog.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
class MineOrderView extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _MineOrderView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MineOrderView extends State<MineOrderView> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(left:16.w, bottom:20.h, right:16.w, top:10.h),
|
|
|
|
padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 3),
|
|
|
|
blurRadius: 14,
|
|
|
|
spreadRadius: 0,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 4.h),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).wodedingdan,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 8.h,),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: (){
|
|
|
|
toOrderHistory(1);
|
|
|
|
},
|
|
|
|
child: orderStatusItem(1),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: (){
|
|
|
|
toOrderHistory(2);
|
|
|
|
},
|
|
|
|
child: orderStatusItem(2),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: (){
|
|
|
|
toOrderHistory(3);
|
|
|
|
},
|
|
|
|
child: orderStatusItem(3),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: (){
|
|
|
|
toOrderHistory(0);
|
|
|
|
},
|
|
|
|
child: orderStatusItem(0),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
toOrderHistory(int status) {
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (value.getString("token") == null ||
|
|
|
|
value.getString("token") == "") {
|
|
|
|
LoginTipsDialog().show(context);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Navigator.of(context).pushNamed('/router/order_history_page', arguments: {"status":status});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> orderStatusImg = [
|
|
|
|
"assets/image/icon_mine_order_qb.webp",
|
|
|
|
"assets/image/icon_mine_order_dfk.webp",
|
|
|
|
"assets/image/icon_mine_order_wwc.webp",
|
|
|
|
"assets/image/icon_mine_order_ywc.webp",
|
|
|
|
];
|
|
|
|
|
|
|
|
List<String> orderStatusText = [
|
|
|
|
S.current.quanbu,
|
|
|
|
S.current.daifukuan,
|
|
|
|
S.current.weiwancheng,
|
|
|
|
S.current.yiwancheng,
|
|
|
|
];
|
|
|
|
|
|
|
|
Widget orderStatusItem(int status) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 4.h),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
orderStatusImg[status],
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
width: 36.w,
|
|
|
|
height: 36.w,
|
|
|
|
),
|
|
|
|
SizedBox(height: 4.h,),
|
|
|
|
Text(
|
|
|
|
orderStatusText[status],
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|