You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
135 lines
3.7 KiB
135 lines
3.7 KiB
3 years ago
|
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.fromLTRB(16.w, 10.h, 16.w, 6.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(
|
||
|
"我的订单",
|
||
|
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.png",
|
||
|
"assets/image/icon_mine_order_dfk.png",
|
||
|
"assets/image/icon_mine_order_wwc.png",
|
||
|
"assets/image/icon_mine_order_ywc.png",
|
||
|
];
|
||
|
|
||
|
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: 32.w,
|
||
|
height: 32.w,
|
||
|
),
|
||
|
SizedBox(height: 4.h,),
|
||
|
Text(
|
||
|
orderStatusText[status],
|
||
|
style: TextStyle(
|
||
|
color: Color(0xFF353535),
|
||
|
fontSize: 12.sp,
|
||
|
fontWeight: MyFontWeight.medium,
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|