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

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

@@ -3,6 +3,9 @@ import 'package:flutter/material.dart';
 import 'package:flutter/widgets.dart';
 import 'package:taskservice/Common/JXColors.dart';
 
+/**
+ * 导航栏
+* */
 class MyScaffold extends StatelessWidget {
   final Widget body;
   final String title;
@@ -24,6 +27,9 @@ class MyScaffold extends StatelessWidget {
   }
 }
 
+/**
+ * 搜索控件
+ * */
 class SearchBar extends StatefulWidget {
   final Function(String value) onTextChanged;
   final String hint;
@@ -92,3 +98,58 @@ class _SearchBarState extends State<SearchBar> {
     );
   }
 }
+
+/**
+ * 编辑cell
+ * */
+class EditCell extends StatefulWidget {
+  final String mark;
+  final String hint;
+  final Function(String value) onEditingComplete;
+  final TextEditingController controller;
+  EditCell({this.mark, this.hint, this.controller, this.onEditingComplete});
+  @override
+  _EditCell createState() => _EditCell();
+}
+
+class _EditCell extends State<EditCell> {
+  @override
+  Widget build(BuildContext context) {
+    // TODO: implement build
+    return Row(
+      mainAxisSize: MainAxisSize.max,
+      children: <Widget>[
+        SizedBox(
+          width: 20,
+        ),
+        Text(
+          widget.mark,
+          style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
+        ),
+        Expanded(
+            child: Padding(
+              padding: const EdgeInsets.symmetric(horizontal: 20),
+              child: TextField(
+                controller: widget.controller,
+                maxLines: 1,
+                obscureText: false,
+                cursorColor: JXColors.k1F2529,
+                decoration: InputDecoration(
+                  //border: InputBorder.none,
+                  hintText: widget.hint,
+                  labelStyle: TextStyle(
+                    color: JXColors.k2E3032,
+                    fontSize: 16.0,
+                  ),
+                ),
+                onEditingComplete: widget.onEditingComplete(widget.controller.text),
+              ),
+            )),
+      ],
+    );
+  }
+}
+
+
+
+

+ 90 - 0
taskservice/lib/src/service/page_addservice.dart

@@ -0,0 +1,90 @@
+
+import 'dart:html';
+
+import 'package:flutter/cupertino.dart';
+import 'package:taskservice/Common/JXColors.dart';
+import 'package:taskservice/Model/JXServiceModel.dart';
+import 'package:taskservice/src/custom_widgets.dart';
+
+class CreateAddService extends StatefulWidget {
+  @override
+  _CreateAddService createState() => _CreateAddService();
+}
+
+class _CreateAddService extends State<CreateAddService> {
+  /*服务*/
+  JXServiceModel _service;
+  /*类型*/
+  TextEditingController kindController = TextEditingController();
+
+  @override
+  void initState() {
+    // TODO: implement initState
+    super.initState();
+    _service = JXServiceModel();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    // TODO: implement build
+    return MyScaffold(
+        title: '编辑服务',
+        body: Column(
+          children: <Widget>[
+            Expanded(
+              child: Column(
+                children: <Widget>[
+                  Container(
+                    padding: EdgeInsets.all(0),
+                    width: MediaQuery.of(context).size.width,
+                    height: 46.0,
+                    child: EditCell(
+                      mark: '类型',
+                      hint: '请输入类型',
+                      controller: kindController,
+                      onEditingComplete: (value){
+                        _service.kind = value;
+                      },
+                    ),
+                  ),
+                  Container(
+                    padding: EdgeInsets.all(0),
+                    width: MediaQuery.of(context).size.width,
+                    height: 46.0,
+                    child: Row(
+                      children: <Widget>[
+
+                      ],
+                    ),
+                  ),
+                ],
+              ),
+            ),
+            Container(
+              padding: EdgeInsets.all(0),
+              width: MediaQuery.of(context).size.width,
+              height: 44.0,
+              child: CupertinoButton(
+                onPressed: saveBtnClickAction,
+                color: JXColors.k101E40,
+                borderRadius: BorderRadius.all(Radius.circular(0)),
+                child: Text(
+                  '保存',
+                  style: TextStyle(
+                    fontSize: 14,
+                    color: JXColors.kFFFFFF,
+                  ),
+                ),
+              ),
+            )
+          ],
+        ),);
+  }
+
+  /*保存*/
+  void saveBtnClickAction() {
+    print('保存');
+  }
+
+  /*输入框*/
+}