YSCrossRecord.dart 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_wallet/base/YSBase.dart';
  3. import 'package:flutter_wallet/shop/view/YSExchangeRecordListItemView.dart';
  4. import 'package:flutter_wallet/tools/YSColors.dart';
  5. import 'package:flutter_wallet/tools/YSRefrehLoad.dart';
  6. import 'package:flutter_wallet/tools/YSTools.dart';
  7. class YSCrossRecord extends StatefulWidget {
  8. final Map item;
  9. const YSCrossRecord({Key? key, required this.item}) : super(key: key);
  10. @override
  11. YSCrossRecordState createState() => YSCrossRecordState();
  12. }
  13. class YSCrossRecordState extends State<YSCrossRecord> {
  14. List _array = [];
  15. @override
  16. Widget build(BuildContext context) {
  17. return YSBase(
  18. ysTitle: '跨链记录',
  19. ysChild: Container(
  20. width: ysWidth(context),
  21. height: ysHeight(context)-ysTOP(context)-60,
  22. color: Colors.white,
  23. child: YSRefreshLoad(
  24. url: 'cross-txs',
  25. request: {'from_addr':widget.item['address']},
  26. postData: (value) {
  27. _array = value;
  28. setState(() {});
  29. },
  30. child: SingleChildScrollView(
  31. child: ListView.separated(
  32. itemBuilder: (context,index){
  33. Map item = _array[index];
  34. return Padding(
  35. padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
  36. child: YSExchangeRecordListItemView(item: item)
  37. );
  38. },
  39. separatorBuilder: (context,index){
  40. return Divider(height: hsp(20),color: YSColors.backgroundColor(context),thickness: hsp(20),);
  41. },
  42. itemCount: _array.length,
  43. padding: const EdgeInsets.all(0),
  44. physics: const NeverScrollableScrollPhysics(),
  45. shrinkWrap: true,
  46. ),
  47. ),
  48. ),
  49. ),
  50. );
  51. }
  52. }
  53. class YSCrossRecord2 extends StatefulWidget {
  54. const YSCrossRecord2({Key? key}) : super(key: key);
  55. @override
  56. YSCrossRecord2State createState() => YSCrossRecord2State();
  57. }
  58. class YSCrossRecord2State extends State<YSCrossRecord2> {
  59. List _array = [];
  60. @override
  61. Widget build(BuildContext context) {
  62. return YSBase(
  63. ysTitle: '兑换记录',
  64. ysChild: Container(
  65. width: ysWidth(context),
  66. height: ysHeight(context)-ysTOP(context)-60,
  67. color: Colors.white,
  68. child: YSRefreshLoad(
  69. url: 'transactions',
  70. request: {'chain_id':YSData().typeId,'address':YSData().wallet['public'],'type':0},
  71. postData: (value) {
  72. _array = value;
  73. setState(() {});
  74. },
  75. child: SingleChildScrollView(
  76. child: ListView.separated(
  77. itemBuilder: (context,index){
  78. Map item = _array[index];
  79. return Padding(
  80. padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
  81. child: YSExchangeRecordListItemView2(item: item)
  82. );
  83. },
  84. separatorBuilder: (context,index){
  85. return Divider(height: hsp(20),color: YSColors.backgroundColor(context),thickness: hsp(20),);
  86. },
  87. itemCount: _array.length,
  88. padding: const EdgeInsets.all(0),
  89. physics: const NeverScrollableScrollPhysics(),
  90. shrinkWrap: true,
  91. ),
  92. ),
  93. ),
  94. ),
  95. );
  96. }
  97. }