Commit f096b86d2123794b4c061396ae90bb42d6b2a07c

Authored by wdn127929
1 parent ce4ace9c

部分

  1 +{
  2 + "dart.flutterCreateOrganization": null
  3 +}
@@ -111,7 +111,7 @@ dependencies { @@ -111,7 +111,7 @@ dependencies {
111 implementation 'com.tencent.tpns:xiaomi:1.2.0.3-release' // 小米推送 111 implementation 'com.tencent.tpns:xiaomi:1.2.0.3-release' // 小米推送
112 implementation 'com.tencent.tpns:oppo:1.2.0.3-release' // OPPO 推送 112 implementation 'com.tencent.tpns:oppo:1.2.0.3-release' // OPPO 推送
113 implementation 'com.tencent.tpns:vivo:1.2.0.3-release' // vivo 推送 113 implementation 'com.tencent.tpns:vivo:1.2.0.3-release' // vivo 推送
114 - implementation 'com.amap.api:location:latest.integration' 114 + implementation 'com.amap.api:location:4.7.0'
115 implementation 'com.zhihu.android:matisse:0.5.3-beta3' 115 implementation 'com.zhihu.android:matisse:0.5.3-beta3'
116 implementation 'com.github.bumptech.glide:glide:4.11.0' 116 implementation 'com.github.bumptech.glide:glide:4.11.0'
117 annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' 117 annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
@@ -3,6 +3,9 @@ buildscript { @@ -3,6 +3,9 @@ buildscript {
3 repositories { 3 repositories {
4 google() 4 google()
5 jcenter() 5 jcenter()
  6 + // maven { url 'https://maven.aliyun.com/repository/google' }
  7 + // maven { url 'https://maven.aliyun.com/repository/jcenter' }
  8 + // maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
6 9
7 maven {url 'http://developer.huawei.com/repo/'} 10 maven {url 'http://developer.huawei.com/repo/'}
8 } 11 }
@@ -18,6 +21,9 @@ allprojects { @@ -18,6 +21,9 @@ allprojects {
18 repositories { 21 repositories {
19 google() 22 google()
20 jcenter() 23 jcenter()
  24 + // maven { url 'https://maven.aliyun.com/repository/google' }
  25 + // maven { url 'https://maven.aliyun.com/repository/jcenter' }
  26 + // maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
21 27
22 maven {url 'http://developer.huawei.com/repo/'} 28 maven {url 'http://developer.huawei.com/repo/'}
23 } 29 }
  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:one_key/models/coupon_model.dart';
  5 +import 'package:one_key/provider/coupon_provider.dart';
  6 +import 'package:one_key/res/colors.dart';
  7 +import 'package:one_key/utils/utils.dart';
  8 +import 'package:one_key/widgets/dashed_line_widget.dart';
  9 +import 'package:one_key/widgets/h_empty_view.dart';
  10 +import 'package:one_key/widgets/round_button.dart';
  11 +import 'package:one_key/widgets/v_empty_view.dart';
  12 +
  13 +class CouponItemF extends StatefulWidget {
  14 + final String from;
  15 + final VoidCallback onPressed;
  16 + final VoidCallback onPressedSwich;
  17 + final CouponSunModel couponSonModel;
  18 + final bool showBtn;
  19 + final bool showCheck;
  20 + CouponItemF(
  21 + {Key key,
  22 + this.from,
  23 + this.onPressed,
  24 + this.onPressedSwich,
  25 + this.couponSonModel,
  26 + this.showBtn = false,
  27 + this.showCheck = false})
  28 + : super(key: key);
  29 +
  30 + @override
  31 + _CouponItemFState createState() => _CouponItemFState();
  32 +}
  33 +
  34 +class _CouponItemFState extends State<CouponItemF> {
  35 + // bool showText = false;
  36 + @override
  37 + Widget build(BuildContext context) {
  38 + CouponSunModel sunModel = widget.couponSonModel;
  39 + bool notSelect = false;
  40 + if (widget.from == 'history') {
  41 + notSelect = false;
  42 + } else {
  43 + notSelect = sunModel.isOpenBool;
  44 + }
  45 + double explainH = 0.0;
  46 +
  47 + if (ObjectUtil.isNotEmpty(sunModel.explain)) {
  48 + explainH = Utils.calculateTextHeight(
  49 + '说明:${sunModel.explain}',
  50 + ScreenUtil().setSp(24),
  51 + FontWeight.normal,
  52 + ScreenUtil.screenWidthDp - ScreenUtil().setWidth(92 * 2),
  53 + 5,
  54 + context);
  55 + }
  56 + return Stack(children: [
  57 + InkWell(
  58 + onTap: widget.onPressed,
  59 + child: Container(
  60 + // width: ScreenUtil().setWidth(610),
  61 + margin: EdgeInsets.fromLTRB(
  62 + ScreenUtil().setWidth(40),
  63 + ScreenUtil().setWidth(0),
  64 + ScreenUtil().setWidth(40),
  65 + ScreenUtil().setWidth(32)),
  66 + decoration: BoxDecoration(
  67 + color: MyColours.color_ffffff,
  68 + boxShadow: [
  69 + BoxShadow(
  70 + spreadRadius: ScreenUtil().setWidth(2),
  71 + color: Color.fromRGBO(0, 0, 0, 0.25),
  72 + offset: Offset(0, ScreenUtil().setWidth(8)),
  73 + blurRadius: ScreenUtil().setWidth(8))
  74 + ],
  75 + borderRadius: BorderRadius.all(
  76 + Radius.circular(ScreenUtil().setWidth(16)),
  77 + ),
  78 + ),
  79 + child: Column(
  80 + mainAxisSize: MainAxisSize.min,
  81 + crossAxisAlignment: CrossAxisAlignment.start,
  82 + children: [
  83 + Container(
  84 + height: ScreenUtil().setWidth(40),
  85 + padding: EdgeInsets.symmetric(
  86 + horizontal: ScreenUtil().setWidth(24)),
  87 + decoration: BoxDecoration(
  88 + color: notSelect
  89 + ? MyColours.color_438E93
  90 + : MyColours.color_999999,
  91 + borderRadius: BorderRadius.only(
  92 + topLeft: Radius.circular(ScreenUtil().setWidth(16)),
  93 + topRight:
  94 + Radius.circular(ScreenUtil().setWidth(16)))),
  95 + child: Row(
  96 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  97 + children: [
  98 + Text(
  99 + '店铺优惠券(核销)',
  100 + style: TextStyle(
  101 + color: MyColours.color_ffffff,
  102 + fontSize: ScreenUtil().setSp(24)),
  103 + ),
  104 + InkWell(
  105 + onTap: widget.onPressedSwich,
  106 + child: Text(
  107 + '被领取:${sunModel.receiveNum}张 已使用:${sunModel.useNum}张',
  108 + maxLines: 1,
  109 + overflow: TextOverflow.ellipsis,
  110 + style: TextStyle(
  111 + color: MyColours.color_ffffff,
  112 + fontSize: ScreenUtil().setSp(20))),
  113 + ),
  114 + ],
  115 + ),
  116 + ),
  117 + Container(
  118 + padding: EdgeInsets.fromLTRB(
  119 + ScreenUtil().setWidth(30),
  120 + ScreenUtil().setWidth(9 * 2),
  121 + ScreenUtil().setWidth(10),
  122 + ScreenUtil().setWidth(20)),
  123 + child: Column(
  124 + crossAxisAlignment: CrossAxisAlignment.start,
  125 + children: [
  126 + Container(
  127 + width: ScreenUtil().setWidth(232 * 2),
  128 + child: Container(
  129 + height: ScreenUtil().setWidth(25 * 2),
  130 + constraints: BoxConstraints(
  131 + maxWidth: ScreenUtil().setWidth(190)),
  132 + child: Text(
  133 + sunModel.aname,
  134 + maxLines: 2,
  135 + overflow: TextOverflow.ellipsis,
  136 + style: TextStyle(
  137 + color: notSelect
  138 + ? MyColours.color_515151
  139 + : MyColours.color_999999,
  140 + fontSize: ScreenUtil().setSp(36),
  141 + fontWeight: FontWeight.bold),
  142 + ),
  143 + )),
  144 + Container(
  145 + height: ScreenUtil().setWidth(14 * 2),
  146 + width: ScreenUtil().setWidth(232 * 2),
  147 + child: Text('${sunModel.desc}',
  148 + maxLines: 1,
  149 + overflow: TextOverflow.ellipsis,
  150 + style: TextStyle(
  151 + color: notSelect
  152 + ? MyColours.color_515151
  153 + : MyColours.color_999999,
  154 + fontSize: ScreenUtil().setSp(20),
  155 + )),
  156 + ),
  157 + VEmptyView(16),
  158 + (ObjectUtil.isNotEmpty(sunModel.stime) &&
  159 + sunModel.stime != '0') ||
  160 + (ObjectUtil.isNotEmpty(sunModel.etime) &&
  161 + sunModel.etime != '0')
  162 + ? Container(
  163 + child: Text(
  164 + '使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
  165 + style: TextStyle(
  166 + color: MyColours.color_999999,
  167 + fontSize: ScreenUtil().setSp(20))),
  168 + )
  169 + : Container(),
  170 + ],
  171 + ),
  172 + // widget.from == 'select'
  173 + // ? widget.showCheck
  174 + // ? Positioned(
  175 + // right: 0,
  176 + // top: ScreenUtil().setWidth(20),
  177 + // child: Image.asset(
  178 + // Utils.getImgPath(widget.couponSonModel.isCheck
  179 + // ? 'check_r'
  180 + // : 'check_un'),
  181 + // width: ScreenUtil().setWidth(40),
  182 + // height: ScreenUtil().setWidth(40),
  183 + // ))
  184 + // : Container()
  185 + // :
  186 + ),
  187 + const MySeparator(
  188 + width: 3, color: MyColours.color_f3f3f3),
  189 + ObjectUtil.isNotEmpty(sunModel.explain)
  190 + ? InkWell(
  191 + onTap: () {
  192 + if (explainH > 19) {
  193 + setState(() {
  194 + widget.couponSonModel.showText =
  195 + !widget.couponSonModel.showText;
  196 + });
  197 + }
  198 + },
  199 + child: Container(
  200 + width: double.infinity,
  201 + decoration: BoxDecoration(
  202 + color: notSelect
  203 + ? MyColours.color_ffffff
  204 + : MyColours.color_FAFAFA,
  205 + borderRadius: BorderRadius.only(
  206 + bottomLeft: Radius.circular(
  207 + ScreenUtil().setWidth(20)),
  208 + bottomRight: Radius.circular(
  209 + ScreenUtil().setWidth(20)))),
  210 + child: Row(
  211 + crossAxisAlignment: CrossAxisAlignment.start,
  212 + children: [
  213 + widget.couponSonModel.showText
  214 + ? Container(
  215 + padding: EdgeInsets.fromLTRB(
  216 + ScreenUtil().setWidth(30),
  217 + ScreenUtil().setWidth(14),
  218 + ScreenUtil().setWidth(0),
  219 + ScreenUtil().setWidth(14)),
  220 + width: ScreenUtil.screenWidthDp -
  221 + ScreenUtil().setWidth(92 * 2),
  222 + child: Text('说明:${sunModel.explain}',
  223 + maxLines: 5,
  224 + style: TextStyle(
  225 + color: MyColours.color_999999,
  226 + fontSize:
  227 + ScreenUtil().setSp(20))),
  228 + )
  229 + : Container(
  230 + padding: EdgeInsets.fromLTRB(
  231 + ScreenUtil().setWidth(30),
  232 + ScreenUtil().setWidth(14),
  233 + ScreenUtil().setWidth(0),
  234 + ScreenUtil().setWidth(14)),
  235 + width: ScreenUtil.screenWidthDp -
  236 + ScreenUtil().setWidth(92 * 2) +
  237 + ScreenUtil().setWidth(20),
  238 + child: Text('说明:${sunModel.explain}',
  239 + maxLines: 1,
  240 + overflow: TextOverflow.fade,
  241 + softWrap: false,
  242 + style: TextStyle(
  243 + color: MyColours.color_999999,
  244 + fontSize:
  245 + ScreenUtil().setSp(20))),
  246 + ),
  247 + Spacer(),
  248 + explainH > 19
  249 + ? Container(
  250 + margin: EdgeInsets.only(
  251 + top: ScreenUtil().setWidth(12)),
  252 + child: Image.asset(
  253 + !widget.couponSonModel.showText
  254 + ? Utils.getImgPath('quan_down')
  255 + : Utils.getImgPath('quan_up'),
  256 + width: ScreenUtil().setWidth(68),
  257 + height: ScreenUtil().setWidth(44)),
  258 + )
  259 + : Container(),
  260 + HEmptyView(14)
  261 + ],
  262 + )),
  263 + )
  264 + : Container(),
  265 + ],
  266 + ),
  267 + )),
  268 + Positioned(
  269 + right: ScreenUtil().setWidth(100),
  270 + top: ScreenUtil().setWidth(37 * 2),
  271 + child: widget.showBtn
  272 + ? RoundButton(
  273 + width: ScreenUtil().setWidth(32 * 2),
  274 + height: ScreenUtil().setWidth(21 * 2),
  275 + radius: ScreenUtil().setWidth(10),
  276 + text: notSelect ? '停用' : '启用',
  277 + fontSize: 24,
  278 + textColor: notSelect
  279 + ? MyColours.color_438E93
  280 + : MyColours.color_999999,
  281 + gradientStart: MyColours.color_ffffff,
  282 + gradientEnd: MyColours.color_ffffff,
  283 + borderColor: notSelect
  284 + ? MyColours.color_438E93
  285 + : MyColours.color_999999,
  286 + onPressed: widget.onPressedSwich,
  287 + )
  288 + : Container())
  289 + ]);
  290 + }
  291 +}
@@ -3,6 +3,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; @@ -3,6 +3,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart';
3 import 'package:flutter_screenutil/screenutil.dart'; 3 import 'package:flutter_screenutil/screenutil.dart';
4 import 'package:one_key/constant/state.dart'; 4 import 'package:one_key/constant/state.dart';
5 import 'package:one_key/pages/coupon/coupon_item.dart'; 5 import 'package:one_key/pages/coupon/coupon_item.dart';
  6 +import 'package:one_key/pages/coupon/coupon_item_f.dart';
6 import 'package:one_key/provider/coupon_provider.dart'; 7 import 'package:one_key/provider/coupon_provider.dart';
7 import 'package:one_key/provider/user_model.dart'; 8 import 'package:one_key/provider/user_model.dart';
8 import 'package:one_key/res/colors.dart'; 9 import 'package:one_key/res/colors.dart';
@@ -26,9 +27,10 @@ class CouponPage extends StatefulWidget { @@ -26,9 +27,10 @@ class CouponPage extends StatefulWidget {
26 _CouponPageState createState() => _CouponPageState(); 27 _CouponPageState createState() => _CouponPageState();
27 } 28 }
28 29
29 -class _CouponPageState extends State<CouponPage> { 30 +class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
30 EasyRefreshController _controller = EasyRefreshController(); 31 EasyRefreshController _controller = EasyRefreshController();
31 CouponProvider couponProvider; 32 CouponProvider couponProvider;
  33 + TabController tabController;
32 34
33 ///获取优惠券列表数据 35 ///获取优惠券列表数据
34 _couponNetworkData({bool isShowLoading = true}) async { 36 _couponNetworkData({bool isShowLoading = true}) async {
@@ -63,6 +65,15 @@ class _CouponPageState extends State<CouponPage> { @@ -63,6 +65,15 @@ class _CouponPageState extends State<CouponPage> {
63 void initState() { 65 void initState() {
64 // TODO: implement initState 66 // TODO: implement initState
65 super.initState(); 67 super.initState();
  68 + tabController = TabController(length: 3, vsync: this);
  69 + tabController.addListener(() {
  70 + //点击tab时或滑动tab回调一次
  71 + // if (tabController.index.toDouble() == tabController.animation.value) {
  72 + // getMessage(index: tabController.index);
  73 + // selectIndex = tabController.index;
  74 + setState(() {});
  75 + // }
  76 + });
66 WidgetsBinding.instance.addPostFrameCallback((_) { 77 WidgetsBinding.instance.addPostFrameCallback((_) {
67 _couponNetworkData(); 78 _couponNetworkData();
68 }); 79 });
@@ -82,7 +93,7 @@ class _CouponPageState extends State<CouponPage> { @@ -82,7 +93,7 @@ class _CouponPageState extends State<CouponPage> {
82 Widget build(BuildContext context) { 93 Widget build(BuildContext context) {
83 couponProvider = Provider.of<CouponProvider>(context, listen: true); 94 couponProvider = Provider.of<CouponProvider>(context, listen: true);
84 return Scaffold( 95 return Scaffold(
85 - backgroundColor: MyColours.color_fefefe, 96 + backgroundColor: MyColours.color_f3f3f3,
86 appBar: SystemAppBar('线上券', rightImgName: '历史券', onTap: () { 97 appBar: SystemAppBar('线上券', rightImgName: '历史券', onTap: () {
87 if (widget.needRefrsh) { 98 if (widget.needRefrsh) {
88 EventBus().emit('refresh_coupon_invitation'); 99 EventBus().emit('refresh_coupon_invitation');
@@ -95,18 +106,52 @@ class _CouponPageState extends State<CouponPage> { @@ -95,18 +106,52 @@ class _CouponPageState extends State<CouponPage> {
95 NavigatorUtil.goCouponHistoryPage(context); 106 NavigatorUtil.goCouponHistoryPage(context);
96 }), 107 }),
97 body: WillPopScope( 108 body: WillPopScope(
98 - onWillPop: () {  
99 - if (widget.needRefrsh) {  
100 - EventBus().emit('refresh_coupon_invitation');  
101 - } else {  
102 - EventBus().emit('changeStatusColor');  
103 - }  
104 - Navigator.of(context).pop();  
105 - },  
106 - child: Column(  
107 - children: [  
108 - Expanded(child: Consumer<CouponProvider>(  
109 - builder: (context, model, _) { 109 + onWillPop: () {
  110 + if (widget.needRefrsh) {
  111 + EventBus().emit('refresh_coupon_invitation');
  112 + } else {
  113 + EventBus().emit('changeStatusColor');
  114 + }
  115 + Navigator.of(context).pop();
  116 + },
  117 + child: Column(
  118 + children: <Widget>[
  119 + Container(
  120 + width: double.infinity,
  121 + height: ScreenUtil().setWidth(80),
  122 + color: MyColours.color_ffffff,
  123 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(6)),
  124 + child: TabBar(
  125 + controller: tabController,
  126 + tabs: [
  127 + Tab(
  128 + text: "全部",
  129 + ),
  130 + Tab(
  131 + text: "店铺优惠券",
  132 + ),
  133 + Tab(
  134 + text: "我的优惠券",
  135 + )
  136 + ],
  137 + indicatorColor: MyColours.color_438E93,
  138 + indicatorSize: TabBarIndicatorSize.label,
  139 + indicatorWeight: ScreenUtil().setWidth(4),
  140 + labelColor: MyColours.color_438E93,
  141 + unselectedLabelColor: MyColours.color_999999,
  142 + labelStyle: TextStyle(
  143 + color: MyColours.color_438E93,
  144 + fontSize: ScreenUtil().setSp(28),
  145 + fontWeight: FontWeight.bold),
  146 + unselectedLabelStyle: TextStyle(
  147 + color: MyColours.color_999999,
  148 + fontSize: ScreenUtil().setSp(24),
  149 + ),
  150 + )),
  151 + VEmptyView(11),
  152 + Expanded(
  153 + child: TabBarView(controller: tabController, children: [
  154 + Consumer<CouponProvider>(builder: (context, model, _) {
110 if (model.pageState != PageState.Success) { 155 if (model.pageState != PageState.Success) {
111 return ExceptionPage( 156 return ExceptionPage(
112 pageState: model.pageState, 157 pageState: model.pageState,
@@ -127,29 +172,7 @@ class _CouponPageState extends State<CouponPage> { @@ -127,29 +172,7 @@ class _CouponPageState extends State<CouponPage> {
127 SliverList( 172 SliverList(
128 delegate: SliverChildBuilderDelegate( 173 delegate: SliverChildBuilderDelegate(
129 (BuildContext context, int index) { 174 (BuildContext context, int index) {
130 - return Container(  
131 - margin:  
132 - EdgeInsets.all(ScreenUtil().setWidth(40)),  
133 - padding:  
134 - EdgeInsets.all(ScreenUtil().setWidth(30)),  
135 - color: MyColours.color_F0F0F0,  
136 - child: Text(  
137 - '使用说明:需在结账前出示优惠券二维码,店内工作人员微信扫码核销。超过有效期的券,会自动作废并移出列表。优惠券不可找零、兑现。',  
138 - style: TextStyle(  
139 - color: MyColours.color_666666,  
140 - fontSize: ScreenUtil().setSp(24),  
141 - ),  
142 - strutStyle: StrutStyle(  
143 - forceStrutHeight: true,  
144 - height: 1,  
145 - leading: 0.3),  
146 - ));  
147 - }, childCount: 1),  
148 - ),  
149 - SliverList(  
150 - delegate: SliverChildBuilderDelegate(  
151 - (BuildContext context, int index) {  
152 - return CouponItem( 175 + return CouponItemF(
153 from: 'quan', 176 from: 'quan',
154 couponSonModel: 177 couponSonModel:
155 couponProvider.couponList[index], 178 couponProvider.couponList[index],
@@ -178,31 +201,154 @@ class _CouponPageState extends State<CouponPage> { @@ -178,31 +201,154 @@ class _CouponPageState extends State<CouponPage> {
178 // }, 201 // },
179 ); 202 );
180 } 203 }
181 - },  
182 - )),  
183 - VEmptyView(20),  
184 - Padding(  
185 - padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,  
186 - ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),  
187 - child: RoundButton(  
188 - onPressed: () async {  
189 - bool needRefresh =  
190 - await NavigatorUtil.goCouponEditPage(context);  
191 - print(needRefresh);  
192 - if (needRefresh != null && needRefresh) {  
193 - //刷新页面数据  
194 - // _controller.callRefresh();  
195 - _couponNetworkData();  
196 - }  
197 - },  
198 - text: '创建新券',  
199 - fontSize: 34,  
200 - isBold: false,  
201 - height: ScreenUtil().setWidth(80),  
202 - width: double.infinity,  
203 - radius: ScreenUtil().setWidth(10),  
204 - ))  
205 - ],  
206 - ))); 204 + }),
  205 + Container(
  206 + width: 100,
  207 + height: 100,
  208 + color: Colors.blue,
  209 + ),
  210 + Container(
  211 + width: 100,
  212 + height: 100,
  213 + color: Colors.purple,
  214 + )
  215 + // MessageOnlineCheckPage()
  216 + ]),
  217 + ),
  218 + Container(
  219 + height: ScreenUtil().setWidth(91 * 2),
  220 + width: double.infinity,
  221 + padding: EdgeInsets.only(
  222 + top: ScreenUtil().setWidth(16 * 2),
  223 + bottom: ScreenUtil().setWidth(35 * 2),
  224 + left: ScreenUtil().setWidth(45 * 2),
  225 + right: ScreenUtil().setWidth(45 * 2),
  226 + ),
  227 + decoration: BoxDecoration(
  228 + color: MyColours.color_ffffff,
  229 + boxShadow: [
  230 + BoxShadow(
  231 + spreadRadius: ScreenUtil().setWidth(2),
  232 + color: Color.fromRGBO(0, 0, 0, 0.1),
  233 + offset: Offset(0, ScreenUtil().setWidth(-2)),
  234 + blurRadius: ScreenUtil().setWidth(8))
  235 + ],
  236 + borderRadius: BorderRadius.all(
  237 + Radius.circular(ScreenUtil().setWidth(16)),
  238 + ),
  239 + ),
  240 + child: RoundButton(
  241 + text: '创建新的优惠券',
  242 + height: ScreenUtil().setWidth(80),
  243 + radius: ScreenUtil().setWidth(14),
  244 + isBold: false,
  245 + fontSize: 28,
  246 + onPressed: () {},
  247 + ),
  248 + )
  249 + ],
  250 + ),
  251 + // child: Column(
  252 + // children: [
  253 + // Expanded(child: Consumer<CouponProvider>(
  254 + // builder: (context, model, _) {
  255 + // if (model.pageState != PageState.Success) {
  256 + // return ExceptionPage(
  257 + // pageState: model.pageState,
  258 + // callback: () {
  259 + // // offset = 0;
  260 + // // getMessage(showLoading: true);
  261 + // _couponNetworkData();
  262 + // },
  263 + // emptyMsg: "暂时没有列表信息哦",
  264 + // emptyImg: "empty_search",
  265 + // showMsg: "加载中,请稍后...",
  266 + // );
  267 + // } else {
  268 + // return EasyRefresh.custom(
  269 + // controller: _controller,
  270 + // shrinkWrap: true,
  271 + // slivers: [
  272 + // SliverList(
  273 + // delegate: SliverChildBuilderDelegate(
  274 + // (BuildContext context, int index) {
  275 + // return Container(
  276 + // margin:
  277 + // EdgeInsets.all(ScreenUtil().setWidth(40)),
  278 + // padding:
  279 + // EdgeInsets.all(ScreenUtil().setWidth(30)),
  280 + // color: MyColours.color_F0F0F0,
  281 + // child: Text(
  282 + // '使用说明:需在结账前出示优惠券二维码,店内工作人员微信扫码核销。超过有效期的券,会自动作废并移出列表。优惠券不可找零、兑现。',
  283 + // style: TextStyle(
  284 + // color: MyColours.color_666666,
  285 + // fontSize: ScreenUtil().setSp(24),
  286 + // ),
  287 + // strutStyle: StrutStyle(
  288 + // forceStrutHeight: true,
  289 + // height: 1,
  290 + // leading: 0.3),
  291 + // ));
  292 + // }, childCount: 1),
  293 + // ),
  294 + // SliverList(
  295 + // delegate: SliverChildBuilderDelegate(
  296 + // (BuildContext context, int index) {
  297 + // return CouponItem(
  298 + // from: 'quan',
  299 + // couponSonModel:
  300 + // couponProvider.couponList[index],
  301 + // showBtn: true,
  302 + // onPressedSwich: () {
  303 + // couponProvider.couponList[index].isOpenBool =
  304 + // !couponProvider
  305 + // .couponList[index].isOpenBool;
  306 + // _setCustomerActivity(index);
  307 + // },
  308 + // onPressed: () {
  309 + // NavigatorUtil.goCouponDetailPage(context,
  310 + // couponProvider.couponList[index]);
  311 + // },
  312 + // );
  313 + // }, childCount: couponProvider.couponList.length),
  314 + // )
  315 + // ],
  316 + // // onRefresh: () async {
  317 + // // // offset = 0;
  318 + // // // getMessage(showLoading: false);
  319 + // // },
  320 + // // onLoad: () async {
  321 + // // // offset++;
  322 + // // // getMessage(showLoading: false);
  323 + // // },
  324 + // );
  325 + // }
  326 + // },
  327 + // )),
  328 + // VEmptyView(20),
  329 + // Padding(
  330 + // padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
  331 + // ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
  332 + // child: RoundButton(
  333 + // onPressed: () async {
  334 + // bool needRefresh =
  335 + // await NavigatorUtil.goCouponEditPage(context);
  336 + // print(needRefresh);
  337 + // if (needRefresh != null && needRefresh) {
  338 + // //刷新页面数据
  339 + // // _controller.callRefresh();
  340 + // _couponNetworkData();
  341 + // }
  342 + // },
  343 + // text: '创建新券',
  344 + // fontSize: 34,
  345 + // isBold: false,
  346 + // height: ScreenUtil().setWidth(80),
  347 + // width: double.infinity,
  348 + // radius: ScreenUtil().setWidth(10),
  349 + // ))
  350 + // ],
  351 + // )
  352 + ));
207 } 353 }
208 } 354 }
  1 +// import 'package:flutter/material.dart';
  2 +// import 'package:flutter_easyrefresh/easy_refresh.dart';
  3 +// import 'package:flutter_screenutil/screenutil.dart';
  4 +// import 'package:one_key/constant/state.dart';
  5 +// import 'package:one_key/pages/coupon/coupon_item.dart';
  6 +// import 'package:one_key/provider/coupon_provider.dart';
  7 +// import 'package:one_key/provider/user_model.dart';
  8 +// import 'package:one_key/res/colors.dart';
  9 +// import 'package:one_key/utils/event_bus.dart';
  10 +// import 'package:one_key/route/navigator_util.dart';
  11 +// import 'package:one_key/widgets/page_exception.dart';
  12 +// import 'package:one_key/widgets/round_button.dart';
  13 +// import 'package:one_key/widgets/system_app_bar.dart';
  14 +// import 'package:one_key/widgets/v_empty_view.dart';
  15 +// import 'package:provider/provider.dart';
  16 +
  17 +// /**
  18 +// * 优惠券列表
  19 +// */
  20 +
  21 +// class CouponPage extends StatefulWidget {
  22 +// final bool needRefrsh;
  23 +// CouponPage({Key key, this.needRefrsh = false}) : super(key: key);
  24 +
  25 +// @override
  26 +// _CouponPageState createState() => _CouponPageState();
  27 +// }
  28 +
  29 +// class _CouponPageState extends State<CouponPage> {
  30 +// EasyRefreshController _controller = EasyRefreshController();
  31 +// CouponProvider couponProvider;
  32 +
  33 +// ///获取优惠券列表数据
  34 +// _couponNetworkData({bool isShowLoading = true}) async {
  35 +// Map<String, String> params = {
  36 +// "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  37 +// // 'is_time': '0'
  38 +// };
  39 +// await couponProvider.getCustomerActivity(context, params,
  40 +// isShowLoading: isShowLoading);
  41 +// }
  42 +
  43 +// ///修改活动信息
  44 +// _setCustomerActivity(int index) async {
  45 +// Map<String, String> params = {
  46 +// "id": couponProvider.couponList[index].id,
  47 +// "status": couponProvider.couponList[index].isOpenBool ? '1' : '0'
  48 +// };
  49 +// bool isSuccess = await couponProvider.setCustomerActivity(context, params,
  50 +// isShowLoading: false);
  51 +// print(isSuccess);
  52 +// _couponNetworkData(isShowLoading: false);
  53 +// // if (isSuccess) {
  54 +// // couponProvider.notifyListeners();
  55 +// // } else {
  56 +// // couponProvider.couponList[index].isOpenBool =
  57 +// // !couponProvider.couponList[index].isOpenBool;
  58 +// // couponProvider.notifyListeners();
  59 +// // }
  60 +// }
  61 +
  62 +// @override
  63 +// void initState() {
  64 +// // TODO: implement initState
  65 +// super.initState();
  66 +// WidgetsBinding.instance.addPostFrameCallback((_) {
  67 +// _couponNetworkData();
  68 +// });
  69 +// // bus.on("refresh_coupon_list", (arg) {
  70 +// // _couponNetworkData();
  71 +// // });
  72 +// }
  73 +
  74 +// @override
  75 +// void dispose() {
  76 +// bus.off('changeStatusColor');
  77 +// // bus.off("refresh_coupon_list");
  78 +// super.dispose();
  79 +// }
  80 +
  81 +// @override
  82 +// Widget build(BuildContext context) {
  83 +// couponProvider = Provider.of<CouponProvider>(context, listen: true);
  84 +// return Scaffold(
  85 +// backgroundColor: MyColours.color_fefefe,
  86 +// appBar: SystemAppBar('线上券', rightImgName: '历史券', onTap: () {
  87 +// if (widget.needRefrsh) {
  88 +// EventBus().emit('refresh_coupon_invitation');
  89 +// } else {
  90 +// EventBus().emit('changeStatusColor');
  91 +// }
  92 +
  93 +// Navigator.of(context).pop();
  94 +// }, onTapRight: () {
  95 +// NavigatorUtil.goCouponHistoryPage(context);
  96 +// }),
  97 +// body: WillPopScope(
  98 +// onWillPop: () {
  99 +// if (widget.needRefrsh) {
  100 +// EventBus().emit('refresh_coupon_invitation');
  101 +// } else {
  102 +// EventBus().emit('changeStatusColor');
  103 +// }
  104 +// Navigator.of(context).pop();
  105 +// },
  106 +// child: Column(
  107 +// children: [
  108 +// Expanded(child: Consumer<CouponProvider>(
  109 +// builder: (context, model, _) {
  110 +// if (model.pageState != PageState.Success) {
  111 +// return ExceptionPage(
  112 +// pageState: model.pageState,
  113 +// callback: () {
  114 +// // offset = 0;
  115 +// // getMessage(showLoading: true);
  116 +// _couponNetworkData();
  117 +// },
  118 +// emptyMsg: "暂时没有列表信息哦",
  119 +// emptyImg: "empty_search",
  120 +// showMsg: "加载中,请稍后...",
  121 +// );
  122 +// } else {
  123 +// return EasyRefresh.custom(
  124 +// controller: _controller,
  125 +// shrinkWrap: true,
  126 +// slivers: [
  127 +// SliverList(
  128 +// delegate: SliverChildBuilderDelegate(
  129 +// (BuildContext context, int index) {
  130 +// return Container(
  131 +// margin:
  132 +// EdgeInsets.all(ScreenUtil().setWidth(40)),
  133 +// padding:
  134 +// EdgeInsets.all(ScreenUtil().setWidth(30)),
  135 +// color: MyColours.color_F0F0F0,
  136 +// child: Text(
  137 +// '使用说明:需在结账前出示优惠券二维码,店内工作人员微信扫码核销。超过有效期的券,会自动作废并移出列表。优惠券不可找零、兑现。',
  138 +// style: TextStyle(
  139 +// color: MyColours.color_666666,
  140 +// fontSize: ScreenUtil().setSp(24),
  141 +// ),
  142 +// strutStyle: StrutStyle(
  143 +// forceStrutHeight: true,
  144 +// height: 1,
  145 +// leading: 0.3),
  146 +// ));
  147 +// }, childCount: 1),
  148 +// ),
  149 +// SliverList(
  150 +// delegate: SliverChildBuilderDelegate(
  151 +// (BuildContext context, int index) {
  152 +// return CouponItem(
  153 +// from: 'quan',
  154 +// couponSonModel:
  155 +// couponProvider.couponList[index],
  156 +// showBtn: true,
  157 +// onPressedSwich: () {
  158 +// couponProvider.couponList[index].isOpenBool =
  159 +// !couponProvider
  160 +// .couponList[index].isOpenBool;
  161 +// _setCustomerActivity(index);
  162 +// },
  163 +// onPressed: () {
  164 +// NavigatorUtil.goCouponDetailPage(context,
  165 +// couponProvider.couponList[index]);
  166 +// },
  167 +// );
  168 +// }, childCount: couponProvider.couponList.length),
  169 +// )
  170 +// ],
  171 +// // onRefresh: () async {
  172 +// // // offset = 0;
  173 +// // // getMessage(showLoading: false);
  174 +// // },
  175 +// // onLoad: () async {
  176 +// // // offset++;
  177 +// // // getMessage(showLoading: false);
  178 +// // },
  179 +// );
  180 +// }
  181 +// },
  182 +// )),
  183 +// VEmptyView(20),
  184 +// Padding(
  185 +// padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
  186 +// ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
  187 +// child: RoundButton(
  188 +// onPressed: () async {
  189 +// bool needRefresh =
  190 +// await NavigatorUtil.goCouponEditPage(context);
  191 +// print(needRefresh);
  192 +// if (needRefresh != null && needRefresh) {
  193 +// //刷新页面数据
  194 +// // _controller.callRefresh();
  195 +// _couponNetworkData();
  196 +// }
  197 +// },
  198 +// text: '创建新券',
  199 +// fontSize: 34,
  200 +// isBold: false,
  201 +// height: ScreenUtil().setWidth(80),
  202 +// width: double.infinity,
  203 +// radius: ScreenUtil().setWidth(10),
  204 +// ))
  205 +// ],
  206 +// )));
  207 +// }
  208 +// }
  1 +import 'package:flutter/material.dart';
  2 +
  3 +class MySeparator extends StatelessWidget {
  4 + final double width;
  5 + final double height;
  6 + final Color color;
  7 +
  8 + const MySeparator(
  9 + {this.width = 10.0, this.height = 1, this.color = Colors.black});
  10 +
  11 + @override
  12 + Widget build(BuildContext context) {
  13 + return LayoutBuilder(
  14 + builder: (BuildContext context, BoxConstraints constraints) {
  15 + final boxWidth = constraints.constrainWidth();
  16 + final dashWidth = width;
  17 + final dashHeight = height;
  18 + final dashCount = (boxWidth / (2 * dashWidth)).floor();
  19 + return Flex(
  20 + children: List.generate(dashCount, (_) {
  21 + return SizedBox(
  22 + width: dashWidth,
  23 + height: dashHeight,
  24 + child: DecoratedBox(
  25 + decoration: BoxDecoration(color: color),
  26 + ),
  27 + );
  28 + }),
  29 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  30 + direction: Axis.horizontal,
  31 + );
  32 + },
  33 + );
  34 + }
  35 +}
@@ -130,6 +130,7 @@ dependencies: @@ -130,6 +130,7 @@ dependencies:
130 # 视频信息获取 130 # 视频信息获取
131 video_compress: ^2.1.1 131 video_compress: ^2.1.1
132 #高德地图 132 #高德地图
  133 + # amap_map_fluttify: ^0.30.1
133 amap_map_fluttify: 0.25.0 134 amap_map_fluttify: 0.25.0
134 # amap_map_fluttify: ^0.30.1 135 # amap_map_fluttify: ^0.30.1
135 #虚线边框 136 #虚线边框