添加 商品评价页面

添加 商品退换页面
对接其接口
hmxc
张萌 4 years ago
parent 69bccd0f71
commit d814615f64

@ -327,6 +327,9 @@ class _Market {
///app ///app
String get confirmReceive => '/user/shop/confirmReceipt'; String get confirmReceive => '/user/shop/confirmReceipt';
///app
String get goodsEvaluation => '/user/shop/evaluation';
} }
class _Upload { class _Upload {

@ -1,9 +1,10 @@
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:aku_community/model/common/img_model.dart';
part 'my_order_list_model.g.dart'; part 'my_order_list_model.g.dart';
@JsonSerializable() @JsonSerializable()
@ -17,6 +18,9 @@ class MyOrderListModel extends Equatable {
final double sellingPrice; final double sellingPrice;
final double? markingPrice; final double? markingPrice;
final int num; final int num;
final String supplierName;
final String levelOneCategory;
final String levelTwoCategory;
final int status; final int status;
final String arrivalTime; final String arrivalTime;
MyOrderListModel({ MyOrderListModel({
@ -24,11 +28,14 @@ class MyOrderListModel extends Equatable {
required this.code, required this.code,
required this.goodsId, required this.goodsId,
required this.goodsName, required this.goodsName,
this.backType, this.backType,
required this.goodsImgList, required this.goodsImgList,
required this.sellingPrice, required this.sellingPrice,
this.markingPrice, this.markingPrice,
required this.num, required this.num,
required this.supplierName,
required this.levelOneCategory,
required this.levelTwoCategory,
required this.status, required this.status,
required this.arrivalTime, required this.arrivalTime,
}); });
@ -89,6 +96,9 @@ class MyOrderListModel extends Equatable {
sellingPrice, sellingPrice,
markingPrice, markingPrice,
num, num,
supplierName,
levelOneCategory,
levelTwoCategory,
status, status,
arrivalTime, arrivalTime,
]; ];

@ -19,6 +19,9 @@ MyOrderListModel _$MyOrderListModelFromJson(Map<String, dynamic> json) {
sellingPrice: (json['sellingPrice'] as num).toDouble(), sellingPrice: (json['sellingPrice'] as num).toDouble(),
markingPrice: (json['markingPrice'] as num?)?.toDouble(), markingPrice: (json['markingPrice'] as num?)?.toDouble(),
num: json['num'] as int, num: json['num'] as int,
supplierName: json['supplierName'] as String,
levelOneCategory: json['levelOneCategory'] as String,
levelTwoCategory: json['levelTwoCategory'] as String,
status: json['status'] as int, status: json['status'] as int,
arrivalTime: json['arrivalTime'] as String, arrivalTime: json['arrivalTime'] as String,
); );

@ -3,10 +3,12 @@ import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/market/order/my_order_list_model.dart'; import 'package:aku_community/models/market/order/my_order_list_model.dart';
import 'package:aku_community/ui/market/order/my_order_func.dart'; import 'package:aku_community/ui/market/order/my_order_func.dart';
import 'package:aku_community/utils/card_bottom_button.dart'; import 'package:aku_community/ui/market/order/my_order_refund_page.dart';
import 'package:aku_community/widget/buttons/card_bottom_button.dart';
import 'package:aku_community/widget/bee_divider.dart'; import 'package:aku_community/widget/bee_divider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/const/resource.dart'; import 'package:aku_community/const/resource.dart';
import 'package:aku_community/extensions/widget_list_ext.dart'; import 'package:aku_community/extensions/widget_list_ext.dart';
@ -24,92 +26,121 @@ class MyOrderCard extends StatefulWidget {
class _MyOrderCardState extends State<MyOrderCard> { class _MyOrderCardState extends State<MyOrderCard> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return GestureDetector(
width: double.infinity, onTap: () {},
decoration: BoxDecoration( child: Container(
color: Colors.white, width: double.infinity,
), decoration: BoxDecoration(
padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), color: Colors.white,
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w),
children: [ child: Column(
Row( crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
widget.model.goodsName.text Row(
.size(32.sp) children: [
.bold widget.model.goodsName.text
.color(ktextPrimary) .size(32.sp)
.make(), .bold
Spacer(), .color(ktextPrimary)
widget.model.statusString.text .make(),
.size(30.sp) Spacer(),
.bold widget.model.statusString.text
.color(widget.model.statusColor) .size(30.sp)
.make(), .bold
], .color(widget.model.statusColor)
), .make(),
16.w.heightBox, ],
BeeDivider.horizontal(), ),
24.w.heightBox, 16.w.heightBox,
Row( BeeDivider.horizontal(),
crossAxisAlignment: CrossAxisAlignment.start, 24.w.heightBox,
children: [ Row(
ClipRRect( crossAxisAlignment: CrossAxisAlignment.start,
borderRadius: BorderRadius.circular(8.w), children: [
clipBehavior: Clip.antiAlias, ClipRRect(
child: FadeInImage.assetNetwork( borderRadius: BorderRadius.circular(8.w),
width: 160.w, clipBehavior: Clip.antiAlias,
height: 160.w, child: FadeInImage.assetNetwork(
fit: BoxFit.cover, width: 160.w,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, height: 160.w,
image: fit: BoxFit.cover,
API.image(ImgModel.first(widget.model.goodsImgList))), placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
), image:
Column( API.image(ImgModel.first(widget.model.goodsImgList))),
children: [ ),
Row( SizedBox(
crossAxisAlignment: CrossAxisAlignment.start, height: 160.w,
child: Column(
children: [ children: [
widget.model.goodsName.text Row(
.size(28.sp) crossAxisAlignment: CrossAxisAlignment.start,
.color(ktextPrimary) children: [
.maxLines(2) widget.model.goodsName.text
.overflow(TextOverflow.ellipsis) .size(28.sp)
.bold .color(ktextPrimary)
.make(), .maxLines(2)
.overflow(TextOverflow.ellipsis)
.bold
.make(),
Spacer(),
'¥${widget.model.sellingPrice}'
.text
.size(28.sp)
.bold
.color(Color(0xFFE60E0E))
.make(),
],
),
Spacer(), Spacer(),
'¥${widget.model.sellingPrice}' Row(
.text children: [
.size(28.sp) ('${widget.model.levelOneCategory}|${widget.model.levelTwoCategory}')
.bold .text
.color(Color(0xFFE60E0E)) .size(24.sp)
.make(), .color(ktextSubColor)
.make()
],
),
// 12.w.heightBox,
// Row(
// children: [
// ('${widget.model.levelTwoCategory}')
// .text
// .size(24.sp)
// .color(ktextSubColor)
// .make()
// ],
// ),
], ],
), ),
//TODO: ).expand()
...[ ],
_rowTile('下单时间', widget.model.arrivlaTimeString), ),
_rowTile('到达地点', '人才公寓小区北侧门口'), 40.w.heightBox,
_rowTile('发货时间', widget.model.arrivlaTimeString), ...[
].sepWidget(separate: 16.w.heightBox), _rowTile('下单时间', widget.model.arrivlaTimeString),
], _rowTile('到达地点', '人才公寓小区北侧门口'),
) _rowTile('发货时间', widget.model.arrivlaTimeString),
], ].sepWidget(separate: 16.w.heightBox),
), ..._bottomWidget(),
_bottomWidget(), ],
], ),
), ),
); );
} }
Widget _bottomWidget() { List<Widget> _bottomWidget() {
List<Widget> _buttons = _getBottomButton(widget.model.status); List<Widget> _buttons = _getBottomButton(widget.model.status);
return _buttons.isEmpty return _buttons.isEmpty
? SizedBox() ? []
: Row( : [
children: [Spacer(), ..._buttons], 40.w.heightBox,
); Row(
children: [Spacer(), ..._buttons],
),
];
} }
List<Widget> _getBottomButton(int status) { List<Widget> _getBottomButton(int status) {
@ -122,6 +153,13 @@ class _MyOrderCardState extends State<MyOrderCard> {
await MyOrderFunc.cancelOrder(widget.model.id); await MyOrderFunc.cancelOrder(widget.model.id);
widget.callRefresh(); widget.callRefresh();
}), }),
].sepWidget(separate: 24.w.widthBox);
case 2:
return <Widget>[
CardBottomButton.yellow(text: '查看详情', onPressed: () {}),
].sepWidget(separate: 24.w.widthBox);
case 3:
return [
CardBottomButton.yellow( CardBottomButton.yellow(
text: '确认收货', text: '确认收货',
onPressed: () async { onPressed: () async {
@ -129,26 +167,30 @@ class _MyOrderCardState extends State<MyOrderCard> {
widget.callRefresh(); widget.callRefresh();
}), }),
].sepWidget(separate: 24.w.widthBox); ].sepWidget(separate: 24.w.widthBox);
case 2: case 4:
return <Widget>[ return <Widget>[
// CardBottomButton.white(text: '提醒商家', onPressed: () {}), CardBottomButton.white(
].sepWidget(separate: 24.w.widthBox); text: '评价商品',
case 3: onPressed: () async {
return [ widget.callRefresh();
// CardBottomButton.white(text: '商品投诉', onPressed: () {}), }),
CardBottomButton.white( CardBottomButton.white(
text: '申请退换', text: '申请退换',
onPressed: () async { onPressed: () async {
await MyOrderFunc.refundOrder(widget.model.id); await Get.to(() => MyOrderRefundPage(
model: widget.model,
));
widget.callRefresh(); widget.callRefresh();
}), }),
// CardBottomButton.yellow(text: '查看详情', onPressed: () {}),
].sepWidget(separate: 24.w.widthBox); ].sepWidget(separate: 24.w.widthBox);
case 4: case 6:
return <Widget>[ return <Widget>[
// CardBottomButton.white(text: '查看详情', onPressed: () {}), CardBottomButton.yellow(text: '查看详情', onPressed: () {}),
// CardBottomButton.yellow(text: '完成退换', onPressed: () {}), ];
].sepWidget(separate: 24.w.widthBox); case 8:
return <Widget>[
CardBottomButton.yellow(text: '查看详情', onPressed: () {}),
];
default: default:
return []; return [];
} }
@ -160,6 +202,7 @@ class _MyOrderCardState extends State<MyOrderCard> {
) { ) {
return Row( return Row(
children: [ children: [
// (160 + 24).w.widthBox,
title.text.size(24.sp).color(ktextSubColor).make(), title.text.size(24.sp).color(ktextSubColor).make(),
Spacer(), Spacer(),
content.text.size(24.sp).color(ktextPrimary).make(), content.text.size(24.sp).color(ktextPrimary).make(),

@ -0,0 +1,19 @@
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
class MyOrderDetailPage extends StatefulWidget {
MyOrderDetailPage({Key? key}) : super(key: key);
@override
_MyOrderDetailPageState createState() => _MyOrderDetailPageState();
}
class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '订单详情',
body: ListView(),
);
}
}

@ -0,0 +1,191 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/market/order/my_order_list_model.dart';
import 'package:aku_community/ui/market/order/my_order_func.dart';
import 'package:aku_community/widget/bee_divider.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/others/bee_text_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/const/resource.dart';
class MyOrderEvaluationPage extends StatefulWidget {
final MyOrderListModel model;
MyOrderEvaluationPage({Key? key, required this.model}) : super(key: key);
@override
_MyOrderEvaluationPageState createState() => _MyOrderEvaluationPageState();
}
class _MyOrderEvaluationPageState extends State<MyOrderEvaluationPage> {
late TextEditingController _editingController;
int _rating = 10;
@override
void initState() {
super.initState();
_editingController = TextEditingController();
}
@override
void dispose() {
_editingController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '商品评价',
body: ListView(
padding: EdgeInsets.all(32.w),
children: [
_goodsInfoWidget(),
24.w.heightBox,
_resonWidget(),
],
),
bottomNavi: BottomButton(
onPressed: () async {
await MyOrderFunc.goodsEvalution(
widget.model.id, _rating, _editingController.text);
},
child: '确认提交'.text.size(32.sp).color(ktextPrimary).bold.make()),
);
}
Widget _goodsInfoWidget() {
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
),
padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
widget.model.goodsName.text
.size(32.sp)
.bold
.color(ktextPrimary)
.make(),
Spacer(),
widget.model.statusString.text
.size(30.sp)
.bold
.color(widget.model.statusColor)
.make(),
],
),
16.w.heightBox,
BeeDivider.horizontal(),
24.w.heightBox,
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8.w),
clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork(
width: 160.w,
height: 160.w,
fit: BoxFit.cover,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image:
API.image(ImgModel.first(widget.model.goodsImgList))),
),
SizedBox(
height: 160.w,
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.model.goodsName.text
.size(28.sp)
.color(ktextPrimary)
.maxLines(2)
.overflow(TextOverflow.ellipsis)
.bold
.make(),
Spacer(),
'¥${widget.model.sellingPrice}'
.text
.size(28.sp)
.bold
.color(Color(0xFFE60E0E))
.make(),
],
),
Spacer(),
Row(
children: [
('${widget.model.levelOneCategory}|${widget.model.levelTwoCategory}')
.text
.size(24.sp)
.color(ktextSubColor)
.make()
],
),
// 12.w.heightBox,
// Row(
// children: [
// ('${widget.model.levelTwoCategory}')
// .text
// .size(24.sp)
// .color(ktextSubColor)
// .make()
// ],
// ),
],
),
).expand()
],
),
],
),
);
}
Widget _resonWidget() {
return Container(
padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 24.w),
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'商品评价'.text.size(32.sp).bold.color(ktextPrimary).make(),
32.w.heightBox,
RatingBar.builder(
initialRating: _rating / 2,
minRating: 0,
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
// itemPadding: EdgeInsets.symmetric(horizontal: 16.w),
itemBuilder: (context, _) => Icon(
Icons.star_border_rounded,
color: kPrimaryColor,
),
itemSize: 64.w,
onRatingUpdate: (rating) {
_rating = rating.floor();
},
glow: false,
),
32.w.heightBox,
BeeTextField(controller: _editingController, hintText: '请输入评价内容')
],
),
);
}
}

