示例#1
0
        /// <inheritdoc cref="IOrbwalker" />
        public OrbwalkerMode DuplicateMode(OrbwalkerMode mode, string newName, GlobalKey key)
        {
            var newMode = new OrbwalkerMode(newName, key, mode.GetTargetImplementation, mode.ModeBehaviour);

            AddMode(newMode);
            return(newMode);
        }
示例#2
0
 public MaterialApp(
     Key key = null,
     GlobalKey <NavigatorState> navigatorKey = null,
     Widget home = null,
     Dictionary <string, WidgetBuilder> routes = null,
     string initialRoute          = null,
     RouteFactory onGenerateRoute = null,
     InitialRouteListFactory onGenerateInitialRoutes = null,
     RouteFactory onUnknownRoute = null,
     List <NavigatorObserver> navigatorObservers = null,
     TransitionBuilder builder = null,
     string title = "",
     GenerateAppTitle onGenerateTitle = null,
     Color color         = null,
     ThemeData theme     = null,
     ThemeData darkTheme = null,
     ThemeMode themeMode = ThemeMode.system,
     Locale locale       = null,
     List <LocalizationsDelegate> localizationsDelegates       = null,
     LocaleListResolutionCallback localeListResolutionCallback = null,
     LocaleResolutionCallback localeResolutionCallback         = null,
     List <Locale> supportedLocales               = null,
     bool showPerformanceOverlay                  = false,
     bool checkerboardRasterCacheImages           = false,
     bool checkerboardOffscreenLayers             = false,
     bool debugShowCheckedModeBanner              = true,
     Dictionary <LogicalKeySet, Intent> shortcuts = null,
     Dictionary <LocalKey, ActionFactory> actions = null
     ) : base(key: key)
 {
     supportedLocales = supportedLocales ?? new List <Locale> {
         new Locale("en", "US")
     };
     this.navigatorKey                  = navigatorKey;
     this.home                          = home;
     this.routes                        = routes ?? new Dictionary <string, WidgetBuilder>();
     this.onGenerateInitialRoutes       = onGenerateInitialRoutes;
     this.initialRoute                  = initialRoute;
     this.onGenerateRoute               = onGenerateRoute;
     this.onUnknownRoute                = onUnknownRoute;
     this.navigatorObservers            = navigatorObservers ?? new List <NavigatorObserver>();
     this.builder                       = builder;
     this.title                         = title;
     this.onGenerateTitle               = onGenerateTitle;
     this.color                         = color;
     this.theme                         = theme;
     this.darkTheme                     = darkTheme;
     this.themeMode                     = themeMode;
     this.locale                        = locale;
     this.localizationsDelegates        = localizationsDelegates;
     this.localeListResolutionCallback  = localeListResolutionCallback;
     this.localeResolutionCallback      = localeResolutionCallback;
     this.supportedLocales              = supportedLocales;
     this.showPerformanceOverlay        = showPerformanceOverlay;
     this.checkerboardRasterCacheImages = checkerboardRasterCacheImages;
     this.checkerboardOffscreenLayers   = checkerboardOffscreenLayers;
     this.debugShowCheckedModeBanner    = debugShowCheckedModeBanner;
     this.shortcuts                     = shortcuts;
     this.actions                       = actions;
 }
示例#3
0
        public override void didUpdateWidget(StatefulWidget oldWidget)
        {
            base.didUpdateWidget(oldWidget);
            TabBar _oldWidget = (TabBar)oldWidget;

            if (this.widget.controller != _oldWidget.controller)
            {
                this._updateTabController();
                this._initIndicatorPainter();
            }
            else if (this.widget.indicatorColor != _oldWidget.indicatorColor ||
                     this.widget.indicatorWeight != _oldWidget.indicatorWeight ||
                     this.widget.indicatorSize != _oldWidget.indicatorSize ||
                     this.widget.indicator != _oldWidget.indicator)
            {
                this._initIndicatorPainter();
            }

            if (this.widget.tabs.Count > _oldWidget.tabs.Count)
            {
                int delta = this.widget.tabs.Count - _oldWidget.tabs.Count;
                for (int i = 0; i < delta; i++)
                {
                    this._tabKeys.Add(GlobalKey.key());
                }
            }
            else if (this.widget.tabs.Count < _oldWidget.tabs.Count)
            {
                int delta = _oldWidget.tabs.Count - this.widget.tabs.Count;
                this._tabKeys.RemoveRange(this.widget.tabs.Count, delta);
            }
        }
