Esempio n. 1
0
 private void _addItem()
 {
     if (!string.IsNullOrWhiteSpace(controller.text))
     {
         widget.model.onAddItems(controller.text);
         controller.clear();
     }
 }
Esempio n. 2
0
    public override Widget build(BuildContext context)
    {
        return(new Scaffold(
                   body: new SafeArea(
                       child: new ListView(
                           padding: EdgeInsets.symmetric(horizontal: 24.0f),
                           children: new List <Widget>
        {
            new SizedBox(height: 200.0f),
            new TextField(
                controller: emailController,
                decoration: new InputDecoration(
                    filled: true,
                    labelText: "邮箱"
                    )
                ),
            new SizedBox(height: 12.0f),
            new TextField(
                controller: passwordController,
                decoration: new InputDecoration(
                    filled: true,
                    labelText: "密码"
                    ),
                obscureText: true
                ),
            new ButtonBar(
                children: new List <Widget>
            {
                new FlatButton(
                    child: new Text("关闭"),
                    onPressed: () => Navigator.pop(context)
                    ),
                new FlatButton(
                    child: new Text("清空"),
                    onPressed: () =>
                {
                    emailController.clear();
                    passwordController.clear();
                }
                    ),
                new RaisedButton(
                    child: new Text("登录"),
                    onPressed: () =>
                {
                    // TODO: 接口有cors 代码仅供参考了 =-=
//                                        Login();
                    Navigator.pop(context, "登陆成功");
                }
                    )
            }
                )
        }
                           )
                       )
                   ));
    }
Esempio n. 3
0
    private void OnSend(string text)
    {
        if (string.IsNullOrEmpty(text))
        {
            return;
        }

        _textController.clear();

        /// make sure the textfield is still focus after sending in case the user used the return key to send the message
        FocusScope.of(context).requestFocus(_textFocus);

        widget.OnSubmit?.Invoke(text);
    }
Esempio n. 4
0
 Widget _buildChatTextField()
 {
     return(new CupertinoTextField(
                controller: _chatTextController,
                textCapitalization: TextCapitalization.sentences,
                placeholder: "Text Message",
                decoration: new BoxDecoration(
                    border: Border.all(
                        width: 0.0f,
                        color: CupertinoColors.inactiveGray
                        ),
                    borderRadius: BorderRadius.circular(15.0f)
                    ),
                maxLines: null,
                keyboardType: TextInputType.multiline,
                prefix: new Padding(padding: EdgeInsets.symmetric(horizontal: 4.0f)),
                suffix: new Padding(
                    padding: EdgeInsets.symmetric(horizontal: 4.0f),
                    child: new CupertinoButton(
                        color: CupertinoColors.activeGreen,
                        minSize: 0.0f,
                        child: new Icon(
                            CupertinoIcons.up_arrow,
                            size: 21.0f,
                            color: CupertinoColors.white
                            ),
                        padding: EdgeInsets.all(2.0f),
                        borderRadius: BorderRadius.circular(15.0f),
                        onPressed: () => setState(() => _chatTextController.clear())
                        )
                    ),
                autofocus: true,
                suffixMode: OverlayVisibilityMode.editing,
                onSubmitted: (string text) => setState(() => _chatTextController.clear())
                ));
 }
Esempio n. 5
0
 TextField BuildNameTextField()
 {
     return(new TextField(
                controller: nameController,
                style: inputStyle,
                decoration: new InputDecoration(
                    labelText: "账号",
                    suffixIcon: new GestureDetector(
                        onTap: () =>
     {
         nameController.clear();
     },
                        child: new Icon(nameController.text.Length > 0 ? Icons.clear : null)
                        )
                    ),
                maxLines: 1
                ));
 }
