Line data Source code
1 : import 'package:flutter/material.dart'; 2 : import 'package:liquid_swipe/Clippers/CircularWave.dart'; 3 : import 'package:liquid_swipe/Helpers/Helpers.dart'; 4 : import 'package:liquid_swipe/PageHelpers/page_dragger.dart'; 5 : 6 : import '../Clippers/WaveLayer.dart'; 7 : 8 : /// Internal Class 9 : /// 10 : /// This Widget reveals the next page in the liquid wave form. 11 : /// 12 : /// Required Parameters : 13 : /// [horizontalReveal] Horizontal Reveal from [PageDragger] 14 : /// [child] refers to the Next Page 15 : /// [slideDirection] left to Right or Right to left or default none. see [SlideDirection] 16 : /// [iconPosition] double type value. represents the percentage of the slide icon position vertically 17 : /// [waveType] add currently available [WaveType]'s 18 : /// [verticalReveal] Vertical Reveal from [PageDragger] 19 : class PageReveal extends StatelessWidget { 20 : final double horizontalReveal; 21 : final Widget child; 22 : final SlideDirection? slideDirection; 23 : final Size iconSize; 24 : final WaveType waveType; 25 : final double verticalReveal; 26 : 27 : ///Constructor for [PageReveal]. 28 1 : PageReveal({ 29 : required this.horizontalReveal, 30 : required this.child, 31 : this.slideDirection, 32 : required this.iconSize, 33 : required this.waveType, 34 : required this.verticalReveal, 35 : }); 36 : 37 1 : @override 38 : Widget build(BuildContext context) { 39 1 : switch (waveType) { 40 1 : case WaveType.circularReveal: 41 1 : return ClipPath( 42 : clipBehavior: Clip.antiAliasWithSaveLayer, 43 1 : clipper: CircularWave( 44 1 : iconSize, 45 2 : slideDirection == SlideDirection.leftToRight 46 0 : ? 1.0 - horizontalReveal 47 1 : : horizontalReveal, 48 1 : verticalReveal, 49 : ), 50 1 : child: child, 51 : ); 52 : default: 53 1 : return ClipPath( 54 : clipBehavior: Clip.antiAliasWithSaveLayer, 55 1 : clipper: WaveLayer( 56 2 : revealPercent: slideDirection == SlideDirection.leftToRight 57 0 : ? 1.0 - horizontalReveal 58 1 : : horizontalReveal, 59 1 : slideDirection: slideDirection, 60 1 : iconSize: iconSize, 61 1 : verReveal: verticalReveal, 62 : ), 63 1 : child: child, 64 : ); 65 : } 66 : } 67 : }