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 : final bool enableSideReveal; 27 : 28 : ///Constructor for [PageReveal]. 29 1 : PageReveal({ 30 : required this.horizontalReveal, 31 : required this.child, 32 : this.slideDirection, 33 : required this.iconSize, 34 : required this.waveType, 35 : required this.verticalReveal, 36 : required this.enableSideReveal, 37 : }); 38 : 39 1 : @override 40 : Widget build(BuildContext context) { 41 1 : switch (waveType) { 42 1 : case WaveType.circularReveal: 43 1 : return ClipPath( 44 : clipBehavior: Clip.antiAliasWithSaveLayer, 45 1 : clipper: CircularWave( 46 1 : iconSize, 47 2 : slideDirection == SlideDirection.leftToRight 48 0 : ? 1.0 - horizontalReveal 49 1 : : horizontalReveal, 50 1 : verticalReveal, 51 : ), 52 1 : child: child, 53 : ); 54 : default: 55 1 : return ClipPath( 56 : clipBehavior: Clip.antiAliasWithSaveLayer, 57 1 : clipper: WaveLayer( 58 2 : revealPercent: slideDirection == SlideDirection.leftToRight 59 0 : ? 1.0 - horizontalReveal 60 1 : : horizontalReveal, 61 1 : slideDirection: slideDirection, 62 1 : iconSize: iconSize, 63 1 : verReveal: verticalReveal, 64 1 : enableSideReveal: enableSideReveal), 65 1 : child: child, 66 : ); 67 : } 68 : } 69 : }