YSWalletManagerListItemView.dart 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_wallet/generated/l10n.dart';
  4. import 'package:flutter_wallet/login/view/YSHelpView.dart';
  5. import 'package:flutter_wallet/tools/YSNetWork.dart';
  6. import '../../tools/YSColors.dart';
  7. import '../../tools/YSTools.dart';
  8. import '../YSWalletDetail.dart';
  9. class YSWalletManagerListItemView extends StatefulWidget {
  10. final bool isDetail;
  11. final Map item;
  12. const YSWalletManagerListItemView({Key? key, required this.item, this.isDetail = false}) : super(key: key);
  13. @override
  14. YSWalletManagerListItemViewState createState() => YSWalletManagerListItemViewState();
  15. }
  16. class YSWalletManagerListItemViewState extends State<YSWalletManagerListItemView> {
  17. @override
  18. Widget build(BuildContext context) {
  19. return widget.isDetail?YSItemView(
  20. item: widget.item
  21. ):GestureDetector(
  22. onTap: (){
  23. if(widget.isDetail==true)return;
  24. Navigator.of(context).push(
  25. CupertinoPageRoute(builder: (context){
  26. return YSWalletDetail(wallet: widget.item,);
  27. })
  28. );
  29. },
  30. behavior: HitTestBehavior.opaque,
  31. child: YSItemView(item: widget.item,),
  32. );
  33. }
  34. }
  35. class YSItemView extends StatelessWidget {
  36. final Map item;
  37. const YSItemView({Key? key, required this.item}) : super(key: key);
  38. @override
  39. Widget build(BuildContext context) {
  40. return Container(
  41. width: ysWidth(context)-hsp(30),
  42. height: hsp(70),
  43. padding: EdgeInsets.all(hsp(10)),
  44. decoration: BoxDecoration(
  45. color: YSColors.containColor(context),
  46. borderRadius: const BorderRadius.all(Radius.circular(10)),
  47. boxShadow: [
  48. BoxShadow(color: YSColors.shadowColor(context),blurRadius: 5)
  49. ]
  50. ),
  51. child: Row(
  52. children: [
  53. Stack(
  54. children: [
  55. Image.asset(YSColors.imageStyle(context, '路径 3备份 4'),height: hsp(50),width: hsp(50),),
  56. Container(
  57. width: hsp(50),
  58. margin: EdgeInsets.only(top: hsp(40)),
  59. height: hsp(10),
  60. // child: Row(
  61. // children: [
  62. // Expanded(child: Text('-29535.65%',style: TextStyle(fontSize: zsp(6),color: const Color(0xFFFA9C9C)),)),
  63. // Image.asset(YSColors.imageStyle(context, '数据折线上升4备份'),height: hsp(10),width: hsp(10),)
  64. // ],
  65. // ),
  66. )
  67. ],
  68. ),
  69. Expanded(child: Padding(
  70. padding: EdgeInsets.only(right: hsp(10),left: hsp(10)),
  71. child: Column(
  72. crossAxisAlignment: CrossAxisAlignment.start,
  73. mainAxisSize: MainAxisSize.min,
  74. children: [
  75. Row(
  76. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  77. children: [
  78. RichText(text: TextSpan(
  79. text: '${item['name']}',
  80. style: YSColors.contentStyle(context),
  81. children: [
  82. WidgetSpan(child: YSTagView(wallet: item,),alignment: PlaceholderAlignment.middle)
  83. ]
  84. )),
  85. if(item['chooseType']==1)Icon(Icons.check_circle,size: hsp(20),color: YSColors.iconColor(context),)
  86. ],
  87. ),
  88. Padding(
  89. padding: EdgeInsets.only(top: hsp(5)),
  90. child: Row(
  91. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  92. children: [
  93. Row(
  94. children: [
  95. Container(
  96. constraints: BoxConstraints(
  97. maxWidth: ysWidth(context)/2
  98. ),
  99. child: Text(ysTextCut(item['public']),style: YSColors.subStyle(context),maxLines: 1,),
  100. ),
  101. GestureDetector(
  102. onTap: (){
  103. YSCopyPaste.copy(item['public']);
  104. },
  105. child: Image.asset(YSColors.imageStyle(context, '复制'),height: hsp(15),width: hsp(15),),
  106. )
  107. ],
  108. ),
  109. // Text('10.1 Layer3',style: TextStyle(fontSize: zsp(8),color: const Color(0xFF3D5AFF)),),
  110. ],
  111. ),
  112. )
  113. ],
  114. ),
  115. )),
  116. ],
  117. ),
  118. );
  119. }
  120. }