Beispiel #1
0
 public override void initState()
 {
     base.initState();
     m_MentionCandidates     = new HashSet <string>();
     m_TextEditingController = new TextEditingController();
     widget.focusNode.addListener(OnFocusChanged);
     m_TextEditingController.addListener(TextControllerListener);
 }
Beispiel #2
0
 public override void initState()
 {
     base.initState();
     _selectionGestureDetectorBuilder = new _CupertinoTextFieldSelectionGestureDetectorBuilder(state: this);
     if (widget.controller == null)
     {
         _controller = new TextEditingController();
         _controller.addListener(updateKeepAlive);
     }
 }
Beispiel #3
0
        public override void didUpdateWidget(StatefulWidget oldWidget)
        {
            oldWidget = (CupertinoTextField)oldWidget;
            base.didUpdateWidget(oldWidget);
            if (widget.controller == null && ((CupertinoTextField)oldWidget).controller != null)
            {
                _controller = TextEditingController.fromValue(((CupertinoTextField)oldWidget).controller.value);
                _controller.addListener(updateKeepAlive);
            }
            else if (widget.controller != null && ((CupertinoTextField)oldWidget).controller == null)
            {
                _controller = null;
            }
            bool isEnabled  = widget.enabled ?? true;
            bool wasEnabled = ((CupertinoTextField)oldWidget).enabled ?? true;

            if (wasEnabled && !isEnabled)
            {
                _effectiveFocusNode.unfocus();
            }
        }
Beispiel #4
0
 public override void initState()
 {
     base.initState();
     nameController.addListener(() => { setState(); });
     passwordController.addListener(() => { setState(); });
 }