Skip to content

Commit

Permalink
Merge branch 'mourad-brahim-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
iamSahdeep committed Sep 30, 2019
2 parents c30f2f1 + 10c4f8c commit 566dc40
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Greetings

on: [pull_request, issues]

jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Hey, Thanks for creating the first issue. I will respond in a day or two. If doesn''t, feel free to ping me.'
pr-message: 'Hey, Thanks for creating the first Pull Request. I will respond in a day or two. If doesn''t, feel free to ping me.'
Binary file modified android/.idea/caches/gradle_models.ser
Binary file not shown.
8 changes: 7 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void main() {
}

class MyApp extends StatelessWidget {

final pages = [
Container(
color: Colors.pink,
Expand Down Expand Up @@ -212,7 +213,7 @@ class MyApp extends StatelessWidget {
),
),
];

int page = 0;
@override
Widget build(BuildContext context) {
return new MaterialApp(
Expand All @@ -224,6 +225,11 @@ class MyApp extends StatelessWidget {
enableLoop: false,
positionSlideIcon: 0.5,
waveType: WaveType.liquidReveal,
onPageChangeCallback: (page) => pageChangeCallback(page),
)));
}

pageChangeCallback(int page) {
print(page);
}
}
20 changes: 13 additions & 7 deletions lib/liquid_swipe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import 'Constants/Helpers.dart';

final key = new GlobalKey<_LiquidSwipe>();

typedef OnPageChangeCallback = void Function(int activePageIndex);

class LiquidSwipe extends StatefulWidget {
final List<Container> pages;
final double fullTransitionValue;
Expand All @@ -21,6 +23,8 @@ class LiquidSwipe extends StatefulWidget {
final bool enableLoop;
final WaveType waveType;

final OnPageChangeCallback onPageChangeCallback;

const LiquidSwipe({
Key key,
@required this.pages,
Expand All @@ -31,7 +35,9 @@ class LiquidSwipe extends StatefulWidget {
this.positionSlideIcon = 0.54,
this.enableLoop = true,
this.waveType = WaveType.liquidReveal,
this.onPageChangeCallback,
}) : assert(pages != null),
assert(onPageChangeCallback != null),
assert(fullTransitionValue != null),
assert(initialPage != null &&
initialPage >= 0 &&
Expand Down Expand Up @@ -71,6 +77,12 @@ class _LiquidSwipe extends State<LiquidSwipe> with TickerProviderStateMixin {
slidePercentVer = 0.0; //slide percentage (0.0 to 1.0)
StreamSubscription<SlideUpdate> slideUpdateStream$;

set setActivePageIndex(int value) {
activePageIndex = value;

widget.onPageChangeCallback(activePageIndex);
}

@override
void initState() {
slidePercentHor = slidePercentVer = 0;
Expand Down Expand Up @@ -152,6 +164,7 @@ class _LiquidSwipe extends State<LiquidSwipe> with TickerProviderStateMixin {
//done animating
else if (event.updateType == UpdateType.doneAnimating) {
activePageIndex = nextPageIndex;
widget.onPageChangeCallback(activePageIndex);
slideDirection = SlideDirection.none;
slidePercentHor = 0.5;
slidePercentVer = widget.positionSlideIcon;
Expand Down Expand Up @@ -208,11 +221,4 @@ class _LiquidSwipe extends State<LiquidSwipe> with TickerProviderStateMixin {
), //Stack
); //Scaffold
}

next() {
_LiquidSwipe().setState(() {
activePageIndex += 1;
nextPageIndex = activePageIndex + 1;
});
}
}

0 comments on commit 566dc40

Please sign in to comment.