Lailin 4 лет назад
Родитель
Сommit
fe78755a41

+ 8 - 0
taskservice/gen/com/jxzs/taskservice/BuildConfig.java

@@ -0,0 +1,8 @@
+/*___Generated_by_IDEA___*/
+
+package com.jxzs.taskservice;
+
+/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
+public final class BuildConfig {
+  public final static boolean DEBUG = Boolean.parseBoolean(null);
+}

+ 7 - 0
taskservice/gen/com/jxzs/taskservice/Manifest.java

@@ -0,0 +1,7 @@
+/*___Generated_by_IDEA___*/
+
+package com.jxzs.taskservice;
+
+/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
+public final class Manifest {
+}

+ 7 - 0
taskservice/gen/com/jxzs/taskservice/R.java

@@ -0,0 +1,7 @@
+/*___Generated_by_IDEA___*/
+
+package com.jxzs.taskservice;
+
+/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
+public final class R {
+}

+ 104 - 116
taskservice/lib/main.dart

@@ -27,7 +27,7 @@ class MyApp extends StatelessWidget {
         // closer together (more dense) than on mobile platforms.
         visualDensity: VisualDensity.adaptivePlatformDensity,
       ),
-      home: MyHomePage(title: '吉祥之舍'),
+      home: MyHomePage(title: 'JXZS'),
     );
   }
 }
