-
-
Save dhafinrayhan/a63f94e0bb09ed7a2334c09c79012f14 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
import 'package:flutter/material.dart'; | |
/// Flutter code sample for [PageView]. | |
void main() => runApp(const PageViewExampleApp()); | |
class PageViewExampleApp extends StatelessWidget { | |
const PageViewExampleApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
appBar: AppBar(title: const Text('PageView Sample')), | |
body: const PageViewExample(), | |
), | |
); | |
} | |
} | |
class PageViewExample extends StatelessWidget { | |
const PageViewExample({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
final PageController controller = PageController(); | |
return PageView( | |
/// [PageView.scrollDirection] defaults to [Axis.horizontal]. | |
/// Use [Axis.vertical] to scroll vertically. | |
controller: controller, | |
children: const <Widget>[ | |
Column( | |
children: [ | |
Text('First Page'), | |
TextField(), | |
], | |
), | |
Column( | |
children: [ | |
Text('Second Page'), | |
TextField(), | |
], | |
), | |
Column( | |
children: [ | |
Text('Third Page'), | |
TextField(), | |
], | |
), | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment