Line data Source code
1 : import 'package:liquid_swipe/PageHelpers/animated_page_dragger.dart'; 2 : import 'package:liquid_swipe/liquid_swipe.dart'; 3 : 4 : /// A constant value with works like a sensitivity of reveal. 5 : /// Used if not mentioned here [LiquidSwipe.fullTransitionValue] 6 : const FULL_TRANSITION_PX = 300.0; 7 : 8 : /// Helper Factor for Completing the Animation when user is done with dragging 9 : const PERCENT_PER_MILLISECOND = 0.00125; 10 : 11 : ///SlideDirections Enum with 3 Values 12 : ///[SlideDirection.leftToRight] if user swipes from left to right 13 : ///[SlideDirection.rightToLeft] if user swipes from right to left 14 : ///[SlideDirection.none] if user is not swipe at all. 15 4 : enum SlideDirection { 16 : leftToRight, 17 : rightToLeft, 18 : none, 19 : } 20 : 21 : ///UpdateType Enum with 4 values 22 : ///[UpdateType.dragging] when user starts dragging or currently being dragging 23 : ///[UpdateType.doneDragging] when user is done with dragging 24 : ///[UpdateType.animating] when we are manually animating the Swipe using [AnimatedPageDragger] 25 : ///[UpdateType.doneAnimating] we are done with animating now update values like currentPage and nextPage etc. 26 : /// 27 : /// Flow will always be [UpdateType.dragging] > [UpdateType.doneDragging] > [UpdateType.animating] > [UpdateType.doneAnimating] 28 4 : enum UpdateType { 29 : dragging, 30 : doneDragging, 31 : animating, 32 : doneAnimating, 33 : } 34 : 35 : ///Current Transition in the LiquidSwipe, whether to open the reveal or close the reveal 36 4 : enum TransitionGoal { 37 : open, 38 : close, 39 : } 40 : 41 : ///WaveType : Type of wave you want currently support 2, [WaveType.circularReveal] and [WaveType.liquidReveal] 42 : ///see also : [LiquidSwipe.waveType] 43 4 : enum WaveType { 44 : circularReveal, 45 : liquidReveal, 46 : } 47 : 48 : ///Utils Methods 49 : mixin Utils { 50 : ///Temporary fix to the misalignment of the icon. 51 1 : static double handleIconAlignment(double ver) { 52 1 : if (ver > 0.5) { 53 4 : ver += (0.5 - ver).abs() / 20; 54 : } else { 55 4 : ver -= (0.5 - ver).abs() / 15; 56 : } 57 : return ver; 58 : } 59 : }