system_information_page.dart 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import 'package:bbyyy/my_tools/my_colors.dart';
  2. import 'package:bbyyy/my_tools/my_cookie.dart';
  3. import 'package:bbyyy/my_tools/my_tools.dart';
  4. import 'package:bbyyy/my_tools/my_views.dart';
  5. import 'package:flutter/material.dart';
  6. class SystemInformationPage extends StatefulWidget {
  7. @override
  8. _SystemInformationPageState createState() => _SystemInformationPageState();
  9. }
  10. class _SystemInformationPageState extends State<SystemInformationPage> {
  11. List<String> sysMsg = [];
  12. @override
  13. void initState() {
  14. // TODO: implement initState
  15. super.initState();
  16. String s = MyCookie().prefs.getString('${MyCookie().getUID()}系统消息');
  17. if (s != null) {
  18. sysMsg = s.split('!@##@!');
  19. }
  20. setState(() {});
  21. }
  22. @override
  23. Widget build(BuildContext context) {
  24. return Scaffold(
  25. body: Column(
  26. children: [
  27. MyViews().myAppBar('系统消息', context, []),
  28. Expanded(
  29. child: ListView.builder(
  30. itemBuilder: (BuildContext context, int index) {
  31. return GestureDetector(
  32. onTap: () {
  33. MyTools().toPage(context,
  34. SystemMessageDetailsPage(sysMsg[index]), (then) {});
  35. },
  36. behavior: HitTestBehavior.translucent,
  37. child: Column(
  38. children: [
  39. Container(
  40. color: Colors.white,
  41. child: Text(
  42. sysMsg[index],
  43. maxLines: 2,
  44. overflow: TextOverflow.ellipsis,
  45. softWrap: true,
  46. style:
  47. TextStyle(color: MyColors.c333333, fontSize: 14),
  48. ),
  49. alignment: Alignment.centerLeft,
  50. padding: EdgeInsets.all(10),
  51. ),
  52. Container(
  53. height: 0.5,
  54. color: MyColors.cF7F7F7,
  55. )
  56. ],
  57. ),
  58. );
  59. },
  60. itemCount: sysMsg.length,
  61. padding: EdgeInsets.all(0),
  62. ),
  63. )
  64. ],
  65. ),
  66. );
  67. }
  68. }
  69. class SystemMessageDetailsPage extends StatefulWidget {
  70. String sysMsg;
  71. SystemMessageDetailsPage(this.sysMsg);
  72. @override
  73. _SystemMessageDetailsPageState createState() =>
  74. _SystemMessageDetailsPageState();
  75. }
  76. class _SystemMessageDetailsPageState extends State<SystemMessageDetailsPage> {
  77. @override
  78. Widget build(BuildContext context) {
  79. return Scaffold(
  80. body: Column(
  81. children: [
  82. MyViews().myAppBar('系统消息详情', context, []),
  83. Expanded(
  84. child: Container(
  85. margin: EdgeInsets.all(20),
  86. child: Text(
  87. widget.sysMsg,
  88. style: TextStyle(color: MyColors.c333333, fontSize: 20),
  89. ),
  90. ),
  91. ),
  92. ],
  93. ),
  94. );
  95. }
  96. }