@ -3,18 +3,34 @@ import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/utils/network/net_util.dart';
class MyOrderFunc { class MyOrderFunc {
///
static Future confirmReceive(int goodsAppointmentId) async { static Future confirmReceive(int goodsAppointmentId) async {
BaseModel baseModel = await NetUtil().get(API.market.confirmReceive, BaseModel baseModel = await NetUtil().get(API.market.confirmReceive,
params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true); params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true);
} }
static Future refundOrder(int goodsAppointmentId) async { ///退
static Future refundOrder(int goodsAppointmentId, String reson) async {
BaseModel baseModel = await NetUtil().get(API.market.confirmReceive, BaseModel baseModel = await NetUtil().get(API.market.confirmReceive,
params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true); params: {"goodsAppointmentId": goodsAppointmentId, "backReason": reson},
showMessage: true);
} }
///
static Future cancelOrder(int goodsAppointmentId) async { static Future cancelOrder(int goodsAppointmentId) async {
BaseModel baseModel = await NetUtil().get(API.market.confirmReceive, BaseModel baseModel = await NetUtil().get(API.market.confirmReceive,
params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true); params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true);
} }
///
static Future goodsEvalution(
int goodsAppointmentId, int rating, String evaluationReason) async {
BaseModel baseModel = await NetUtil().get(API.market.confirmReceive,
params: {
"goodsAppointmentId": goodsAppointmentId,
"score": rating,
"evaluationReason": evaluationReason
},
showMessage: true);
}
} }

