YSMessage.dart 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:ysairplane/tools/YSTools.dart';
  4. class YSMessage extends StatefulWidget {
  5. @override
  6. _YSMessageState createState() => _YSMessageState();
  7. }
  8. class _YSMessageState extends State<YSMessage> {
  9. bool _isShow = false;
  10. @override
  11. Widget build(BuildContext context) {
  12. return Scaffold(
  13. backgroundColor: Color(0xFFF0F0F1),
  14. appBar: CupertinoNavigationBar(
  15. backgroundColor: Colors.white,
  16. leading: GestureDetector(child: Icon(Icons.arrow_back_ios,size: 15,color: Color(0xFF000000),),onTap: (){Navigator.pop(context);},),
  17. border: Border(),
  18. middle: GestureDetector(
  19. onTap: (){
  20. setState(() {
  21. _isShow = !_isShow;
  22. });
  23. },
  24. child: Row(
  25. mainAxisSize: MainAxisSize.min,
  26. children: [
  27. Text('全部消息',style: TextStyle(fontSize: zsp(36),color: Color(0xFF000000)),),
  28. Icon(Icons.keyboard_arrow_down,size: 15,color: Color(0xFF000000),),
  29. ],
  30. ),
  31. ),
  32. ),
  33. body: Stack(
  34. children: [
  35. ListView.separated(
  36. shrinkWrap: true,
  37. itemBuilder: (context,index){
  38. return Container(
  39. padding: EdgeInsets.all(hsp(30)),
  40. color: Colors.white,
  41. child: index==0?Row(
  42. crossAxisAlignment: CrossAxisAlignment.start,
  43. children: [
  44. Container(
  45. height: hsp(66),
  46. width: hsp(66),
  47. decoration: BoxDecoration(
  48. color: Colors.lightBlue,
  49. borderRadius: BorderRadius.all(Radius.circular(hsp(33)))
  50. ),
  51. margin: EdgeInsets.only(right: wsp(20)),
  52. ),
  53. Column(
  54. crossAxisAlignment: CrossAxisAlignment.start,
  55. children: [
  56. Text('系统消息',style: TextStyle(fontSize: zsp(28),color: Color(0xFF3C61B2),fontWeight: FontWeight.bold),),
  57. Container(
  58. child: Text('2020.09.09 12:00',style: TextStyle(fontSize: zsp(22),color: Color(0xFF9A9A9A)),),
  59. margin: EdgeInsets.only(top: hsp(10),bottom: hsp(20)),
  60. ),
  61. Container(
  62. child: Text('你提交的头条消息修改申请已通过申请你提交的头条消息修改申请已通过申请。你提交的头条消息修改申请已通过申请。',style: TextStyle(fontSize: zsp(28),color: Color(0xFF343434)),),
  63. width: MediaQuery.of(context).size.width-hsp(170),
  64. )
  65. ],
  66. )
  67. ],
  68. ):index==1||index==2||index==3?Column(
  69. children: [
  70. Row(
  71. crossAxisAlignment: CrossAxisAlignment.start,
  72. children: [
  73. Container(
  74. height: hsp(66),
  75. width: hsp(66),
  76. decoration: BoxDecoration(
  77. color: Colors.lightBlue,
  78. borderRadius: BorderRadius.all(Radius.circular(hsp(33)))
  79. ),
  80. margin: EdgeInsets.only(right: wsp(20)),
  81. ),
  82. Column(
  83. crossAxisAlignment: CrossAxisAlignment.start,
  84. children: [
  85. Text('司徒杰森',style: TextStyle(fontSize: zsp(28),color: Color(0xFF3C61B2),fontWeight: FontWeight.bold),),
  86. Container(
  87. child: Text('2020.09.09 12:00',style: TextStyle(fontSize: zsp(22),color: Color(0xFF9A9A9A)),),
  88. margin: EdgeInsets.only(top: hsp(10)),
  89. ),
  90. ],
  91. )
  92. ],
  93. ),
  94. Container(
  95. child: Text(index==1?'@我 好想和你一起提前过年':index==2?'赞了这条动态':'我亲戚家还有掉厕所的,哈哈哈哈哈哈哈哈哈哈都活的好好的 还考上了医学院。',style: TextStyle(fontSize: zsp(28),color: Color(0xFF343434)),),
  96. width: MediaQuery.of(context).size.width-hsp(66),
  97. margin: EdgeInsets.only(top: hsp(30),bottom: hsp(20)),
  98. ),
  99. Row(
  100. children: [
  101. Container(
  102. height: hsp(120),
  103. width: hsp(120),
  104. color: Colors.blueGrey,
  105. ),
  106. Container(
  107. height: hsp(120),
  108. width: MediaQuery.of(context).size.width-hsp(186),
  109. color: Color(0xFFF4F6F8),
  110. child: Text('有没有想提前过年的小有想提前过年的小朋友,一起放个烟花呗~',style: TextStyle(fontSize: zsp(24),color: Color(0xFF7F7F7F)),maxLines: 2,overflow: TextOverflow.ellipsis,),
  111. padding: EdgeInsets.all(hsp(20)),
  112. )
  113. ],
  114. )
  115. ],
  116. ):Row(
  117. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  118. children: [
  119. Row(
  120. children: [
  121. Container(
  122. height: hsp(66),
  123. width: hsp(66),
  124. decoration: BoxDecoration(
  125. color: Colors.lightBlue,
  126. borderRadius: BorderRadius.all(Radius.circular(hsp(33)))
  127. ),
  128. margin: EdgeInsets.only(right: wsp(20)),
  129. ),
  130. Column(
  131. crossAxisAlignment: CrossAxisAlignment.start,
  132. children: [
  133. RichText(
  134. text: TextSpan(
  135. text: '司徒杰森',
  136. style: TextStyle(fontSize: zsp(28),color: Color(0xFF3C61B2),fontWeight: FontWeight.bold),
  137. children: [
  138. TextSpan(
  139. text: ' 关注了你',
  140. style: TextStyle(color: Color(0xFF575757),fontWeight: FontWeight.normal),
  141. )
  142. ]
  143. ),
  144. ),
  145. Container(
  146. child: Text('2020.09.09 12:00',style: TextStyle(fontSize: zsp(22),color: Color(0xFF9A9A9A)),),
  147. margin: EdgeInsets.only(top: hsp(10)),
  148. ),
  149. ],
  150. )
  151. ],
  152. ),
  153. Container(
  154. height: hsp(60),
  155. width: wsp(100),
  156. decoration: BoxDecoration(
  157. color: Color(0xFF007AFF),
  158. borderRadius: BorderRadius.all(Radius.circular(50))
  159. ),
  160. alignment: Alignment.center,
  161. child: Text('关注',style: TextStyle(color: Colors.white,fontSize: zsp(24)),),
  162. )
  163. ],
  164. ),
  165. );
  166. },
  167. separatorBuilder: (context,index){
  168. return Divider(height: hsp(12),thickness: hsp(12),color: Color(0xFFF0F0F1),);
  169. },
  170. itemCount: 5,
  171. padding: EdgeInsets.only(top: hsp(12),bottom: hsp(43)),
  172. ),
  173. if(_isShow==true)Column(
  174. children: [
  175. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEEEEEE),),
  176. Container(
  177. color: Colors.white,
  178. child: ListView.separated(
  179. shrinkWrap: true,
  180. itemBuilder: (context,index){
  181. return Container(
  182. height: hsp(105),
  183. color: Colors.white,
  184. alignment: Alignment.centerLeft,
  185. padding: EdgeInsets.only(left: wsp(50),right: wsp(50)),
  186. child: Row(
  187. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  188. children: [
  189. Text('系统消息',style: TextStyle(fontSize: zsp(28),color: Color(0xFF343434),fontWeight: index==0?FontWeight.bold:FontWeight.normal),),
  190. Icon(Icons.check,color: index==0?Color(0xFF007AFF):Colors.transparent,size: hsp(40),)
  191. ],
  192. )
  193. );
  194. },
  195. separatorBuilder: (context,index){
  196. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEEEEEE),);
  197. },
  198. itemCount: 6,
  199. physics: NeverScrollableScrollPhysics(),
  200. ),
  201. ),
  202. GestureDetector(
  203. onTap: (){
  204. setState(() {
  205. _isShow = false;
  206. });
  207. },
  208. child: Container(
  209. height: MediaQuery.of(context).size.height-hsp(105)*6-3-MediaQuery.of(context).padding.top-44,
  210. width: MediaQuery.of(context).size.width,
  211. color: Colors.black54,
  212. ),
  213. )
  214. ],
  215. )
  216. ],
  217. ),
  218. );
  219. }
  220. }