flutter page view

import 'package:flutter/material.dart'; final Color darkBlue = Color.fromARGB(255, 18, 32, 47);

void main() { runApp(MyApp()); }

class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue), debugShowCheckedModeBanner: false, home: Scaffold( body: Center( child: MyWidget(), ), ), ); } }

class MyWidget extends StatefulWidget { @override _MyWidgetState createState() => _MyWidgetState(); }

class _MyWidgetState extends State<MyWidget> {

Widget buildPage(String text, Color color){ return Center( child:Text( text, style:TextStyle(fontSize:80.0,color:color), ), ); }

Widget buildPageView(){ return PageView( children:<Widget>[ buildPage("Helow", Colors.red), buildPage("Helsdhgow", Colors.yellow), buildPage("aow", Colors.green), ], ); } @override Widget build(BuildContext context) { return Scaffold( body:buildPageView() ); } }

No Comments Yet