Example #1
0
 public override void initState()
 {
     base.initState();
     _selectionGestureDetectorBuilder = new _SelectableTextSelectionGestureDetectorBuilder(state: this);
     _controller = new _TextSpanEditingController(
         textSpan: widget.textSpan ?? new TextSpan(text: widget.data)
         );
 }
Example #2
0
        public override void didUpdateWidget(StatefulWidget oldWidget)
        {
            var _oldWidget = (SelectableText)oldWidget;

            base.didUpdateWidget(oldWidget);
            if (widget.data != _oldWidget.data || widget.textSpan != _oldWidget.textSpan)
            {
                _controller = new _TextSpanEditingController(
                    textSpan: widget.textSpan ?? new TextSpan(text: widget.data)
                    );
            }
            if (_effectiveFocusNode.hasFocus && _controller.selection.isCollapsed)
            {
                _showSelectionHandles = false;
            }
        }