Kaynağa Gözat

更改 主界面

lailin 4 yıl önce
ebeveyn
işleme
e6149d58a7

+ 10 - 0
taskservice/lib/Model/JXMemberModel.dart

@@ -38,4 +38,14 @@ class JXMemberModel {
       'remark': remark,
     };
   }
+
+  /*获取显示tips*/
+  String theFirstTipsDes() {
+    if (this.service.length > 0) {
+      JXServiceModel ser = this.service[0];
+      return '${ser.kind} ${ser.remark}';
+    } else {
+      return '无任务';
+    }
+  }
 }

+ 0 - 1
taskservice/lib/src/custom_widgets.dart

@@ -76,7 +76,6 @@ class _SearchBarState extends State<SearchBar> {
               onChanged: widget.onTextChanged,
             ),
           ),
-          SizedBox(width: 6,),
           CupertinoButton(
             onPressed: widget.onBtnClear,
             padding: EdgeInsets.all(0),

+ 83 - 20
taskservice/lib/src/home/home.dart

@@ -1,6 +1,7 @@
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/widgets.dart';
+import 'package:path/path.dart';
 import 'package:taskservice/Common/JXColors.dart';
 import 'package:taskservice/Model/JXMemberModel.dart';
 import 'package:taskservice/src/acclist/page_acclist.dart';
@@ -18,9 +19,6 @@ class MyHomePage extends StatefulWidget {
 
 class _MyHomePageState extends State<MyHomePage> {
   // 参数
-  /*空白区域键盘消失控制*/
-  FocusNode blankNode = FocusNode();
-
   /*搜索值*/
   static final TextEditingController _searchController =
       TextEditingController();
@@ -37,23 +35,35 @@ class _MyHomePageState extends State<MyHomePage> {
       JXMemberModel()
         ..name = 'Jack'
         ..tel = '156000'
-        ..addr = '广州',
+        ..prov = '广东省'
+        ..city = '广州市'
+        ..area = '番禺区'
+        ..addr = '罗家村坑边街1023号。。。。。。',
       JXMemberModel()
         ..name = 'Ros'
         ..tel = '1523'
-        ..addr = '广州12',
+        ..prov = '广东省'
+        ..city = '广州市'
+        ..area = '番禺区'
+        ..addr = '罗家村坑边街1023号。。。。。。',
       JXMemberModel()
         ..name = 'Rose'
         ..tel = '156186'
-        ..addr = '广州12',
+        ..prov = '广东省'
+        ..city = '广州市'
+        ..area = '番禺区'
+        ..addr = '罗家村坑边街1023号。。。。。。',
       JXMemberModel()
         ..name = 'Base'
         ..tel = '186'
-        ..addr = '广州12',
+        ..prov = '广东省'
+        ..city = '广州市'
+        ..area = '番禺区'
+        ..addr = '罗家村坑边街1023号。。。。。。罗家村坑边街1023号',
     ];
 
     for (JXMemberModel model in _basesource) {
-      _cells.add(theCellBuilder(context, model));
+      _cells.add(theCellBuilder(model));
     }
   }
 
@@ -61,7 +71,7 @@ class _MyHomePageState extends State<MyHomePage> {
   Widget build(BuildContext context) {
     return GestureDetector(
       onTap: () {
-        FocusScope.of(context).requestFocus(blankNode);
+
       },
       child: MyScaffold(
         title: '吉祥之舍',
@@ -73,7 +83,6 @@ class _MyHomePageState extends State<MyHomePage> {
               onTextChanged: (value) {
                 filterMember();
               },
-              focusNode: blankNode,
               onBtnClear: () {
                 /*清空*/
                 setState(() {
@@ -89,7 +98,7 @@ class _MyHomePageState extends State<MyHomePage> {
               child: ListView.builder(
                 padding: EdgeInsets.only(left: 12.0, right: 12.0),
                 itemCount: _cells.length,
-                itemExtent: 92.0,
+                itemExtent: 138.0,
                 itemBuilder: (BuildContext context, int row) {
                   return _cells[row];
                 },
@@ -163,22 +172,22 @@ class _MyHomePageState extends State<MyHomePage> {
       }
     }
     for (JXMemberModel model in tmpItems) {
-      _cells.add(theCellBuilder(context, model));
+      _cells.add(theCellBuilder(model));
     }
     setState(() {});
   }
 
   /*cell*/
-  Widget theCellBuilder(BuildContext context, JXMemberModel model) {
+  Widget theCellBuilder(JXMemberModel model) {
     return GestureDetector(
         onTap: () {
           print('click cell, name:${model.name}');
         },
         child: Container(
-          height: 92.0,
+          height: 138.0,
           alignment: Alignment.topCenter,
           child: Container(
-            height: 80.0,
+            height: 130.0,
             alignment: Alignment.center,
             decoration: BoxDecoration(
               color: JXColors.kFFFFFF,
@@ -208,7 +217,7 @@ class _MyHomePageState extends State<MyHomePage> {
                       child: Container(
                         padding: EdgeInsets.only(top: 12.0, right: 12.0),
                         child: Text(
-                          model.tel,
+                          'Tel:${model.tel}',
                           textAlign: TextAlign.right,
                           style: TextStyle(
                             fontSize: 16,
@@ -224,17 +233,71 @@ class _MyHomePageState extends State<MyHomePage> {
                   children: [
                     Expanded(
                       child: Container(
-                        padding: EdgeInsets.only(left: 18, top: 12, right: 18),
+                        padding: EdgeInsets.fromLTRB(12.0, 6.0, 12.0, 6.0),
+                        child: Text(
+                          '${model.prov}${model.city}${model.area}',
+                          maxLines: 1,
+                          overflow: TextOverflow.ellipsis,
+                          textAlign: TextAlign.right,
+                          style: TextStyle(color: JXColors.k101E40, fontSize: 16.0),
+                        ),
+                      ),
+                    ),
+                  ],
+                ),
+                Row(
+                  mainAxisAlignment: MainAxisAlignment.start,
+                  children: <Widget>[
+                    Expanded(
+                      child: Container(
+                        padding: EdgeInsets.only(left: 12.0, right: 12.0),
+                        height: 24.0,
+                        child: Text(
+                          '${model.addr}',
+                          maxLines: 1,
+                          overflow: TextOverflow.ellipsis,
+                          textAlign: TextAlign.right,
+                          style: TextStyle(color: JXColors.k101E40, fontSize: 16.0),
+                        ),
+                      ),
+                    ),
+                  ],
+                ),
+                SizedBox(
+                  height: 12.0,
+                  child: Divider(
+                    height: 1.0,
+                    indent: 4.0,
+                    endIndent: 4.0,
+                    color: JXColors.kE6E6E6,
+                  ),
+                ),
+                Row(
+                  mainAxisAlignment: MainAxisAlignment.start,
+                  children: [
+                    Container(
+                      padding: EdgeInsets.only(left: 12.0),
+                      width: 32,
+                      child: Icon(
+                        Icons.access_alarm,
+                        size: 20,
+                      ),
+                    ),
+                    SizedBox(width:4.0),
+                    Expanded(
+                      child: Container(
+                        padding: EdgeInsets.only(left: 2.0, right: 12),
                         child: Text(
-                          '任务:${model.addr}',
+                          '${model.theFirstTipsDes()}',
+                          maxLines: 1,
                           overflow: TextOverflow.ellipsis,
                           style: TextStyle(
-                            fontSize: 16,
+                            fontSize: 16.0,
                             color: JXColors.k2E3032,
                           ),
                         ),
                       ),
-                    )
+                    ),
                   ],
                 )
               ],