-
-
Save TechieBlossom/67f4d386eecc3c7687f408d192b1117a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1 | |
class MoviePageView extends StatefulWidget { | |
final List<MovieEntity> movies; | |
final int initialPage; | |
const MoviePageView({ | |
Key key, | |
@required this.movies, | |
@required this.initialPage, | |
}) : assert(initialPage >= 0, 'initialPage cannot be less than 0'), | |
super(key: key); | |
@override | |
_MoviePageViewState createState() => _MoviePageViewState(); | |
} | |
class _MoviePageViewState extends State<MoviePageView> { | |
//2 | |
PageController _pageController; | |
@override | |
void initState() { | |
super.initState(); | |
//3 | |
_pageController = PageController( | |
initialPage: widget.initialPage, | |
keepPage: false, | |
viewportFraction: 0.7, | |
); | |
} | |
@override | |
void dispose() { | |
//4 | |
_pageController.dispose(); | |
super.dispose(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
//TODO: PageView.Builder | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment