Esempio n. 1
0
        /// Update the information associated with the node with the given `id`.
        ///
        /// The semantics nodes form a tree, with the root of the tree always having
        /// an id of zero. The `childrenInTraversalOrder` and `childrenInHitTestOrder`
        /// are the ids of the nodes that are immediate children of this node. The
        /// former enumerates children in traversal order, and the latter enumerates
        /// the same children in the hit test order. The two lists must have the same
        /// length and contain the same ids. They may only differ in the order the
        /// ids are listed in. For more information about different child orders, see
        /// [DebugSemanticsDumpOrder].
        ///
        /// The system retains the nodes that are currently reachable from the root.
        /// A given update need not contain information for nodes that do not change
        /// in the update. If a node is not reachable from the root after an update,
        /// the node will be discarded from the tree.
        ///
        /// The `flags` are a bit field of [SemanticsFlag]s that apply to this node.
        ///
        /// The `actions` are a bit field of [SemanticsAction]s that can be undertaken
        /// by this node. If the user wishes to undertake one of these actions on this
        /// node, the [Window.onSemanticsAction] will be called with `id` and one of
        /// the possible [SemanticsAction]s. Because the semantics tree is maintained
        /// asynchronously, the [Window.onSemanticsAction] callback might be called
        /// with an action that is no longer possible.
        ///
        /// The `label` is a string that describes this node. The `value` property
        /// describes the current value of the node as a string. The `increasedValue`
        /// string will become the `value` string after a [SemanticsAction.increase]
        /// action is performed. The `decreasedValue` string will become the `value`
        /// string after a [SemanticsAction.decrease] action is performed. The `hint`
        /// string describes what result an action performed on this node has. The
        /// reading direction of all these strings is given by `textDirection`.
        ///
        /// The fields 'textSelectionBase' and 'textSelectionExtent' describe the
        /// currently selected text within `value`.
        ///
        /// For scrollable nodes `scrollPosition` describes the current scroll
        /// position in logical pixel. `scrollExtentMax` and `scrollExtentMin`
        /// describe the maximum and minimum in-rage values that `scrollPosition` can
        /// be. Both or either may be infinity to indicate unbound scrolling. The
        /// value for `scrollPosition` can (temporarily) be outside this range, for
        /// example during an overscroll. `scrollChildren` is the count of the
        /// total number of child nodes that contribute semantics and `scrollIndex`
        /// is the index of the first visible child node that contributes semantics.
        ///
        /// The `rect` is the region occupied by this node in its own coordinate
        /// system.
        ///
        /// The `transform` is a matrix that maps this node's coordinate system into
        /// its parent's coordinate system.
        public void updateNode(
            int id = 0,
            SemanticsFlag flags     = 0,
            SemanticsAction actions = 0,
            int textSelectionBase   = 0,
            int textSelectionExtent = 0,
            int scrollChildren      = 0,
            int scrollIndex         = 0,
            double scrollPosition   = 0.0,
            double scrollExtentMax  = 0.0,
            double scrollExtentMin  = 0.0,
            Rect rect                           = null,
            String label                        = null,
            String hint                         = null,
            String value                        = null,
            String increasedValue               = null,
            String decreasedValue               = null,
            TextDirection textDirection         = TextDirection.ltr,
            SKMatrix44 transform                = null,
            List <int> childrenInTraversalOrder = null,
            List <int> childrenInHitTestOrder   = null,
            List <int> additionalActions        = null)
        {
            SemanticsNode node = new SemanticsNode
            {
                id                         = id,
                flags                      = flags,
                actions                    = actions,
                textSelectionBase          = textSelectionBase,
                textSelectionExtent        = textSelectionExtent,
                scrollChildren             = scrollChildren,
                scrollIndex                = scrollIndex,
                scrollPosition             = scrollPosition,
                scrollExtentMax            = scrollExtentMax,
                scrollExtentMin            = scrollExtentMin,
                rect                       = rect.ToSKRect(),
                label                      = label,
                hint                       = hint,
                value                      = value,
                increasedValue             = increasedValue,
                decreasedValue             = decreasedValue,
                textDirection              = textDirection,
                transform                  = transform,
                childrenInTraversalOrder   = childrenInTraversalOrder,
                childrenInHitTestOrder     = childrenInHitTestOrder,
                customAccessibilityActions = additionalActions
            };

            nodes_[id] = node;
        }
Esempio n. 2
0
 public bool HasAction(SemanticsAction action) => actions.HasFlag(action);