示例#4
0
        float _getPosition(GlobalKey key)
        {
            var renderBoxRed = (RenderBox)key.currentContext.findRenderObject();
            var position     = renderBoxRed.localToGlobal(Offset.zero);

            return(position.dy);
        }
示例#5
0
 public MaterialApp(
     Key key = null,
     GlobalKey <NavigatorState> navigatorKey = null,
     Widget home = null,
     Dictionary <string, WidgetBuilder> routes = null,
     string initialRoute          = null,
     RouteFactory onGenerateRoute = null,
     RouteFactory onUnknownRoute  = null,
     List <NavigatorObserver> navigatorObservers = null,
     TransitionBuilder builder = null,
     string title                = "",
     Color color                 = null,
     ThemeData theme             = null,
     bool showPerformanceOverlay = false,
     Window window               = null) : base(key: key)
 {
     D.assert(window != null);
     this.window                 = window;
     this.navigatorKey           = navigatorKey;
     this.home                   = home;
     this.routes                 = routes ?? new Dictionary <string, WidgetBuilder>();
     this.initialRoute           = initialRoute;
     this.onGenerateRoute        = onGenerateRoute;
     this.onUnknownRoute         = onUnknownRoute;
     this.navigatorObservers     = navigatorObservers ?? new List <NavigatorObserver>();
     this.builder                = builder;
     this.title                  = title;
     this.color                  = color;
     this.theme                  = theme;
     this.showPerformanceOverlay = showPerformanceOverlay;
 }
示例#6
0
        public WidgetsApp(
            Key key = null,
            GlobalKey <NavigatorState> navigatorKey     = null,
            RouteFactory onGenerateRoute                = null,
            RouteFactory onUnknownRoute                 = null,
            PageRouteFactory pageRouteBuilder           = null,
            List <NavigatorObserver> navigatorObservers = null,
            string initialRoute = null,
            Dictionary <string, WidgetBuilder> routes = null,
            TransitionBuilder builder = null,
            Window window             = null,
            TextStyle textStyle       = null,
            Widget home = null
            ) : base(key)
        {
            D.assert(window != null);
            routes                  = routes ?? new Dictionary <string, WidgetBuilder>();
            this.window             = window;
            this.home               = home;
            this.navigatorKey       = navigatorKey;
            this.onGenerateRoute    = onGenerateRoute;
            this.onUnknownRoute     = onUnknownRoute;
            this.pageRouteBuilder   = pageRouteBuilder;
            this.routes             = routes;
            this.navigatorObservers = navigatorObservers ?? new List <NavigatorObserver>();
            this.initialRoute       = initialRoute;
            this.builder            = builder;
            this.textStyle          = textStyle;

            D.assert(
                home == null ||
                !this.routes.ContainsKey(Navigator.defaultRouteName),
                "If the home property is specified, the routes table " +
                "cannot include an entry for \" / \", since it would be redundant."
                );

            D.assert(
                builder != null ||
                home != null ||
                this.routes.ContainsKey(Navigator.defaultRouteName) ||
                onGenerateRoute != null ||
                onUnknownRoute != null,
                "Either the home property must be specified, " +
                "or the routes table must include an entry for \"/\", " +
                "or there must be on onGenerateRoute callback specified, " +
                "or there must be an onUnknownRoute callback specified, " +
                "or the builder property must be specified, " +
                "because otherwise there is nothing to fall back on if the " +
                "app is started with an intent that specifies an unknown route."
                );

            D.assert(
                builder != null ||
                onGenerateRoute != null ||
                pageRouteBuilder != null,
                "If neither builder nor onGenerateRoute are provided, the " +
                "pageRouteBuilder must be specified so that the default handler " +
                "will know what kind of PageRoute transition to build."
                );
        }
示例#7
0
 public override void initState()
 {
     base.initState();
     this._textFieldKey = (GlobalKey)this.widget.textFieldKey ?? GlobalKey.key("textFieldKey");
     this._controller   = this.widget.controller ?? new TextEditingController("");
     this._focusNode    = this.widget.focusNode ?? new FocusNode();
     this._controller.addListener(this._onTextChanged);
 }
示例#8
0
 public override void initState()
 {
     base.initState();
     this._tabKeys = new List <GlobalKey>();
     foreach (Widget tab in this.widget.tabs)
     {
         this._tabKeys.Add(GlobalKey.key());
     }
 }
