@@ -134,6 +134,7 @@ class SlideActionListDelegate extends SlideActionDelegate {
134134 /// The slide actions.
135135 final List <Widget > actions;
136136
137+ /// The number of actions.
137138 @override
138139 int get actionCount => actions? .length ?? 0 ;
139140
@@ -156,6 +157,7 @@ class _SlidableScope extends InheritedWidget {
156157 bool updateShouldNotify (_SlidableScope oldWidget) => oldWidget.state != state;
157158}
158159
160+ /// The data used by a [Slidable] .
159161class SlidableData extends InheritedWidget {
160162 SlidableData ({
161163 Key key,
@@ -174,17 +176,35 @@ class SlidableData extends InheritedWidget {
174176 @required Widget child,
175177 }) : super (key: key, child: child);
176178
179+ /// The type of slide action that is currently been showed by the [Slidable] .
177180 final SlideActionType actionType;
181+
182+ /// The rendering mode in which the [Slidable] is.
178183 final SlidableRenderingMode renderingMode;
184+
185+ /// The total extent of all the actions
179186 final double totalActionsExtent;
187+
188+ /// The offset threshold the item has to be dragged in order to be considered
189+ /// dismissed.
180190 final double dismissThreshold;
191+
192+ /// Indicates whether the [Slidable] can be dismissed.
181193 final bool dismissible;
182194
183195 /// The current actions that have to be shown.
184196 final SlideActionDelegate actionDelegate;
197+
198+ /// Animation for the whole movement.
185199 final Animation <double > overallMoveAnimation;
200+
201+ /// Animation for the actions.
186202 final Animation <double > actionsMoveAnimation;
203+
204+ /// Dismiss animation.
187205 final Animation <double > dismissAnimation;
206+
207+ /// The slidable.
188208 final Slidable slidable;
189209
190210 /// Relative ratio between one slide action and the extent of the child.
@@ -193,16 +213,31 @@ class SlidableData extends InheritedWidget {
193213 /// The direction in which this widget can be slid.
194214 final Axis direction;
195215
216+ /// Indicates whether the primary actions are currently shown.
196217 bool get showActions => actionType == SlideActionType .primary;
218+
219+ /// The number of actions.
197220 int get actionCount => actionDelegate? .actionCount ?? 0 ;
221+
222+ /// If the [actionType] is [SlideActionType.primary] returns 1, -1 otherwise.
198223 double get actionSign => actionType == SlideActionType .primary ? 1.0 : - 1.0 ;
224+
225+ /// Indicates wheter the direction is horizontal.
199226 bool get directionIsXAxis => direction == Axis .horizontal;
227+
228+ /// The alignment of the actions.
200229 Alignment get alignment => Alignment (
201230 directionIsXAxis ? - actionSign : 0.0 ,
202231 directionIsXAxis ? 0.0 : - actionSign,
203232 );
233+
234+ /// If the [direction] is horizontal, returns the [totalActionsExtent]
235+ /// otherwise null.
204236 double get actionPaneWidthFactor =>
205237 directionIsXAxis ? totalActionsExtent : null ;
238+
239+ /// If the [direction] is vertical, returns the [totalActionsExtent]
240+ /// otherwise null.
206241 double get actionPaneHeightFactor =>
207242 directionIsXAxis ? null : totalActionsExtent;
208243
@@ -238,6 +273,7 @@ class SlidableData extends InheritedWidget {
238273 );
239274 }
240275
276+ /// Creates a [FractionallyAlignedSizedBox] related to the current direction and showed actions.
241277 FractionallyAlignedSizedBox createFractionallyAlignedSizedBox ({
242278 Widget child,
243279 double extentFactor,
@@ -262,14 +298,16 @@ class SlidableData extends InheritedWidget {
262298 return List .generate (
263299 actionCount,
264300 (int index) => actionDelegate.build (
265- context,
266- index,
267- actionsMoveAnimation,
268- SlidableRenderingMode .slide,
269- ),
301+ context,
302+ index,
303+ actionsMoveAnimation,
304+ SlidableRenderingMode .slide,
305+ ),
270306 );
271307 }
272308
309+ /// Whether the framework should notify widgets that inherit from this widget.
310+ @override
273311 bool updateShouldNotify (SlidableData oldWidget) =>
274312 (oldWidget.actionType != actionType) ||
275313 (oldWidget.renderingMode != renderingMode) ||
@@ -288,19 +326,29 @@ class SlidableData extends InheritedWidget {
288326/// A controller that keep tracks of the active [SlidableState] and close
289327/// the previous one.
290328class SlidableController {
329+ /// Creates a controller that keep tracks of the active [SlidableState] and close
330+ /// the previous one.
291331 SlidableController ({
292332 this .onSlideAnimationChanged,
293333 this .onSlideIsOpenChanged,
294334 });
295335
336+ /// Function called when the animation changed.
296337 final ValueChanged <Animation <double >> onSlideAnimationChanged;
338+
339+ /// Function called when the [Slidable] open status changed.
297340 final ValueChanged <bool > onSlideIsOpenChanged;
341+
298342 bool _isSlideOpen;
299343
300344 Animation <double > _slideAnimation;
301345
302346 SlidableState _activeState;
347+
348+ /// The state of the active [Slidable] .
303349 SlidableState get activeState => _activeState;
350+
351+ /// Changes the state of the active [Slidable] .
304352 set activeState (SlidableState value) {
305353 _activeState? ._flingAnimationController ();
306354
@@ -559,8 +607,11 @@ class SlidableState extends State<Slidable>
559607 double get _totalActionsExtent => widget.actionExtentRatio * (_actionCount);
560608
561609 double get _dismissThreshold {
562- if (widget.dismissal == null ) return _kDismissThreshold;
563- else return widget.dismissal.dismissThresholds[actionType] ?? _kDismissThreshold;
610+ if (widget.dismissal == null )
611+ return _kDismissThreshold;
612+ else
613+ return widget.dismissal.dismissThresholds[actionType] ??
614+ _kDismissThreshold;
564615 }
565616
566617 bool get _dismissible => widget.dismissal != null && _dismissThreshold < 1.0 ;
@@ -716,8 +767,9 @@ class SlidableState extends State<Slidable>
716767 if (_dismissible && ! widget.dismissal.dragDismissible) {
717768 // If the widget is not dismissible by dragging, clamp drag result
718769 // so the widget doesn't slide past [_totalActionsExtent].
719- _overallMoveController.value = (_dragExtent.abs () / _overallDragAxisExtent)
720- .clamp (0.0 , _totalActionsExtent);
770+ _overallMoveController.value =
771+ (_dragExtent.abs () / _overallDragAxisExtent)
772+ .clamp (0.0 , _totalActionsExtent);
721773 } else {
722774 _overallMoveController.value =
723775 _dragExtent.abs () / _overallDragAxisExtent;
0 commit comments