|
|
@@ -1,9 +1,15 @@
|
|
|
import 'package:deus_app/common/local/StoreHelper.dart';
|
|
|
import 'package:deus_app/common/utils/ConstantString.dart';
|
|
|
+import 'package:deus_app/common/utils/ToastUtils.dart';
|
|
|
+import 'package:deus_app/page/patrol/patrol_job_page.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
+import '../device/device_manage_page.dart';
|
|
|
+
|
|
|
class HomePage extends StatefulWidget {
|
|
|
+ static var routeName = '/HomePage';
|
|
|
+
|
|
|
const HomePage({Key? key}) : super(key: key);
|
|
|
|
|
|
@override
|
|
|
@@ -16,11 +22,20 @@ class _MineViewPageState extends State<HomePage> {
|
|
|
{"name": "今日巡检任务", "num": 2}
|
|
|
];
|
|
|
List icons = [
|
|
|
- {"name": "设备管理", "image": "images/device_manage.png"},
|
|
|
- {"name": "维保任务", "image": "images/maintenance.png"},
|
|
|
- {"name": "巡检任务", "image": "images/patrol_inspect.png"},
|
|
|
- {"name": "保修管理", "image": "images/maintenance_manage.png"},
|
|
|
+ {
|
|
|
+ "name": "设备管理",
|
|
|
+ "image": "images/device_manage.png",
|
|
|
+ 'jump': DeviceManagePage.routeName
|
|
|
+ },
|
|
|
+ {"name": "维保任务", "image": "images/maintenance.png", 'jump': ''},
|
|
|
+ {
|
|
|
+ "name": "巡检任务",
|
|
|
+ "image": "images/patrol_inspect.png",
|
|
|
+ 'jump': PatrolJobPage.routeName
|
|
|
+ },
|
|
|
+ {"name": "保修管理", "image": "images/maintenance_manage.png", 'jump': ''},
|
|
|
];
|
|
|
+
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
@@ -60,10 +75,11 @@ class _MineViewPageState extends State<HomePage> {
|
|
|
Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
children: [
|
|
|
- Icon(
|
|
|
- Icons.settings,
|
|
|
+ IconButton(
|
|
|
+ icon: Icon(Icons.settings),
|
|
|
color: Colors.white,
|
|
|
- )
|
|
|
+ onPressed: () => showToast("text"),
|
|
|
+ ),
|
|
|
],
|
|
|
),
|
|
|
Row(
|
|
|
@@ -77,7 +93,9 @@ class _MineViewPageState extends State<HomePage> {
|
|
|
Text(
|
|
|
StoreHelper.getStorage(ConstantString.name),
|
|
|
style: TextStyle(
|
|
|
- color: Colors.white, fontWeight: FontWeight.bold,fontSize: 15),
|
|
|
+ color: Colors.white,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ fontSize: 15),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
@@ -98,7 +116,7 @@ class _MineViewPageState extends State<HomePage> {
|
|
|
SizedBox(width: 50),
|
|
|
Text(StoreHelper.getStorage(ConstantString.orgName),
|
|
|
style:
|
|
|
- TextStyle(color: Color(0xffaaaaaa), fontSize: 15))
|
|
|
+ TextStyle(color: Color(0xffaaaaaa), fontSize: 15))
|
|
|
],
|
|
|
),
|
|
|
],
|
|
|
@@ -108,8 +126,7 @@ class _MineViewPageState extends State<HomePage> {
|
|
|
padding: EdgeInsets.all(10),
|
|
|
margin: EdgeInsets.all(15),
|
|
|
decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- borderRadius: BorderRadius.circular(10)),
|
|
|
+ color: Colors.white, borderRadius: BorderRadius.circular(10)),
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
@@ -165,7 +182,7 @@ class _MineViewPageState extends State<HomePage> {
|
|
|
Container(
|
|
|
margin: EdgeInsets.only(left: 15, right: 15),
|
|
|
decoration:
|
|
|
- BoxDecoration(borderRadius: BorderRadius.circular(10)),
|
|
|
+ BoxDecoration(borderRadius: BorderRadius.circular(10)),
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
@@ -179,30 +196,33 @@ class _MineViewPageState extends State<HomePage> {
|
|
|
mainAxisSpacing: 10,
|
|
|
crossAxisSpacing: 10,
|
|
|
childAspectRatio:
|
|
|
- (MediaQuery.of(context).size.width / 3 - 60 / 3) /
|
|
|
- 120,
|
|
|
+ (MediaQuery.of(context).size.width / 3 - 60 / 3) /
|
|
|
+ 120,
|
|
|
),
|
|
|
itemBuilder: (context, index) {
|
|
|
Map item = icons[index];
|
|
|
- return Container(
|
|
|
- padding: EdgeInsets.all(5),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Color(0xffffffff),
|
|
|
- borderRadius: BorderRadius.circular(10)),
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Image.asset(
|
|
|
- item["image"],
|
|
|
- width: 60,
|
|
|
- height: 60,
|
|
|
- ),
|
|
|
- SizedBox(height: 10),
|
|
|
- Text(item["name"].toString(),
|
|
|
- style: TextStyle(
|
|
|
- color: Color(0xff000000), fontSize: 13))
|
|
|
- ],
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () => Navigator.pushNamed(context, item['jump']),
|
|
|
+ child: Container(
|
|
|
+ padding: EdgeInsets.all(5),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Color(0xffffffff),
|
|
|
+ borderRadius: BorderRadius.circular(10)),
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Image.asset(
|
|
|
+ item["image"],
|
|
|
+ width: 60,
|
|
|
+ height: 60,
|
|
|
+ ),
|
|
|
+ SizedBox(height: 10),
|
|
|
+ Text(item["name"].toString(),
|
|
|
+ style: TextStyle(
|
|
|
+ color: Color(0xff000000), fontSize: 13))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
},
|