示例#9
0
        public static Rect _getRect(GlobalKey globalKey)
        {
            D.assert(globalKey.currentContext != null);
            RenderBox renderBoxContainer = globalKey.currentContext.findRenderObject() as RenderBox;
            Offset    containerOffset    = renderBoxContainer.localToGlobal(
                renderBoxContainer.paintBounds.topLeft
                );

            return(containerOffset & renderBoxContainer.paintBounds.size);
        }
示例#10
0
 public override void initState()
 {
     base.initState();
     _keys = new List <GlobalKey>();
     for (int i = 0; i < widget.steps.Count; i++)
     {
         _keys.Add(GlobalKey.key());
         _oldStates[i] = widget.steps[i].state;
     }
 }
示例#11
0
        public static Rect _getScaledRect(GlobalKey globalKey, float scale)
        {
            Rect   childRect    = CupertinoContextMenuUtils._getRect(globalKey);
            Size   sizeScaled   = childRect.size * scale;
            Offset offsetScaled = new Offset(
                childRect.left + (childRect.size.width - sizeScaled.width) / 2,
                childRect.top + (childRect.size.height - sizeScaled.height) / 2
                );

            return(offsetScaled & sizeScaled);
        }
示例#12
0
 public DrawerController(
     GlobalKey key                 = null,
     Widget child                  = null,
     DrawerAlignment?alignment     = null,
     DrawerCallback drawerCallback = null) : base(key: key)
 {
     D.assert(child != null);
     D.assert(alignment != null);
     this.child          = child;
     this.alignment      = alignment ?? DrawerAlignment.start;
     this.drawerCallback = drawerCallback;
 }
示例#13
0
 void _attachRootWidget(Widget widget)
 {
     this.windowAdapter.attachRootWidget(() => new WidgetsApp(
                                             home: widget,
                                             navigatorKey: GlobalKey <NavigatorState> .key(),
                                             pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
                                             new PageRouteBuilder(
                                                 settings: settings,
                                                 pageBuilder: (BuildContext context, Animation <float> animation,
                                                               Animation <float> secondaryAnimation) => builder(context)
                                                 )));
 }
示例#14
0
 public _ListModel(
     GlobalKey <AnimatedListState> listKey,
     RemovedItemBuilder removedItemBuilder,
     IEnumerable <int> initialItems = null
     )
 {
     D.assert(listKey != null);
     D.assert(removedItemBuilder != null);
     _items                  = initialItems?.ToList() ?? new List <int>();
     this.listKey            = listKey;
     this.removedItemBuilder = removedItemBuilder;
 }
示例#15
0
 public static string GetName(this GlobalKey key)
 {
     return(key switch
     {
         GlobalKey.Eikthyr => "defeated_eikthyr",
         GlobalKey.Elder => "defeated_gdking",
         GlobalKey.Bonemass => "defeated_bonemass",
         GlobalKey.Moder => "defeated_dragon",
         GlobalKey.Yagluth => "defeated_goblinking",
         GlobalKey.Troll => "KilledTroll",
         GlobalKey.Surtling => "killed_surtling",
         _ => ""
     });
示例#16
0
        public static bool _hitTestInteractive(GlobalKey customPaintKey, Offset offset)
        {
            if (customPaintKey.currentContext == null)
            {
                return(false);
            }
            CustomPaint      customPaint = customPaintKey.currentContext.widget as CustomPaint;
            ScrollbarPainter painter     = customPaint.foregroundPainter as ScrollbarPainter;
            RenderBox        renderBox   = customPaintKey.currentContext.findRenderObject() as RenderBox;
            Offset           localOffset = renderBox.globalToLocal(offset);

            return(painter.hitTestInteractive(localOffset));
        }
示例#17
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(false);
            this._scrollController    = new ScrollController();
            this._contentFocusNodeKey = GlobalKey.key("_contentFocusNodeKey");
            this._nameFocusNodeKey    = GlobalKey.key("_nameFocusNodeKey");
            this._contactFocusNodeKey = GlobalKey.key("_contactFocusNodeKey");

            this._contentFocusNode.addListener(this._contentFocusNodeListener);
            this._nameFocusNode.addListener(this._nameFocusNodeListener);
            this._contactFocusNode.addListener(this._contactFocusNodeListener);
        }
示例#18
0
 public NestedNavigator(
     GlobalKey <NavigatorState> navigatorKey,
     string initialRoute,
     Dictionary <string, WidgetBuilder> routes,
     RouteCallback onGenerateRoute = null,
     PopCallback onWillPop         = null
     )
 {
     _navigatorKey    = navigatorKey;
     _initialRoute    = initialRoute;
     _routes          = routes;
     _onGenerateRoute = onGenerateRoute;
     _onWillPop       = onWillPop;
 }
