2
0

2 Коммиты 526319e3fa ... 9deb0e6353

Автор SHA1 Сообщение Дата
  lailin 9deb0e6353 Merge branch '1.0.0' of ssh://gogs.soulhub.xyz:8525/JXZS/JXZS_TaskService into 1.0.0 4 лет назад
  lailin bb94992cd7 首页搜索 兼容 4 лет назад

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

@@ -1,6 +1,8 @@
 /*
 用户信息模型
 * */
+import 'JXServiceModel.dart';
+
 class JXMemberModel {
   int id = -1;
   /*姓名*/
@@ -21,6 +23,9 @@ class JXMemberModel {
   /*其他*/
   String remark = '';
 
+  /*服务*/
+  List <JXServiceModel> service = [];
+
   Map<String, dynamic> toMap() {
     return {
       'name': name,

+ 15 - 4
taskservice/lib/src/custom_widgets.dart

@@ -1,3 +1,4 @@
+import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/widgets.dart';
 import 'package:taskservice/Common/JXColors.dart';
@@ -24,7 +25,9 @@ class SearchBar extends StatefulWidget {
   final Function(String value) onTextChanged;
   final String hint;
   final FocusNode focusNode;
-  SearchBar({this.onTextChanged, this.hint, this.focusNode});
+  final Function() onBtnClear;
+  final TextEditingController searchController;
+  SearchBar({this.onTextChanged, this.hint, this.focusNode, this.onBtnClear, this.searchController});
   @override
   _SearchBarState createState() => _SearchBarState();
 }
@@ -56,13 +59,14 @@ class _SearchBarState extends State<SearchBar> {
           ),
           Expanded(
             child: TextField(
+              controller: widget.searchController,
               maxLines: 1,
               focusNode: widget.focusNode,
               obscureText: false,
               cursorColor: JXColors.k1F2529,
               decoration: InputDecoration(
                 border: InputBorder.none,
-                hintText: widget.hint,
+                hintText: '快速筛选',
                 labelStyle: TextStyle(
                   color: JXColors.k2E3032,
                   fontSize: 24.0,
@@ -71,8 +75,15 @@ class _SearchBarState extends State<SearchBar> {
               onChanged: widget.onTextChanged,
             ),
           ),
-          SizedBox(
-            width: 12,
+          SizedBox(width: 6,),
+          CupertinoButton(
+            onPressed: widget.onBtnClear,
+            padding: EdgeInsets.all(0),
+            child: Icon(
+              Icons.cancel,
+              color: JXColors.k747A7E,
+              size: 24.0,
+            ),
           ),
         ]),
       ),

+ 68 - 121
taskservice/lib/src/home/home.dart

@@ -22,7 +22,8 @@ class _MyHomePageState extends State<MyHomePage> {
   FocusNode blankNode = FocusNode();
 
   /*搜索值*/
-  static final TextEditingController _searchController = TextEditingController();
+  static final TextEditingController _searchController =
+      TextEditingController();
 
   /*tableView*/
   List<Widget> _cells = [];
@@ -85,71 +86,6 @@ class _MyHomePageState extends State<MyHomePage> {
     setState(() {});
   }
 
-  /*筛选空间*/
-  Widget theFilterBar() {
-    return Container(
-      color: JXColors.kF0F0F0,
-      padding: EdgeInsets.fromLTRB(12.0, 8, 12.0, 8),
-      child: Container(
-        alignment: Alignment.center,
-        decoration: BoxDecoration(
-          color: JXColors.kE6E6E6,
-          borderRadius: BorderRadius.circular(12.0),
-          border: Border.all(color: JXColors.kE6E6E6, width: 1),
-        ),
-        height: 44.0,
-        child: Row(children: <Widget>[
-          SizedBox(
-            width: 12,
-          ),
-          Icon(
-            Icons.search,
-            size: 24.0,
-          ),
-          SizedBox(
-            width: 6,
-          ),
-          Expanded(
-            child: TextField(
-              controller: _searchController,
-              maxLines: 1,
-              focusNode: blankNode,
-              obscureText: false,
-              cursorColor: JXColors.k1F2529,
-              decoration: InputDecoration(
-                border: InputBorder.none,
-                hintText: '快速筛选',
-                labelStyle: TextStyle(
-                  color: JXColors.k2E3032,
-                  fontSize: 24.0,
-                ),
-              ),
-              onChanged: (value) {
-                filterMember();
-              },
-            ),
-          ),
-          SizedBox(width: 6,),
-          CupertinoButton(
-            onPressed: () {
-              /*清空输入框*/
-              setState(() {
-                _searchController.clear();
-                filterMember();
-              });
-            },
-            padding: EdgeInsets.all(0),
-            child: Icon(
-              Icons.cancel,
-              color: JXColors.k747A7E,
-              size: 24.0,
-            ),
-          ),
-        ]),
-      ),
-    );
-  }
-
   /*cell*/
   Widget theCellBuilder(BuildContext context, JXMemberModel model) {
     return GestureDetector(
@@ -228,22 +164,34 @@ class _MyHomePageState extends State<MyHomePage> {
   @override
   Widget build(BuildContext context) {
     return GestureDetector(
-      onTap: () {
-        FocusScope.of(context).requestFocus(blankNode);
-      },
-      child: Scaffold(
-        appBar: AppBar(
-          title: Text(widget.title),
-        ),
-        body: SafeArea(
+        onTap: () {
+          FocusScope.of(context).requestFocus(blankNode);
+        },
+        child: Scaffold(
+          appBar: AppBar(
+            title: Text(widget.title),
+          ),
+          body: SafeArea(
             child: Column(
               mainAxisAlignment: MainAxisAlignment.start,
               children: <Widget>[
-            SearchBar(hint: '快速筛选', onTextChanged: (value) {
-              filterMember();
-            }, focusNode: blankNode,),
-            Expanded(
-                child: Container(
+                SearchBar(
+                  hint: '快速筛选',
+                  onTextChanged: (value) {
+                    filterMember();
+                  },
+                  focusNode: blankNode,
+                  onBtnClear: () {
+                    /*清空*/
+                    setState(() {
+                      _searchController.clear();
+                      filterMember();
+                    });
+                  },
+                  searchController: _searchController,
+                ),
+                Expanded(
+                    child: Container(
                   color: JXColors.kF0F0F0,
                   child: ListView.builder(
                     padding: EdgeInsets.only(left: 12.0, right: 12.0),
@@ -254,48 +202,47 @@ class _MyHomePageState extends State<MyHomePage> {
                     },
                   ),
                 )),
-        Row(
-        mainAxisAlignment: MainAxisAlignment.start,
-        children: <Widget>[
-        Expanded(
-        child: CupertinoButton(
-            onPressed: ()
-        {
-        Navigator.of(context).pushNamed('$CreateAccPage');
-        },
-        padding: EdgeInsets.all(0),
-        color: JXColors.kFFFFFF,
-        borderRadius: BorderRadius.all(Radius.circular(0)),
-        child: Text(
-          '新建会员',
-          style: TextStyle(
-            fontSize: 14,
-            color: JXColors.k101E40,
+                Row(
+                  mainAxisAlignment: MainAxisAlignment.start,
+                  children: <Widget>[
+                    Expanded(
+                      child: CupertinoButton(
+                        onPressed: () {
+                          Navigator.of(context).pushNamed('$CreateAccPage');
+                        },
+                        padding: EdgeInsets.all(0),
+                        color: JXColors.kFFFFFF,
+                        borderRadius: BorderRadius.all(Radius.circular(0)),
+                        child: Text(
+                          '新建会员',
+                          style: TextStyle(
+                            fontSize: 14,
+                            color: JXColors.k101E40,
+                          ),
+                        ),
+                      ),
+                    ),
+                    Expanded(
+                      child: CupertinoButton(
+                        onPressed: () {
+                          print('会员列表');
+                          Navigator.of(context).pushNamed('$AccountListPage');
+                        },
+                        padding: EdgeInsets.all(0),
+                        color: JXColors.k1F2529,
+                        borderRadius: BorderRadius.all(Radius.circular(0)),
+                        child: Text('会员列表',
+                            style: TextStyle(
+                              fontSize: 14,
+                              color: JXColors.kFFFFFF,
+                            )),
+                      ),
+                    ),
+                  ],
+                )
+              ],
+            ),
           ),
-        ),
-      ),
-    ),
-    Expanded(
-    child: CupertinoButton(
-    onPressed: () {
-    print('会员列表');
-    Navigator.of(context).pushNamed('$AccountListPage');
-    },
-    padding: EdgeInsets.all(0),
-    color: JXColors.k1F2529,
-    borderRadius: BorderRadius.all(Radius.circular(0)),
-    child: Text('会员列表',
-    style: TextStyle(
-    fontSize: 14,
-    color: JXColors.kFFFFFF,
-    )),
-    ),
-    ),
-    ],
-    )
-    ],
-    ),
-    ),
-    ));
+        ));
   }
 }