Future <bool> _confirmStartResizeAnimation() { if (widget.confirmDismiss != null) { DismissDirection?direction = _dismissDirection; D.assert(direction != null); return(widget.confirmDismiss(direction)); } return(Future.value(true).to <bool>()); }
IPromise <bool> _confirmStartResizeAnimation() { if (this.widget.confirmDismiss != null) { DismissDirection?direction = this._dismissDirection; D.assert(direction != null); return(this.widget.confirmDismiss(direction)); } return(Promise <bool> .Resolved(true)); }
public _LeaveBehindListItem( Key key = null, LeaveBehindItem item = null, onArchiveFunc onArchive = null, onDeleteFunc onDelete = null, DismissDirection?dismissDirection = null, bool?confirmDismiss = null ) : base(key: key) { this.item = item; this.onArchive = onArchive; this.onDelete = onDelete; this.dismissDirection = dismissDirection; this.confirmDismiss = confirmDismiss; }
void _handleResizeProgressChanged() { if (this._resizeController.isCompleted) { if (this.widget.onDismissed != null) { DismissDirection?direction = this._dismissDirection; D.assert(direction != null); this.widget.onDismissed(direction); } } else { if (this.widget.onResize != null) { this.widget.onResize(); } } }
void _startResizeAnimation() { D.assert(this._moveController != null); D.assert(this._moveController.isCompleted); D.assert(this._resizeController == null); D.assert(this._sizePriorToCollapse == null); if (this.widget.resizeDuration == null) { if (this.widget.onDismissed != null) { DismissDirection?direction = this._dismissDirection; D.assert(direction != null); this.widget.onDismissed(direction); } } else { this._resizeController = new AnimationController(duration: this.widget.resizeDuration, vsync: this); this._resizeController.addListener(this._handleResizeProgressChanged); this._resizeController.addStatusListener((AnimationStatus status) => this.updateKeepAlive()); this._resizeController.forward(); this.setState(() => { this._sizePriorToCollapse = this.context.size; this._resizeAnimation = this._resizeController.drive( new CurveTween( curve: _kResizeTimeCurve ) ).drive( new FloatTween( begin: 1.0f, end: 0.0f ) ); }); } }
public override Widget build(BuildContext context) { base.build(context); // See AutomaticKeepAliveClientMixin. D.assert(!this._directionIsXAxis || WidgetsD.debugCheckHasDirectionality(context)); Widget background = this.widget.background; if (this.widget.secondaryBackground != null) { DismissDirection?direction = this._dismissDirection; if (direction == DismissDirection.endToStart || direction == DismissDirection.up) { background = this.widget.secondaryBackground; } } if (this._resizeAnimation != null) { // we've been dragged aside, and are now resizing. D.assert(() => { if (this._resizeAnimation.status != AnimationStatus.forward) { D.assert(this._resizeAnimation.status == AnimationStatus.completed); throw new UIWidgetsError( "A dismissed Dismissible widget is still part of the tree.\n" + "Make sure to implement the onDismissed handler and to immediately remove the Dismissible\n" + "widget from the application once that handler has fired." ); } return(true); }); return(new SizeTransition( sizeFactor: this._resizeAnimation, axis: this._directionIsXAxis ? Axis.vertical : Axis.horizontal, child: new SizedBox( width: this._sizePriorToCollapse.width, height: this._sizePriorToCollapse.height, child: background ) )); } Widget content = new SlideTransition( position: this._moveAnimation, child: this.widget.child ); if (background != null) { List <Widget> children = new List <Widget> { }; if (!this._moveAnimation.isDismissed) { children.Add(Positioned.fill( child: new ClipRect( clipper: new _DismissibleClipper( axis: this._directionIsXAxis ? Axis.horizontal : Axis.vertical, moveAnimation: this._moveAnimation ), child: background ) )); } children.Add(content); content = new Stack(children: children); } return(new GestureDetector( onHorizontalDragStart: this._directionIsXAxis ? (GestureDragStartCallback)this._handleDragStart : null, onHorizontalDragUpdate: this._directionIsXAxis ? (GestureDragUpdateCallback)this._handleDragUpdate : null, onHorizontalDragEnd: this._directionIsXAxis ? (GestureDragEndCallback)this._handleDragEnd : null, onVerticalDragStart: this._directionIsXAxis ? null : (GestureDragStartCallback)this._handleDragStart, onVerticalDragUpdate: this._directionIsXAxis ? null : (GestureDragUpdateCallback)this._handleDragUpdate, onVerticalDragEnd: this._directionIsXAxis ? null : (GestureDragEndCallback)this._handleDragEnd, behavior: HitTestBehavior.opaque, child: content, dragStartBehavior: this.widget.dragStartBehavior )); }