@@ -35,15 +35,6 @@ class MyApp extends StatelessWidget {
 class MyHomePage extends StatefulWidget {
   MyHomePage({Key key, this.title}) : super(key: key);
 
-  // This widget is the home page of your application. It is stateful, meaning
-  // that it has a State object (defined below) that contains fields that affect
-  // how it looks.
-
-  // This class is the configuration for the state. It holds the values (in this
-  // case the title) provided by the parent (in this case the App widget) and
-  // used by the build method of the State. Fields in a Widget subclass are
-  // always marked "final".
-
   final String title;
 
   @override
@@ -51,122 +42,119 @@ class MyHomePage extends StatefulWidget {
 }
 
 class _MyHomePageState extends State<MyHomePage> {
-  int _counter = 0;
+  // 参数
+  /*空白区域键盘消失控制*/
+  FocusNode blankNode = FocusNode();
+  /*搜索值*/
+  String _searchText;
+
+  /*筛选列表数据*/
+  void filterListView() {
+    print('筛选:$_searchText');
+    String text = _searchText;
 
-  void _incrementCounter() {
-    setState(() {
-      // This call to setState tells the Flutter framework that something has
-      // changed in this State, which causes it to rerun the build method below
-      // so that the display can reflect the updated values. If we changed
-      // _counter without calling setState(), then the build method would not be
-      // called again, and so nothing would appear to happen.
-      _counter++;
-    });
+  }
+  /*显示列表*/
+  List<Widget> theCellData() {
+    List<Widget> widgets = [];
+    for (int i = 0; i < 100; i++) {
+      widgets.add(Padding(padding: EdgeInsets.all(10.0), child: Text("Row $i")));
+    }
+    return widgets;
   }
 
   @override
   Widget build(BuildContext context) {
-    // This method is rerun every time setState is called, for instance as done
-    // by the _incrementCounter method above.
-    //
-    // The Flutter framework has been optimized to make rerunning build methods
-    // fast, so that you can just rebuild anything that needs updating rather
-    // than having to individually change instances of widgets.
-    return Scaffold(
-      appBar: AppBar(
-        // Here we take the value from the MyHomePage object that was created by
-        // the App.build method, and use it to set our appbar title.
-        title: Text(widget.title),
-      ),
-      body: SafeArea(
-        // Center is a layout widget. It takes a single child and positions it
-        // in the middle of the parent.
-        child: Column(
-          // Column is also a layout widget. It takes a list of children and
-          // arranges them vertically. By default, it sizes itself to fit its
-          // children horizontally, and tries to be as tall as its parent.
-          //
-          // Invoke "debug painting" (press "p" in the console, choose the
-          // "Toggle Debug Paint" action from the Flutter Inspector in Android
-          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
-          // to see the wireframe for each widget.
-          //
-          // Column has various properties to control how it sizes itself and
-          // how it positions its children. Here we use mainAxisAlignment to
-          // center the children vertically; the main axis here is the vertical
-          // axis because Columns are vertical (the cross axis would be
-          // horizontal).
-          mainAxisAlignment: MainAxisAlignment.start,
-          children: <Widget>[
-            Container(
-              color: JXColors.kF0F0F0,
-              alignment: Alignment.center,
-              padding: EdgeInsets.fromLTRB(12.0, 4.0, 12.0, 4.0),
-              height: 50.0,
-              child: Row(children: <Widget>[
+    return GestureDetector(
+        onTap: () {
+          FocusScope.of(context).requestFocus(blankNode);
+        },
+        child: Scaffold(
+          appBar: AppBar(
+            title: Text(widget.title),
+          ),
+          body: SafeArea(
+            child: Column(
+              mainAxisAlignment: MainAxisAlignment.start,
+              children: <Widget>[
                 Container(
-                  width: 44.0,
-                  child: Icon(
-                    Icons.search,
-                    size: 30.0,
-                  )
-                ),
+                    color: JXColors.kF0F0F0,
+                    alignment: Alignment.center,
+                    padding: EdgeInsets.fromLTRB(12.0, 4.0, 12.0, 4.0),
+                    height: 50.0,
+                    child: Row(children: <Widget>[
+                      Container(
+                          width: 44.0,
+                          child: Icon(
+                            Icons.search,
+                            size: 24.0,
+                          )),
+                      Expanded(
+                        child: TextField(
+                          obscureText: false,
+                          cursorColor: JXColors.k1F2529,
+                          decoration: InputDecoration(
+                            border: InputBorder.none,
+                            hintText: '快速筛选',
+                            labelStyle: TextStyle(
+                              color: JXColors.k2E3032,
+                              fontSize: 18,
+                            ),
+                          ),
+                          onSubmitted: (value) {
+                            setState(() {
+                              _searchText = value;
+                            });
+                            filterListView();
+                          },
+                          onEditingComplete: () {
+                            /*键盘消失*/
+                            FocusScope.of(context).requestFocus(blankNode);
+                          },
+                        ),
+                      ),
+                    ])),
                 Expanded(
-                  child: TextField(
-                    obscureText: true,
-                    cursorColor: JXColors.k1F2529,
-                    decoration: InputDecoration(
-                      border: OutlineInputBorder(),
-                      labelText: 'Password',
-                    ),
-                  ),
-                ),
-              ]
-              )
-            ),
-            Expanded(
-              flex: 1,
-              child: Container(
-                color: Colors.blue,
-              )
-            ),
-            Container(
-              color: Colors.red,
-              height: 44.0,
-              child: Row(children: <Widget>[
-                Expanded(
-                  child: FlatButton(
-                    onPressed: (){
-                      print('新建会员');
-                    },
-                    padding: EdgeInsets.all(0),
-                    color: JXColors.kFFFFFF,
-                    textColor: JXColors.k1F2529,
-                    child: const Text('新建会员', style: TextStyle(fontSize: 14)),
-                  ),
-                ),
-                Expanded(
-                  child: FlatButton(
-                    onPressed: (){
-                      print('会员列表');
-                    },
-                    padding: EdgeInsets.all(0),
-                    color: JXColors.k1F2529,
-                    textColor: JXColors.kFFFFFF,
-                    child: const Text('会员列表', style: TextStyle(fontSize: 14)),
+                    flex: 1,
+                    child: Container(
+                      color: Colors.lightBlue,
+                      child: ListView(children: theCellData()),
+                    )),
+                Container(
+                  color: Colors.red,
+                  height: 44.0,
+                  child: Row(
+                    children: <Widget>[
+                      Expanded(
+                        child: FlatButton(
+                          onPressed: () {
+                            print('新建会员');
+                          },
+                          padding: EdgeInsets.all(0),
+                          color: JXColors.kFFFFFF,
+                          textColor: JXColors.k1F2529,
+                          child: const Text('新建会员',
+                              style: TextStyle(fontSize: 14)),
+                        ),
+                      ),
+                      Expanded(
+                        child: FlatButton(
+                          onPressed: () {
+                            print('会员列表');
+                          },
+                          padding: EdgeInsets.all(0),
+                          color: JXColors.k1F2529,
+                          textColor: JXColors.kFFFFFF,
+                          child: const Text('会员列表',
+                              style: TextStyle(fontSize: 14)),
+                        ),
+                      ),
+                    ],
                   ),
                 ),
               ],
-              ),
             ),
-          ],
-        ),
-      ),
-      floatingActionButton: FloatingActionButton(
-        onPressed: _incrementCounter,
-        tooltip: 'Increment',
-        child: Icon(Icons.add),
-      ), // This trailing comma makes auto-formatting nicer for build methods.
-    );
+          ),
+        ));
   }
 }