Hibok
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

150 wiersze
4.6 KiB

  1. import 'package:chat/data/constants.dart';
  2. import 'package:chat/generated/i18n.dart';
  3. import 'package:chat/utils/CustomUI.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter/services.dart';
  6. import 'package:oktoast/oktoast.dart';
  7. class VerificationPage extends StatefulWidget {
  8. final List applyList;
  9. VerificationPage({Key key, this.applyList}) : super(key: key);
  10. _VerificationPageState createState() => _VerificationPageState();
  11. }
  12. class _VerificationPageState extends State<VerificationPage> {
  13. @override
  14. void initState() {
  15. super.initState();
  16. }
  17. @override
  18. Widget build(BuildContext context) {
  19. Widget appBar = new AppBar(
  20. title: new Text(
  21. I18n.of(context).check_incode,
  22. textScaleFactor: 1.0,
  23. ),
  24. centerTitle: true,
  25. leading: CustomUI.buildCustomLeading(context),
  26. );
  27. return Scaffold(
  28. body: SafeArea(
  29. child: Center(
  30. child: Container(
  31. height: MediaQuery.of(context).size.height,
  32. width: MediaQuery.of(context).size.width,
  33. child: _buildBody(),
  34. ),
  35. )),
  36. appBar: appBar,
  37. resizeToAvoidBottomPadding: false,
  38. );
  39. }
  40. Widget _buildBody() {
  41. return widget.applyList.length == 0
  42. ? CustomUI.buildNoData(context)
  43. : ListView(
  44. children: widget.applyList == null
  45. ? []
  46. : widget.applyList.map((item) {
  47. return item['Status'] == 0
  48. ? Container()
  49. : _buildResult(item);
  50. }).toList(),
  51. );
  52. }
  53. Widget _buildResult(data) {
  54. bool isSucess = data['Status'] == 1;
  55. Widget tip = Container(
  56. margin: EdgeInsets.only(top: 25.5, bottom: 44),
  57. child: Text(
  58. isSucess
  59. ? I18n.of(context).successful_application1
  60. : I18n.of(context).application_failed1,
  61. textScaleFactor: 1.0,
  62. style: TextStyle(
  63. color: isSucess ? const Color(0xFF2D81FF) : const Color(0xFFFF4523),
  64. fontSize: 22),
  65. ),
  66. );
  67. Widget success = Column(
  68. children: <Widget>[
  69. Container(
  70. margin: EdgeInsets.only(bottom: 22),
  71. width: MediaQuery.of(context).size.width,
  72. alignment: Alignment.center,
  73. child: Text(
  74. I18n.of(context).your_incode,
  75. textScaleFactor: 1.0,
  76. style: TextStyle(
  77. color: Constants.BlackTextColor,
  78. fontSize: 17,
  79. fontWeight: FontWeight.w500),
  80. ),
  81. ),
  82. Container(
  83. decoration: BoxDecoration(
  84. border: Border(
  85. bottom:
  86. BorderSide(width: 1, color: const Color(0xFFFF4523)))),
  87. child: Text(
  88. data['Code'],
  89. textScaleFactor: 1.0,
  90. style: TextStyle(color: const Color(0xFFFF4523), fontSize: 33.36),
  91. ),
  92. ),
  93. InkWell(
  94. onTap: () {
  95. ClipboardData clipboardData =
  96. new ClipboardData(text: data['Code']);
  97. Clipboard.setData(clipboardData);
  98. showToast(I18n.of(context).successful_copy);
  99. },
  100. child: Container(
  101. alignment: Alignment.center,
  102. margin: EdgeInsets.only(top: 60),
  103. padding: EdgeInsets.only(top: 5, left: 20, right: 20, bottom: 5),
  104. width: 198.05,
  105. height: 32.85,
  106. decoration: BoxDecoration(
  107. color: const Color(0xFF2D81FF),
  108. borderRadius: BorderRadius.all(Radius.circular(30))),
  109. child: Text(
  110. I18n.of(context).copy,
  111. textScaleFactor: 1.0,
  112. style: TextStyle(color: Colors.white),
  113. ),
  114. )),
  115. ],
  116. );
  117. Widget fail = Align(
  118. child: Padding(
  119. padding: EdgeInsets.only(left: 80, right: 80),
  120. child: Text(
  121. I18n.of(context).application_failed,
  122. textScaleFactor: 1.0,
  123. textAlign: TextAlign.center,
  124. style: TextStyle(color: const Color(0xFFB3B3B3)),
  125. ),
  126. ),
  127. );
  128. return Stack(
  129. children: <Widget>[
  130. Container(
  131. child: Image.asset('assets/images/yqm_bg.png'),
  132. margin: EdgeInsets.only(left: 41, right: 41, top: 20.5),
  133. ),
  134. Container(
  135. margin: EdgeInsets.only(top: 20.5),
  136. child: Column(
  137. children: <Widget>[tip, isSucess ? success : fail],
  138. ))
  139. ],
  140. );
  141. }
  142. }