notice_list.dart 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import 'package:eitc_erm_app/utils/Constants.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_html/flutter_html.dart';
  4. import 'bean/notice_manage_list.dart';
  5. import 'notice_detail.dart';
  6. void main() {
  7. WidgetsFlutterBinding.ensureInitialized();
  8. runApp(NoticeList(""));
  9. }
  10. NoticeManageList mNoticeManageList = new NoticeManageList();
  11. class NoticeList extends StatefulWidget {
  12. NoticeList(noticeManageList, {super.key}) {
  13. mNoticeManageList = noticeManageList;
  14. }
  15. @override
  16. State<StatefulWidget> createState() => NoticeListState();
  17. }
  18. class NoticeListState extends State<NoticeList> {
  19. @override
  20. void initState() {
  21. super.initState();
  22. }
  23. @override
  24. Widget build(BuildContext context) {
  25. return Scaffold(
  26. appBar: AppBar(
  27. title: const Text('公告',
  28. style: TextStyle(
  29. color: Colors.white,
  30. )),
  31. centerTitle: true,
  32. elevation: 0.5,
  33. backgroundColor: Global.StatusBarColor,
  34. leading: IconButton(
  35. tooltip: '返回上一页',
  36. icon: const Icon(
  37. Icons.arrow_back_ios,
  38. color: Colors.white,
  39. ),
  40. onPressed: () {
  41. Navigator.of(context).pop();
  42. //_nextPage(-1);
  43. },
  44. ),
  45. ),
  46. body: Center(
  47. child: ListView.builder(
  48. itemCount: mNoticeManageList.data?.length,
  49. itemBuilder: (context, index) {
  50. return GestureDetector(
  51. child: Card(
  52. color: Colors.white,
  53. child: Padding(
  54. padding: const EdgeInsets.all(10),
  55. child: Column(
  56. crossAxisAlignment: CrossAxisAlignment.start,
  57. children: [
  58. Text(
  59. mNoticeManageList.data![index].noticeTitle ?? "",
  60. style: Theme.of(context).textTheme.titleLarge,
  61. ),
  62. const SizedBox(
  63. height: 5.0,
  64. ),
  65. Align(
  66. alignment: Alignment.centerRight,
  67. child: Text(
  68. mNoticeManageList.data![index].noticeStartTime ?? "",
  69. style: Theme.of(context)
  70. .textTheme
  71. .bodySmall
  72. ?.copyWith(color: Colors.grey),
  73. ),
  74. ),
  75. const SizedBox(
  76. height: 5.0,
  77. ),
  78. Html(
  79. data: mNoticeManageList.data![index].noticeContent,
  80. ),
  81. Align(
  82. alignment: Alignment.bottomRight,
  83. child: Text(
  84. "查看详情",
  85. style: Theme.of(context)
  86. .textTheme
  87. .bodyMedium
  88. ?.copyWith(color: Global.StatusBarColor),
  89. ),
  90. ),
  91. ],
  92. ),
  93. )),
  94. onTap: () {
  95. Navigator.push(
  96. context,
  97. MaterialPageRoute(
  98. builder: (context) =>
  99. NoticeDetail(mNoticeManageList, index)),
  100. );
  101. },
  102. );
  103. },
  104. )),
  105. );
  106. }
  107. }