Bladeren bron

提取 控件

lailin 4 jaren geleden
bovenliggende
commit
865c26b8af
2 gewijzigde bestanden met toevoegingen van 80 en 82 verwijderingen
  1. 10 9
      taskservice/lib/src/custom_widgets.dart
  2. 70 73
      taskservice/lib/src/home/home.dart

+ 10 - 9
taskservice/lib/src/custom_widgets.dart

@@ -9,15 +9,16 @@ class MyScaffold extends StatelessWidget {
   MyScaffold({@required this.title, @required this.body});
   @override
   Widget build(BuildContext context) {
-    return SafeArea(
-        child: Scaffold(
-          appBar: AppBar(
-            centerTitle: true,
-            title: Text(title),
-            backgroundColor: JXColors.k1F2529,
-          ),
-          body: body,
-        ));
+    return Scaffold(
+      appBar: AppBar(
+        centerTitle: true,
+        title: Text(title),
+        backgroundColor: JXColors.k101E40,
+      ),
+      body: SafeArea(
+        child: body,
+      ),
+    );
   }
 }
 

+ 70 - 73
taskservice/lib/src/home/home.dart

@@ -60,86 +60,83 @@ 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(
-            child: Column(
+      onTap: () {
+        FocusScope.of(context).requestFocus(blankNode);
+      },
+      child: MyScaffold(
+        title: '吉祥之舍',
+        body: Column(
+          mainAxisAlignment: MainAxisAlignment.start,
+          children: <Widget>[
+            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),
+                itemCount: _cells.length,
+                itemExtent: 92.0,
+                itemBuilder: (BuildContext context, int row) {
+                  return _cells[row];
+                },
+              ),
+            )),
+            Row(
               mainAxisAlignment: MainAxisAlignment.start,
               children: <Widget>[
-                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),
-                    itemCount: _cells.length,
-                    itemExtent: 92.0,
-                    itemBuilder: (BuildContext context, int row) {
-                      return _cells[row];
+                  child: CupertinoButton(
+                    onPressed: () {
+                      Navigator.of(context).pushNamed('$CreateAccPage');
                     },
-                  ),
-                )),
-                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,
-                          ),
-                        ),
+                    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.k101E40,
+                    borderRadius: BorderRadius.all(Radius.circular(0)),
+                    child: Text('会员列表',
+                        style: TextStyle(
+                          fontSize: 14,
+                          color: JXColors.kFFFFFF,
+                        )),
+                  ),
+                ),
               ],
-            ),
-          ),
-        ));
+            )
+          ],
+        ),
+      ),
+    );
   }
 
   /*筛选列表数据*/