You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
291 lines
12 KiB
291 lines
12 KiB
3 years ago
|
import 'package:barcode_widget/barcode_widget.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:huixiang/generated/l10n.dart';
|
||
|
import 'package:huixiang/retrofit/data/exchange_order.dart';
|
||
|
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:qr_flutter/qr_flutter.dart';
|
||
|
|
||
|
class ExchangeWriteOffPage extends StatefulWidget {
|
||
|
final arguments;
|
||
|
|
||
|
ExchangeWriteOffPage({this.arguments});
|
||
|
|
||
|
@override
|
||
|
State<StatefulWidget> createState() {
|
||
|
return _ExchangeWriteOffPage();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class _ExchangeWriteOffPage extends State<ExchangeWriteOffPage> {
|
||
|
ExchangeOrder exchangeOrder;
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
super.initState();
|
||
|
|
||
|
exchangeOrder = ExchangeOrder.fromJson(widget.arguments["exchangeOrder"]);
|
||
|
if (mounted) setState(() {});
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
backgroundColor: Color(0xFF32A060),
|
||
|
appBar: MyAppBar(
|
||
|
title: S.of(context).hexiaomaxiangqing,
|
||
|
titleSize: 18.sp,
|
||
|
titleColor: Colors.white,
|
||
|
background: Color(0xFF32A060),
|
||
|
leadingColor: Colors.white,
|
||
|
),
|
||
|
body: Container(
|
||
|
alignment: Alignment.topCenter,
|
||
|
child: Stack(
|
||
|
alignment: Alignment.topCenter,
|
||
|
children: [
|
||
|
Image.asset(
|
||
|
"assets/image/icon_write_off_bg.png",
|
||
|
width: MediaQuery.of(context).size.width * 0.912,
|
||
|
fit: BoxFit.fill,
|
||
|
),
|
||
|
LayoutBuilder(builder: (context, constraints) {
|
||
|
return Container(
|
||
|
width: constraints.constrainWidth() * 0.912,
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Expanded(
|
||
|
child: Container(
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Text(
|
||
|
exchangeOrder != null ? exchangeOrder.creditOrderDetailList[0].name : "",
|
||
|
style: TextStyle(
|
||
|
fontSize: 16.sp,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Color(0xFF353535)),
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 8.h,
|
||
|
),
|
||
|
Text(
|
||
|
(exchangeOrder.updateTime == null) ? "" : S.of(context).youxiaoqi(
|
||
|
"${exchangeOrder.updateTime}"),
|
||
|
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: [
|
||
|
Text(
|
||
|
exchangeOrder != null
|
||
|
? "${exchangeOrder.id.substring(0, 4)} "
|
||
|
"${exchangeOrder.id.substring(4, 8)} "
|
||
|
"${exchangeOrder.id.substring(8, 12)} "
|
||
|
"${exchangeOrder.id.substring(12, 16)} "
|
||
|
"${exchangeOrder.id.substring(16, exchangeOrder.id.length)}"
|
||
|
: "",
|
||
|
style: TextStyle(
|
||
|
fontSize: 14.sp,
|
||
|
wordSpacing: exchangeOrder == null
|
||
|
? 10
|
||
|
: (MediaQuery.of(context).size.width -
|
||
|
64.w) /
|
||
|
(((exchangeOrder.id.length) * 4)),
|
||
|
letterSpacing: exchangeOrder == null
|
||
|
? 8
|
||
|
: (MediaQuery.of(context).size.width -
|
||
|
64.w) /
|
||
|
(((exchangeOrder.id.length) * 4)),
|
||
|
fontWeight: MyFontWeight.semi_bold,
|
||
|
color: Color(0xFF353535),
|
||
|
),
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 12.h,
|
||
|
),
|
||
|
BarcodeWidget(
|
||
|
barcode: Barcode.code128(useCode128C: true),
|
||
|
data: exchangeOrder != null ? exchangeOrder.id : "",
|
||
|
height: 72.h,
|
||
|
color: Colors.black,
|
||
|
drawText: false,
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 16.h,
|
||
|
),
|
||
|
Expanded(child: QrImage(
|
||
|
data: exchangeOrder != null ? exchangeOrder.id : "",
|
||
|
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, 24.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,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
})
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|