Last active
November 25, 2019 17:30
-
-
Save Blasanka/a870803bb57bb57caf7eea11698e5a19 to your computer and use it in GitHub Desktop.
This is a example source code for infinite pageview in flutter. Read the tutorial here: https://slcoderlk.blogspot.com/2018/05/motiv-quote-app-pageview-for-swipe.html
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
import 'package:flutter/material.dart'; | |
void main() => runApp(LimeApp()); | |
class LimeApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Lime', | |
theme: ThemeData( | |
canvasColor: Colors.primaries[6], | |
), | |
home: MainPage(), | |
); | |
} | |
} | |
class MainPage extends StatelessWidget { | |
List<Widget> pages = [YourPage(), YourSecondPage(), YourThirdPage()]; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Container( | |
decoration: BoxDecoration( | |
color: Colors.black54, | |
), | |
margin: EdgeInsets.symmetric( | |
vertical: 50.0, | |
horizontal: 10.0, | |
), | |
child: PageView.builder( | |
controller: PageController( | |
initialPage: 1, | |
viewportFraction: 0.8, | |
), | |
itemBuilder: (_, int index) => pages[index]; | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment