public bool debugIsVisible(OverlayEntry entry) { bool result = false; D.assert(this._entries.Contains(entry)); D.assert(() => { for (int i = this._entries.Count - 1; i > 0; i -= 1) { // todo why not including 0? OverlayEntry candidate = this._entries[i]; if (candidate == entry) { result = true; break; } if (candidate.opaque) { break; } } return(true); }); return(result); }
protected internal override void install(OverlayEntry insertionPoint) { D.assert(this._overlayEntries.isEmpty()); this._overlayEntries.AddRange(this.createOverlayEntries()); this.navigator.overlay?.insertAll(this._overlayEntries, insertionPoint); base.install(insertionPoint); }
internal void _remove(OverlayEntry entry) { if (mounted) { setState(() => { _entries.Remove(entry); }); } }
void hideToolbar() { D.assert(_toolbar != null); _toolbarController.stop(); _toolbar.remove(); _toolbar = null; }
public void showToolbar() { D.assert(_toolbar == null); _toolbar = new OverlayEntry(builder: _buildToolbar); Overlay.of(context, rootOverlay: true, debugRequiredFor: debugRequiredFor).insert(_toolbar); _toolbarController.forward(from: 0.0f); }
internal void _remove(OverlayEntry entry) { if (this.mounted) { this.setState(() => { this._entries.Remove(entry); }); } }
public void insertAll(ICollection <OverlayEntry> entries, OverlayEntry below = null, OverlayEntry above = null) { D.assert(above == null || below == null, () => "Only one of `above` and `below` may be specified."); D.assert(above == null || (above._overlay == this && this._entries.Contains(above)), () => "The provided entry for `above` is not present in the Overlay."); D.assert(below == null || (below._overlay == this && this._entries.Contains(below)), () => "The provided entry for `below` is not present in the Overlay."); D.assert(entries.All(entry => !this._entries.Contains(entry)), () => "One or more of the specified entries are already present in the Overlay."); D.assert(entries.All(entry => entry._overlay == null), () => "One or more of the specified entries are already present in another Overlay."); if (entries.isEmpty()) { return; } foreach (OverlayEntry entry in entries) { D.assert(entry._overlay == null); entry._overlay = this; } this.setState(() => { this._entries.InsertRange(this._insertionIndex(below, above), entries); }); }
public void showToolbar() { D.assert(this._toolbar == null); this._toolbar = new OverlayEntry(builder: this._buildToolbar); Overlay.of(this.context, debugRequiredFor: this.debugRequiredFor).insert(this._toolbar); this._toolbarController.forward(from: 0.0f); }
public _DragAvatar( OverlayState overlayState, T data = default, Axis?axis = null, Offset initialPosition = null, Offset dragStartPoint = null, Widget feedback = null, Offset feedbackOffset = null, _OnDragEnd onDragEnd = null ) { if (feedbackOffset == null) { feedbackOffset = Offset.zero; } D.assert(overlayState != null); this.overlayState = overlayState; this.data = data; this.axis = axis; this.dragStartPoint = dragStartPoint ?? Offset.zero; this.feedback = feedback; this.feedbackOffset = feedbackOffset ?? Offset.zero; this.onDragEnd = onDragEnd; _entry = new OverlayEntry(_build); this.overlayState.insert(_entry); _position = initialPosition ?? Offset.zero; updateDrag(initialPosition); }
internal _OverlayEntryWidget(Key key, OverlayEntry entry, bool tickerEnabled = true) : base(key: key) { D.assert(key != null); D.assert(entry != null); this.entry = entry; this.tickerEnabled = tickerEnabled; }
public override ICollection<OverlayEntry> createOverlayEntries() { this._modalBarrier = new OverlayEntry(builder: this._buildModalBarrier); var content = new OverlayEntry( builder: this._buildModalScope, maintainState: this.maintainState ); return new List<OverlayEntry> {this._modalBarrier, content}; }
protected internal override void install(OverlayEntry insertionPoint) { D.assert(!this._transitionCompleter.isCompleted, $"Cannot install a {this.GetType()} after disposing it."); this._controller = this.createAnimationController(); D.assert(this._controller != null, $"{this.GetType()}.createAnimationController() returned null."); this._animation = this.createAnimation(); D.assert(this._animation != null, $"{this.GetType()}.createAnimation() returned null."); base.install(insertionPoint); }
public void insert(OverlayEntry entry, OverlayEntry above = null) { D.assert(entry._overlay == null); D.assert(above == null || (above._overlay == this && this._entries.Contains(above))); entry._overlay = this; this.setState(() => { int index = above == null ? this._entries.Count : this._entries.IndexOf(above) + 1; this._entries.Insert(index, entry); }); }
public void rearrange(IEnumerable <OverlayEntry> newEntries, OverlayEntry below = null, OverlayEntry above = null) { List <OverlayEntry> newEntriesList = newEntries is List <OverlayEntry>?(newEntries as List <OverlayEntry>) : newEntries.ToList(); D.assert( above == null || below == null, () => "Only one of `above` and `below` may be specified." ); D.assert( above == null || (above._overlay == this && _entries.Contains(above)), () => "The provided entry for `above` is not present in the Overlay." ); D.assert( below == null || (below._overlay == this && _entries.Contains(below)), () => "The provided entry for `below` is not present in the Overlay." ); D.assert( newEntriesList.All(entry => entry._overlay == null || entry._overlay == this), () => "One or more of the specified entries are already present in another Overlay." ); D.assert( newEntriesList.All(entry => _entries.IndexOf(entry) == _entries.LastIndexOf(entry)), () => "One or more of the specified entries are specified multiple times." ); if (newEntriesList.isEmpty()) { return; } if (_entries.SequenceEqual(newEntriesList)) { return; } HashSet <OverlayEntry> old = new HashSet <OverlayEntry>(_entries); foreach (OverlayEntry entry in newEntriesList) { entry._overlay = entry._overlay ?? this; } setState(() => { _entries.Clear(); _entries.AddRange(newEntriesList); foreach (OverlayEntry entry in newEntriesList) { old.Remove(entry); } _entries.InsertRange(_insertionIndex(below, above), old); }); }
public override IEnumerable <OverlayEntry> createOverlayEntries() { _modalBarrier = new OverlayEntry(builder: _buildModalBarrier); var content = new OverlayEntry( builder: _buildModalScope, maintainState: maintainState ); return(new List <OverlayEntry> { _modalBarrier, content }); }
public void insert(OverlayEntry entry, OverlayEntry below = null, OverlayEntry above = null) { D.assert(above == null || below == null, () => "Only one of `above` and `below` may be specified."); D.assert(above == null || (above._overlay == this && _entries.Contains(above)), () => "The provided entry for `above` is not present in the Overlay."); D.assert(below == null || (below._overlay == this && _entries.Contains(below)), () => "The provided entry for `below` is not present in the Overlay."); D.assert(!_entries.Contains(entry), () => "The specified entry is already present in the Overlay."); D.assert(entry._overlay == null, () => "The specified entry is already present in another Overlay."); entry._overlay = this; setState(() => { _entries.Insert(_insertionIndex(below, above), entry); }); }
public void _handleAnimationUpdate(AnimationStatus status) { if (status == AnimationStatus.completed || status == AnimationStatus.dismissed) { _proxyAnimation.parent = null; D.assert(overlayEntry != null); overlayEntry.remove(); overlayEntry = null; manifest.fromHero.endFlight(keepPlaceholder: status == AnimationStatus.completed); manifest.toHero.endFlight(keepPlaceholder: status == AnimationStatus.dismissed); onFlightEnded(this); } }
public void hide() { if (this._handles != null) { this._handles[0].remove(); this._handles[1].remove(); this._handles = null; } this._toolbar?.remove(); this._toolbar = null; this._toolbarController.stop(); }
void _handleSelectionHandleTapped() { if (this._value.selection.isCollapsed) { if (this._toolbar != null) { this._toolbar?.remove(); this._toolbar = null; } else { this.showToolbar(); } } }
void _handleAnimationUpdate(AnimationStatus status) { if (status == AnimationStatus.completed || status == AnimationStatus.dismissed) { this._proxyAnimation.parent = null; D.assert(this.overlayEntry != null); this.overlayEntry.remove(); this.overlayEntry = null; this.manifest.fromHero.endFlight(); this.manifest.toHero.endFlight(); this.onFlightEnded(this); } }
internal int _insertionIndex(OverlayEntry below, OverlayEntry above) { D.assert(below == null || above == null); if (below != null) { return(_entries.IndexOf(below)); } if (above != null) { return(_entries.IndexOf(above) + 1); } return(_entries.Count); }
public void start(_HeroFlightManifest initialManifest) { D.assert(!_aborted); D.assert(() => { Animation <float> initial = initialManifest.animation; D.assert(initial != null); HeroFlightDirection type = initialManifest.type; switch (type) { case HeroFlightDirection.pop: return(initial.value == 1.0f && initialManifest.isUserGestureTransition ? initial.status == AnimationStatus.completed : initial.status == AnimationStatus.reverse); case HeroFlightDirection.push: return(initial.value == 0.0f && initial.status == AnimationStatus.forward); } throw new Exception("Unknown type: " + type); }); manifest = initialManifest; if (manifest.type == HeroFlightDirection.pop) { _proxyAnimation.parent = new ReverseAnimation(manifest.animation); } else { _proxyAnimation.parent = manifest.animation; } manifest.fromHero.startFlight(shouldIncludedChildInPlaceholder: manifest.type == HeroFlightDirection.push); manifest.toHero.startFlight(); heroRectTween = _doCreateRectTween( HeroUtils._boundingBoxFor(manifest.fromHero.context, manifest.fromRoute.subtreeContext), HeroUtils._boundingBoxFor(manifest.toHero.context, manifest.toRoute.subtreeContext) ); overlayEntry = new OverlayEntry(builder: _buildOverlay); manifest.overlay.insert(overlayEntry); }
public void insertAll(ICollection <OverlayEntry> entries, OverlayEntry above = null) { D.assert(above == null || (above._overlay == this && this._entries.Contains(above))); if (entries.isEmpty()) { return; } foreach (OverlayEntry entry in entries) { D.assert(entry._overlay == null); entry._overlay = this; } this.setState(() => { int index = above == null ? this._entries.Count : this._entries.IndexOf(above) + 1; this._entries.InsertRange(index, entries); }); }
public void start(_HeroFlightManifest initialManifest) { D.assert(!this._aborted); D.assert(() => { Animation <float> initial = initialManifest.animation; D.assert(initial != null); HeroFlightDirection type = initialManifest.type; switch (type) { case HeroFlightDirection.pop: return(initial.value == 1.0f && initialManifest.isUserGestureTransition ? initial.status == AnimationStatus.completed : initial.status == AnimationStatus.reverse); case HeroFlightDirection.push: return(initial.value == 0.0f && initial.status == AnimationStatus.forward); } throw new Exception("Unknown type: " + type); }); this.manifest = initialManifest; if (this.manifest.type == HeroFlightDirection.pop) { this._proxyAnimation.parent = new ReverseAnimation(this.manifest.animation); } else { this._proxyAnimation.parent = this.manifest.animation; } this.manifest.fromHero.startFlight(); this.manifest.toHero.startFlight(); this.heroRectTween = this._doCreateRectTween( HeroUtils._globalBoundingBoxFor(this.manifest.fromHero.context), HeroUtils._globalBoundingBoxFor(this.manifest.toHero.context) ); this.overlayEntry = new OverlayEntry(builder: this._buildOverlay); this.manifest.overlay.insert(this.overlayEntry); }
void finishDrag(_DragEndKind endKind, Velocity velocity = null) { bool wasAccepted = false; if (endKind == _DragEndKind.dropped && this._activeTarget != null) { this._activeTarget.didDrop(this); wasAccepted = true; this._enteredTargets.Remove(this._activeTarget); } this._leaveAllEntered(); this._activeTarget = null; this._entry.remove(); this._entry = null; if (this.onDragEnd != null) { this.onDragEnd(velocity == null ? Velocity.zero : velocity, this._lastOffset, wasAccepted); } }
internal _OverlayEntry(OverlayEntry entry) : base(key: entry._key) { D.assert(entry != null); this.entry = entry; }
protected internal virtual void install(OverlayEntry insertionPoint) { }
protected internal override void install(OverlayEntry insertionPoint) { base.install(insertionPoint); this._animationProxy = new ProxyAnimation(base.animation); this._secondaryAnimationProxy = new ProxyAnimation(base.secondaryAnimation); }