Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import "package:flutter/material.dart";
- void main() => runApp(MyApp());
- class MyApp extends StatefulWidget {
- MyApp({Key key}) : super(key : key);
- @override
- _MyApp createState() => _MyApp();
- }
- class _MyApp extends State {
- var _currentPage = 0;
- var _pages = [
- Text("Página 1 - Avisos"),
- Text("Página 2 - Aniversários"),
- Text("Página 3 - Dados")
- ];
- @override
- Widget build(BuildContext context) {
- return MaterialApp(title : "Exemplo - BottomNavigationBar",
- home : Scaffold(
- body : Center(child : _pages.elementAt(_currentPage)),
- bottomNavigationBar : BottomNavigationBar(
- items : [
- BottomNavigationBarItem(
- icon : Icon(Icons.announcement),
- title : Text("Avisos")
- ),
- BottomNavigationBarItem(
- icon : Icon(Icons.cake),
- title : Text("Aniversários")
- ),
- BottomNavigationBarItem(
- icon : Icon(Icons.cloud),
- title : Text("Dados")
- ),
- ],
- currentIndex : _currentPage,
- fixedColor : Colors.red,
- onTap : (int inIndex) {
- setState(() { _currentPage = inIndex; });
- }
- )
- )
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment