Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'placeholder_widget.dart';
  3.  
  4. class Home extends StatefulWidget {
  5. @override
  6. State<StatefulWidget> createState() {
  7. return _HomeState();
  8. }
  9. }
  10.  
  11. class _HomeState extends State<Home> {
  12. int _currentIndex = 0;
  13. final List<Widget> _children = [
  14. PlaceholderWidget(Colors.white),
  15. PlaceholderWidget(Colors.deepOrange),
  16. PlaceholderWidget(Colors.green),
  17. PlaceholderWidget(Colors.blueAccent)
  18. ];
  19. void onTabTapped(int index) {
  20. setState(() {
  21. _currentIndex = index;
  22. });
  23. }
  24. @override
  25. Widget build(BuildContext context) {
  26. return Scaffold(
  27. body: _children[_currentIndex],
  28. bottomNavigationBar: BottomNavigationBar(
  29. onTap: onTabTapped,
  30. currentIndex: _currentIndex,
  31. type: BottomNavigationBarType.fixed,
  32. selectedItemColor: Colors.black,
  33. unselectedItemColor: Colors.blue,
  34. items: [
  35. BottomNavigationBarItem(
  36. icon: new Icon(Icons.home),
  37. title: new Text('Home'),
  38. ),
  39. BottomNavigationBarItem(
  40. icon: new Icon(Icons.map),
  41. title: new Text('Map',
  42. ),
  43. ),
  44. BottomNavigationBarItem(
  45. icon: new Icon(Icons.language),
  46. title: new Text('Useful Links'),
  47. ),
  48. BottomNavigationBarItem(
  49. icon: new Icon(Icons.calendar_today),
  50. title: new Text('Calendar'),
  51. ),
  52. ]
  53. ),
  54. );
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement