YSComment.dart 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:ysairplane/base/YSBase.dart';
  4. import 'package:ysairplane/code/YSCommnetAdd.dart';
  5. import 'package:ysairplane/tools/YSTools.dart';
  6. import 'package:smooth_star_rating/smooth_star_rating.dart';
  7. class YSComment extends StatefulWidget {
  8. @override
  9. _YSCommentState createState() => _YSCommentState();
  10. }
  11. class _YSCommentState extends State<YSComment> {
  12. List _tags = ['服务热情(346)','服务热情(346)','服务热情(346)','服务热情(346)','服务热情(346)','服务热情(346)','服务热情(346)','服务热情(346)','服务热情(346)','服务热情(346)','服务热情(346)','服务热情(346)',];
  13. @override
  14. Widget build(BuildContext context) {
  15. return YSBase(
  16. ystitle: '点评',
  17. yschild: Column(
  18. crossAxisAlignment: CrossAxisAlignment.start,
  19. children: [
  20. Container(
  21. color: Colors.white,
  22. width: MediaQuery.of(context).size.width,
  23. padding: EdgeInsets.all(hsp(30)),
  24. child: Column(
  25. children: [
  26. GestureDetector(
  27. onTap: (){
  28. Navigator.of(context).push(
  29. CupertinoPageRoute(
  30. builder: (context){
  31. return YSCommentAdd();
  32. }
  33. )
  34. );
  35. },
  36. child: Container(
  37. width: MediaQuery.of(context).size.width,
  38. child: Text('评价(32)',style: TextStyle(fontSize: zsp(36),color: Color(0xFF000000),fontWeight: FontWeight.bold),),
  39. ),
  40. ),
  41. Container(
  42. margin: EdgeInsets.only(top: hsp(30),bottom: hsp(30),right: wsp(10)),
  43. height: hsp(120),
  44. child: Row(
  45. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  46. children: [
  47. Container(
  48. child: Column(
  49. children: [
  50. RichText(
  51. text: TextSpan(
  52. text: '5.0',
  53. style: TextStyle(fontSize: zsp(60),color: Color(0xFFED5E58),fontWeight: FontWeight.bold),
  54. children: [
  55. TextSpan(
  56. text: ' 超赞',
  57. style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal),
  58. )
  59. ]
  60. ),
  61. ),
  62. Text('高于94%同类型航空',style: TextStyle(fontSize: zsp(20),color: Color(0xFF202020)),),
  63. ],
  64. ),
  65. width: wsp(200),
  66. ),
  67. Container(
  68. height: hsp(120),
  69. width: MediaQuery.of(context).size.width-hsp(120)-wsp(210)-wsp(60),
  70. margin: EdgeInsets.only(left: wsp(10),right: wsp(0)),
  71. child: GridView.builder(
  72. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  73. crossAxisCount: 2,
  74. childAspectRatio: (MediaQuery.of(context).size.width-hsp(120)-wsp(210)-wsp(60))/2/hsp(60)
  75. ),
  76. itemBuilder: (context, index) {
  77. return Container(
  78. height: hsp(60),
  79. child: Row(
  80. children: [
  81. Text('舒适 4.9 ',style: TextStyle(fontSize: zsp(22),color: Color(0xFF202020)),),
  82. Container(
  83. height: hsp(8),
  84. decoration: BoxDecoration(
  85. color: Color(0xFFED5E58),
  86. borderRadius: BorderRadius.all(Radius.circular(50))
  87. ),
  88. width: wsp(75),
  89. )
  90. ],
  91. ),
  92. );
  93. },
  94. itemCount: 4,
  95. padding: EdgeInsets.all(0),
  96. physics: NeverScrollableScrollPhysics(),
  97. ),
  98. )
  99. ],
  100. ),
  101. ),
  102. Container(
  103. width: MediaQuery.of(context).size.width-hsp(120),
  104. child: Wrap(
  105. alignment: WrapAlignment.start,
  106. children: <Widget>[
  107. for (int i =0;i<_tags.length;i++ ) GestureDetector(
  108. behavior: HitTestBehavior.opaque,
  109. onTap: (){
  110. },
  111. child: Container(
  112. margin: EdgeInsets.symmetric(vertical: hsp(10), horizontal: hsp(10)),
  113. decoration: BoxDecoration(
  114. color: Color(0xFFFDF1F1),
  115. borderRadius: BorderRadius.all(Radius.circular(5))
  116. ),
  117. padding: EdgeInsets.only(left: wsp(15), right: wsp(15),top: hsp(10),bottom: hsp(10)),
  118. child: Text('${_tags[i]}', style: TextStyle(fontSize: zsp(24),color: Color(0xFF000000)), textAlign: TextAlign.center,),
  119. ),
  120. )
  121. ]
  122. ),
  123. ),
  124. ],
  125. ),
  126. ),
  127. ListView.separated(
  128. shrinkWrap: true,
  129. itemBuilder: (context,index){
  130. return Container(
  131. padding: EdgeInsets.all(hsp(30)),
  132. child: Column(
  133. crossAxisAlignment: CrossAxisAlignment.start,
  134. children: [
  135. Row(
  136. children: [
  137. Container(
  138. height: hsp(90),
  139. width: hsp(90),
  140. margin: EdgeInsets.only(right: wsp(20)),
  141. decoration: BoxDecoration(
  142. color: Colors.lightGreen,
  143. borderRadius: BorderRadius.all(Radius.circular(50))
  144. ),
  145. ),
  146. Container(
  147. height: hsp(80),
  148. child: Column(
  149. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  150. crossAxisAlignment: CrossAxisAlignment.start,
  151. children: [
  152. Row(
  153. children: [
  154. Text('周真美丽',style: TextStyle(fontSize: zsp(28),color: Color(0xFF000000),fontWeight: FontWeight.bold),),
  155. Container(
  156. height: hsp(30),
  157. child: Row(
  158. children: [
  159. Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),),
  160. Text(' 砖石贵宾',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),)
  161. ],
  162. ),
  163. padding: EdgeInsets.only(left: wsp(7),right: wsp(7)),
  164. margin: EdgeInsets.only(left: wsp(10)),
  165. decoration: BoxDecoration(
  166. color: Color(0xFF000000),
  167. borderRadius: BorderRadius.all(Radius.circular(2))
  168. ),
  169. )
  170. ],
  171. ),
  172. SmoothStarRating(
  173. rating: 4.0,
  174. isReadOnly: true,
  175. size: hsp(30),
  176. filledIconData: Icons.star,
  177. halfFilledIconData: Icons.star_half,
  178. defaultIconData: Icons.star_border,
  179. starCount: 5,
  180. allowHalfRating: true,
  181. spacing: 1.0,
  182. onRated: (value) {
  183. print("rating value -> $value");
  184. },
  185. color: Color(0xFFF97C00),
  186. borderColor: Color(0xFFF97C00),
  187. )
  188. ],
  189. ),
  190. width: MediaQuery.of(context).size.width-hsp(360),
  191. ),
  192. Text('2019-3-24 发布',style: TextStyle(fontSize: zsp(22),color: Color(0xFF9A9A9A)),)
  193. ],
  194. crossAxisAlignment: CrossAxisAlignment.start,
  195. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  196. ),
  197. Container(
  198. margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20)),
  199. child: ysTextExpend(text: index==0?'海南航空公司非常好,我很欣赏!航空公司非空欣赏很欣赏很欣赏赏常好我很欣赏!航空公司非常好, 我很欣很欣赏很欣赏很欣赏赏海南航空公司非常好,'
  200. '我很欣赏!航空公司非空欣赏很欣赏很欣赏赏常好我很欣赏!航空公司非常好, 我很欣很欣赏很欣赏很欣赏赏':'海南航空公司非常好,我很欣赏海南航空公司非常好,我很欣赏海南航空公司非常好,我很欣赏',
  201. style: TextStyle(fontSize: zsp(28),color: Color(0xFF000000)),maxLines: 3,)
  202. ),
  203. if(index==1)GridView.builder(
  204. shrinkWrap: true,
  205. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  206. crossAxisCount: 3,
  207. childAspectRatio: (MediaQuery.of(context).size.width-hsp(140)-wsp(60))/3/hsp(160),
  208. crossAxisSpacing: hsp(10),
  209. mainAxisSpacing: hsp(10)
  210. ),
  211. itemBuilder: (context, index) {
  212. return Container(
  213. height: hsp(160),
  214. color: Colors.red.withOpacity((index+1)*0.1),
  215. );
  216. },
  217. itemCount: 3,
  218. padding: EdgeInsets.all(0),
  219. physics: NeverScrollableScrollPhysics(),
  220. )
  221. ],
  222. ),
  223. );
  224. },
  225. separatorBuilder: (context,index){
  226. return Divider(color: Color(0xFFF1F2F4),height: hsp(10),thickness: hsp(10),);
  227. },
  228. itemCount: 3,
  229. physics: NeverScrollableScrollPhysics(),
  230. ),
  231. ],
  232. ),
  233. );
  234. }
  235. }