|
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
|
|
|
|
import 'package:barcode_widget/barcode_widget.dart'; |
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter_html/flutter_html.dart'; |
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
@ -13,9 +14,13 @@ import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/separator.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
|
import 'package:qr_flutter/qr_flutter.dart'; |
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
|
|
import '../view_widget/classic_header.dart'; |
|
|
|
|
import '../view_widget/my_footer.dart'; |
|
|
|
|
|
|
|
|
|
class WriteOffPage extends StatefulWidget { |
|
|
|
|
final arguments; |
|
|
|
|
|
|
|
|
@ -31,6 +36,7 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
dynamic coupon; |
|
|
|
|
ApiService apiService; |
|
|
|
|
CouponDetail queryCoupon; |
|
|
|
|
final RefreshController refreshController = RefreshController(); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
@ -79,23 +85,43 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
background: Color(0xFF32A060), |
|
|
|
|
leadingColor: Colors.white, |
|
|
|
|
), |
|
|
|
|
body: Container( |
|
|
|
|
body: SmartRefresher( |
|
|
|
|
controller: refreshController, |
|
|
|
|
enablePullDown: false, |
|
|
|
|
enablePullUp: false, |
|
|
|
|
header: MyHeader(), |
|
|
|
|
footer: CustomFooter( |
|
|
|
|
builder: (context, mode) { |
|
|
|
|
return MyFooter(mode); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
scrollController: ScrollController(), |
|
|
|
|
child: Container( |
|
|
|
|
child: SingleChildScrollView( |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
alignment: Alignment.topCenter, |
|
|
|
|
height: 530.h, |
|
|
|
|
child: Stack( |
|
|
|
|
alignment: Alignment.topCenter, |
|
|
|
|
children: [ |
|
|
|
|
Image.asset( |
|
|
|
|
"assets/image/icon_write_off_bg.webp", |
|
|
|
|
"assets/image/write_off_bg.webp", |
|
|
|
|
width: MediaQuery.of(context).size.width * 0.912, |
|
|
|
|
height: 540.h, |
|
|
|
|
fit: BoxFit.fill, |
|
|
|
|
), |
|
|
|
|
LayoutBuilder(builder: (context, constraints) { |
|
|
|
|
return Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
width: constraints.constrainWidth() * 0.912, |
|
|
|
|
padding:EdgeInsets.only(top: 24.h), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: Container( |
|
|
|
|
Container( |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
@ -106,7 +132,7 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
color: Color(0xFF353535)), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 8.h, |
|
|
|
|
height:11.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
(coupon["useStartTime"] == null || coupon["useEndTime"] == null) ? "" : S.of(context).youxiaoqi( |
|
|
|
@ -122,10 +148,8 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
), |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
), |
|
|
|
|
flex: 6, |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
margin: EdgeInsets.only(left: 20.w, right: 20.w), |
|
|
|
|
margin: EdgeInsets.only(left: 20.w, right: 20.w,top:16.h,bottom:30.h), |
|
|
|
|
child: MySeparator( |
|
|
|
|
width: 5.w, |
|
|
|
|
height: 1.h, |
|
|
|
@ -164,7 +188,7 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 12.h, |
|
|
|
|
height: 15.h, |
|
|
|
|
), |
|
|
|
|
BarcodeWidget( |
|
|
|
|
barcode: Barcode.code128(useCode128C: true), |
|
|
|
@ -197,11 +221,266 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
height: 1.h, |
|
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
|
), |
|
|
|
|
margin: EdgeInsets.only(left: 20.w, right: 20.w), |
|
|
|
|
margin: EdgeInsets.only(left: 20.w, right: 20.w,bottom:20.h), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}), |
|
|
|
|
//原版本样式 |
|
|
|
|
// LayoutBuilder(builder: (context, constraints) { |
|
|
|
|
// return Container( |
|
|
|
|
// width: constraints.constrainWidth() * 0.912, |
|
|
|
|
// child: Column( |
|
|
|
|
// children: [ |
|
|
|
|
// Expanded( |
|
|
|
|
// child: Container( |
|
|
|
|
// child: Column( |
|
|
|
|
// children: [ |
|
|
|
|
// Text( |
|
|
|
|
// coupon != null ? coupon["couponName"] : "", |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize: 16.sp, |
|
|
|
|
// fontWeight: FontWeight.bold, |
|
|
|
|
// color: Color(0xFF353535)), |
|
|
|
|
// ), |
|
|
|
|
// SizedBox( |
|
|
|
|
// height: 8.h, |
|
|
|
|
// ), |
|
|
|
|
// Text( |
|
|
|
|
// (coupon["useStartTime"] == null || coupon["useEndTime"] == null) ? "" : S.of(context).youxiaoqi( |
|
|
|
|
// "${coupon["useStartTime"].replaceAll("-", ".").split(" ")[0]}-${coupon["useEndTime"].replaceAll("-", ".").split(" ")[0]}"), |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize: 12.sp, |
|
|
|
|
// color: Color(0xFF353535), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
// ), |
|
|
|
|
// alignment: Alignment.center, |
|
|
|
|
// ), |
|
|
|
|
// flex: 6, |
|
|
|
|
// ), |
|
|
|
|
// Container( |
|
|
|
|
// margin: EdgeInsets.only(left: 20.w, right: 20.w), |
|
|
|
|
// child: MySeparator( |
|
|
|
|
// width: 5.w, |
|
|
|
|
// height: 1.h, |
|
|
|
|
// color: Color(0xFFA29E9E), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// Expanded( |
|
|
|
|
// child: Container( |
|
|
|
|
// alignment: Alignment.center, |
|
|
|
|
// child: Column( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
// children: [ |
|
|
|
|
// SizedBox(height: 5.h,), |
|
|
|
|
// Text( |
|
|
|
|
// coupon != null |
|
|
|
|
// ? "${coupon["memberCouponId"].substring(0, 4)} " |
|
|
|
|
// "${coupon["memberCouponId"].substring(4, 8)} " |
|
|
|
|
// "${coupon["memberCouponId"].substring(8, 12)} " |
|
|
|
|
// "${coupon["memberCouponId"].substring(12, 16)} " |
|
|
|
|
// "${coupon["memberCouponId"].substring(16, coupon["memberCouponId"].length)}" |
|
|
|
|
// : "", |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize: 14.sp, |
|
|
|
|
// wordSpacing: coupon == null |
|
|
|
|
// ? 10 |
|
|
|
|
// : (MediaQuery.of(context).size.width - |
|
|
|
|
// 64.w) / |
|
|
|
|
// (((coupon["memberCouponId"].length) * 4)), |
|
|
|
|
// letterSpacing: coupon == null |
|
|
|
|
// ? 8 |
|
|
|
|
// : (MediaQuery.of(context).size.width - |
|
|
|
|
// 64.w) / |
|
|
|
|
// (((coupon["memberCouponId"].length) * 4)), |
|
|
|
|
// fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
// color: Color(0xFF353535), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// SizedBox( |
|
|
|
|
// height: 12.h, |
|
|
|
|
// ), |
|
|
|
|
// BarcodeWidget( |
|
|
|
|
// barcode: Barcode.code128(useCode128C: true), |
|
|
|
|
// data: coupon != null ? coupon["memberCouponId"] : "", |
|
|
|
|
// height: 72.h, |
|
|
|
|
// color: Colors.black, |
|
|
|
|
// drawText: false, |
|
|
|
|
// ), |
|
|
|
|
// SizedBox( |
|
|
|
|
// height: 16.h, |
|
|
|
|
// ), |
|
|
|
|
// Expanded(child: QrImage( |
|
|
|
|
// data: "{\"type\":\"wiped\",\"memberCouponId\":\"${coupon["memberCouponId"]}\"}", |
|
|
|
|
// version: QrVersions.auto, |
|
|
|
|
// size: 200.w, |
|
|
|
|
// gapless: true, |
|
|
|
|
// ),), |
|
|
|
|
// SizedBox( |
|
|
|
|
// height: 35.h, |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// margin: EdgeInsets.symmetric(horizontal: 20.w), |
|
|
|
|
// ), |
|
|
|
|
// flex: 27, |
|
|
|
|
// ), |
|
|
|
|
// Container( |
|
|
|
|
// child: MySeparator( |
|
|
|
|
// width: 5.w, |
|
|
|
|
// height: 1.h, |
|
|
|
|
// color: Color(0xFFA29E9E), |
|
|
|
|
// ), |
|
|
|
|
// margin: EdgeInsets.only(left: 20.w, right: 20.w), |
|
|
|
|
// ), |
|
|
|
|
// Expanded( |
|
|
|
|
// child: Container( |
|
|
|
|
// padding: EdgeInsets.fromLTRB(20.w, 15.h, 20.w, 15.h), |
|
|
|
|
// child: Column( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
// children: [ |
|
|
|
|
// Row( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
// children: [ |
|
|
|
|
// Container( |
|
|
|
|
// width: 3.w, |
|
|
|
|
// height: 15.h, |
|
|
|
|
// margin: |
|
|
|
|
// EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h), |
|
|
|
|
// decoration: BoxDecoration( |
|
|
|
|
// borderRadius: BorderRadius.circular(3), |
|
|
|
|
// color: Color(0xFF20662A), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// Text( |
|
|
|
|
// S.of(context).shiyongtiaojian, |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontWeight: FontWeight.bold, |
|
|
|
|
// fontSize: 14.sp, |
|
|
|
|
// color: Color(0xFF353535), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// Row( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
// children: [ |
|
|
|
|
// SizedBox( |
|
|
|
|
// width: 11.w, |
|
|
|
|
// ), |
|
|
|
|
// Expanded( |
|
|
|
|
// child: Text( |
|
|
|
|
// S |
|
|
|
|
// .of(context) |
|
|
|
|
// .qianwanghuixiangmendianduihuanhexiao, |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// textBaseline: TextBaseline.alphabetic, |
|
|
|
|
// fontSize: 14.sp, |
|
|
|
|
// color: Color(0xFF353535)), |
|
|
|
|
// ), |
|
|
|
|
// flex: 1, |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// Row( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
// children: [ |
|
|
|
|
// Container( |
|
|
|
|
// width: 3.w, |
|
|
|
|
// height: 15.h, |
|
|
|
|
// margin: EdgeInsets.fromLTRB(4, 7, 4, 7), |
|
|
|
|
// decoration: BoxDecoration( |
|
|
|
|
// borderRadius: BorderRadius.circular(3), |
|
|
|
|
// color: Color(0xFF20662A), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// Text( |
|
|
|
|
// S.of(context).shiyongshuoming, |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontWeight: FontWeight.bold, |
|
|
|
|
// fontSize: 14.sp, |
|
|
|
|
// color: Color(0xFF353535)), |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// Row( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
// children: [ |
|
|
|
|
// SizedBox( |
|
|
|
|
// width: 11.w, |
|
|
|
|
// ), |
|
|
|
|
// Text( |
|
|
|
|
// S.of(context).zitiduihuanquan, |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// textBaseline: TextBaseline.alphabetic, |
|
|
|
|
// fontSize: 14.sp, |
|
|
|
|
// color: Color(0xFF353535), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// Row( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
// children: [ |
|
|
|
|
// SizedBox( |
|
|
|
|
// width: 11.w, |
|
|
|
|
// ), |
|
|
|
|
// Text( |
|
|
|
|
// S.of(context).huixiangrenyimendian, |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// textBaseline: TextBaseline.alphabetic, |
|
|
|
|
// fontSize: 14.sp, |
|
|
|
|
// color: Color(0xFF353535), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// flex: 13, |
|
|
|
|
// ), |
|
|
|
|
// Expanded( |
|
|
|
|
// child: Container(), |
|
|
|
|
// flex: 3, |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// ); |
|
|
|
|
// }) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
width: MediaQuery.of(context).size.width * 0.912, |
|
|
|
|
padding: EdgeInsets.only(left:18.w, bottom:15.h, right:18.w), |
|
|
|
|
margin:EdgeInsets.only(bottom: 21.h), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
|
bottomLeft: Radius.circular(6), |
|
|
|
|
bottomRight: Radius.circular(6),), |
|
|
|
|
color: Colors.white, |
|
|
|
|
boxShadow: [ |
|
|
|
|
BoxShadow( |
|
|
|
|
color: Color(0x08213303).withAlpha(12), |
|
|
|
|
offset: Offset(0, 2), |
|
|
|
|
blurRadius: 3, |
|
|
|
|
spreadRadius: 0, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Container( |
|
|
|
|
padding: EdgeInsets.fromLTRB(20.w, 15.h, 20.w, 15.h), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
@ -230,6 +509,7 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox(height:12.h,), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
@ -245,12 +525,14 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
textBaseline: TextBaseline.alphabetic, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
height: 1.5.h, |
|
|
|
|
color: Color(0xFF353535)), |
|
|
|
|
), |
|
|
|
|
flex: 1, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox(height:16.h,), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
@ -258,7 +540,7 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
Container( |
|
|
|
|
width: 3.w, |
|
|
|
|
height: 15.h, |
|
|
|
|
margin: EdgeInsets.fromLTRB(4, 7, 4, 7), |
|
|
|
|
margin: EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(3), |
|
|
|
|
color: Color(0xFF20662A), |
|
|
|
@ -273,54 +555,25 @@ class _WriteOffPage extends State<WriteOffPage> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
SizedBox( |
|
|
|
|
width: 11.w, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).zitiduihuanquan, |
|
|
|
|
style: TextStyle( |
|
|
|
|
textBaseline: TextBaseline.alphabetic, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
SizedBox( |
|
|
|
|
width: 11.w, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).huixiangrenyimendian, |
|
|
|
|
style: TextStyle( |
|
|
|
|
textBaseline: TextBaseline.alphabetic, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
child: Html( |
|
|
|
|
data: |
|
|
|
|
coupon != null ? coupon["remark"] : "", |
|
|
|
|
customImageRenders: { |
|
|
|
|
networkSourceMatcher(): networkImageRender( |
|
|
|
|
loadingWidget: () { |
|
|
|
|
return Container(); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
flex: 13, |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Container(), |
|
|
|
|
flex: 3, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|