基础库
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.
 
 
 
 
 

159 line
5.1 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:loading_indicator/loading_indicator.dart';
  3. import 'package:zhiying_comm/zhiying_comm.dart';
  4. ///
  5. /// 转链的过渡动画
  6. ///
  7. class TurnChainDialog extends StatefulWidget {
  8. @override
  9. _TurnChainDialogState createState() => _TurnChainDialogState();
  10. }
  11. class _TurnChainDialogState extends State<TurnChainDialog> {
  12. @override
  13. Widget build(BuildContext context) {
  14. return Scaffold(
  15. backgroundColor: Colors.transparent,
  16. body: Center(
  17. child: Container(
  18. height: 250,
  19. width: 260,
  20. // margin: const EdgeInsets.symmetric(horizontal: 70),
  21. padding: const EdgeInsets.all(20),
  22. decoration: BoxDecoration(color: HexColor.fromHex('#FEFFFE'), borderRadius: BorderRadius.circular(13)),
  23. child: Column(
  24. mainAxisAlignment: MainAxisAlignment.center,
  25. crossAxisAlignment: CrossAxisAlignment.center,
  26. children: <Widget>[
  27. /// 跳转图标
  28. _buildTransitionIconWidget(),
  29. /// 正在跳转提示文字
  30. Padding(padding: const EdgeInsets.only(top: 12), child: _buildJumpTipWidget()),
  31. /// 返利和券
  32. Padding(padding: const EdgeInsets.only(top: 13), child: _buildCouponAndRebateWidget()),
  33. // /// 共省提示
  34. Padding(padding: const EdgeInsets.only(top: 14), child: _buildSaveMoneyTipWidget()),
  35. /// 注意提示文字
  36. Padding(padding: const EdgeInsets.only(top: 8, left: 9.5, right: 9.5), child: _buildNoticeWidget()),
  37. ],
  38. )),
  39. ),
  40. );
  41. }
  42. /// 过渡图标
  43. Widget _buildTransitionIconWidget() {
  44. return Container(
  45. height: 50,
  46. child: Row(
  47. crossAxisAlignment: CrossAxisAlignment.center,
  48. mainAxisAlignment: MainAxisAlignment.center,
  49. children: <Widget>[
  50. Container(
  51. margin: const EdgeInsets.only(right: 8),
  52. width: 50,
  53. height: 50,
  54. color: Colors.red,
  55. ),
  56. Container(
  57. height: 10,
  58. width: 34,
  59. child: LoadingIndicator(
  60. indicatorType: Indicator.ballPulse,
  61. color: HexColor.fromHex('#FE7978'),
  62. colors: [
  63. HexColor.fromHex('#FF2020'),
  64. HexColor.fromHex('#FE7978'),
  65. HexColor.fromHex('#FEBCBB'),
  66. ],
  67. ),
  68. ),
  69. Container(
  70. margin: const EdgeInsets.only(left: 8),
  71. width: 50,
  72. height: 50,
  73. color: Colors.red,
  74. ),
  75. ],
  76. ),
  77. );
  78. }
  79. /// 跳转文字提示
  80. Widget _buildJumpTipWidget() {
  81. return Text(
  82. '正在跳转淘宝',
  83. style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 15, fontWeight: FontWeight.bold),
  84. );
  85. }
  86. /// 返利与优惠券
  87. Widget _buildCouponAndRebateWidget() {
  88. return Container(
  89. height: 30,
  90. child: Row(
  91. mainAxisAlignment: MainAxisAlignment.center,
  92. children: <Widget>[
  93. _buildCustomButtonWidget(text: '返利', textColor: '#FEFFFE', number: '¥ 23.99', numberColor: '#FEFFFE', bgColor: '#FF2020'),
  94. const SizedBox(width: 8),
  95. _buildCustomButtonWidget(text: '券', textColor: '#FEFFFE', number: '¥ 15.00', numberColor: '#FEFFFE', bgColor: '#FF2020'),
  96. ],
  97. ),
  98. );
  99. }
  100. Widget _buildCustomButtonWidget({String text, String textColor, String number, String numberColor, String bgColor, String bgImg}) {
  101. return Container(
  102. height: 30,
  103. width: 95,
  104. alignment: Alignment.center,
  105. decoration: BoxDecoration(
  106. borderRadius: BorderRadius.circular(8),
  107. color: !EmptyUtil.isEmpty(bgImg) ? null : HexColor.fromHex(bgColor),
  108. image: EmptyUtil.isEmpty(bgImg)
  109. ? null
  110. : DecorationImage(
  111. image: CachedNetworkImageProvider(bgImg ?? ''),
  112. )),
  113. child: RichText(
  114. text: TextSpan(children: [
  115. TextSpan(
  116. text: text ?? '',
  117. style: TextStyle(color: HexColor.fromHex(textColor)),
  118. ),
  119. TextSpan(
  120. text: number ?? '',
  121. style: TextStyle(color: HexColor.fromHex(numberColor)),
  122. ),
  123. ]),
  124. ));
  125. }
  126. /// 总共省下多少钱的提示
  127. Widget _buildSaveMoneyTipWidget() {
  128. return RichText(
  129. text: TextSpan(children: [
  130. TextSpan(text: '共省 ¥', style: TextStyle(color: HexColor.fromHex('#FF2020'), fontSize: 13)),
  131. TextSpan(text: '38', style: TextStyle(color: HexColor.fromHex('#FF2020'), fontSize: 18)),
  132. TextSpan(text: '.99', style: TextStyle(color: HexColor.fromHex('#FF2020'), fontSize: 13)),
  133. ]),
  134. );
  135. }
  136. /// 注意提示文字提示
  137. Widget _buildNoticeWidget() {
  138. return Text(
  139. '注意:使用红包下单,会导致收益变少,或没有收益!',
  140. textAlign: TextAlign.center,
  141. maxLines: 2,
  142. overflow: TextOverflow.ellipsis,
  143. style: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 11),
  144. );
  145. }
  146. }