示例#19
0
        /// <summary>
        ///     Creates a new instance of an OrbwalkerMode using a Global Key
        /// </summary>
        public OrbwalkerMode(string name, GlobalKey key, TargetDelegate targetDelegate, OrbwalkModeDelegate orbwalkBehaviour)
        {
            if (name == null || key == null)
            {
                throw new Exception("There was an error creating the Orbwalker Mode");
            }

            this.Name                    = name;
            this.ModeBehaviour           = orbwalkBehaviour;
            this.GetTargetImplementation = targetDelegate;
            this.MenuItem                = key.KeyBindItem;
            key.Activate();
            this.UsingGlobalKey = true;
        }
示例#20
0
 public _ThumbPressGestureRecognizer(
     float?postAcceptSlopTolerance = null,
     PointerDeviceKind kind        = default,
     object debugOwner             = null,
     GlobalKey customPaintKey      = null
     ) : base(
         postAcceptSlopTolerance: postAcceptSlopTolerance,
         kind: kind,
         debugOwner: debugOwner,
         duration: TimeSpan.FromMilliseconds(100)
         )
 {
     _customPaintKey = customPaintKey;
 }
示例#21
0
        private void Hook()
        {
            Unhook();

            if (process != null)
            {
                globalKey           = new GlobalKey();
                globalKey.KeyEvent += GlobalKey_KeyEvent;

                globalMouse              = new GlobalMouse();
                globalMouse.ButtonEvent += GlobalMouse_ButtonEvent;

                globalWindow            = new GlobalWindow(process);
                globalWindow.MoveEvent += GlobalWindow_MoveEvent;
            }
        }
示例#22
0
 public ShrinePage(
     Key key = null,
     GlobalKey <ScaffoldState> scaffoldKey = null,
     Widget body = null,
     Widget floatingActionButton = null,
     List <Product> products     = null,
     Dictionary <Product, Order> shoppingCart = null
     ) : base(key: key)
 {
     D.assert(body != null);
     D.assert(scaffoldKey != null);
     this.scaffoldKey          = scaffoldKey;
     this.body                 = body;
     this.floatingActionButton = floatingActionButton;
     this.products             = products;
     this.shoppingCart         = shoppingCart;
 }
示例#23
0
        public CupertinoApp(
            Key key = null,
            GlobalKey <NavigatorState> navigatorKey = null,
            Widget home = null,
            CupertinoThemeData theme = null,
            Dictionary <string, WidgetBuilder> routes = null,
            string initialRoute          = null,
            RouteFactory onGenerateRoute = null,
            RouteFactory onUnknownRoute  = null,
            List <NavigatorObserver> navigatorObservers = null,
            TransitionBuilder builder = null,
            string title = "",
            GenerateAppTitle onGenerateTitle = null,
            Color color   = null,
            Locale locale = null,
            List <LocalizationsDelegate <CupertinoLocalizations> > localizationsDelegates = null,
            LocaleListResolutionCallback localeListResolutionCallback = null,
            LocaleResolutionCallback localeResolutionCallback         = null,
            List <Locale> supportedLocales = null,
            bool showPerformanceOverlay    = false
            ) : base(key: key)
        {
            D.assert(title != null);

            supportedLocales = supportedLocales ?? new List <Locale> {
                new Locale("en", "US")
            };
            this.navigatorKey                 = navigatorKey;
            this.home                         = home;
            this.theme                        = theme;
            this.routes                       = routes ?? new Dictionary <string, WidgetBuilder>();
            this.initialRoute                 = initialRoute;
            this.onGenerateRoute              = onGenerateRoute;
            this.onUnknownRoute               = onUnknownRoute;
            this.navigatorObservers           = navigatorObservers ?? new List <NavigatorObserver>();
            this.builder                      = builder;
            this.title                        = title;
            this.onGenerateTitle              = onGenerateTitle;
            this.color                        = color;
            this.locale                       = locale;
            this.localizationsDelegates       = localizationsDelegates;
            this.localeListResolutionCallback = localeListResolutionCallback;
            this.localeResolutionCallback     = localeResolutionCallback;
            this.supportedLocales             = supportedLocales;
            this.showPerformanceOverlay       = showPerformanceOverlay;
        }
