|2| Page Selector
Flutter |2| Page Selector:
import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: "Bottam AppBar", home: MyHomepage(), ); } } class MyHomepage extends StatefulWidget { @override _MyHomepageState createState() => _MyHomepageState(); } class _MyHomepageState extends State<MyHomepage> { static const kIcons = <Icon>[ Icon(Icons.home), Icon(Icons.contact_phone), Icon(Icons.android), Icon(Icons.account_balance_wallet), Icon(Icons.face), Icon(Icons.language), Icon(Icons.watch_later), ]; @override Widget build(BuildContext context) { return DefaultTabController( length: kIcons.length, child: Builder( builder: (BuildContext context) => Padding( padding: const EdgeInsets.all(39.0), child: Column( children: <Widget>[ TabPageSelector(), Expanded( child: IconTheme( data: IconThemeData( size: 137.0, color: Theme.of(context).accentColor, ), child: TabBarView(children: kIcons), ), ), RaisedButton( child: Text('SKIP'), onPressed: () { final TabController controller = DefaultTabController.of(context); if (!controller.indexIsChanging) { controller.animateTo(kIcons.length - 1); } }, ) ], ), ), ), ); } }
Comments
Post a Comment