From 724dc31b687319f66db362b55e2b7c6c2cabbcd7 Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Tue, 5 May 2020 21:15:18 +0530 Subject: [PATCH 01/14] Fixed: Make Pages Widget --- lib/liquid_swipe.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/liquid_swipe.dart b/lib/liquid_swipe.dart index e02a357..074f5c2 100644 --- a/lib/liquid_swipe.dart +++ b/lib/liquid_swipe.dart @@ -58,7 +58,7 @@ class _LiquidSwipe extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { - List pages = widget.pages; + List pages = widget.pages; return ChangeNotifierProvider( create: (BuildContext context) { return IAmARiderProvider( From ed3328ae734b2528f1e02a20b134f7bbcca274ef Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Tue, 5 May 2020 23:43:29 +0530 Subject: [PATCH 02/14] Jump to Page with Controller --- example/lib/main.dart | 19 ++++++- lib/PageHelpers/LiquidController.dart | 21 ++++++++ lib/Provider/iamariderprovider.dart | 21 +++++++- lib/liquid_swipe.dart | 72 +++++++++++++++------------ 4 files changed, 98 insertions(+), 35 deletions(-) create mode 100644 lib/PageHelpers/LiquidController.dart diff --git a/example/lib/main.dart b/example/lib/main.dart index 7f75e73..61d2435 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -22,9 +22,15 @@ class MyApp extends StatefulWidget { class _MyAppState extends State { int page = 0; - + LiquidController liquidController; UpdateType updateType; + @override + void initState() { + liquidController = LiquidController(); + super.initState(); + } + final pages = [ Container( color: Colors.pink, @@ -231,6 +237,7 @@ class _MyAppState extends State { onPageChangeCallback: pageChangeCallback, currentUpdateTypeCallback: updateTypeCallback, waveType: WaveType.liquidReveal, + liquidController: liquidController, ), Padding( padding: EdgeInsets.all(20), @@ -244,6 +251,16 @@ class _MyAppState extends State { ], ), ), + Align( + alignment: Alignment.center, + child: FlatButton( + onPressed: () { + liquidController.animateToPage(4); + }, + child: Text("fafsdfadsfdsaf"), + color: Colors.white, + ), + ) ], ), ), diff --git a/lib/PageHelpers/LiquidController.dart b/lib/PageHelpers/LiquidController.dart new file mode 100644 index 0000000..83ae9d4 --- /dev/null +++ b/lib/PageHelpers/LiquidController.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; +import 'package:liquid_swipe/Provider/iamariderprovider.dart'; +import 'package:provider/provider.dart'; + +class LiquidController { + BuildContext context; + + LiquidController(); + + setContext(BuildContext c) { + context = c; + } + + jumpToPage(int page) { + Provider.of(context, listen: false).jumpToPage(page); + } + + animateToPage(int page) { + Provider.of(context, listen: false).animateToPage(page); + } +} diff --git a/lib/Provider/iamariderprovider.dart b/lib/Provider/iamariderprovider.dart index e0bb396..03bab0a 100644 --- a/lib/Provider/iamariderprovider.dart +++ b/lib/Provider/iamariderprovider.dart @@ -29,7 +29,7 @@ class IAmARiderProvider extends ChangeNotifier { double slideIcon, OnPageChangeCallback onPageChangeCallback, CurrentUpdateTypeCallback currentUpdateTypeCallback) { - slidePercentHor = slidePercentVer = 0; + slidePercentHor = slidePercentVer = 0.5; activePageIndex = initialPage; nextPageIndex = initialPage; enableLoop = loop; @@ -40,6 +40,23 @@ class IAmARiderProvider extends ChangeNotifier { _onPageChangeCallback = onPageChangeCallback; } + animateToPage(int page) { +// new Timer.periodic(const Duration(seconds: 1), (t) { +// updateSlide(SlideUpdate( +// SlideDirection.rightToLeft, 1, 0.5, UpdateType.doneAnimating)); +// if (activePageIndex == page) { +// t.cancel(); +// } +// }); + } + + jumpToPage(int page) { + activePageIndex = page - 1; + nextPageIndex = page; + updateSlide(SlideUpdate( + SlideDirection.rightToLeft, 1, 0.5, UpdateType.doneAnimating)); + } + updateSlide(SlideUpdate slidUpdate) { slideUpdate = slidUpdate; updateData(slidUpdate); @@ -128,7 +145,7 @@ class IAmARiderProvider extends ChangeNotifier { _onPageChangeCallback(activePageIndex); } slideDirection = SlideDirection.none; - slidePercentHor = 0.5; + slidePercentHor = 0.0; slidePercentVer = positionSlideIcon; return; } diff --git a/lib/liquid_swipe.dart b/lib/liquid_swipe.dart index 074f5c2..2c488e7 100644 --- a/lib/liquid_swipe.dart +++ b/lib/liquid_swipe.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:liquid_swipe/Helpers/Helpers.dart'; +import 'package:liquid_swipe/PageHelpers/LiquidController.dart'; import 'package:liquid_swipe/PageHelpers/page.dart'; import 'package:liquid_swipe/PageHelpers/page_dragger.dart'; import 'package:liquid_swipe/PageHelpers/page_reveal.dart'; @@ -8,6 +9,7 @@ import 'package:liquid_swipe/Provider/iamariderprovider.dart'; import 'package:provider/provider.dart'; export 'package:liquid_swipe/Helpers/Helpers.dart'; +export 'package:liquid_swipe/PageHelpers/LiquidController.dart'; final key = new GlobalKey<_LiquidSwipe>(); @@ -22,6 +24,7 @@ class LiquidSwipe extends StatefulWidget { final Widget slideIconWidget; final double positionSlideIcon; final bool enableLoop; + final LiquidController liquidController; final WaveType waveType; final OnPageChangeCallback onPageChangeCallback; final CurrentUpdateTypeCallback currentUpdateTypeCallback; @@ -35,6 +38,7 @@ class LiquidSwipe extends StatefulWidget { this.slideIconWidget = const Icon(Icons.arrow_back_ios), this.positionSlideIcon = 0.54, this.enableLoop = true, + this.liquidController, this.waveType = WaveType.liquidReveal, this.onPageChangeCallback, this.currentUpdateTypeCallback, @@ -51,8 +55,11 @@ class LiquidSwipe extends StatefulWidget { } class _LiquidSwipe extends State with TickerProviderStateMixin { + LiquidController liquidController; + @override void initState() { + liquidController = widget.liquidController ?? LiquidController(); super.initState(); } @@ -70,39 +77,40 @@ class _LiquidSwipe extends State with TickerProviderStateMixin { widget.onPageChangeCallback, widget.currentUpdateTypeCallback); }, - child: Consumer( - builder: (BuildContext context, IAmARiderProvider model, _) => - Stack( - children: [ - CustomPage( - pageView: model.slideDirection == SlideDirection.leftToRight - ? pages[model.activePageIndex] - : pages[model.nextPageIndex], - ), - //Pages - PageReveal( - //next page reveal - revealPercent: model.slidePercentHor, - child: CustomPage( - pageView: model.slideDirection == SlideDirection.leftToRight - ? pages[model.nextPageIndex] - : pages[model.activePageIndex], - ), - slideDirection: model.slideDirection, - iconPosition: widget.positionSlideIcon, - waveType: widget.waveType, - vertReveal: model.slidePercentVer, - ), - PageDragger( - //Used for gesture control - fullTransitionPX: widget.fullTransitionValue, - enableSlideIcon: widget.enableSlideIcon, - slideIconWidget: widget.slideIconWidget, - iconPosition: widget.positionSlideIcon, - ), //PageDragger - ], //Widget//Stack + child: + Consumer(builder: (BuildContext context, IAmARiderProvider model, _) { + liquidController.setContext(context); + return Stack( + children: [ + CustomPage( + pageView: model.slideDirection == SlideDirection.leftToRight + ? pages[model.activePageIndex] + : pages[model.nextPageIndex], + ), + //Pages + PageReveal( + //next page reveal + revealPercent: model.slidePercentHor, + child: CustomPage( + pageView: model.slideDirection == SlideDirection.leftToRight + ? pages[model.nextPageIndex] + : pages[model.activePageIndex], + ), + slideDirection: model.slideDirection, + iconPosition: widget.positionSlideIcon, + waveType: widget.waveType, + vertReveal: model.slidePercentVer, ), - ), + PageDragger( + //Used for gesture control + fullTransitionPX: widget.fullTransitionValue, + enableSlideIcon: widget.enableSlideIcon, + slideIconWidget: widget.slideIconWidget, + iconPosition: widget.positionSlideIcon, + ), //PageDragger + ], //Widget//Stack + ); + }), ); //Scaffold } } From 354825e952186bc84117cba403a33e096fbdf331 Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Wed, 6 May 2020 20:55:30 +0530 Subject: [PATCH 03/14] Animating Page with Controller --- example/lib/main.dart | 18 +++++++++------ lib/PageHelpers/LiquidController.dart | 7 +++--- lib/PageHelpers/page_dragger.dart | 10 ++++++-- lib/Provider/iamariderprovider.dart | 33 ++++++++++++++++++--------- 4 files changed, 45 insertions(+), 23 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 61d2435..ce41984 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -252,13 +252,17 @@ class _MyAppState extends State { ), ), Align( - alignment: Alignment.center, - child: FlatButton( - onPressed: () { - liquidController.animateToPage(4); - }, - child: Text("fafsdfadsfdsaf"), - color: Colors.white, + alignment: Alignment.topRight, + child: Padding( + padding: const EdgeInsets.all(25.0), + child: FlatButton( + onPressed: () { + liquidController.animateToPage( + page: pages.length, duration: 1000); + }, + child: Text("Skip to End"), + color: Colors.white.withOpacity(0.1), + ), ), ) ], diff --git a/lib/PageHelpers/LiquidController.dart b/lib/PageHelpers/LiquidController.dart index 83ae9d4..b8fed29 100644 --- a/lib/PageHelpers/LiquidController.dart +++ b/lib/PageHelpers/LiquidController.dart @@ -11,11 +11,12 @@ class LiquidController { context = c; } - jumpToPage(int page) { + jumpToPage({int page}) { Provider.of(context, listen: false).jumpToPage(page); } - animateToPage(int page) { - Provider.of(context, listen: false).animateToPage(page); + animateToPage({int page, int duration}) { + Provider.of(context, listen: false).animateToPage( + page, duration); } } diff --git a/lib/PageHelpers/page_dragger.dart b/lib/PageHelpers/page_dragger.dart index bb688a9..ebb6095 100644 --- a/lib/PageHelpers/page_dragger.dart +++ b/lib/PageHelpers/page_dragger.dart @@ -60,7 +60,10 @@ class _PageDraggerState extends State { slidePercentVer = (dy / 500).abs().clamp(0.0, 1.25); } - // Adding to slideUpdateStream + if (Provider + .of(context, listen: false) + .isInProgress) + return; Provider.of(context, listen: false) .updateSlide(SlideUpdate( slideDirection, @@ -73,7 +76,10 @@ class _PageDraggerState extends State { // This method executes when user ends dragging. onDragEnd(DragEndDetails details) { - // Adding to slideUpdateStream + if (Provider + .of(context, listen: false) + .isInProgress) + return; Provider.of(context, listen: false) .updateSlide(SlideUpdate( SlideDirection.none, diff --git a/lib/Provider/iamariderprovider.dart b/lib/Provider/iamariderprovider.dart index 03bab0a..66d681d 100644 --- a/lib/Provider/iamariderprovider.dart +++ b/lib/Provider/iamariderprovider.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/cupertino.dart'; import 'package:liquid_swipe/Helpers/Helpers.dart'; import 'package:liquid_swipe/Helpers/slide_update.dart'; @@ -7,7 +9,7 @@ import 'package:liquid_swipe/liquid_swipe.dart'; class IAmARiderProvider extends ChangeNotifier { SlideUpdate slideUpdate; AnimatedPageDragger - animatedPageDragger; //When user stops dragging then by using this page automatically drags. + animatedPageDragger; //When user stops dragging then by using this page automatically drags. int activePageIndex = 0; //active page index int nextPageIndex = 0; //next page index @@ -20,9 +22,9 @@ class IAmARiderProvider extends ChangeNotifier { double positionSlideIcon; OnPageChangeCallback _onPageChangeCallback; CurrentUpdateTypeCallback _currentUpdateTypeCallback; + bool isInProgress = false; - IAmARiderProvider( - int initialPage, + IAmARiderProvider(int initialPage, bool loop, int length, TickerProviderStateMixin mixin, @@ -40,14 +42,23 @@ class IAmARiderProvider extends ChangeNotifier { _onPageChangeCallback = onPageChangeCallback; } - animateToPage(int page) { -// new Timer.periodic(const Duration(seconds: 1), (t) { -// updateSlide(SlideUpdate( -// SlideDirection.rightToLeft, 1, 0.5, UpdateType.doneAnimating)); -// if (activePageIndex == page) { -// t.cancel(); -// } -// }); + animateToPage(int page, int duration) { + if (isInProgress) return; + isInProgress = true; + new Timer.periodic(const Duration(milliseconds: 1), (t) { + if (t.tick < duration / 2) { + updateSlide(SlideUpdate(SlideDirection.rightToLeft, t.tick / duration, + 1, UpdateType.dragging)); + } else if (t.tick < duration) { + updateSlide(SlideUpdate(SlideDirection.rightToLeft, t.tick / duration, + 1, UpdateType.animating)); + } else { + updateSlide(SlideUpdate( + SlideDirection.rightToLeft, 1, 1, UpdateType.doneAnimating)); + t.cancel(); + isInProgress = false; + } + }); } jumpToPage(int page) { From 5d7a513a27f27c3efbdf62cc43cdeda2ad362ac1 Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Wed, 6 May 2020 21:14:24 +0530 Subject: [PATCH 04/14] Added duration to animate & disabling gesture while animating --- lib/PageHelpers/LiquidController.dart | 2 +- lib/PageHelpers/page_dragger.dart | 56 ++++++++++++--------------- lib/Provider/iamariderprovider.dart | 2 + 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/lib/PageHelpers/LiquidController.dart b/lib/PageHelpers/LiquidController.dart index b8fed29..3c4a782 100644 --- a/lib/PageHelpers/LiquidController.dart +++ b/lib/PageHelpers/LiquidController.dart @@ -15,7 +15,7 @@ class LiquidController { Provider.of(context, listen: false).jumpToPage(page); } - animateToPage({int page, int duration}) { + animateToPage({int page, int duration = 1000}) { Provider.of(context, listen: false).animateToPage( page, duration); } diff --git a/lib/PageHelpers/page_dragger.dart b/lib/PageHelpers/page_dragger.dart index ebb6095..4ec2e0e 100644 --- a/lib/PageHelpers/page_dragger.dart +++ b/lib/PageHelpers/page_dragger.dart @@ -60,10 +60,6 @@ class _PageDraggerState extends State { slidePercentVer = (dy / 500).abs().clamp(0.0, 1.25); } - if (Provider - .of(context, listen: false) - .isInProgress) - return; Provider.of(context, listen: false) .updateSlide(SlideUpdate( slideDirection, @@ -76,10 +72,6 @@ class _PageDraggerState extends State { // This method executes when user ends dragging. onDragEnd(DragEndDetails details) { - if (Provider - .of(context, listen: false) - .isInProgress) - return; Provider.of(context, listen: false) .updateSlide(SlideUpdate( SlideDirection.none, @@ -97,33 +89,35 @@ class _PageDraggerState extends State { @override Widget build(BuildContext context) { //Gesture Detector for horizontal drag + final model = Provider.of(context, listen: false); + return GestureDetector( behavior: HitTestBehavior.translucent, - onHorizontalDragStart: onDragStart, - onHorizontalDragUpdate: onDragUpdate, - onHorizontalDragEnd: onDragEnd, - onVerticalDragStart: onDragStart, - onVerticalDragEnd: onDragEnd, - onVerticalDragUpdate: onDragUpdate, + onHorizontalDragStart: model.isInProgress ? null : onDragStart, + onHorizontalDragUpdate: model.isInProgress ? null : onDragUpdate, + onHorizontalDragEnd: model.isInProgress ? null : onDragEnd, + onVerticalDragStart: model.isInProgress ? null : onDragStart, + onVerticalDragEnd: model.isInProgress ? null : onDragEnd, + onVerticalDragUpdate: model.isInProgress ? null : onDragUpdate, child: widget.enableSlideIcon ? Align( - alignment: Alignment( - 1 - slidePercentHor + 0.005, - widget.iconPosition + widget.iconPosition / 10, - ), - child: Opacity( - opacity: 1 - slidePercentHor, - child: FloatingActionButton( - onPressed: null, - backgroundColor: Colors.transparent, - elevation: 0.0, - child: slideDirection != SlideDirection.leftToRight - ? widget.slideIconWidget - : null, - foregroundColor: Colors.black, - ), - ), - ) + alignment: Alignment( + 1 - slidePercentHor + 0.005, + widget.iconPosition + widget.iconPosition / 10, + ), + child: Opacity( + opacity: 1 - slidePercentHor, + child: FloatingActionButton( + onPressed: null, + backgroundColor: Colors.transparent, + elevation: 0.0, + child: slideDirection != SlideDirection.leftToRight + ? widget.slideIconWidget + : null, + foregroundColor: Colors.black, + ), + ), + ) : null, ); } diff --git a/lib/Provider/iamariderprovider.dart b/lib/Provider/iamariderprovider.dart index 66d681d..431750f 100644 --- a/lib/Provider/iamariderprovider.dart +++ b/lib/Provider/iamariderprovider.dart @@ -45,6 +45,8 @@ class IAmARiderProvider extends ChangeNotifier { animateToPage(int page, int duration) { if (isInProgress) return; isInProgress = true; + activePageIndex = page - 2; + nextPageIndex = page - 1; new Timer.periodic(const Duration(milliseconds: 1), (t) { if (t.tick < duration / 2) { updateSlide(SlideUpdate(SlideDirection.rightToLeft, t.tick / duration, From 9d9f585ebf6899354ba10eadd88daa35d232f9cf Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Wed, 6 May 2020 21:41:33 +0530 Subject: [PATCH 05/14] get current active page from controller --- example/lib/main.dart | 10 ++++------ lib/PageHelpers/LiquidController.dart | 9 +++++++-- lib/Provider/iamariderprovider.dart | 8 +++++++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index ce41984..5ed0512 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -231,9 +231,8 @@ class _MyAppState extends State { LiquidSwipe( pages: pages, fullTransitionValue: 200, - enableSlideIcon: true, - enableLoop: true, - positionSlideIcon: 0.5, + enableSlideIcon: false, + enableLoop: false, onPageChangeCallback: pageChangeCallback, currentUpdateTypeCallback: updateTypeCallback, waveType: WaveType.liquidReveal, @@ -257,8 +256,7 @@ class _MyAppState extends State { padding: const EdgeInsets.all(25.0), child: FlatButton( onPressed: () { - liquidController.animateToPage( - page: pages.length, duration: 1000); + liquidController.animateToPage(page: 0, duration: 1000); }, child: Text("Skip to End"), color: Colors.white.withOpacity(0.1), @@ -272,7 +270,7 @@ class _MyAppState extends State { } pageChangeCallback(int lpage) { - print(lpage); + print(liquidController.currentPage); setState(() { page = lpage; }); diff --git a/lib/PageHelpers/LiquidController.dart b/lib/PageHelpers/LiquidController.dart index 3c4a782..8fa27fd 100644 --- a/lib/PageHelpers/LiquidController.dart +++ b/lib/PageHelpers/LiquidController.dart @@ -16,7 +16,12 @@ class LiquidController { } animateToPage({int page, int duration = 1000}) { - Provider.of(context, listen: false).animateToPage( - page, duration); + Provider.of(context, listen: false) + .animateToPage(page, duration); } + + int get currentPage => + Provider + .of(context, listen: false) + .activePageIndex; } diff --git a/lib/Provider/iamariderprovider.dart b/lib/Provider/iamariderprovider.dart index 431750f..81133d2 100644 --- a/lib/Provider/iamariderprovider.dart +++ b/lib/Provider/iamariderprovider.dart @@ -42,11 +42,16 @@ class IAmARiderProvider extends ChangeNotifier { _onPageChangeCallback = onPageChangeCallback; } + /// Animating page to the mentioned page + /// Known Issue : First we have to jump to the previous screen animateToPage(int page, int duration) { - if (isInProgress) return; + if (isInProgress || activePageIndex == page) return; isInProgress = true; activePageIndex = page - 2; nextPageIndex = page - 1; + if (activePageIndex < 0) { + activePageIndex = 0; + } new Timer.periodic(const Duration(milliseconds: 1), (t) { if (t.tick < duration / 2) { updateSlide(SlideUpdate(SlideDirection.rightToLeft, t.tick / duration, @@ -63,6 +68,7 @@ class IAmARiderProvider extends ChangeNotifier { }); } + ///If no animation is required. jumpToPage(int page) { activePageIndex = page - 1; nextPageIndex = page; From c0e7757be211ae685c3908e0442ea9bbdc901b91 Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Wed, 6 May 2020 21:54:21 +0530 Subject: [PATCH 06/14] minor fixes --- example/lib/main.dart | 4 ++-- lib/Provider/iamariderprovider.dart | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 5ed0512..5f20f77 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -232,7 +232,7 @@ class _MyAppState extends State { pages: pages, fullTransitionValue: 200, enableSlideIcon: false, - enableLoop: false, + enableLoop: true, onPageChangeCallback: pageChangeCallback, currentUpdateTypeCallback: updateTypeCallback, waveType: WaveType.liquidReveal, @@ -256,7 +256,7 @@ class _MyAppState extends State { padding: const EdgeInsets.all(25.0), child: FlatButton( onPressed: () { - liquidController.animateToPage(page: 0, duration: 1000); + liquidController.animateToPage(page: 4, duration: 1000); }, child: Text("Skip to End"), color: Colors.white.withOpacity(0.1), diff --git a/lib/Provider/iamariderprovider.dart b/lib/Provider/iamariderprovider.dart index 81133d2..918961c 100644 --- a/lib/Provider/iamariderprovider.dart +++ b/lib/Provider/iamariderprovider.dart @@ -47,10 +47,12 @@ class IAmARiderProvider extends ChangeNotifier { animateToPage(int page, int duration) { if (isInProgress || activePageIndex == page) return; isInProgress = true; - activePageIndex = page - 2; - nextPageIndex = page - 1; + activePageIndex = page - 1; + nextPageIndex = page; if (activePageIndex < 0) { activePageIndex = 0; + jumpToPage(page); + return; } new Timer.periodic(const Duration(milliseconds: 1), (t) { if (t.tick < duration / 2) { @@ -70,10 +72,12 @@ class IAmARiderProvider extends ChangeNotifier { ///If no animation is required. jumpToPage(int page) { + isInProgress = true; activePageIndex = page - 1; nextPageIndex = page; updateSlide(SlideUpdate( SlideDirection.rightToLeft, 1, 0.5, UpdateType.doneAnimating)); + isInProgress = false; } updateSlide(SlideUpdate slidUpdate) { From 9710eb0a27f1ec3b5e81e11e009753e1426f594b Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Mon, 11 May 2020 19:25:01 +0530 Subject: [PATCH 07/14] animating to page one by one --- example/lib/main.dart | 4 +- lib/Provider/iamariderprovider.dart | 62 +++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 5f20f77..a5c9866 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -235,7 +235,7 @@ class _MyAppState extends State { enableLoop: true, onPageChangeCallback: pageChangeCallback, currentUpdateTypeCallback: updateTypeCallback, - waveType: WaveType.liquidReveal, + waveType: WaveType.circularReveal, liquidController: liquidController, ), Padding( @@ -256,7 +256,7 @@ class _MyAppState extends State { padding: const EdgeInsets.all(25.0), child: FlatButton( onPressed: () { - liquidController.animateToPage(page: 4, duration: 1000); + liquidController.animateToPage(page: 0, duration: 1000); }, child: Text("Skip to End"), color: Colors.white.withOpacity(0.1), diff --git a/lib/Provider/iamariderprovider.dart b/lib/Provider/iamariderprovider.dart index 918961c..e5cc317 100644 --- a/lib/Provider/iamariderprovider.dart +++ b/lib/Provider/iamariderprovider.dart @@ -8,9 +8,7 @@ import 'package:liquid_swipe/liquid_swipe.dart'; class IAmARiderProvider extends ChangeNotifier { SlideUpdate slideUpdate; - AnimatedPageDragger - animatedPageDragger; //When user stops dragging then by using this page automatically drags. - + AnimatedPageDragger animatedPageDragger; int activePageIndex = 0; //active page index int nextPageIndex = 0; //next page index SlideDirection slideDirection = SlideDirection.none; //slide direction @@ -44,7 +42,7 @@ class IAmARiderProvider extends ChangeNotifier { /// Animating page to the mentioned page /// Known Issue : First we have to jump to the previous screen - animateToPage(int page, int duration) { + animateDirectlyToPage(int page, int duration) { if (isInProgress || activePageIndex == page) return; isInProgress = true; activePageIndex = page - 1; @@ -70,8 +68,64 @@ class IAmARiderProvider extends ChangeNotifier { }); } + animateToPage(int page, int duration) { + if (isInProgress || activePageIndex == page) return; + isInProgress = true; + int diff = 0; + if (activePageIndex < page) { + diff = page - activePageIndex; + int newDuration = duration ~/ diff; + new Timer.periodic(Duration(milliseconds: newDuration), (callback) { + new Timer.periodic(const Duration(milliseconds: 1), (t) { + if (t.tick < newDuration / 2) { + updateSlide( + SlideUpdate(SlideDirection.rightToLeft, t.tick / newDuration, + 1, UpdateType.dragging)); + } else if (t.tick < newDuration) { + updateSlide( + SlideUpdate(SlideDirection.rightToLeft, t.tick / newDuration, + 1, UpdateType.animating)); + } else { + updateSlide(SlideUpdate( + SlideDirection.rightToLeft, 1, 1, UpdateType.doneAnimating)); + t.cancel(); + } + }); + if (callback.tick >= diff) { + callback.cancel(); + isInProgress = false; + } + }); + } else { + diff = activePageIndex - page; + int newDuration = duration ~/ diff; + new Timer.periodic(Duration(milliseconds: newDuration), (callback) { + new Timer.periodic(const Duration(milliseconds: 1), (t) { + if (t.tick < newDuration / 2) { + updateSlide( + SlideUpdate(SlideDirection.leftToRight, t.tick / newDuration, + 1, UpdateType.dragging)); + } else if (t.tick < newDuration) { + updateSlide( + SlideUpdate(SlideDirection.leftToRight, t.tick / newDuration, + 1, UpdateType.animating)); + } else { + updateSlide(SlideUpdate( + SlideDirection.leftToRight, 1, 1, UpdateType.doneAnimating)); + t.cancel(); + } + }); + if (callback.tick >= diff) { + callback.cancel(); + isInProgress = false; + } + }); + } + } + ///If no animation is required. jumpToPage(int page) { + if (page == activePageIndex || isInProgress) return; isInProgress = true; activePageIndex = page - 1; nextPageIndex = page; From a825d4fed2e43fde69462c92a95c7505d75610f4 Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Mon, 11 May 2020 19:36:42 +0530 Subject: [PATCH 08/14] minor changes --- example/lib/main.dart | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index a5c9866..d216c06 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -235,7 +235,7 @@ class _MyAppState extends State { enableLoop: true, onPageChangeCallback: pageChangeCallback, currentUpdateTypeCallback: updateTypeCallback, - waveType: WaveType.circularReveal, + waveType: WaveType.liquidReveal, liquidController: liquidController, ), Padding( @@ -251,17 +251,32 @@ class _MyAppState extends State { ), ), Align( - alignment: Alignment.topRight, + alignment: Alignment.bottomRight, child: Padding( padding: const EdgeInsets.all(25.0), child: FlatButton( onPressed: () { - liquidController.animateToPage(page: 0, duration: 1000); + liquidController.animateToPage( + page: pages.length - 1, duration: 500); }, child: Text("Skip to End"), color: Colors.white.withOpacity(0.1), ), ), + ), + Align( + alignment: Alignment.bottomLeft, + child: Padding( + padding: const EdgeInsets.all(25.0), + child: FlatButton( + onPressed: () { + liquidController.animateToPage( + page: liquidController.currentPage + 1, duration: 400); + }, + child: Text("Next"), + color: Colors.white.withOpacity(0.1), + ), + ), ) ], ), From df22e79e525e6b4fb9fdd95e3a61e6c4c394ac25 Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Sun, 7 Jun 2020 02:19:23 +0530 Subject: [PATCH 09/14] Vertical scrollable child support --- example/lib/main.dart | 32 +++++++++++++++++++++++++++++++ lib/PageHelpers/page_dragger.dart | 6 +++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index d216c06..9ca59e0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -197,6 +197,38 @@ class _MyAppState extends State { ], ), ), + Container( + color: Colors.greenAccent, + child: Center( + child: Container( + height: 300, + width: 200, + child: SingleChildScrollView( + child: Text( + "1 Description that is too long in text format(Here Data is coming from API) jdlksaf j klkjjflkdsjfkddfdfsdfds " + + "2 Description that is too long in text format(Here Data is coming from API) d fsdfdsfsdfd dfdsfdsf sdfdsfsd d " + + "3 Description that is too long in text format(Here Data is coming from API) adfsfdsfdfsdfdsf dsf dfd fds fs" + + "4 Description that is too long in text format(Here Data is coming from API) dsaf dsafdfdfsd dfdsfsda fdas dsad" + + "5 Description that is too long in text format(Here Data is coming from API) dsfdsfd fdsfds fds fdsf dsfds fds " + + "6 Description that is too long in text format(Here Data is coming from API) asdfsdfdsf fsdf sdfsdfdsf sd dfdsf" + + "7 Description that is too long in text format(Here Data is coming from API) df dsfdsfdsfdsfds df dsfds fds fsd" + + "8 Description that is too long in text format(Here Data is coming from API)" + + "9 Description that is too long in text format(Here Data is coming from API)" + + "10 Description that is too long in text format(Here Data is coming from API)"), + ), + ), + )), + Container( + color: Colors.greenAccent, + child: Center( + child: Container( + height: 300, + width: 200, + child: SingleChildScrollView( + child: Text(""), + ), + ), + )), ]; Widget _buildDot(int index) { diff --git a/lib/PageHelpers/page_dragger.dart b/lib/PageHelpers/page_dragger.dart index 4ec2e0e..16f6a15 100644 --- a/lib/PageHelpers/page_dragger.dart +++ b/lib/PageHelpers/page_dragger.dart @@ -96,9 +96,9 @@ class _PageDraggerState extends State { onHorizontalDragStart: model.isInProgress ? null : onDragStart, onHorizontalDragUpdate: model.isInProgress ? null : onDragUpdate, onHorizontalDragEnd: model.isInProgress ? null : onDragEnd, - onVerticalDragStart: model.isInProgress ? null : onDragStart, - onVerticalDragEnd: model.isInProgress ? null : onDragEnd, - onVerticalDragUpdate: model.isInProgress ? null : onDragUpdate, + //onVerticalDragStart: model.isInProgress ? null : onDragStart, + // onVerticalDragEnd: model.isInProgress ? null : onDragEnd, + // onVerticalDragUpdate: model.isInProgress ? null : onDragUpdate, child: widget.enableSlideIcon ? Align( alignment: Alignment( From 6d5da5d7f52815199bd5263047c252494ed1675f Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Tue, 16 Jun 2020 18:53:29 +0530 Subject: [PATCH 10/14] additional callback for sliding percentage and other fixes --- example/lib/main.dart | 44 ++++------------------------- lib/Provider/iamariderprovider.dart | 38 ++++++++++++++++--------- lib/liquid_swipe.dart | 12 +++++--- 3 files changed, 39 insertions(+), 55 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 9ca59e0..aa98ff7 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -197,38 +197,6 @@ class _MyAppState extends State { ], ), ), - Container( - color: Colors.greenAccent, - child: Center( - child: Container( - height: 300, - width: 200, - child: SingleChildScrollView( - child: Text( - "1 Description that is too long in text format(Here Data is coming from API) jdlksaf j klkjjflkdsjfkddfdfsdfds " + - "2 Description that is too long in text format(Here Data is coming from API) d fsdfdsfsdfd dfdsfdsf sdfdsfsd d " + - "3 Description that is too long in text format(Here Data is coming from API) adfsfdsfdfsdfdsf dsf dfd fds fs" + - "4 Description that is too long in text format(Here Data is coming from API) dsaf dsafdfdfsd dfdsfsda fdas dsad" + - "5 Description that is too long in text format(Here Data is coming from API) dsfdsfd fdsfds fds fdsf dsfds fds " + - "6 Description that is too long in text format(Here Data is coming from API) asdfsdfdsf fsdf sdfsdfdsf sd dfdsf" + - "7 Description that is too long in text format(Here Data is coming from API) df dsfdsfdsfdsfds df dsfds fds fsd" + - "8 Description that is too long in text format(Here Data is coming from API)" + - "9 Description that is too long in text format(Here Data is coming from API)" + - "10 Description that is too long in text format(Here Data is coming from API)"), - ), - ), - )), - Container( - color: Colors.greenAccent, - child: Center( - child: Container( - height: 300, - width: 200, - child: SingleChildScrollView( - child: Text(""), - ), - ), - )), ]; Widget _buildDot(int index) { @@ -266,9 +234,9 @@ class _MyAppState extends State { enableSlideIcon: false, enableLoop: true, onPageChangeCallback: pageChangeCallback, - currentUpdateTypeCallback: updateTypeCallback, waveType: WaveType.liquidReveal, liquidController: liquidController, + slidePercentCallback: slidePercentCallback, ), Padding( padding: EdgeInsets.all(20), @@ -277,7 +245,7 @@ class _MyAppState extends State { Expanded(child: SizedBox()), Row( mainAxisAlignment: MainAxisAlignment.center, - children: List.generate(5, _buildDot), + children: List.generate(pages.length, _buildDot), ), ], ), @@ -302,8 +270,8 @@ class _MyAppState extends State { padding: const EdgeInsets.all(25.0), child: FlatButton( onPressed: () { - liquidController.animateToPage( - page: liquidController.currentPage + 1, duration: 400); + liquidController.jumpToPage( + page: liquidController.currentPage + 1); }, child: Text("Next"), color: Colors.white.withOpacity(0.1), @@ -323,7 +291,7 @@ class _MyAppState extends State { }); } - updateTypeCallback(UpdateType updateType) { - print(updateType); + slidePercentCallback(double hor, double ver) { + print(hor.toInt().toString() + " " + ver.toString()); } } diff --git a/lib/Provider/iamariderprovider.dart b/lib/Provider/iamariderprovider.dart index e5cc317..1415a13 100644 --- a/lib/Provider/iamariderprovider.dart +++ b/lib/Provider/iamariderprovider.dart @@ -20,6 +20,7 @@ class IAmARiderProvider extends ChangeNotifier { double positionSlideIcon; OnPageChangeCallback _onPageChangeCallback; CurrentUpdateTypeCallback _currentUpdateTypeCallback; + SlidePercentCallback _slidePercentCallback; bool isInProgress = false; IAmARiderProvider(int initialPage, @@ -28,7 +29,8 @@ class IAmARiderProvider extends ChangeNotifier { TickerProviderStateMixin mixin, double slideIcon, OnPageChangeCallback onPageChangeCallback, - CurrentUpdateTypeCallback currentUpdateTypeCallback) { + CurrentUpdateTypeCallback currentUpdateTypeCallback, + SlidePercentCallback slidePercentCallback) { slidePercentHor = slidePercentVer = 0.5; activePageIndex = initialPage; nextPageIndex = initialPage; @@ -38,10 +40,12 @@ class IAmARiderProvider extends ChangeNotifier { positionSlideIcon = slideIcon; _currentUpdateTypeCallback = currentUpdateTypeCallback; _onPageChangeCallback = onPageChangeCallback; + _slidePercentCallback = slidePercentCallback; } /// Animating page to the mentioned page /// Known Issue : First we have to jump to the previous screen + /// Not using for now animateDirectlyToPage(int page, int duration) { if (isInProgress || activePageIndex == page) return; isInProgress = true; @@ -78,13 +82,11 @@ class IAmARiderProvider extends ChangeNotifier { new Timer.periodic(Duration(milliseconds: newDuration), (callback) { new Timer.periodic(const Duration(milliseconds: 1), (t) { if (t.tick < newDuration / 2) { - updateSlide( - SlideUpdate(SlideDirection.rightToLeft, t.tick / newDuration, - 1, UpdateType.dragging)); + updateSlide(SlideUpdate(SlideDirection.rightToLeft, + t.tick / newDuration, 1, UpdateType.dragging)); } else if (t.tick < newDuration) { - updateSlide( - SlideUpdate(SlideDirection.rightToLeft, t.tick / newDuration, - 1, UpdateType.animating)); + updateSlide(SlideUpdate(SlideDirection.rightToLeft, + t.tick / newDuration, 1, UpdateType.animating)); } else { updateSlide(SlideUpdate( SlideDirection.rightToLeft, 1, 1, UpdateType.doneAnimating)); @@ -102,13 +104,11 @@ class IAmARiderProvider extends ChangeNotifier { new Timer.periodic(Duration(milliseconds: newDuration), (callback) { new Timer.periodic(const Duration(milliseconds: 1), (t) { if (t.tick < newDuration / 2) { - updateSlide( - SlideUpdate(SlideDirection.leftToRight, t.tick / newDuration, - 1, UpdateType.dragging)); + updateSlide(SlideUpdate(SlideDirection.leftToRight, + t.tick / newDuration, 1, UpdateType.dragging)); } else if (t.tick < newDuration) { - updateSlide( - SlideUpdate(SlideDirection.leftToRight, t.tick / newDuration, - 1, UpdateType.animating)); + updateSlide(SlideUpdate(SlideDirection.leftToRight, + t.tick / newDuration, 1, UpdateType.animating)); } else { updateSlide(SlideUpdate( SlideDirection.leftToRight, 1, 1, UpdateType.doneAnimating)); @@ -126,9 +126,13 @@ class IAmARiderProvider extends ChangeNotifier { ///If no animation is required. jumpToPage(int page) { if (page == activePageIndex || isInProgress) return; + if (activePageIndex == pagesLength - 1 && !enableLoop) { + return; + } isInProgress = true; activePageIndex = page - 1; nextPageIndex = page; + if (nextPageIndex >= pagesLength) nextPageIndex = 0; updateSlide(SlideUpdate( SlideDirection.rightToLeft, 1, 0.5, UpdateType.doneAnimating)); isInProgress = false; @@ -144,6 +148,14 @@ class IAmARiderProvider extends ChangeNotifier { if (prevUpdate != event.updateType && _currentUpdateTypeCallback != null) _currentUpdateTypeCallback(event.updateType); + if (_slidePercentCallback != null && + event.updateType != UpdateType.doneAnimating) { + String hor = (event.slidePercentHor * 100).toStringAsExponential(2); + String ver = (event.slidePercentVer * 100).toStringAsExponential(2); + _slidePercentCallback( + double.parse(hor), (((double.parse(ver)) * 100) / 125)); + } + prevUpdate = event.updateType; //if the user is dragging then diff --git a/lib/liquid_swipe.dart b/lib/liquid_swipe.dart index 2c488e7..df468f0 100644 --- a/lib/liquid_swipe.dart +++ b/lib/liquid_swipe.dart @@ -15,6 +15,8 @@ final key = new GlobalKey<_LiquidSwipe>(); typedef OnPageChangeCallback = void Function(int activePageIndex); typedef CurrentUpdateTypeCallback = void Function(UpdateType updateType); +typedef SlidePercentCallback = void Function( + double slidePercentHorizontal, double slidePercetnVertical); class LiquidSwipe extends StatefulWidget { final List pages; @@ -28,9 +30,9 @@ class LiquidSwipe extends StatefulWidget { final WaveType waveType; final OnPageChangeCallback onPageChangeCallback; final CurrentUpdateTypeCallback currentUpdateTypeCallback; + final SlidePercentCallback slidePercentCallback; - const LiquidSwipe({ - Key key, + const LiquidSwipe({Key key, @required this.pages, this.fullTransitionValue = FULL_TARNSITION_PX, this.initialPage = 0, @@ -42,7 +44,8 @@ class LiquidSwipe extends StatefulWidget { this.waveType = WaveType.liquidReveal, this.onPageChangeCallback, this.currentUpdateTypeCallback, - }) : assert(pages != null), + this.slidePercentCallback}) + : assert(pages != null), assert(fullTransitionValue != null), assert(initialPage != null && initialPage >= 0 && @@ -75,7 +78,8 @@ class _LiquidSwipe extends State with TickerProviderStateMixin { this, widget.positionSlideIcon, widget.onPageChangeCallback, - widget.currentUpdateTypeCallback); + widget.currentUpdateTypeCallback, + widget.slidePercentCallback); }, child: Consumer(builder: (BuildContext context, IAmARiderProvider model, _) { From 8e29f6f56a8249621e15c3ab5e16abbc389a5047 Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Fri, 19 Jun 2020 19:40:04 +0530 Subject: [PATCH 11/14] pre release --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 25b6f88..a741e8f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: liquid_swipe description: A Flutter plugin to implement liquid Swipe effect to provided containers. -version: 1.4.3 +version: 1.5.0-dev.1 homepage: https://github.com/iamSahdeep/liquid_swipe_flutter environment: From 39395dd973e4e1a7879ef4b1e9865bb251ec9e9e Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Fri, 19 Jun 2020 20:25:09 +0530 Subject: [PATCH 12/14] v1.5.0-dev.1 --- CHANGELOG.md | 11 +++++++++++ README.md | 16 +++++++++++++--- example/pubspec.lock | 2 +- lib/PageHelpers/LiquidController.dart | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b34e0..d035e3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ #ChangeLog +## 1.5.0-dev.1 +* Making Pages of Type Widget [724dc31b687319f66db362b55e2b7c6c2cabbcd7](https://github.com/iamSahdeep/liquid_swipe_flutter/commit/724dc31b687319f66db362b55e2b7c6c2cabbcd7) +* LiquidController & jump to page + [ed3328ae734b2528f1e02a20b134f7bbcca274ef](https://github.com/iamSahdeep/liquid_swipe_flutter/commit/ed3328ae734b2528f1e02a20b134f7bbcca274ef) +* Animating the Page with Controller + [354825e952186bc84117cba403a33e096fbdf331](https://github.com/iamSahdeep/liquid_swipe_flutter/commit/354825e952186bc84117cba403a33e096fbdf331) +* Get Current Page from Controller [9d9f585ebf6899354ba10eadd88daa35d232f9cf](https://github.com/iamSahdeep/liquid_swipe_flutter/commit/9d9f585ebf6899354ba10eadd88daa35d232f9cf) +* Add support for vertically scrollable childs + [df22e79e525e6b4fb9fdd95e3a61e6c4c394ac25](https://github.com/iamSahdeep/liquid_swipe_flutter/commit/df22e79e525e6b4fb9fdd95e3a61e6c4c394ac25) +* Additional Callback for sliding percentage + [6d5da5d7f52815199bd5263047c252494ed1675f](https://github.com/iamSahdeep/liquid_swipe_flutter/commit/6d5da5d7f52815199bd5263047c252494ed1675f) ## 1.4.3 * Might Fix : https://github.com/iamSahdeep/liquid_swipe_flutter/issues/32 diff --git a/README.md b/README.md index d4e9a67..b93edfb 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Download sample apk as shown in example from releases. * Add this to your pubspec.yaml ``` dependencies: - liquid_swipe: ^1.4.3 + liquid_swipe: ^1.5.0-dev.1 ``` * Get the package from Pub: @@ -53,7 +53,7 @@ Download sample apk as shown in example from releases. ## Usage - - *`Liquid Swipe`* just requires the list of [`containers`](https://api.flutter.dev/flutter/widgets/Container-class.html). Just to provide flexibity to the developer to design its own view through it. + - *`Liquid Swipe`* just requires the list of [`Widgets like Container`](https://api.flutter.dev/flutter/widgets/Container-class.html). Just to provide flexibity to the developer to design its own view through it. ``` final pages = [ Container(...), @@ -92,12 +92,22 @@ Download sample apk as shown in example from releases. | waveType |`WaveType` | Select the type of reveal you want. | WaveType.liquidReveal | You can use circularReveal, more coming soon. Import Helpers.dart file if Autoimport doesn't work. | | onPageChangeCallback |`CallBack` | Pass your method as a callback, it will return a pageNo. | None | see Example | | currentUpdateTypeCallback |`CallBack` | same Callback but returns an UpdateType | None | see Example | +| slidePercentCallback |`CallBack` | returns SlidePercent both horizontal & vertical | None | see Example | +### Additional + +From v1.5.0-dev.1 we can use LiquidController class to create its instance and use it from controlling pages programmatically. +Features/Methods added but will not be limited to : + - jumpToPage({int page}) : It will jump to the mentioned page but without animation or swipe. + - animateToPage({int page, int duration = 600}) : It will animate to the mentioned page in given time with animation of swipes. + - currentPage : This getter will return the current Page which is being displayed. + +Please look at the Example in this project for detailed usage. # Contributors -Thanks to all these wonderful people and everyone that created issues. +Thanks to all these wonderful people and everyone that created issues or contributed in any way possible. ([emoji key](https://allcontributors.org/docs/en/emoji-key)): diff --git a/example/pubspec.lock b/example/pubspec.lock index e94ba65..dae8e8e 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -87,7 +87,7 @@ packages: path: ".." relative: true source: path - version: "1.4.3" + version: "1.5.0-dev.1" matcher: dependency: transitive description: diff --git a/lib/PageHelpers/LiquidController.dart b/lib/PageHelpers/LiquidController.dart index 8fa27fd..18428b0 100644 --- a/lib/PageHelpers/LiquidController.dart +++ b/lib/PageHelpers/LiquidController.dart @@ -15,7 +15,7 @@ class LiquidController { Provider.of(context, listen: false).jumpToPage(page); } - animateToPage({int page, int duration = 1000}) { + animateToPage({int page, int duration = 600}) { Provider.of(context, listen: false) .animateToPage(page, duration); } From 3ba35857f4d21a1e1665231798b367e16d0c1bb3 Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Fri, 19 Jun 2020 20:39:45 +0530 Subject: [PATCH 13/14] readme fixed --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b93edfb..c124594 100644 --- a/README.md +++ b/README.md @@ -99,9 +99,9 @@ Download sample apk as shown in example from releases. From v1.5.0-dev.1 we can use LiquidController class to create its instance and use it from controlling pages programmatically. Features/Methods added but will not be limited to : - - jumpToPage({int page}) : It will jump to the mentioned page but without animation or swipe. - - animateToPage({int page, int duration = 600}) : It will animate to the mentioned page in given time with animation of swipes. - - currentPage : This getter will return the current Page which is being displayed. + - jumpToPage({int page}) : It will jump to the mentioned page but without animation or swipe. + - animateToPage({int page, int duration = 600}) : It will animate to the mentioned page in given time with animation of swipes. + - currentPage : This getter will return the current Page which is being displayed. Please look at the Example in this project for detailed usage. From 03676557a541df28da9b77bc1cd6a3f2b1e3d66a Mon Sep 17 00:00:00 2001 From: Sahdeep Singh Date: Fri, 19 Jun 2020 20:40:22 +0530 Subject: [PATCH 14/14] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d035e3a..7a1a8bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -#ChangeLog +# ChangeLog ## 1.5.0-dev.1 * Making Pages of Type Widget [724dc31b687319f66db362b55e2b7c6c2cabbcd7](https://github.com/iamSahdeep/liquid_swipe_flutter/commit/724dc31b687319f66db362b55e2b7c6c2cabbcd7)