feedback_page.dart 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import 'package:flutter/material.dart';
  2. import 'package:sport/bean/feed_back.dart';
  3. import 'package:sport/pages/my/feedback_detail_page.dart';
  4. import 'package:sport/router/navigator_util.dart';
  5. import 'package:sport/services/api/inject_api.dart';
  6. import 'package:sport/widgets/appbar.dart';
  7. import 'package:sport/widgets/image.dart';
  8. import 'package:sport/widgets/list_tile.dart';
  9. import 'package:sport/widgets/loading.dart';
  10. class FeedbackPage extends StatefulWidget {
  11. @override
  12. State<StatefulWidget> createState() => _PageState();
  13. }
  14. class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
  15. @override
  16. void initState() {
  17. super.initState();
  18. }
  19. @override
  20. void dispose() {
  21. super.dispose();
  22. }
  23. @override
  24. Widget build(BuildContext context) {
  25. const contentPadding = EdgeInsets.symmetric(horizontal: 0.0);
  26. return Scaffold(
  27. backgroundColor: Colors.white,
  28. body: CustomScrollView(
  29. slivers: <Widget>[
  30. buildSliverAppBar(context, "用户反馈"),
  31. SliverPadding(
  32. padding: const EdgeInsets.symmetric(horizontal: 12),
  33. sliver: SliverToBoxAdapter(
  34. child: FutureBuilder<FeedTypeInfo?>(
  35. future: loginApi.getFeedBackTypes(),
  36. builder: (BuildContext context,
  37. AsyncSnapshot<FeedTypeInfo?> snapshot) {
  38. List<FeedTypeInfoData> list = snapshot.data?.data ?? [];
  39. if(list.isEmpty){
  40. return Center(child: RequestLoadingWidget(),);
  41. }
  42. return ListView(
  43. padding: EdgeInsets.zero,
  44. physics: NeverScrollableScrollPhysics(),
  45. shrinkWrap: true,
  46. children: divideTiles(
  47. context: context,
  48. includeLast: true,
  49. tiles: list
  50. .map((e) => ListTile(
  51. title: Text(
  52. '${e.groupName}',
  53. style: TextStyle(fontSize: 16.0),
  54. ),
  55. trailing: arrowRight5(),
  56. contentPadding: contentPadding,
  57. onTap: () => NavigatorUtil.goPage(context,
  58. (context) => FeedbackDetailPage(e)),
  59. ))
  60. .toList(),
  61. ).toList(),
  62. );
  63. },
  64. ),
  65. ),
  66. ),
  67. ],
  68. ));
  69. }
  70. }
  71. class BubblePainter extends CustomPainter {
  72. final circular = Radius.circular(10);
  73. final Paint _paint = Paint()
  74. ..color = Colors.white
  75. ..strokeJoin = StrokeJoin.round;
  76. final double _bubbleWidth = 6;
  77. @override
  78. void paint(Canvas canvas, Size size) {
  79. // Path path = Path()..moveTo(size.width, size.height / 2)..quadraticBezierTo(size.width / 3*2, size.height / 2 + 50, 0, size.height / 2)
  80. // ..quadraticBezierTo(size.width / 3, size.height,size.width,size.height)..close();
  81. Path path = Path()
  82. ..moveTo(_bubbleWidth + 1, 10)
  83. ..lineTo(0, 15)
  84. ..lineTo(0, 16)
  85. ..lineTo(_bubbleWidth + 1, 21)
  86. ..close();
  87. canvas.drawPath(path, _paint);
  88. canvas.drawRRect(
  89. RRect.fromLTRBR(_bubbleWidth, 0, size.width, size.height, circular),
  90. _paint);
  91. }
  92. @override
  93. bool shouldRepaint(CustomPainter oldDelegate) {
  94. return oldDelegate != this;
  95. }
  96. }
  97. class BubblePainterRight extends CustomPainter {
  98. final circular = Radius.circular(10);
  99. final Paint _paint = Paint()
  100. ..color = Color(0xffffe400).withOpacity(0.7)
  101. ..strokeJoin = StrokeJoin.round;
  102. final double _bubbleWidth = 6;
  103. @override
  104. void paint(Canvas canvas, Size size) {
  105. // Path path = Path()..moveTo(size.width, size.height / 2)..quadraticBezierTo(size.width / 3*2, size.height / 2 + 50, 0, size.height / 2)
  106. // ..quadraticBezierTo(size.width / 3, size.height,size.width,size.height)..close();
  107. double left = size.width - _bubbleWidth - 1;
  108. Path path = Path()
  109. ..moveTo(left, 10)
  110. ..lineTo(size.width, 15)
  111. ..lineTo(size.width, 16)
  112. ..lineTo(left, 21)
  113. ..close();
  114. canvas.drawPath(path, _paint);
  115. canvas.drawRRect(
  116. RRect.fromLTRBR(0, 0, size.width - _bubbleWidth, size.height, circular),
  117. _paint);
  118. }
  119. @override
  120. bool shouldRepaint(CustomPainter oldDelegate) {
  121. return oldDelegate != this;
  122. }
  123. }