Quellcode durchsuchen

第一次提交

yangyang vor 2 Jahren
Ursprung
Commit
a6eededc64

BIN
assets/images/home_bg.jpg


BIN
images/2.0x/home_bg.jpg


BIN
images/3.0x/home_bg.jpg


BIN
images/device_manage.png


BIN
images/head.png


BIN
images/home_bg.jpg


BIN
images/maintenance.png


BIN
images/maintenance_manage.png


BIN
images/patrol_inspect.png


+ 5 - 6
lib/common/style/TitleBar.dart

@@ -19,9 +19,7 @@ class TitleBar {
    * appBar: TitleBar().backAppbar(context, '个人资料',(){}),
    */
   backAppbar(BuildContext context, String title) {
-    return PreferredSize(
-        preferredSize: Size.fromHeight(48),
-        child: AppBar(
+    return AppBar(
           title: Text(
             title,
             style: TextStyle(color: GSYColors.primaryDarkValue, fontSize: 16),
@@ -29,10 +27,10 @@ class TitleBar {
           centerTitle: true,
           leading: BackButton(),
           brightness: Brightness.light,
-          backgroundColor: GSYColors.white,
+          backgroundColor: Color(0xFF4875EC),
           elevation: 0,
           iconTheme: IconThemeData(color: GSYColors.primaryDarkValue),
-        ));
+        );
   }
 
   /**
@@ -73,7 +71,8 @@ class TitleBar {
     return AppBar(
       centerTitle: true,
       titleSpacing: 0,
-      backgroundColor:Colors.black,
+      elevation: 0,
+      backgroundColor: Color(0xFF4875EC),
       // 返回按钮
       title: Text(
         title,

+ 2 - 2
lib/main.dart

@@ -1,4 +1,4 @@
-import 'package:deus_app/page/login/login_page.dart';
+import 'package:deus_app/page/home/home_page.dart';
 import 'package:flutter/material.dart';
 
 void main() {
@@ -27,7 +27,7 @@ class MyApp extends StatelessWidget {
         primarySwatch: Colors.blue,
       ),
       // home: const MyHomePage(title: 'Flutter Demo Home Page'),
-      home: LoginPage(),
+      home: HomePage(),
     );
   }
 }

+ 203 - 17
lib/page/home/home_page.dart

@@ -1,29 +1,215 @@
-import 'package:deus_app/common/style/TitleBar.dart';
-import 'package:deus_app/common/utils/ConstantString.dart';
-import 'package:deus_app/common/utils/ToastUtils.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
 
 class HomePage extends StatefulWidget {
-  const HomePage({super.key});
+  const HomePage({Key? key}) : super(key: key);
 
   @override
-  State createState() {
-    return _HomePage();
-  }
+  _MineViewPageState createState() => _MineViewPageState();
 }
 
-class _HomePage extends State<HomePage>{
+class _MineViewPageState extends State<HomePage> {
+  List items = [
+    {"name": "今日维保任务", "num": 1},
+    {"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"},
+  ];
+  @override
+  void initState() {
+    super.initState();
+  }
+
+  void registerHandler() {}
 
   @override
   Widget build(BuildContext context) {
     return Scaffold(
-      
-      appBar: TitleBar().homeAppBar(ConstantString.mainText, () {
-        showToast("text");
-      }),
-      body: const Center(
-
-      ),
-    );
+        extendBodyBehindAppBar: true,
+        appBar: AppBar(
+          shadowColor: Colors.transparent,
+          backgroundColor: Colors.transparent,
+          systemOverlayStyle: SystemUiOverlayStyle.light
+              .copyWith(statusBarColor: Colors.transparent),
+          // title: Text(user != null ? user["nickname"] : "",style:TextStyle(color: Colors.white),),
+          centerTitle: true,
+          elevation: 0.0,
+          toolbarHeight: 0,
+        ),
+        backgroundColor: const Color(0xfff4f6ff),
+        body: Column(
+          children: [
+            Container(
+              padding: EdgeInsets.only(
+                  left: 15,
+                  right: 15,
+                  top: MediaQuery.of(context).padding.top + 10),
+              height: MediaQuery.of(context).size.width * 0.53,
+              decoration: BoxDecoration(
+                image: DecorationImage(
+                    image: AssetImage("images/home_bg.jpg"), fit: BoxFit.cover),
+              ),
+              child: Column(
+                children: [
+                  Row(
+                    mainAxisAlignment: MainAxisAlignment.end,
+                    children: [
+                      Icon(
+                        Icons.settings,
+                        color: Colors.white,
+                      )
+                    ],
+                  ),
+                  Row(
+                    children: [
+                      Image.asset(
+                        "images/head.png",
+                        width: 40,
+                        height: 40,
+                      ),
+                      SizedBox(width: 10),
+                      Text(
+                        "SHAW",
+                        style: TextStyle(
+                            color: Colors.white, fontWeight: FontWeight.bold),
+                      )
+                    ],
+                  ),
+                  SizedBox(height: 20),
+                  Row(
+                    children: [
+                      SizedBox(width: 50),
+                      Text("13239202394",
+                          style: TextStyle(
+                              color: Colors.white,
+                              fontWeight: FontWeight.bold,
+                              fontSize: 20))
+                    ],
+                  ),
+                  SizedBox(height: 10),
+                  Row(
+                    children: [
+                      SizedBox(width: 50),
+                      Text("中国平安保险公司",
+                          style:
+                          TextStyle(color: Color(0xffaaaaaa), fontSize: 15))
+                    ],
+                  ),
+                ],
+              ),
+            ),
+            Container(
+              padding: EdgeInsets.all(10),
+              margin: EdgeInsets.all(15),
+              decoration: BoxDecoration(
+                  color:  Colors.white,
+                  borderRadius: BorderRadius.circular(10)),
+              child: Column(
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  SizedBox(height: 15),
+                  Container(
+                      width: double.infinity,
+                      height: 40,
+                      alignment: Alignment.center,
+                      decoration: BoxDecoration(
+                          color: Color(0xff74b900),
+                          borderRadius: BorderRadius.circular(10)),
+                      child: Text("当前设备运行正常",
+                          style: TextStyle(
+                              color: Color(0xffffffff), fontSize: 15))),
+                  SizedBox(
+                    height: 20,
+                  ),
+                  Text("待办任务",
+                      style: TextStyle(color: Color(0xff000000), fontSize: 18)),
+                  SizedBox(
+                    height: 10,
+                  ),
+                  GridView.builder(
+                    shrinkWrap: true,
+                    padding: const EdgeInsets.only(
+                      top: 10,
+                    ),
+                    gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
+                      crossAxisCount: 1,
+                      mainAxisSpacing: 10,
+                      crossAxisSpacing: 10,
+                      childAspectRatio: MediaQuery.of(context).size.width / 30,
+                    ),
+                    itemBuilder: (context, index) {
+                      Map item = items[index];
+                      return Row(
+                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                        children: [
+                          Text(item["name"],
+                              style: TextStyle(
+                                  color: Color(0xff000000), fontSize: 13)),
+                          Text(item["num"].toString(),
+                              style: TextStyle(
+                                  color: Color(0xff000000), fontSize: 13))
+                        ],
+                      );
+                    },
+                    itemCount: items.length,
+                  )
+                ],
+              ),
+            ),
+            Container(
+              margin: EdgeInsets.only(left: 15, right: 15),
+              decoration:
+              BoxDecoration(borderRadius: BorderRadius.circular(10)),
+              child: Column(
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  GridView.builder(
+                    shrinkWrap: true,
+                    padding: const EdgeInsets.only(
+                      top: 0,
+                    ),
+                    gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
+                      crossAxisCount: 3,
+                      mainAxisSpacing: 10,
+                      crossAxisSpacing: 10,
+                      childAspectRatio:
+                      (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))
+                          ],
+                        ),
+                      );
+                    },
+                    itemCount: icons.length,
+                  )
+                ],
+              ),
+            ),
+          ],
+        ));
   }
-}
+}

+ 0 - 3
lib/page/login/login_page.dart

@@ -43,7 +43,6 @@ class _LoginPageState extends State<LoginPage> {
         centerTitle: true,
 
         title: const Text(ConstantString.loginText,style: TextStyle(fontSize: 17)),
-        backgroundColor:Colors.black,
       ),
       body: Center(
         child: Column(
@@ -172,12 +171,10 @@ class _LoginPageState extends State<LoginPage> {
       width: double.infinity,
       margin: EdgeInsets.all(10),
       decoration: BoxDecoration(
-        color:Colors.black,
         borderRadius: BorderRadius.circular(4.0),
       ),
       child: GSYFlexButton(
         text: ConstantString.loginText,
-        color: Colors.black,
         textColor: GSYColors.textWhite,
         fontSize: 16,
         onPress: login,

+ 5 - 3
pubspec.yaml

@@ -69,9 +69,11 @@ flutter:
   uses-material-design: true
 
   # To add assets to your application, add an assets section, like this:
-assets:
-   - assets/install.png
-
+  assets:
+    - images/
+    - images/home_bg.jpg
+    - images/2.0x/home_bg.jpg
+    - images/3.0x/home_bg.jpg
   # An image asset can refer to one or more resolution-specific "variants", see
   # https://flutter.dev/assets-and-images/#resolution-aware