@ -17,8 +17,10 @@ class _MyOrderPageState extends State<MyOrderPage>
List<String> _tabs = [ List<String> _tabs = [
'待发货', '待发货',
'已发货', '已发货',
'已到货',
'已收货', '已收货',
'退换/投诉', '已评价',
'退换货申请',
]; ];
@override @override
@ -33,18 +35,43 @@ class _MyOrderPageState extends State<MyOrderPage>
super.dispose(); super.dispose();
} }
int _transIndes(int index) {
switch (index) {
case 0:
return 1;
case 1:
return 2;
case 2:
return 3;
case 3:
return 4;
case 4:
return 6;
case 5:
return 8;
default:
return 0;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '我的订单', title: '我的订单',
appBarBottom: PreferredSize( appBarBottom: PreferredSize(
preferredSize: Size.fromHeight(88.w), preferredSize: Size.fromHeight(88.w),
child: BeeTabBar(controller: _tabController, tabs: _tabs), child: BeeTabBar(
scrollable: true, controller: _tabController, tabs: _tabs),
), ),
body: TabBarView( body: TabBarView(
controller: _tabController, controller: _tabController,
children: List.generate( children: List.generate(
_tabs.length, (index) => MyOrderView(index: index))), _tabs.length,
(index) => MyOrderView(
index: _transIndes(index),
),
),
),
); );
} }
} }

