Commit 6b22d5215cfa4f6d26745000d071d2e93292df9d

Authored by wdn127929
1 parent 83ee84aa

线上券UI

459 Bytes

... ... @@ -67,6 +67,7 @@ class CouponSunModel extends Object {
bool isOpenBool = false;
bool isCheck = false;
bool showText = false;
CouponSunModel(
this.id,
... ...
... ... @@ -10,6 +10,7 @@ import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
... ... @@ -32,7 +33,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
TextEditingController _couponNameEditControl = TextEditingController();
TextEditingController _couponRequireEditControl = TextEditingController();
TextEditingController _couponExplainEditControl = TextEditingController();
final heightCell = ScreenUtil().setWidth(80);
final heightCell = ScreenUtil().setWidth(48);
bool swichState = true; //默认启用 开关状态
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
String fromDate = '点击选择'; //有效期开始时间
... ... @@ -100,14 +101,10 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
///输入框
Widget _textfield(String title, String hintText) {
return Container(
height: heightCell,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
// height: ScreenUtil().setWidth(40),
// color: Colors.red,
child: Text(
title,
style: TextStyle(
... ... @@ -116,13 +113,15 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
fontSize: ScreenUtil().setSp(34)),
),
),
HEmptyView(20),
Expanded(
HEmptyView(80),
Container(
width: ScreenUtil().setWidth(231 * 2),
child: TextField(
controller: title == '券名称'
? _couponNameEditControl
: _couponRequireEditControl,
textAlign: TextAlign.right,
textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
... ... @@ -132,19 +131,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
fontSize: ScreenUtil().setSp(32),
),
focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
// textAlignVertical: TextAlignVertical.bottom,
decoration: InputDecoration(
// fillColor: Colors.lightGreenAccent,
// filled: true,
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32),
),
// contentPadding: EdgeInsets.only(
// bottom: ScreenUtil().setWidth(30)), //ios 17
// border: InputBorder.none,
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {},
onEditingComplete: () {
... ... @@ -218,7 +217,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
color: hintText == '点击选择'
? MyColours.color_999999
: MyColours.color_333333,
fontSize: ScreenUtil().setSp(26),
fontSize: ScreenUtil().setSp(32),
)),
HEmptyView(20),
Image.asset(
... ... @@ -239,39 +238,56 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: heightCell,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
title,
textAlign: TextAlign.left,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
)),
),
VEmptyView(10),
Align(
alignment: Alignment.centerLeft,
child: Text(
title,
textAlign: TextAlign.left,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
)),
VEmptyView(30),
TextField(
controller: _couponExplainEditControl,
// keyboardType: TextInputType.number, //键盘类型,数字键盘
maxLines: 7,
// maxLength: 200,
// maxLengthEnforced: true,
maxLines: 6,
maxLength: 50,
// maxLengthEnforced: true,
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_333333), //输入文本的样式
decoration: InputDecoration(
contentPadding: EdgeInsets.all(ScreenUtil().setWidth(20)),
contentPadding: EdgeInsets.all(ScreenUtil().setWidth(30)),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32),
),
fillColor: MyColours.color_EEEEEE,
fillColor: MyColours.color_F9F9F9,
// fillColor: Colors.red,
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
borderSide: BorderSide.none),
enabledBorder: OutlineInputBorder(
//未选中时候的颜色
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
borderSide: BorderSide(
color: MyColours.color_cccccc,
width: ScreenUtil().setWidth(2)),
),
focusedBorder: OutlineInputBorder(
//选中时外边框颜色
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
borderSide: BorderSide(
color: MyColours.app_main,
),
),
// border: OutlineInputBorder(
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(20)),
// borderSide: BorderSide(
// color: Colors.red, width: ScreenUtil().setWidth(2))),
),
onChanged: (value) {},
),
... ... @@ -324,6 +340,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
key: scaffoldKey,
appBar: SystemAppBar(
'创建新券',
... ... @@ -345,18 +362,47 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
horizontal: ScreenUtil().setWidth(40)),
child: Column(
children: [
VEmptyView(20),
VEmptyView(40),
_textfield('券名称', '例:9折券/200元代金券/菜品券'),
VEmptyView(20),
VEmptyView(22),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2)),
),
VEmptyView(30),
_textfield('券要求', '例:无门槛/满2000元'),
VEmptyView(20),
VEmptyView(22),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2)),
),
VEmptyView(30),
_select('有效期从', fromDate),
VEmptyView(20),
VEmptyView(30),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2)),
),
VEmptyView(30),
_select('有效期至', endDate),
VEmptyView(20),
VEmptyView(30),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2)),
),
VEmptyView(30),
_explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'),
VEmptyView(20),
// VEmptyView(20),
_canUse('是否立即启用'),
VEmptyView(30),
],
))),
),
... ...
... ... @@ -4,8 +4,10 @@ import 'package:one_key/constant/state.dart';
import 'package:one_key/pages/coupon/coupon_item.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
/**
... ... @@ -45,6 +47,7 @@ class _CouponHistoryPageState extends State<CouponHistoryPage> {
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_fefefe,
appBar: SystemAppBar(
' 历史券',
onTap: () {
... ... @@ -71,6 +74,12 @@ class _CouponHistoryPageState extends State<CouponHistoryPage> {
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return VEmptyView(40);
}, childCount: 1),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return CouponItem(
from: 'history',
couponSonModel: couponProvider.couponListHistory[index],
... ...
... ... @@ -15,13 +15,15 @@ class CouponItem extends StatefulWidget {
final VoidCallback onPressedSwich;
final CouponSunModel couponSonModel;
final bool showBtn;
final bool showCheck;
CouponItem(
{Key key,
this.from,
this.onPressed,
this.onPressedSwich,
this.couponSonModel,
this.showBtn = false})
this.showBtn = false,
this.showCheck = false})
: super(key: key);
@override
... ... @@ -29,6 +31,7 @@ class CouponItem extends StatefulWidget {
}
class _CouponItemState extends State<CouponItem> {
// bool showText = false;
@override
Widget build(BuildContext context) {
CouponSunModel sunModel = widget.couponSonModel;
... ... @@ -38,6 +41,17 @@ class _CouponItemState extends State<CouponItem> {
} else {
notSelect = sunModel.isOpenBool;
}
double explainH = 0.0;
if (ObjectUtil.isNotEmpty(sunModel.explain)) {
explainH = Utils.calculateTextHeight(
'说明:${sunModel.explain}',
ScreenUtil().setSp(24),
FontWeight.normal,
ScreenUtil.screenWidthDp - ScreenUtil().setWidth(92 * 2),
5,
context);
}
return InkWell(
onTap: widget.onPressed,
child: Stack(
... ... @@ -49,137 +63,260 @@ class _CouponItemState extends State<CouponItem> {
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(30)),
padding: EdgeInsets.all(ScreenUtil().setWidth(30)),
decoration: BoxDecoration(
color:
notSelect ? MyColours.color_FFF0E5 : MyColours.color_EEF0F2,
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20))),
boxShadow: [
BoxShadow(
color: MyColours.color_EEF0F2,
blurRadius: ScreenUtil().setWidth(20))
],
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(ScreenUtil().setWidth(20)),
topLeft: Radius.circular(ScreenUtil().setWidth(20)),
topRight: Radius.circular(ScreenUtil().setWidth(20)),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: ScreenUtil().setWidth(360),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
constraints: BoxConstraints(
maxWidth: ScreenUtil().setWidth(190)),
child: Text(
sunModel.aname,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: notSelect
? MyColours.color_F05522
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(44),
fontWeight: FontWeight.bold),
),
width: ScreenUtil().setWidth(335 * 2 - 20),
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(30),
ScreenUtil().setWidth(26 * 2),
ScreenUtil().setWidth(10),
ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
color: notSelect
? MyColours.color_FFF0E5
: MyColours.color_f5f5f5,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(20)),
topRight: Radius.circular(0),
bottomLeft: ObjectUtil.isNotEmpty(sunModel.explain)
? Radius.circular(0)
: Radius.circular(ScreenUtil().setWidth(20)),
),
Expanded(
flex: 1,
child: Container(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(6)),
child: Text('( ${sunModel.desc} )',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: notSelect
? MyColours.color_F05522
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30),
fontWeight: FontWeight.normal)),
))
],
),
),
(ObjectUtil.isNotEmpty(sunModel.stime) &&
sunModel.stime != '0') ||
(ObjectUtil.isNotEmpty(sunModel.etime) &&
sunModel.etime != '0')
? Container(
padding:
EdgeInsets.only(top: ScreenUtil().setWidth(20)),
child: Text(
'有效期:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
style: TextStyle(
color: notSelect
? MyColours.color_EF7249
: MyColours.color_B7B7B7,
fontSize: ScreenUtil().setSp(22))),
)
: Container(),
),
child: Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: ScreenUtil().setWidth(232 * 2),
child: Container(
height: ScreenUtil().setWidth(28 * 2),
constraints: BoxConstraints(
maxWidth: ScreenUtil().setWidth(190)),
child: Text(
sunModel.aname,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: notSelect
? MyColours.color_F05522
: MyColours.color_B0B0B0,
fontSize: ScreenUtil().setSp(40),
fontWeight: FontWeight.bold),
),
)),
Container(
height: ScreenUtil().setWidth(20 * 2),
width: ScreenUtil().setWidth(232 * 2),
child: Text('${sunModel.desc}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: notSelect
? MyColours.color_F05522
: MyColours.color_B0B0B0,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.normal)),
),
VEmptyView(20),
(ObjectUtil.isNotEmpty(sunModel.stime) &&
sunModel.stime != '0') ||
(ObjectUtil.isNotEmpty(sunModel.etime) &&
sunModel.etime != '0')
? Container(
child: Text(
'有效期:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
style: TextStyle(
color: notSelect
? MyColours.color_EF7249
: MyColours.color_B8B8B8,
fontSize: ScreenUtil().setSp(22))),
)
: Container(),
],
),
widget.from == 'select'
? widget.showCheck
? Positioned(
right: 0,
top: ScreenUtil().setWidth(20),
child: Image.asset(
Utils.getImgPath(
widget.couponSonModel.isCheck
? 'check_r'
: 'check_un'),
width: ScreenUtil().setWidth(40),
height: ScreenUtil().setWidth(40),
))
: Container()
: Positioned(
right: 0,
top: ScreenUtil().setWidth(20),
child: widget.showBtn
? RoundButton(
width: ScreenUtil().setWidth(58 * 2),
height: ScreenUtil().setWidth(26 * 2),
radius: ScreenUtil().setWidth(40),
text: notSelect ? '停用' : '启用',
fontSize: 28,
textColor: notSelect
? MyColours.color_F05522
: MyColours.color_999999,
gradientStart: notSelect
? MyColours.color_FFE2D3
: MyColours.color_E9E9E9,
gradientEnd: notSelect
? MyColours.color_FFE2D3
: MyColours.color_E9E9E9,
onPressed: widget.onPressedSwich,
)
: Container())
],
)),
ObjectUtil.isNotEmpty(sunModel.explain)
? Container(
margin: EdgeInsets.only(top: ScreenUtil().setWidth(30)),
padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
width: double.infinity,
child: Text('说明:${sunModel.explain}',
maxLines: 30,
overflow: TextOverflow.ellipsis,
softWrap: false,
style: TextStyle(
? InkWell(
onTap: () {
if (explainH > 19) {
setState(() {
widget.couponSonModel.showText =
!widget.couponSonModel.showText;
});
}
},
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: notSelect
? MyColours.color_EF7249
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24))),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(30))),
? MyColours.color_ffffff
: MyColours.color_FAFAFA,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
ScreenUtil().setWidth(20)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(20)))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.couponSonModel.showText
? Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(30),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(14)),
width: ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(92 * 2),
child: Text('说明:${sunModel.explain}',
maxLines: 5,
style: TextStyle(
color: notSelect
? MyColours.color_999999
: MyColours.color_cccccc,
fontSize:
ScreenUtil().setSp(24))),
)
: Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(30),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(14)),
width: ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(92 * 2) +
ScreenUtil().setWidth(20),
child: Text('说明:${sunModel.explain}',
maxLines: 1,
overflow: TextOverflow.fade,
softWrap: false,
style: TextStyle(
color: notSelect
? MyColours.color_999999
: MyColours.color_cccccc,
fontSize:
ScreenUtil().setSp(24))),
),
Spacer(),
explainH > 19
? Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(12)),
child: Image.asset(
!widget.couponSonModel.showText
? Utils.getImgPath('quan_down')
: Utils.getImgPath('quan_up'),
width: ScreenUtil().setWidth(68),
height: ScreenUtil().setWidth(44)),
)
: Container(),
HEmptyView(14)
],
)),
)
: Container(),
],
),
),
Positioned(
top: ScreenUtil().setWidth(30),
right: ScreenUtil().setWidth(60),
top: 0,
right: ScreenUtil().setWidth(40),
child: Container(
child: ObjectUtil.isNotEmpty(sunModel.explain)
? Image.asset(
Utils.getImgPath(
notSelect ? 'quan_zhi' : 'quan_un_zhi'),
width: ScreenUtil().setWidth(20),
height: ScreenUtil().setWidth(109 * 2))
: Image.asset(
Utils.getImgPath(
notSelect ? 'quan_wan' : 'quan_un_wan'),
width: ScreenUtil().setWidth(20),
height: ScreenUtil().setWidth(109 * 2)),
)),
Positioned(
top: 0,
right: ScreenUtil().setWidth(40),
child: InkWell(
onTap: widget.onPressedSwich,
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('被领取:${sunModel.receiveNum}张',
style: TextStyle(
color: notSelect
? MyColours.color_EF7249
: MyColours.color_B7B7B7,
fontSize: ScreenUtil().setSp(22))),
VEmptyView(5),
Text('已使用:${sunModel.useNum}张',
style: TextStyle(
color: notSelect
? MyColours.color_EF7249
: MyColours.color_B7B7B7,
fontSize: ScreenUtil().setSp(22))),
],
),
HEmptyView(20),
widget.showBtn
? RoundButton(
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(50),
radius: ScreenUtil().setWidth(40),
text: notSelect ? '停用' : '启用',
textColor: notSelect
? MyColours.color_F05522
: MyColours.color_999999,
gradientStart: notSelect
? MyColours.color_FFE2D3
: MyColours.color_E9E9E9,
gradientEnd: notSelect
? MyColours.color_FFE2D3
: MyColours.color_E9E9E9,
onPressed: widget.onPressedSwich,
)
: Container()
],
child: Container(
constraints:
BoxConstraints(maxWidth: ScreenUtil().setWidth(335 * 2)),
decoration: BoxDecoration(
color: notSelect
? MyColours.color_FFE1CB
: MyColours.color_EEF0F2,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(ScreenUtil().setWidth(20)),
topRight: Radius.circular(ScreenUtil().setWidth(20)),
bottomRight:
Radius.circular(ScreenUtil().setWidth(20)))),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(2)),
child: Text(
'被领取:${sunModel.receiveNum}张 已使用:${sunModel.useNum}张',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: notSelect
? MyColours.color_EF7249
: MyColours.color_B7B7B7,
fontSize: ScreenUtil().setSp(20))),
),
),
)
... ...
... ... @@ -81,6 +81,7 @@ class _CouponPageState extends State<CouponPage> {
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_fefefe,
appBar: SystemAppBar('线上券', rightImgName: '历史券', onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
... ...
... ... @@ -65,25 +65,68 @@ class _CouponSelectPageState extends State<CouponSelectPage> {
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
return Scaffold(
appBar: SystemAppBar(
'优惠券',
onTap: () {
Navigator.pop(context);
Utils.changeStatusColor(color: Colors.transparent);
},
rightImgName: !widget.hasModify &&
couponProvider.pageStateSelect == PageState.Success
? couponProvider.checkValue
? '取消全选'
: '全选'
: '',
onTapRight: () {
if (couponProvider.checkValue) {
couponProvider.cancelAll();
} else {
couponProvider.addAll();
}
},
appBar: AppBar(
elevation: 0,
leading: InkWell(
onTap: () {
Navigator.pop(context);
Utils.changeStatusColor(color: Colors.transparent);
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(15)),
child: Row(
children: <Widget>[
Image.asset(
"assets/icon_back.png",
width: ScreenUtil().setWidth(20),
height: ScreenUtil().setWidth(31),
)
],
)),
),
title: Text(
'优惠券',
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(34),
decoration: TextDecoration.none),
),
actions: <Widget>[
!widget.hasModify &&
couponProvider.pageStateSelect == PageState.Success
? InkWell(
onTap: () {
if (couponProvider.checkValue) {
couponProvider.cancelAll();
} else {
couponProvider.addAll();
}
},
child: Padding(
padding:
EdgeInsets.only(right: ScreenUtil().setWidth(40)),
child: Row(children: [
Container(
// color: Colors.red,
alignment: Alignment.center,
child: Text(
'全选',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(34)),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath(couponProvider.checkValue
? 'check_g'
: 'check_un'),
width: ScreenUtil().setWidth(40))
])))
: Container()
],
centerTitle: true, // 标题居中
),
body: WillPopScope(
child: Column(
... ... @@ -109,61 +152,63 @@ class _CouponSelectPageState extends State<CouponSelectPage> {
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return VEmptyView(40);
}, childCount: 1),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return InkWell(
onTap: () {
couponProvider.couponListSelect[index].isCheck =
!couponProvider
.couponListSelect[index].isCheck;
if (couponProvider
.couponListSelect[index].isCheck) {
couponProvider.addData(index);
} else {
couponProvider.cancelData(index);
}
couponProvider.getCheckValue();
},
child: Row(
children: [
HEmptyView(30),
!widget.hasModify
? Checkbox(
value: couponProvider
.couponListSelect[index].isCheck,
checkColor: MyColours.color_ffffff,
activeColor: MyColours.app_main,
onChanged: (bool value) {
//改这里 ******8
couponProvider.couponListSelect[index]
.isCheck =
!couponProvider
.couponListSelect[index]
.isCheck;
if (couponProvider
.couponListSelect[index]
.isCheck) {
couponProvider.addData(index);
} else {
couponProvider.cancelData(index);
}
couponProvider.getCheckValue();
},
)
: Container(),
// Image.asset(
// couponProvider.listData[index]['checked']
// ? 'assets/select.png'
// : 'assets/unselect.png',
// width: ScreenUtil().setWidth(44)),
Expanded(
child: CouponItem(
onTap: () {
couponProvider.couponListSelect[index].isCheck =
!couponProvider
.couponListSelect[index].isCheck;
if (couponProvider
.couponListSelect[index].isCheck) {
couponProvider.addData(index);
} else {
couponProvider.cancelData(index);
}
couponProvider.getCheckValue();
},
// child: Row(
// children: [
// HEmptyView(30),
// !widget.hasModify
// ? Checkbox(
// value: couponProvider
// .couponListSelect[index].isCheck,
// checkColor: MyColours.color_ffffff,
// activeColor: MyColours.app_main,
// onChanged: (bool value) {},
// )
// : Container(),
// Image.asset(
// couponProvider.listData[index]['checked']
// ? 'assets/select.png'
// : 'assets/unselect.png',
// width: ScreenUtil().setWidth(44)),
child: CouponItem(
from: 'select',
showCheck: !widget.hasModify,
couponSonModel:
couponProvider.couponListSelect[index],
onPressed: () {},
))
],
),
);
onPressed: () {
//改这里 ******8
if (!widget.hasModify) {
couponProvider
.couponListSelect[index].isCheck =
!couponProvider
.couponListSelect[index].isCheck;
if (couponProvider
.couponListSelect[index].isCheck) {
couponProvider.addData(index);
} else {
couponProvider.cancelData(index);
}
couponProvider.getCheckValue();
}
}));
}, childCount: couponProvider.couponListSelect.length),
)
],
... ...
... ... @@ -6,6 +6,8 @@ import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
... ... @@ -101,7 +103,7 @@ class InvicationPageState extends State<InvicationPage> {
Widget _middleWidget(String title, String content) {
return Column(
children: <Widget>[
VEmptyView(38),
VEmptyView(80),
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
... ... @@ -115,8 +117,8 @@ class InvicationPageState extends State<InvicationPage> {
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(13)),
child: Text(title,
style: TextStyle(
color: MyColours.color_eadab9,
fontSize: ScreenUtil().setSp(32))),
color: MyColours.color_CEB689,
fontSize: ScreenUtil().setSp(28))),
),
Image.asset(
"assets/invication_line_right.png",
... ... @@ -130,8 +132,8 @@ class InvicationPageState extends State<InvicationPage> {
child: Text(
content,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(34)),
color: MyColours.color_F2F2F2,
fontSize: ScreenUtil().setSp(36)),
),
)
],
... ... @@ -169,8 +171,8 @@ class InvicationPageState extends State<InvicationPage> {
children: <Widget>[
Image.asset(
"assets/img_ydap.png",
width: ScreenUtil().setWidth(500),
height: ScreenUtil().setHeight(300),
width: ScreenUtil().setWidth(190 * 2),
height: ScreenUtil().setHeight(200),
),
VEmptyView(69),
Row(
... ... @@ -179,7 +181,7 @@ class InvicationPageState extends State<InvicationPage> {
Container(
width: ScreenUtil().setWidth(108),
height: ScreenUtil().setHeight(2),
color: MyColours.color_ffffff,
color: MyColours.color_979797,
),
Container(
width: ScreenUtil().setWidth(442),
... ... @@ -187,7 +189,7 @@ class InvicationPageState extends State<InvicationPage> {
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_ffffff,
color: MyColours.color_979797,
width:
ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.all(
... ... @@ -196,14 +198,14 @@ class InvicationPageState extends State<InvicationPage> {
child: Text(
"订包间,用周到安排",
style: TextStyle(
color: MyColours.color_ffffff,
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28)),
),
),
Container(
width: ScreenUtil().setWidth(108),
height: ScreenUtil().setHeight(2),
color: MyColours.color_ffffff,
color: MyColours.color_979797,
),
],
),
... ... @@ -211,7 +213,7 @@ class InvicationPageState extends State<InvicationPage> {
_middleWidget("包间",
widget.tableInfo.replaceAll("\n", "")),
_middleWidget("时间", dateTimeStr),
VEmptyView(38),
VEmptyView(80),
Column(
children: <Widget>[
Row(
... ... @@ -229,9 +231,9 @@ class InvicationPageState extends State<InvicationPage> {
child: Text("地址导航",
style: TextStyle(
color:
MyColours.color_eadab9,
MyColours.color_CEB689,
fontSize: ScreenUtil()
.setSp(32))),
.setSp(28))),
),
Image.asset(
"assets/invication_arrow_right.png",
... ... @@ -246,8 +248,8 @@ class InvicationPageState extends State<InvicationPage> {
child: Text(
user.sellerAddr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(34)),
color: MyColours.color_F2F2F2,
fontSize: ScreenUtil().setSp(36)),
),
)
],
... ... @@ -271,15 +273,20 @@ class InvicationPageState extends State<InvicationPage> {
NavigatorUtil.goSmsPage(context, widget.rid);
},
child: Container(
width: ScreenUtil().setWidth(232),
width: ScreenUtil().setWidth(135 * 2),
height: double.infinity,
color: MyColours.color_000000,
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_262628,
border: Border(
top: BorderSide(
width: ScreenUtil().setWidth(1),
color: MyColours.color_ECD9B7))),
child: Text(
"发短信",
style: TextStyle(
color: MyColours.color_eadab9,
fontSize: ScreenUtil().setSp(34)),
color: MyColours.color_ECD9B7,
fontSize: ScreenUtil().setSp(28)),
),
),
),
... ... @@ -317,13 +324,13 @@ class InvicationPageState extends State<InvicationPage> {
child: Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_e3d2ac,
color: MyColours.color_ECD9B7,
alignment: Alignment.center,
child: Text(
"通知客户",
style: TextStyle(
color: MyColours.color_83734d,
fontSize: ScreenUtil().setSp(34)),
color: MyColours.color_7B512A,
fontSize: ScreenUtil().setSp(30)),
),
),
),
... ... @@ -357,9 +364,9 @@ class InvicationPageState extends State<InvicationPage> {
),
),
Positioned(
left: ScreenUtil().setWidth(180),
bottom: ScreenUtil().setWidth(130),
right: ScreenUtil().setWidth(180),
// left: ScreenUtil().setWidth(180),
bottom: ScreenUtil().setWidth(110),
right: ScreenUtil().setWidth(40),
child: couponProvider.hasModify ||
couponProvider.coupons.length > 0 ||
couponProvider.couponListSelect.length > 0
... ... @@ -370,27 +377,55 @@ class InvicationPageState extends State<InvicationPage> {
hasModify: couponProvider.hasModify);
},
behavior: HitTestBehavior.opaque,
child: Center(
child: Container(
// width: ScreenUtil().setWidth(400),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(20)),
// height: ScreenUtil().setWidth(100),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(20))),
child: Text(
'共赠送${couponProvider.coupons.length}张优惠券\n点击查看',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
),
),
),
),
)
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(16)),
height: ScreenUtil().setWidth(35 * 2),
decoration: BoxDecoration(
color: MyColours.color_000000,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(20))),
child: Row(
children: [
Text(
'并赠送给顾客${couponProvider.coupons.length}张优惠券',
textAlign: TextAlign.center,
style: TextStyle(
color: MyColours.color_f5f5f5,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(28),
),
),
HEmptyView(40),
RoundButton(
width: ScreenUtil().setWidth(124),
height: ScreenUtil().setWidth(46),
text: '点击查看',
textColor: MyColours.color_FDA31D,
fontSize: 24,
isBold: true,
radius: ScreenUtil().setWidth(10),
gradientStart: MyColours.color_f5f5f5,
gradientEnd: MyColours.color_f5f5f5,
onPressed: () async {
NavigatorUtil.goCouponSelectPage(
context,
rid: widget.rid,
hasModify:
couponProvider.hasModify);
},
)
],
)),
Image.asset(Utils.getImgPath('jian'),
width: ScreenUtil().setWidth(28),
height: ScreenUtil().setWidth(20))
],
))
: Container(),
)
],
... ...
... ... @@ -67,4 +67,15 @@ class MyColours {
static const Color color_EEF0F2 = Color(0xffEEF0F2);
static const Color color_B7B7B7 = Color(0xffB7B7B7);
static const Color color_E9E9E9 = Color(0xffE9E9E9);
static const Color color_B0B0B0 = Color(0xffB0B0B0);
static const Color color_B8B8B8 = Color(0xffB8B8B8);
static const Color color_FFE1CB = Color(0xffFFE1CB);
static const Color color_F9F9F9 = Color(0xffF9F9F9);
static const Color color_979797 = Color(0xff979797);
static const Color color_CEB689 = Color(0xffCEB689);
static const Color color_F2F2F2 = Color(0xffF2F2F2);
static const Color color_ECD9B7 = Color(0xffECD9B7);
static const Color color_7B512A = Color(0xff7B512A);
static const Color color_262628 = Color(0xff262628);
static const Color color_FDA31D = Color(0xffFDA31D);
}
... ...
... ... @@ -22,6 +22,33 @@ import '../app.dart';
typedef BookTimeSetCallback = void Function(bool needChange);
class Utils {
///value: 文本内容;fontSize : 文字的大小;fontWeight:文字权重;maxWidth:文本框的最大宽度;maxLines:文本支持最大多少行
static double calculateTextHeight(
String value,
fontSize,
FontWeight fontWeight,
double maxWidth,
int maxLines,
BuildContext context) {
// value = filterText(value);
TextPainter painter = TextPainter(
///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。
locale: Localizations.localeOf(context, nullOk: true),
maxLines: maxLines,
textDirection: TextDirection.ltr,
text: TextSpan(
text: value,
style: TextStyle(
fontWeight: fontWeight,
fontSize: fontSize,
)));
painter.layout(maxWidth: maxWidth);
///文字的宽度:painter.width
return painter.height;
}
static getDateStrFromJiekou(String ms) {
return DateUtil.formatDate(
DateTime.fromMillisecondsSinceEpoch(int.parse(ms) * 1000),
... ...
... ... @@ -206,6 +206,7 @@ flutter:
- assets/bg_error.png
- assets/mine_radio_nor.png
- assets/mine_radio_sel.png
# assets:
# - images/a_dot_burr.jpeg
... ...