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

190 rivejä
5.0 KiB

  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_swiper/flutter_swiper.dart';
  4. import 'package:zhiying_comm/zhiying_comm.dart';
  5. // 邀请好友
  6. class InvitedFriendsPage extends StatefulWidget {
  7. final Map<String, dynamic> model;
  8. const InvitedFriendsPage(this.model, {Key key}) : super(key: key);
  9. @override
  10. _InvitedFriendsPageState createState() => _InvitedFriendsPageState();
  11. }
  12. class _InvitedFriendsPageState extends State<InvitedFriendsPage> {
  13. @override
  14. Widget build(BuildContext context) {
  15. return Scaffold(
  16. appBar: _createNav(),
  17. backgroundColor: Colors.redAccent,
  18. body: Column(
  19. children: <Widget>[
  20. Expanded(
  21. child: _createSwiper(),
  22. ),
  23. _createTeacher(),
  24. _createBottom(),
  25. ],
  26. ),
  27. );
  28. }
  29. // 导航栏
  30. Widget _createNav() {
  31. return CupertinoNavigationBar(
  32. border: Border(
  33. bottom: BorderSide(
  34. width: 0.0, // One physical pixel.
  35. style: BorderStyle.none,
  36. ),
  37. ),
  38. backgroundColor: Colors.white,
  39. leading: Navigator.canPop(context)
  40. ? GestureDetector(
  41. child: Container(
  42. padding: EdgeInsets.zero,
  43. child: Icon(
  44. Icons.arrow_back_ios,
  45. size: 20,
  46. ),
  47. ),
  48. onTap: () {
  49. if (Navigator.canPop(context)) {
  50. Navigator.pop(context);
  51. }
  52. },
  53. )
  54. : Container(),
  55. middle: Text(
  56. '邀请好友',
  57. style: TextStyle(
  58. fontSize: 15,
  59. color: HexColor.fromHex('#333333'),
  60. ),
  61. ),
  62. trailing: Text(
  63. '规则',
  64. style: TextStyle(
  65. fontSize: 15,
  66. color: HexColor.fromHex('#333333'),
  67. ),
  68. ),
  69. );
  70. }
  71. Widget _createSwiper() {
  72. return Container(
  73. width: double.infinity,
  74. child: Swiper(
  75. itemBuilder: (BuildContext context, int index) {
  76. return new Image.network(
  77. "http://via.placeholder.com/288x188",
  78. fit: BoxFit.fill,
  79. );
  80. },
  81. itemCount: 10,
  82. viewportFraction: 0.8,
  83. scale: 0.9,
  84. ),
  85. );
  86. }
  87. Widget _createTeacher() {
  88. return Container(
  89. width: double.infinity,
  90. margin: EdgeInsets.only(top: 20, left: 30, right: 30),
  91. padding: EdgeInsets.only(left: 13, right: 3),
  92. height: 36,
  93. decoration: BoxDecoration(
  94. color: Color(0x80ffffff),
  95. borderRadius: BorderRadius.circular(18),
  96. ),
  97. child: Row(
  98. children: <Widget>[
  99. Container(
  100. margin: EdgeInsets.only(right: 10),
  101. width: 18,
  102. height: 18,
  103. color: Colors.redAccent,
  104. ),
  105. Expanded(
  106. child: Text(
  107. '联系导师教你更多赚钱秘籍',
  108. maxLines: 1,
  109. overflow: TextOverflow.ellipsis,
  110. style: TextStyle(
  111. fontSize: 13,
  112. color: Color(0xff333333),
  113. ),
  114. ),
  115. ),
  116. Container(
  117. width: 88,
  118. height: 30,
  119. decoration: BoxDecoration(
  120. color: Colors.white, borderRadius: BorderRadius.circular(15)),
  121. child: Center(
  122. child: Text(
  123. '联系导师',
  124. style: TextStyle(
  125. fontSize: 13,
  126. color: Color(0xff333333),
  127. ),
  128. ),
  129. ),
  130. ),
  131. ],
  132. ),
  133. );
  134. }
  135. Widget _createBottom() {
  136. return SafeArea(
  137. top: false,
  138. child: Container(
  139. margin: EdgeInsets.all(12.5),
  140. padding: EdgeInsets.all(10),
  141. width: double.infinity,
  142. decoration: BoxDecoration(
  143. color: Colors.white,
  144. borderRadius: BorderRadius.circular(18),
  145. boxShadow: [
  146. BoxShadow(
  147. offset: Offset(0, 5), //x,y轴
  148. color: Colors.black12.withOpacity(0.1), //投影颜色
  149. blurRadius: 10 //,投影距离
  150. )
  151. ],
  152. ),
  153. child: Column(
  154. children: <Widget>[
  155. Row(
  156. children: List.generate(3, (index) {
  157. return Expanded(
  158. child: Container(
  159. margin: EdgeInsets.only(left: 8, right: 8),
  160. height: 28,
  161. decoration: BoxDecoration(
  162. color: Colors.redAccent,
  163. borderRadius: BorderRadius.circular(14),
  164. ),
  165. ),
  166. );
  167. }),
  168. ),
  169. Padding(
  170. padding: EdgeInsets.only(top: 10),
  171. child: Text(
  172. '您的好友下载APP并使用的您的邀请码成功登录之后,Ta将成为您的粉丝,粉丝下单,您也可以获得收益哦!',
  173. style: TextStyle(fontSize: 13, color: Color(0xff999999)),
  174. ),
  175. ),
  176. ],
  177. ),
  178. ),
  179. );
  180. }
  181. }