pace_view.dart 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:trackoffical_app/utils.dart';
  4. import '../../generated/assets.dart';
  5. import 'package:common_pub/prelude.dart';
  6. import '../../widget/common.dart';
  7. class ModelItem {
  8. int? iUserid;
  9. int? iMsgType;
  10. String? sTime;
  11. String? sColor;
  12. String? sName;
  13. String? sMsg;
  14. // IconData? iconData;
  15. ModelItem(this.iUserid, this.iMsgType, this.sTime, this.sColor, this.sName,
  16. this.sMsg);
  17. }
  18. // const String kSubTitle = "abcdefghijklmnopqrstuvwxyz-1234567890";
  19. List<ModelItem> itemDatas = <ModelItem>[
  20. ModelItem(1, 1, "2023.07.04 12:25:26", "red", "贾奕", "成功打点 A56"),
  21. ModelItem(2, 1, "2023.07.04 12:26:16", "red", "王正祥", "完成比赛"),
  22. ModelItem(3, 1, "2023.07.04 12:27:27", "red", "冯烁", "成功打点 A15"),
  23. ModelItem(4, 1, "2023.07.04 12:28:27", "red", "冯烁", "成功打点 A16"),
  24. ModelItem(5, 1, "2023.07.04 12:29:27", "red", "冯烁", "成功打点 A17"),
  25. ModelItem(6, 1, "2023.07.04 12:29:30", "red", "冯烁", "完成比赛"),
  26. ];
  27. class PaceView extends GetView {
  28. const PaceView({super.key});
  29. @override
  30. Widget build(BuildContext context) {
  31. // final PageTopController c = Get.find();
  32. return Container(
  33. // color: Colors.red,
  34. // alignment: Alignment.topCenter,
  35. width: context.width,
  36. height: 7.22.wp,
  37. // padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
  38. child: Row(
  39. children: [
  40. Padding(
  41. padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
  42. child: Text("消息",
  43. style: TextStyle(fontSize: 1.39.wp, color: Colors.black)),
  44. ),
  45. Container(color: const Color(0xffc9c9c9), height: 4.86.wp, width: 1),
  46. Expanded(
  47. child: Container(
  48. // color: Colors.yellow,
  49. height: 6.wp,
  50. padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
  51. // margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
  52. child: wList(),
  53. ))
  54. ],
  55. ),
  56. );
  57. }
  58. Widget wList() {
  59. var msgCount = itemDatas.length;
  60. return msgCount > 0 ? ListView.builder(
  61. padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
  62. itemCount: msgCount,
  63. itemBuilder: (BuildContext context, int index) {
  64. return SizedBox(
  65. height: 2.0.wp,
  66. child: Row(
  67. children: [
  68. Container(
  69. // color: Colors.red,
  70. padding: EdgeInsets.only(left: 1.wp, right: 0.5.wp),
  71. // alignment: Alignment.center,
  72. child: Icon(
  73. Icons.notifications_none,
  74. size: 1.2.wp,
  75. ),
  76. ),
  77. Container(
  78. // color: Colors.blue,
  79. // alignment: Alignment.center,
  80. child: wMsgItem(index),
  81. ),
  82. ],
  83. ),
  84. );
  85. },
  86. ) : Center(child: Text("当前无消息", style: TextStyle(fontSize: 1.25.wp)));
  87. }
  88. Widget wMsgItem(int index) {
  89. TextStyle textStyle = TextStyle(fontSize: 1.25.wp);
  90. return Row(
  91. children: [
  92. Text(itemDatas[index].sTime!, style: textStyle),
  93. SizedBox(width: 1.wp),
  94. wUserMark(itemDatas[index].iUserid!),
  95. SizedBox(width: 0.3.wp),
  96. Text(itemDatas[index].sName!, style: textStyle),
  97. SizedBox(width: 0.5.wp),
  98. Text(itemDatas[index].sMsg!, style: textStyle),
  99. ],
  100. );
  101. }
  102. }