コード例 #1
0
    void _updateHighlightMode()
    {
        _lastInteractionWasTouch = false;    //(Platform.isAndroid || Platform.isIOS || !WidgetsBinding.instance.mouseTracker.mouseIsConnected);
        FocusHighlightMode newMode = FocusHighlightMode.touch;

        switch (highlightStrategy)
        {
        case FocusHighlightStrategy.automatic:
            if (_lastInteractionWasTouch)
            {
                newMode = FocusHighlightMode.touch;
            }
            else
            {
                newMode = FocusHighlightMode.traditional;
            }
            break;

        case FocusHighlightStrategy.alwaysTouch:
            newMode = FocusHighlightMode.touch;
            break;

        case FocusHighlightStrategy.alwaysTraditional:
            newMode = FocusHighlightMode.traditional;
            break;
        }
        if (newMode != _highlightMode)
        {
            _highlightMode = newMode;
            _notifyHighlightModeListeners();
        }
    }
コード例 #2
0
 void _handleFocusHighlightModeChange(FocusHighlightMode mode)
 {
     if (!mounted)
     {
         return;
     }
     _updateHighlightMode(mode);
 }
コード例 #3
0
        void _handleFocusHighlightModeChange(FocusHighlightMode mode)
        {
            if (!mounted)
            {
                return;
            }

            setState(() => { _focusHighlightMode = mode; });
        }
コード例 #4
0
        void _updateHighlightMode(FocusHighlightMode mode)
        {
            _mayTriggerCallback(task: () => {
                switch (FocusManager.instance.highlightMode)
                {
                case FocusHighlightMode.touch:
                    _canShowHighlight = false;
                    break;

                case FocusHighlightMode.traditional:
                    _canShowHighlight = true;
                    break;
                }
            });
        }
コード例 #5
0
        public override void initState()
        {
            base.initState();
            _updateSelectedIndex();
            if (widget.focusNode == null)
            {
                _internalNode = _internalNode ?? _createFocusNode();
            }

            _actionMap = new Dictionary <LocalKey, ActionFactory>()
            {
                { ActivateAction.key, _createAction }
            };
            focusNode.addListener(_handleFocusChanged);
            FocusManager focusManager = WidgetsBinding.instance.focusManager;

            _focusHighlightMode = focusManager.highlightMode;
            focusManager.addHighlightModeListener(_handleFocusHighlightModeChange);
        }