コード例 #1
0
        public static ActionDispatcher _findDispatcher(Element element)
        {
            D.assert(element.widget is Actions);
            Actions          actions    = element.widget as Actions;
            ActionDispatcher dispatcher = actions.dispatcher;

            if (dispatcher == null)
            {
                bool visitAncestorElement(Element visitedElement)
                {
                    if (!(visitedElement.widget is Actions))
                    {
                        return(true);
                    }

                    Actions actions1 = visitedElement.widget as Actions;

                    if (actions1.dispatcher == null)
                    {
                        return(true);
                    }

                    dispatcher = actions1.dispatcher;
                    return(false);
                }

                element.visitAncestorElements(visitAncestorElement);
            }

            return(dispatcher ?? new ActionDispatcher());
        }
コード例 #2
0
 public Actions(
     Key key = null,
     ActionDispatcher dispatcher = null,
     Dictionary <LocalKey, ActionFactory> actions = null,
     Widget child = null
     ) : base(key: key, child: child)
 {
     D.assert(actions != null);
     this.dispatcher = dispatcher;
     this.actions    = actions;
 }