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.

227 lines
8.6 KiB

import 'package:extended_text/extended_text.dart';
import 'package:flutter/material.dart';
import 'package:recook/constants/api.dart';
import 'package:recook/constants/constants.dart';
import 'package:recook/constants/header.dart';
import 'package:recook/constants/styles.dart';
import 'package:recook/models/order_after_sales_list_model.dart';
import 'package:recook/widgets/custom_cache_image.dart';
class AfterSalesItem extends StatefulWidget {
final OrderAfterSalesModel saleModel;
final Function itemClick;
AfterSalesItem(this.saleModel, this.itemClick);
@override
State<StatefulWidget> createState() {
return _AfterSalesItemState();
}
}
class _AfterSalesItemState extends State<AfterSalesItem> {
OrderAfterSalesModel _saleModel;
@override
void initState() {
super.initState();
_saleModel = widget.saleModel;
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
if (widget.itemClick != null) widget.itemClick();
},
child: Container(
color: AppColor.frenchColor,
child: Container(
height: ScreenAdapterUtils.setHeight(190),
// height: 193,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), color: Colors.white),
margin: EdgeInsets.only(left: 10, right: 10, top: 10),
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
child: _itemWidget(),
),
),
);
}
_itemWidget() {
return Column(
children: <Widget>[
Container(
margin: EdgeInsets.symmetric(
horizontal: rSize(4), vertical: ScreenAdapterUtils.setHeight(10)),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
"售后编号 ",
style: TextStyle(
color: Color(0xff666666),
fontSize: ScreenAdapterUtils.setSp(14),
fontWeight: FontWeight.w600),
),
Text(
_saleModel.asId.toString(),
style: TextStyle(
color: AppColor.blackColor,
fontSize: ScreenAdapterUtils.setSp(14),
),
),
Spacer(),
Text(
_saleModel.asDesc,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: _saleModel.color == 1
? AppColor.redColor
: _saleModel.color == 2
? AppColor.greyColor
: Colors.black,
fontSize: ScreenAdapterUtils.setSp(14)),
),
],
),
),
Container(
height: ScreenAdapterUtils.setHeight(80),
child: Row(
children: <Widget>[
Container(
color: AppColor.frenchColor,
margin: EdgeInsets.symmetric(horizontal: rSize(4)),
child: CustomCacheImage(
width: ScreenAdapterUtils.setHeight(80),
height: ScreenAdapterUtils.setHeight(80),
imageUrl: Api.getResizeImgUrl(_saleModel.mainPhotoUrl,
ScreenAdapterUtils.setHeight(160).toInt()),
fit: BoxFit.cover,
borderRadius: BorderRadius.all(Radius.circular(6)),
),
),
Container(
width: rSize(10),
),
Expanded(
child: Container(
height: ScreenAdapterUtils.setHeight(80),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1, color: AppColor.frenchColor))),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
alignment: Alignment.topLeft,
child: Text(
_saleModel.goodsName,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.black,
fontSize: ScreenAdapterUtils.setSp(15),
fontWeight: FontWeight.w600),
),
),
Container(
alignment: Alignment.topLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: Color(0xffeff1f6),
),
padding: const EdgeInsets.symmetric(
vertical: 3, horizontal: 6),
child: Text(_saleModel.skuName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.black.withOpacity(0.6),
fontSize: ScreenAdapterUtils.setSp(11),
)),
),
])),
],
),
),
)
],
),
),
Expanded(
child: Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(
left: rSize(14) + ScreenAdapterUtils.setHeight(80)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
children: <Widget>[
Text(
"退款金额 ",
style: TextStyle(
color: Color(0xff666666),
fontSize: ScreenAdapterUtils.setSp(14)),
),
Text(
"${_saleModel.refundAmount + _saleModel.refundCoin}",
style: TextStyle(
color: AppColor.redColor,
fontSize: ScreenAdapterUtils.setSp(14)),
),
_saleModel.quantity != null && _saleModel.quantity > 0
? Container(
margin: EdgeInsets.only(left: rSize(10)),
child: ExtendedText.rich(TextSpan(
text: "退货数量 ",
style: TextStyle(
color: Color(0xff666666),
fontSize: ScreenAdapterUtils.setSp(14)),
children: [
TextSpan(
text: _saleModel.quantity
.toInt()
.toString(),
style: TextStyle(
color: AppColor.redColor,
fontSize:
ScreenAdapterUtils.setSp(14)),
)
])),
)
: Container()
],
),
SizedBox(
height: ScreenAdapterUtils.setHeight(10),
),
Text(
TextUtils.isEmpty(_saleModel.createdAt)
? ""
: "申请时间: ${_saleModel.createdAt}",
style: TextStyle(
color: Color(0xff999999),
fontSize: ScreenAdapterUtils.setSp(12)),
),
],
)),
)
],
);
}
}