home_page.dart 7.9 KB

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