示例#24
0
 public CupertinoTabView(
     Key key = null,
     WidgetBuilder builder = null,
     GlobalKey <NavigatorState> navigatorKey = null,
     string defaultTitle = null,
     Dictionary <string, WidgetBuilder> routes = null,
     RouteFactory onGenerateRoute = null,
     RouteFactory onUnknownRoute  = null,
     List <NavigatorObserver> navigatorObservers = null
     ) : base(key: key)
 {
     this.builder            = builder;
     this.navigatorKey       = navigatorKey;
     this.defaultTitle       = defaultTitle;
     this.routes             = routes;
     this.onGenerateRoute    = onGenerateRoute;
     this.onUnknownRoute     = onUnknownRoute;
     this.navigatorObservers = navigatorObservers ?? new List <NavigatorObserver>();
 }
示例#25
0
 public _ContextMenuRouteStatic(
     Key key = null,
     List <Widget> actions    = null,
     Widget child             = null,
     GlobalKey childGlobalKey = null,
     _ContextMenuLocation contextMenuLocation = default,
     _DismissCallback onDismiss = default,
     Orientation orientation    = default,
     GlobalKey sheetGlobalKey   = null
     ) : base(key: key)
 {
     D.assert(contextMenuLocation != default);
     D.assert(orientation != default);
     this.actions             = actions;
     this.child               = child;
     this.childGlobalKey      = childGlobalKey;
     this.contextMenuLocation = contextMenuLocation;
     this.onDismiss           = onDismiss;
     this.orientation         = orientation;
     this.sheetGlobalKey      = sheetGlobalKey;
 }
示例#26
0
 public DrawerController(
     GlobalKey key                       = null,
     Widget child                        = null,
     DrawerAlignment?alignment           = null,
     DrawerCallback drawerCallback       = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start,
     Color scrimColor                    = null,
     bool?enableOpenDragGesture          = true,
     float?edgeDragWidth                 = null
     ) : base(key: key)
 {
     D.assert(child != null);
     D.assert(alignment != null);
     this.child                 = child;
     this.alignment             = alignment ?? DrawerAlignment.start;
     this.drawerCallback        = drawerCallback;
     this.dragStartBehavior     = dragStartBehavior;
     this.scrimColor            = scrimColor;
     this.enableOpenDragGesture = enableOpenDragGesture;
     this.edgeDragWidth         = edgeDragWidth;
 }
示例#27
0
        private void Unhook()
        {
            if (globalKey != null)
            {
                globalKey.KeyEvent -= GlobalKey_KeyEvent;
                globalKey.Dispose();
                globalKey = null;
            }

            if (globalMouse != null)
            {
                globalMouse.ButtonEvent -= GlobalMouse_ButtonEvent;
                globalMouse.Dispose();
                globalMouse = null;
            }

            if (globalWindow != null)
            {
                globalWindow.MoveEvent -= GlobalWindow_MoveEvent;
                globalWindow.Dispose();
                globalWindow = null;
            }
        }
示例#28
0
        /// <summary>
        ///     Creates a new instance of an OrbwalkerMode using a Global Key
        /// </summary>
        public OrbwalkerMode(
            string name,
            GlobalKey key,
            TargetDelegate targetDelegate,
            OrbwalkModeDelegate orbwalkBehaviour)
        {
            if (name == null || key == null)
            {
                throw new Exception("There was an error creating the Orbwalker Mode");
            }

            this.Name                    = name;
            this.ModeBehaviour           = orbwalkBehaviour;
            this.GetTargetImplementation = targetDelegate;
            this.MenuItem                = key.KeyBindItem;
            key.Activate();
            this.UsingGlobalKey = true;

            this.ModeMenu = new Menu($"orbmode.{name}", name)
            {
                new MenuBool($"orbmode.{name}.move", "Movement"),
                new MenuBool($"orbmode.{name}.attack", "Attacking")
            };
        }
示例#29
0
 public static void ChangeKey(GlobalKey newKey)
 {
     ClearKeys();
     newKey.KeyBindItem.Value = true;
 }
示例#30
0
 void _updateNavigator()
 {
     this._navigator = this.widget.navigatorKey ?? new GlobalObjectKey <NavigatorState>(this);
 }
示例#31
0
 public static void Set(this HttpSessionStateBase Session, GlobalKey Key, object Value)
 {
     Set(Session, Key.ToString(), Value);
 }
示例#32
0
 //HttpSessionStateBase
 public static object Get(this HttpSessionStateBase Session, GlobalKey Key)
 {
     return Get(Session, Key.ToString());
 }
示例#33
0
 public static bool Exists(this HttpSessionStateBase Session, GlobalKey Key)
 {
     return Exists(Session, Key.ToString());
 }