@ -0,0 +1,197 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/market/order/my_order_list_model.dart';
import 'package:aku_community/ui/market/order/my_order_func.dart';
import 'package:aku_community/widget/bee_divider.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/aku_single_check_button.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/others/bee_text_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/const/resource.dart';
class MyOrderRefundPage extends StatefulWidget {
final MyOrderListModel model;
MyOrderRefundPage({Key? key, required this.model})
: super(key: key);
@override
_MyOrderRefundPageState createState() => _MyOrderRefundPageState();
}
class _MyOrderRefundPageState extends State<MyOrderRefundPage> {
int _type = 1; //退1退2
late TextEditingController _editingController;
@override
void initState() {
super.initState();
_editingController = TextEditingController();
}
@override
void dispose() {
_editingController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '商品退换',
body: ListView(
padding: EdgeInsets.all(32.w),
children: [
_goodsInfoWidget(),
24.w.heightBox,
_resonWidget(),
],
),
bottomNavi: BottomButton(
onPressed: () async {
await MyOrderFunc.refundOrder(widget.model.id, _editingController.text);
},
child: '确认提交'.text.size(32.sp).color(ktextPrimary).bold.make()),
);
}
Widget _goodsInfoWidget() {
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
),
padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
widget.model.goodsName.text
.size(32.sp)
.bold
.color(ktextPrimary)
.make(),
Spacer(),
widget.model.statusString.text
.size(30.sp)
.bold
.color(widget.model.statusColor)
.make(),
],
),
16.w.heightBox,
BeeDivider.horizontal(),
24.w.heightBox,
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8.w),
clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork(
width: 160.w,
height: 160.w,
fit: BoxFit.cover,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image:
API.image(ImgModel.first(widget.model.goodsImgList))),
),
SizedBox(
height: 160.w,
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.model.goodsName.text
.size(28.sp)
.color(ktextPrimary)
.maxLines(2)
.overflow(TextOverflow.ellipsis)
.bold
.make(),
Spacer(),
'¥${widget.model.sellingPrice}'
.text
.size(28.sp)
.bold
.color(Color(0xFFE60E0E))
.make(),
],
),
Spacer(),
Row(
children: [
('${widget.model.levelOneCategory}|${widget.model.levelTwoCategory}')
.text
.size(24.sp)
.color(ktextSubColor)
.make()
],
),
// 12.w.heightBox,
// Row(
// children: [
// ('${widget.model.levelTwoCategory}')
// .text
// .size(24.sp)
// .color(ktextSubColor)
// .make()
// ],
// ),
],
),
).expand()
],
),
],
),
);
}
Widget _resonWidget() {
return Container(
padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 24.w),
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'退换原因'.text.size(32.sp).bold.color(ktextPrimary).make(),
32.w.heightBox,
Row(
children: [
AkuSingleCheckButton(
text: '正常',
value: 1,
gropValue: _type,
onPressed: () {
_type = 1;
setState(() {});
},
),
80.w.widthBox,
AkuSingleCheckButton(
text: '异常',
value: 2,
gropValue: _type,
onPressed: () {
_type = 2;
setState(() {});
},
),
],
),
32.w.heightBox,
BeeTextField(controller: _editingController, hintText: '请详细描述问题及原因')
],
),
);
}
}