Esempio n. 6
0
    public override Widget build(BuildContext context)
    {
        var inputController = new TextEditingController();

        return(new Column(
                   children: new List <Widget>()
        {
            new Padding(
                padding: EdgeInsets.only(top: 20)
                ),
            new StoreConnector <TodoListState, object>(
                converter: (state => null),
                builder: ((buildContext, _, dispatcher) =>
            {
                return new Flex(
                    direction: Axis.horizontal,
                    children: new List <Widget>()
                {
                    new Expanded(
                        flex: 6,
                        child: new TextField(
                            controller: inputController,
                            decoration: new InputDecoration(hintText: "请输入待办事项"),
                            onSubmitted: (value =>
                    {
                        TodoModel item = new TodoModel(value,
                                                       long.Parse(TimeHelper.GetTimeStamp(DateTime.Now)),
                                                       false);
                        Actions.AddAction action = new Actions.AddAction(item);
                        dispatcher.dispatch(action);
                        inputController.clear();
                    }),
                            onChanged: (value => mCurrentInptu = value)
                            )
                        ),
                    new Expanded(
                        flex: 1,
                        child: new IconButton(icon: new Icon(Icons.add),
                                              onPressed: (() =>
                    {
                        TodoModel item = new TodoModel(mCurrentInptu,
                                                       long.Parse(TimeHelper.GetTimeStamp(DateTime.Now)),
                                                       false);
                        Actions.AddAction action = new Actions.AddAction(item);
                        dispatcher.dispatch(action);
                        mCurrentInptu = string.Empty;
                        inputController.clear();
                    })
                                              )
                        )
                }
                    );
            })
                ),
            new Expanded(
                child: new StoreConnector <TodoListState, List <TodoModel> >(
                    converter: (state =>
            {
                var showState = state.showState;
                var list = state.todoList;
                switch (showState)
                {
                case ShowState.All:
                    return list;

                case ShowState.Finished:
                    return list.Where((mo => mo.isFinish)).ToList();

                case ShowState.UnFinished:
                    return list.Where((mo => (!mo.isFinish))).ToList();

                default:
                    return list;
                }
            }),
                    builder: ((buildContext, model, dispatcher) =>
            {
                return ListView.seperated(
                    itemCount: model.Count,
                    itemBuilder: ((context1, index) =>
                {
                    var item = model[index];
                    var iconColor = item.isFinish ? Colors.blue : Colors.grey;
                    return new ListTile(title: new Text(item.content),
                                        subtitle: new Text(TimeHelper.ConvertStringToDateTime(item.timestamp.ToString())
                                                           .ToString()),
                                        leading: new IconButton(icon: new Icon(Icons.check), iconSize: 20,
                                                                color: iconColor,
                                                                onPressed: (() =>
                    {
                        dispatcher.dispatch(new Actions.UpdateFinishAction(item));
                    })),
                                        trailing: new IconButton(icon: new Icon(Icons.delete), iconSize: 20,
                                                                 onPressed: (() => { dispatcher.dispatch(new Actions.DeleteAction(item)); }))
                                        );
                }),
                    separatorBuilder: ((context1, index) => { return new Divider(color: Colors.blue); })
                    );
            })
                    )
                )
        },
                   mainAxisSize: MainAxisSize.min
                   ));
    }
Esempio n. 7
0
        public override Widget build(BuildContext context)
        {
            return(new StoreConnector <AppState, AppState>(
                       converter: state => state
                       , builder: (buildContext, model, dispather) =>
            {
                return new Scaffold(
                    appBar: new AppBar(

                        centerTitle: true
                        , elevation: 3
                        , backgroundColor: Colors.white
                        , iconTheme: Theme.of(context).iconTheme
                        , leading: new IconButton(icon: new Icon(Icons.arrow_back, color: Colors.black)
                                                  , onPressed: () =>
                {
                    Navigator.of(context).pop();
                })
                        , title: new TextField(decoration: new InputDecoration(
                                                   hintText: "请输入要搜索的内容"
                                                   , hintStyle: new TextStyle(fontSize: 16)
                                                   , suffixIcon: new IconButton(icon: new Icon(Icons.close, size: 14), color: Colors.grey, iconSize: 14
                                                                                , alignment: Alignment.center
                                                                                , onPressed: () => {
                    searchTEController.clear();
                }
                                                                                )
                                                   , contentPadding: EdgeInsets.only(0, 16, 0, 6)
                                                   )
                                               , controller: searchTEController
                                               , autofocus: true
                                               , onChanged: (value) =>
                {
                    //if (!string.IsNullOrWhiteSpace(value))
                    //    dispather.dispatch(new SearchAction(value));
                }
                                               , onSubmitted: (value) => {
                    NetSvc.instance.Send(new AppMsg()
                    {
                        cmd = 1,
                        reqSearchList = new ReqSearchList()
                        {
                            input_text = value
                        }
                    });
                }
                                               )
                        , actions: new List <Widget>()
                {
                    new Icon(Icons.search, color: Colors.transparent)
                }
                        )

                    , body: ListView.builder(

                        itemCount: model.offcial_account_list.Count
                        , itemBuilder: (mcount, index) => {
                    return new OACard(model.offcial_account_list[index]);
                }

                        )

                    );
            }
                       ));
        }