YSWriteOffListItemView.dart 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. import 'package:dotted_border/dotted_border.dart';
  2. import 'package:flutter/material.dart';
  3. import '../../base/YSTools.dart';
  4. class YSWriteOffListItemView extends StatefulWidget {
  5. final Map item;
  6. const YSWriteOffListItemView({Key key, this.item}) : super(key: key);
  7. @override
  8. _YSWriteOffListItemViewState createState() => _YSWriteOffListItemViewState();
  9. }
  10. class _YSWriteOffListItemViewState extends State<YSWriteOffListItemView> {
  11. Map _item = {};
  12. @override
  13. void initState() {
  14. _item.addAll(widget.item);
  15. super.initState();
  16. }
  17. @override
  18. Widget build(BuildContext context) {
  19. if(_item['isOpen']==null){
  20. _item['isOpen'] = false;
  21. }
  22. bool isOpen = _item['isOpen']??false;
  23. return DottedBorder(
  24. color: Color(0xFFFF6D96),
  25. borderType: BorderType.RRect,
  26. radius: Radius.circular(9),
  27. strokeWidth: 1,
  28. child: Container(
  29. color: Colors.white,
  30. width: ysWidth(context)-30,
  31. child: LayoutBuilder(
  32. builder: (context,conSize){
  33. return Column(
  34. children: [
  35. Row(
  36. crossAxisAlignment: CrossAxisAlignment.start,
  37. children: [
  38. Container(
  39. width: conSize.maxWidth-80,
  40. child: Column(
  41. crossAxisAlignment: CrossAxisAlignment.start,
  42. children: [
  43. Container(
  44. child: Text('编 号:${widget.item['couponCode']}',style: TextStyle(fontSize: 12,color: Color(0xFF515050)),maxLines: 1,),
  45. height: 25,
  46. ),
  47. Container(
  48. child: Text('${widget.item['couponTypeName']}',style: TextStyle(fontSize: 16,color: Color(0xFFEE6B8F)),maxLines: 1,),
  49. height: 30,
  50. ),
  51. Container(
  52. child: Text('时 间:${widget.item['applicableRange']}',style: TextStyle(fontSize: 12,color: Color(0xFF515050)),maxLines: 1,),
  53. height: 25,
  54. ),
  55. Container(
  56. child: Text('母亲姓名:${widget.item['pregnantWomanName']}',style: TextStyle(fontSize: 12,color: Color(0xFF515050)),maxLines: 1,),
  57. height: 25,
  58. ),
  59. Container(
  60. child: Text('发券机构:${widget.item['sendHospitalName']}',style: TextStyle(fontSize: 12,color: Color(0xFF515050)),maxLines: 1,),
  61. height: 25,
  62. ),
  63. if(widget.item['status']=='2'||widget.item['status']=='10010')Container(
  64. child: Text(widget.item['status']=='2'?'失效日期:${widget.item['overdueTime']??''}':
  65. widget.item['status']=='10010'?'取消日期:${widget.item['cancelTime']}':'',
  66. style: TextStyle(fontSize: 12,color: Color(0xFF515050)),maxLines: 1,
  67. ),
  68. height: 25,
  69. ),
  70. if(isOpen==true)Container(
  71. child: Column(
  72. crossAxisAlignment: CrossAxisAlignment.start,
  73. children: [
  74. // Padding(
  75. // padding: EdgeInsets.only(bottom: 10),
  76. // child: DashLine(height: 1,color: Color(0xFF979797),),
  77. // ),
  78. Container(
  79. child: Text('核销机构:${widget.item['useHospitalName']}',style: TextStyle(fontSize: 12,color: Color(0xFF515050)),maxLines: 1,),
  80. height: 25,
  81. ),
  82. Container(
  83. child: Text('发券日期:${widget.item['createTime']}',style: TextStyle(fontSize: 12,color: Color(0xFF515050)),maxLines: 1,),
  84. height: 25,
  85. ),
  86. Container(
  87. child: Text('核销日期:${widget.item['useTime']}',style: TextStyle(fontSize: 12,color: Color(0xFF515050)),maxLines: 1,),
  88. height: 25,
  89. ),
  90. ],
  91. ),
  92. ),
  93. ],
  94. ),
  95. ),
  96. Container(
  97. height: 80,
  98. width: 80,
  99. decoration: BoxDecoration(
  100. color: Colors.white,
  101. borderRadius: BorderRadius.all(Radius.circular(50))
  102. ),
  103. child: Image.asset('lib/images/已核销备份 ${_item['status']=='2'?'18':_item['status']=='10010'?'20':'13'}.png'),
  104. )
  105. ],
  106. ),
  107. _item['useTime']!=null?Container(
  108. height: 30,
  109. child: GestureDetector(
  110. onTap: (){
  111. if(_item['isOpen']==true){
  112. _item['isOpen'] = false;
  113. }else{
  114. _item['isOpen'] = true;
  115. }
  116. setState(() {});
  117. },
  118. behavior: HitTestBehavior.opaque,
  119. child: Row(
  120. mainAxisSize: MainAxisSize.min,
  121. children: [
  122. Text(isOpen?'收起':'显示更多',style: TextStyle(fontSize: 10,color: Color(0xFFD8D8D8)),),
  123. Icon(isOpen?Icons.keyboard_arrow_up:Icons.keyboard_arrow_down,size: 15,color: Color(0xFFD8D8D8),)
  124. ],
  125. ),
  126. ),
  127. ):Container(height: 10,),
  128. ],
  129. );
  130. },
  131. ),
  132. padding: EdgeInsets.only(left: 15,right: 15,top: 15),
  133. ),
  134. );
  135. }
  136. }