示例#1
0
 public Ticker createTicker(TickerCallback onTick)
 {
     this._tickers = this._tickers ?? new HashSet<Ticker>();
     var result = new _WidgetTicker<T>(onTick, this, debugLabel: "created by " + this);
     this._tickers.Add(result);
     return result;
 }
示例#2
0
        public Ticker createTicker(TickerCallback onTick)
        {
            D.assert(() => {
                if (this._ticker == null)
                {
                    return(true);
                }

                throw new UIWidgetsError(
                    this.GetType() + " is a SingleTickerProviderStateMixin but multiple tickers were created.\n" +
                    "A SingleTickerProviderStateMixin can only be used as a TickerProvider once. If a " +
                    "State is used for multiple AnimationController objects, or if it is passed to other " +
                    "objects and those objects might use it more than one time in total, then instead of " +
                    "mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin."
                    );
            });

            Func <string> debugLabel = null;

            D.assert(() => {
                debugLabel = () => "created by " + this;
                return(true);
            });
            this._ticker = new Ticker(onTick, debugLabel: debugLabel);
            return(this._ticker);
        }
示例#3
0
 internal _WidgetTicker(
     TickerCallback onTick,
     TickerProviderStateMixin<T> creator,
     string debugLabel = null)
     : base(onTick: onTick, debugLabel: debugLabel)
 {
     this._creator = creator;
 }
示例#4
0
 internal _AutomaticWidgetTicker(
     TickerCallback onTick,
     AutomaticKeepAliveClientWithTickerProviderStateMixin <T> creator,
     string debugLabel = null) :
     base(onTick: onTick, debugLabel: debugLabel)
 {
     this._creator = creator;
 }
示例#5
0
 public Ticker(TickerCallback onTick, Func <string> debugLabel = null)
 {
     D.assert(() => {
         this._debugCreationStack = "skipped, use StackTraceUtility.ExtractStackTrace() if you need it"; // StackTraceUtility.ExtractStackTrace();
         return(true);
     });
     this._onTick    = onTick;
     this.debugLabel = debugLabel;
 }
示例#6
0
 public Ticker(TickerCallback onTick, string debugLabel = null)
 {
     D.assert(() => {
         _debugCreationStack = StackTraceUtility.ExtractStackTrace();
         return(true);
     });
     _onTick         = onTick;
     this.debugLabel = debugLabel;
 }
示例#7
0
 public Ticker(TickerCallback onTick, string debugLabel = null)
 {
     D.assert(() => {
         this._debugCreationStack = new StackTrace();
         return(true);
     });
     this._onTick    = onTick;
     this.debugLabel = debugLabel;
 }
示例#8
0
        public Ticker createTicker(TickerCallback onTick)
        {
            _tickers = _tickers ?? new HashSet <Ticker>();

            var result = new _AutomaticWidgetTicker <T>(onTick, this,
                                                        debugLabel: foundation_.kDebugMode ? "created by " + this : null);

            _tickers.Add(result);
            return(result);
        }
        public Ticker createTicker(TickerCallback onTick)
        {
            this._tickers = this._tickers ?? new HashSet <Ticker>();

            var debugLabel = "";

            D.assert(() => {
                debugLabel = "created by " + this;
                return(true);
            });
            var result = new _AutomaticWidgetTicker <T>(onTick, this, debugLabel: debugLabel);

            this._tickers.Add(result);
            return(result);
        }
示例#10
0
        public Ticker createTicker(TickerCallback onTick)
        {
            this._tickers = this._tickers ?? new HashSet <Ticker>();

            Func <string> debugLabel = null;

            D.assert(() => {
                debugLabel = () => "created by " + this;
                return(true);
            });
            var result = new _WidgetTicker <T>(onTick, this, debugLabel: debugLabel);

            this._tickers.Add(result);
            return(result);
        }
示例#11
0
        public Ticker createTicker(TickerCallback onTick)
        {
            D.assert(() => {
                if (_ticker == null)
                {
                    return(true);
                }

                throw new UIWidgetsError(new List <DiagnosticsNode> {
                    new ErrorSummary($"{GetType()} is a SingleTickerProviderStateMixin but multiple tickers were created."),
                    new ErrorDescription("A SingleTickerProviderStateMixin can only be used as a TickerProvider once."),
                    new ErrorHint(
                        "If a State is used for multiple AnimationController objects, or if it is passed to other " +
                        "objects and those objects might use it more than one time in total, then instead of " +
                        "mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin."
                        )
                });
            });

            _ticker = new Ticker(onTick, debugLabel: foundation_.kDebugMode ? $"created by {this}" : null);
            return(_ticker);
        }
示例#12
0
 public Ticker createTicker(TickerCallback onTick)
 {
     return(new Ticker(onTick: onTick, () => $"created by {this}"));
 }
        public Ticker createTicker(TickerCallback onTick)
        {
            Ticker _ticker = new Ticker(onTick, () => $"created by {this}");

            return(_ticker);
        }
示例#14
0
 public Ticker createTicker(TickerCallback onTick)
 {
     return(new Ticker(onTick));
 }