|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_picker_plus/picker.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../../models/coupon_model.dart';
|
|
|
|
import '../../../provider/finance_provider.dart';
|
|
|
|
import '../../../route/navigator_util.dart';
|
|
|
|
import '../../../utils/dialog_util.dart';
|
|
|
|
import '../../../utils/screen_util.dart';
|
|
|
|
import '../../../utils/utils.dart';
|
|
|
|
import '../../../widgets/round_button.dart';
|
|
|
|
import '../../../widgets/v_empty_view.dart';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 支付返券
|
|
|
|
*/
|
|
|
|
class PaymentGiftPage extends StatefulWidget {
|
|
|
|
const PaymentGiftPage({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<PaymentGiftPage> createState() => _PaymentGiftPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _PaymentGiftPageState extends State<PaymentGiftPage> {
|
|
|
|
bool fullReduction = true;
|
|
|
|
bool ladderReduction = false;
|
|
|
|
|
|
|
|
String fromDateFull = '选择日期';
|
|
|
|
String endDateFull = '选择日期';
|
|
|
|
|
|
|
|
String fromDateLadder = '选择日期';
|
|
|
|
String endDateLadder = '选择日期';
|
|
|
|
|
|
|
|
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
|
|
|
FinanceProvider? financeProvider;
|
|
|
|
TextEditingController fullC = TextEditingController();
|
|
|
|
FocusNode fullNode = FocusNode();
|
|
|
|
|
|
|
|
List coupons = ['1', '2', '3'];
|
|
|
|
List ladders = ['1', '2', '3'];
|
|
|
|
List<CouponSunModel>? couponSelectFree = [];
|
|
|
|
|
|
|
|
///是否立即启用
|
|
|
|
Widget _canUse(
|
|
|
|
String title,
|
|
|
|
bool swich,
|
|
|
|
GestureTapCallback onTap,
|
|
|
|
) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
|
|
|
|
margin: EdgeInsets.only(left: ScreenUtil().setWidth(32)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom:
|
|
|
|
BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
// height: ScreenUtil().setWidth(40),
|
|
|
|
// color: Colors.red,
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151, fontSize: font(16)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Image.asset(
|
|
|
|
swich
|
|
|
|
? Utils.getImgPath('swich_on')
|
|
|
|
: Utils.getImgPath('swich_off'),
|
|
|
|
width: ScreenUtil().setWidth(44 * 2),
|
|
|
|
),
|
|
|
|
HEmptyView(32)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _priceWidget(TextEditingController controller, FocusNode focusNode,
|
|
|
|
{num width = 40}) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(left: w(width)),
|
|
|
|
padding: EdgeInsets.only(top: w(8), bottom: w(8), right: w(16)),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// border: Border(
|
|
|
|
// bottom:
|
|
|
|
// BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'用户消费满',
|
|
|
|
style: TextStyle(color: MyColours.color_515151, fontSize: font(14)),
|
|
|
|
),
|
|
|
|
HEmptyView(10),
|
|
|
|
Container(
|
|
|
|
width: w(70),
|
|
|
|
height: w(26),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(color: MyColours.color_999999, width: w(1))),
|
|
|
|
child: TextField(
|
|
|
|
controller: controller,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 1,
|
|
|
|
// //光标颜色
|
|
|
|
// cursorColor:
|
|
|
|
// widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
|
|
inputFormatters: [
|
|
|
|
FilteringTextInputFormatter.allow(RegExp("[0-9.]")),
|
|
|
|
], // 限制输入为数字,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
),
|
|
|
|
focusNode: focusNode,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
isCollapsed: true,
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
hintText: '输入门槛',
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
),
|
|
|
|
enabledBorder: new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
focusedBorder: new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onChanged: (value) {},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.numberWithOptions()),
|
|
|
|
),
|
|
|
|
HEmptyView(10),
|
|
|
|
Text(
|
|
|
|
'元 发放优惠券',
|
|
|
|
style: TextStyle(color: MyColours.color_515151, fontSize: font(14)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///时间选择
|
|
|
|
Widget _select(String title, String hintText, GestureTapCallback onTap) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(left: w(40)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: w(8),
|
|
|
|
bottom: w(8),
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom:
|
|
|
|
BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
// height: ScreenUtil().setWidth(40),
|
|
|
|
// color: Colors.red,
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
Spacer(),
|
|
|
|
Text(hintText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: hintText == '选择日期'
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('arrow_right_new'),
|
|
|
|
width: ScreenUtil().setWidth(16),
|
|
|
|
),
|
|
|
|
HEmptyView(32),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _couponShow(String name, {GestureTapCallback? onTap}) {
|
|
|
|
return Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(4)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(color: MyColours.color_999999, width: w(1)),
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(r(5)),
|
|
|
|
bottomLeft: Radius.circular(r(5)),
|
|
|
|
)),
|
|
|
|
child: Text(
|
|
|
|
name,
|
|
|
|
style: TextStyle(color: MyColours.color_515151, fontSize: font(12)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(5), vertical: w(4)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
border:
|
|
|
|
Border.all(color: MyColours.color_999999, width: w(1)),
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topRight: Radius.circular(r(5)),
|
|
|
|
bottomRight: Radius.circular(r(5)),
|
|
|
|
)),
|
|
|
|
child: Text(
|
|
|
|
'×',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151, fontSize: font(12)),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _selectCouponBtn(VoidCallback? onPressed) {
|
|
|
|
return RoundButton(
|
|
|
|
text: '+选择优惠券',
|
|
|
|
width: w(88),
|
|
|
|
height: w(26),
|
|
|
|
gradientStart: MyColours.color_ffffff,
|
|
|
|
gradientEnd: MyColours.color_ffffff,
|
|
|
|
textColor: MyColours.color_438E93,
|
|
|
|
borderColor: MyColours.color_438E93,
|
|
|
|
radius: r(5),
|
|
|
|
fontSize: 24,
|
|
|
|
onPressed: onPressed);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _selectCouponWidget(List<CouponSunModel> coupons,
|
|
|
|
{bool needBottom = true, num width = 40, VoidCallback? onPressed}) {
|
|
|
|
List<Widget> data = coupons.map((e) {
|
|
|
|
return _couponShow(e.aname ?? '', onTap: () {
|
|
|
|
//删除选择的券
|
|
|
|
coupons.remove(e);
|
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
}).toList();
|
|
|
|
data.add(_selectCouponBtn(onPressed));
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(top: w(8), bottom: w(8), right: w(16)),
|
|
|
|
margin: EdgeInsets.only(left: w(width)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: w(0.5),
|
|
|
|
color: needBottom
|
|
|
|
? MyColours.color_E7E7E7
|
|
|
|
: MyColours.color_ffffff))),
|
|
|
|
child: Wrap(runSpacing: w(8), spacing: w(6), children: data),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///发放阶梯
|
|
|
|
Widget _ladderWidget(int index, e, {GestureTapCallback? onTap}) {
|
|
|
|
return Container(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.only(left: w(40), top: w(8), bottom: w(8), right: w(16)),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'发放阶梯(${index})',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151, fontSize: font(14)),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(top: w(8), bottom: w(8)),
|
|
|
|
child: Text(
|
|
|
|
'删除',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_438E93, fontSize: font(12)),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
_priceWidget(TextEditingController(), FocusNode(), width: 20),
|
|
|
|
_selectCouponWidget(couponSelectFree!, width: 20, needBottom: false,
|
|
|
|
onPressed: () async {
|
|
|
|
//跳转到优惠券选择页面,条件:券的有效期包含活动有效期
|
|
|
|
//阶梯发券
|
|
|
|
// dynamic temp = await NavigatorUtil.goPaymentGiftSelectPage(
|
|
|
|
// context, '3', {'object': couponSelectFree});
|
|
|
|
// if (temp != null && temp['coupon'] != null) {
|
|
|
|
// couponSelectFree = temp['coupon'];
|
|
|
|
|
|
|
|
// setState(() {});
|
|
|
|
// }
|
|
|
|
}),
|
|
|
|
// }),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
financeProvider = Provider.of<FinanceProvider>(context, listen: true);
|
|
|
|
int i = 0;
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar('支付返券'),
|
|
|
|
key: scaffoldKey,
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
_canUse('开通实际支付满减返券【拉复购】', fullReduction, () {
|
|
|
|
setState(() {
|
|
|
|
fullReduction = !fullReduction;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
_select('活动开始于', fromDateFull, () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
//弹出时间选择器
|
|
|
|
// showPickerDateTime(context);
|
|
|
|
// showDateSelWidget = true;
|
|
|
|
DialogUtil.showPickerDateTime24(
|
|
|
|
context,
|
|
|
|
scaffoldKey,
|
|
|
|
(value) {
|
|
|
|
// {'text': picker.adapter.text, 'select': selecteds}
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
print(value);
|
|
|
|
fromDateFull = DateUtil.formatDateStr(value,
|
|
|
|
format: DateFormats.y_mo_d);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
minValue: DateTime(1987, 1, 1),
|
|
|
|
dateTime: fromDateFull == '选择日期'
|
|
|
|
? null
|
|
|
|
: DateUtil.getDateTime(fromDateFull),
|
|
|
|
pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
|
|
onCancel: () {
|
|
|
|
// showDateSelWidget = false;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
_select('活动结束于', endDateFull, () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
//弹出时间选择器
|
|
|
|
// showPickerDateTime(context);
|
|
|
|
// showDateSelWidget = true;
|
|
|
|
DialogUtil.showPickerDateTime24(
|
|
|
|
context,
|
|
|
|
scaffoldKey,
|
|
|
|
(value) {
|
|
|
|
// {'text': picker.adapter.text, 'select': selecteds}
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
print(value);
|
|
|
|
endDateFull = DateUtil.formatDateStr(value,
|
|
|
|
format: DateFormats.y_mo_d);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
minValue: DateTime(1987, 1, 1),
|
|
|
|
dateTime: endDateFull == '选择日期'
|
|
|
|
? null
|
|
|
|
: DateUtil.getDateTime(endDateFull),
|
|
|
|
pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
|
|
onCancel: () {
|
|
|
|
// showDateSelWidget = false;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
_priceWidget(fullC, fullNode),
|
|
|
|
_selectCouponWidget(couponSelectFree!, onPressed: () async {
|
|
|
|
if (fromDateFull == '选择日期') {
|
|
|
|
Utils.showToast('请选择满减返券的开始日期');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (endDateFull == '选择日期') {
|
|
|
|
Utils.showToast('请选择满减返券的结束日期');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (DateUtil.getDateTime(endDateFull)
|
|
|
|
.compareTo(DateUtil.getDateTime(fromDateFull)) <
|
|
|
|
0) {
|
|
|
|
Utils.showToast('满减返券的活动结束日期不能早于开始日期');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
//选择券,满减送的
|
|
|
|
dynamic temp = await NavigatorUtil.goPaymentGiftSelectPage(
|
|
|
|
context,
|
|
|
|
'3',
|
|
|
|
{'object': couponSelectFree},
|
|
|
|
fromDateFull,
|
|
|
|
endDateFull);
|
|
|
|
if (temp != null && temp['coupon'] != null) {
|
|
|
|
couponSelectFree = temp['coupon'];
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Container(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.only(top: w(8), bottom: w(8), right: w(16)),
|
|
|
|
margin: EdgeInsets.only(left: w(40)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: w(0.5), color: MyColours.color_E7E7E7))),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'发放规则',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151, fontSize: font(14)),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Container(
|
|
|
|
// width: w(100),
|
|
|
|
// height: w(30),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(10), vertical: w(5)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(r(5)),
|
|
|
|
bottomLeft: Radius.circular(r(5)))),
|
|
|
|
child: Text(
|
|
|
|
'每满门槛均发放',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: font(14)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(10), vertical: w(5)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_DBDBDB,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topRight: Radius.circular(r(5)),
|
|
|
|
bottomRight: Radius.circular(r(5)))),
|
|
|
|
child: Text(
|
|
|
|
'仅发放一次',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
fontSize: font(14)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(22),
|
|
|
|
_canUse('开通实际支付阶梯返券【提客单】', ladderReduction, () {
|
|
|
|
//
|
|
|
|
setState(() {
|
|
|
|
ladderReduction = !ladderReduction;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
_select('活动开始于', fromDateLadder, () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
//弹出时间选择器
|
|
|
|
// showPickerDateTime(context);
|
|
|
|
// showDateSelWidget = true;
|
|
|
|
DialogUtil.showPickerDateTime24(
|
|
|
|
context,
|
|
|
|
scaffoldKey,
|
|
|
|
(value) {
|
|
|
|
// {'text': picker.adapter.text, 'select': selecteds}
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
print(value);
|
|
|
|
fromDateLadder = DateUtil.formatDateStr(value,
|
|
|
|
format: DateFormats.y_mo_d);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
minValue: DateTime(1987, 1, 1),
|
|
|
|
dateTime: fromDateLadder == '选择日期'
|
|
|
|
? null
|
|
|
|
: DateUtil.getDateTime(fromDateLadder),
|
|
|
|
pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
|
|
onCancel: () {
|
|
|
|
// showDateSelWidget = false;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
_select('活动结束于', endDateLadder, () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
//弹出时间选择器
|
|
|
|
// showPickerDateTime(context);
|
|
|
|
// showDateSelWidget = true;
|
|
|
|
DialogUtil.showPickerDateTime24(
|
|
|
|
context,
|
|
|
|
scaffoldKey,
|
|
|
|
(value) {
|
|
|
|
// {'text': picker.adapter.text, 'select': selecteds}
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
print(value);
|
|
|
|
endDateLadder = DateUtil.formatDateStr(value,
|
|
|
|
format: DateFormats.y_mo_d);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
minValue: DateTime(1987, 1, 1),
|
|
|
|
dateTime: endDateLadder == '选择日期'
|
|
|
|
? null
|
|
|
|
: DateUtil.getDateTime(endDateLadder),
|
|
|
|
pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
|
|
onCancel: () {
|
|
|
|
// showDateSelWidget = false;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
Column(
|
|
|
|
children: ladders.map((e) {
|
|
|
|
i++;
|
|
|
|
return _ladderWidget(i, e, onTap: () {
|
|
|
|
ladders.remove(e);
|
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
}).toList(),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
ladders.add('${ladders.length + 1}');
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
// height: w(30),
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(left: w(60), top: w(8)),
|
|
|
|
padding: EdgeInsets.symmetric(vertical: w(8)),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
// color: Colors.red,
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7))),
|
|
|
|
child: Text(
|
|
|
|
'增加阶梯',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_438E93, fontSize: font(12)),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: w(13), left: w(45), right: w(45), bottom: w(26)),
|
|
|
|
child: RoundButton(
|
|
|
|
text: '立即提交',
|
|
|
|
height: w(43),
|
|
|
|
radius: r(5),
|
|
|
|
gradientStart: MyColours.color_438E93,
|
|
|
|
gradientEnd: MyColours.color_438E93,
|
|
|
|
borderColor: MyColours.color_438E93,
|
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
isBold: true,
|
|
|
|
fontSize: 32,
|
|
|
|
onPressed: () {},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|