Skip to content

Instantly share code, notes, and snippets.

@TechieBlossom
Last active October 4, 2020 11:48
Show Gist options
  • Save TechieBlossom/28f071879bc9fd4f88aed47f9c14166b to your computer and use it in GitHub Desktop.
Save TechieBlossom/28f071879bc9fd4f88aed47f9c14166b to your computer and use it in GitHub Desktop.
@override
Widget build(BuildContext context) {
//1
return AnimatedBuilder(
//2
animation: pageController,
builder: (context, child) {
//3
double value = 1;
//4
if (pageController.position.haveDimensions) {
value = pageController.page - index;
value = (1 - (value.abs() * 0.1)).clamp(0.0, 1.0);
return Align(
alignment: Alignment.topCenter,
child: Container(
//5
height: Curves.easeIn.transform(value) * ScreenUtil.screenHeight * 0.35,
width: Sizes.dimen_230.w,
child: child,
),
);
} else {
print('else');
return Align(
alignment: Alignment.topCenter,
child: Container(
height:
Curves.easeIn.transform(index == 0 ? value : value * 0.5) *
ScreenUtil.screenHeight * 0.35,
width: Sizes.dimen_230.w,
child: child,
),
);
}
},
child: MovieCardWidget(
movieId: movieId,
posterPath: posterPath,
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment