home_page.dart 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. import 'package:deus_app/common/local/StoreHelper.dart';
  2. import 'package:deus_app/common/utils/ConstantString.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter/services.dart';
  5. class HomePage extends StatefulWidget {
  6. const HomePage({Key? key}) : super(key: key);
  7. @override
  8. _MineViewPageState createState() => _MineViewPageState();
  9. }
  10. class _MineViewPageState extends State<HomePage> {
  11. List items = [
  12. {"name": "今日维保任务", "num": 1},
  13. {"name": "今日巡检任务", "num": 2}
  14. ];
  15. List icons = [
  16. {"name": "设备管理", "image": "images/device_manage.png"},
  17. {"name": "维保任务", "image": "images/maintenance.png"},
  18. {"name": "巡检任务", "image": "images/patrol_inspect.png"},
  19. {"name": "保修管理", "image": "images/maintenance_manage.png"},
  20. ];
  21. @override
  22. void initState() {
  23. super.initState();
  24. }
  25. void registerHandler() {}
  26. @override
  27. Widget build(BuildContext context) {
  28. return Scaffold(
  29. extendBodyBehindAppBar: true,
  30. appBar: AppBar(
  31. shadowColor: Colors.transparent,
  32. backgroundColor: Colors.transparent,
  33. systemOverlayStyle: SystemUiOverlayStyle.light
  34. .copyWith(statusBarColor: Colors.transparent),
  35. // title: Text(user != null ? user["nickname"] : "",style:TextStyle(color: Colors.white),),
  36. centerTitle: true,
  37. elevation: 0.0,
  38. toolbarHeight: 0,
  39. ),
  40. backgroundColor: const Color(0xfff4f6ff),
  41. body: Column(
  42. children: [
  43. Container(
  44. padding: EdgeInsets.only(
  45. left: 15,
  46. right: 15,
  47. top: MediaQuery.of(context).padding.top + 10),
  48. height: MediaQuery.of(context).size.width * 0.53,
  49. decoration: BoxDecoration(
  50. image: DecorationImage(
  51. image: AssetImage("images/home_bg.jpg"), fit: BoxFit.cover),
  52. ),
  53. child: Column(
  54. children: [
  55. Row(
  56. mainAxisAlignment: MainAxisAlignment.end,
  57. children: [
  58. Icon(
  59. Icons.settings,
  60. color: Colors.white,
  61. )
  62. ],
  63. ),
  64. Row(
  65. children: [
  66. Image.asset(
  67. "images/head.png",
  68. width: 40,
  69. height: 40,
  70. ),
  71. SizedBox(width: 10),
  72. Text(
  73. StoreHelper.getStorage(ConstantString.name),
  74. style: TextStyle(
  75. color: Colors.white, fontWeight: FontWeight.bold,fontSize: 15),
  76. )
  77. ],
  78. ),
  79. SizedBox(height: 20),
  80. Row(
  81. children: [
  82. SizedBox(width: 50),
  83. Text(StoreHelper.getStorage(ConstantString.phone),
  84. style: TextStyle(
  85. color: Colors.white,
  86. fontWeight: FontWeight.bold,
  87. fontSize: 18))
  88. ],
  89. ),
  90. SizedBox(height: 10),
  91. Row(
  92. children: [
  93. SizedBox(width: 50),
  94. Text(StoreHelper.getStorage(ConstantString.orgName),
  95. style:
  96. TextStyle(color: Color(0xffaaaaaa), fontSize: 15))
  97. ],
  98. ),
  99. ],
  100. ),
  101. ),
  102. Container(
  103. padding: EdgeInsets.all(10),
  104. margin: EdgeInsets.all(15),
  105. decoration: BoxDecoration(
  106. color: Colors.white,
  107. borderRadius: BorderRadius.circular(10)),
  108. child: Column(
  109. crossAxisAlignment: CrossAxisAlignment.start,
  110. children: [
  111. SizedBox(height: 15),
  112. Container(
  113. width: double.infinity,
  114. height: 40,
  115. alignment: Alignment.center,
  116. decoration: BoxDecoration(
  117. color: Color(0xff74b900),
  118. borderRadius: BorderRadius.circular(10)),
  119. child: Text("当前设备运行正常",
  120. style: TextStyle(
  121. color: Color(0xffffffff), fontSize: 15))),
  122. SizedBox(
  123. height: 20,
  124. ),
  125. Text("待办任务",
  126. style: TextStyle(color: Color(0xff000000), fontSize: 18)),
  127. SizedBox(
  128. height: 10,
  129. ),
  130. GridView.builder(
  131. shrinkWrap: true,
  132. padding: const EdgeInsets.only(
  133. top: 10,
  134. ),
  135. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  136. crossAxisCount: 1,
  137. mainAxisSpacing: 10,
  138. crossAxisSpacing: 10,
  139. childAspectRatio: MediaQuery.of(context).size.width / 30,
  140. ),
  141. itemBuilder: (context, index) {
  142. Map item = items[index];
  143. return Row(
  144. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  145. children: [
  146. Text(item["name"],
  147. style: TextStyle(
  148. color: Color(0xff000000), fontSize: 13)),
  149. Text(item["num"].toString(),
  150. style: TextStyle(
  151. color: Color(0xff000000), fontSize: 13))
  152. ],
  153. );
  154. },
  155. itemCount: items.length,
  156. )
  157. ],
  158. ),
  159. ),
  160. Container(
  161. margin: EdgeInsets.only(left: 15, right: 15),
  162. decoration:
  163. BoxDecoration(borderRadius: BorderRadius.circular(10)),
  164. child: Column(
  165. crossAxisAlignment: CrossAxisAlignment.start,
  166. children: [
  167. GridView.builder(
  168. shrinkWrap: true,
  169. padding: const EdgeInsets.only(
  170. top: 0,
  171. ),
  172. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  173. crossAxisCount: 3,
  174. mainAxisSpacing: 10,
  175. crossAxisSpacing: 10,
  176. childAspectRatio:
  177. (MediaQuery.of(context).size.width / 3 - 60 / 3) /
  178. 120,
  179. ),
  180. itemBuilder: (context, index) {
  181. Map item = icons[index];
  182. return Container(
  183. padding: EdgeInsets.all(5),
  184. decoration: BoxDecoration(
  185. color: Color(0xffffffff),
  186. borderRadius: BorderRadius.circular(10)),
  187. child: Column(
  188. crossAxisAlignment: CrossAxisAlignment.center,
  189. mainAxisAlignment: MainAxisAlignment.center,
  190. children: [
  191. Image.asset(
  192. item["image"],
  193. width: 60,
  194. height: 60,
  195. ),
  196. SizedBox(height: 10),
  197. Text(item["name"].toString(),
  198. style: TextStyle(
  199. color: Color(0xff000000), fontSize: 13))
  200. ],
  201. ),
  202. );
  203. },
  204. itemCount: icons.length,
  205. )
  206. ],
  207. ),
  208. ),
  209. ],
  210. ));
  211. }
  212. }