@ -35,7 +35,7 @@ class _MyOrderViewState extends State<MyOrderView> {
path: API.market.myOrderList, path: API.market.myOrderList,
controller: _refreshController, controller: _refreshController,
extraParams: { extraParams: {
"orderStart":widget.index+1 "orderStart":widget.index
}, },
convert: (models) { convert: (models) {
return models.tableList! return models.tableList!

@ -0,0 +1,48 @@
// Flutter imports:
import 'package:flutter/material.dart';
// Package imports:
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class AkuSingleCheckButton<T> extends StatefulWidget {
final String text;
final T value;
final T gropValue;
final VoidCallback onPressed;
AkuSingleCheckButton(
{Key? key,
required this.text,
required this.value,
required this.gropValue,
required this.onPressed})
: super(key: key);
@override
_AkuSingleCheckButtonState createState() => _AkuSingleCheckButtonState();
}
class _AkuSingleCheckButtonState extends State<AkuSingleCheckButton> {
bool get isSelect => widget.value == widget.gropValue;
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: isSelect ? Color(0xFFFFF8E0) : Colors.white,
border: Border.all(
color: isSelect ? Color(0xFFFFC40C) : Color(0xFF999999),
width: 3.w),
borderRadius: BorderRadius.circular(4.w)),
width: 180.w,
height: 72.w,
child: widget.text.text
.color(isSelect ? Color(0xFF333333) : Color(0xFF999999))
.bold
.size(32.sp)
.make(),
).onInkTap(() {
widget.onPressed();
});
}
}

@ -0,0 +1,59 @@
import 'package:aku_community/base/base_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class BeeTextField extends StatefulWidget {
final TextEditingController controller;
final VoidCallback? onChange;
final String hintText;
final int? minLines;
final int? maxLines;
BeeTextField(
{Key? key,
required this.controller,
this.onChange,
required this.hintText,
this.minLines,
this.maxLines})
: super(key: key);
@override
_BeeTextFieldState createState() => _BeeTextFieldState();
}
class _BeeTextFieldState extends State<BeeTextField> {
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
border: Border.all(
width: 2.w,
color: Color(0xFFE8E8E8),
),
),
child: TextField(
minLines: widget.minLines ?? 5,
maxLines: widget.maxLines ?? 10,
autofocus: false,
onChanged: (value) {
if (widget.onChange != null) {
widget.onChange!();
}
},
decoration: InputDecoration(
hintText: widget.hintText,
hintStyle: TextStyle(
fontSize: 28.sp,
color: ktextSubColor,
),
contentPadding:
EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w),
border: InputBorder.none,
isDense: true,
),
),
);
}
}
Loading…
Cancel
Save