{"id":1023,"date":"2020-10-08T19:53:47","date_gmt":"2020-10-08T10:53:47","guid":{"rendered":"http:\/\/leenux.kr\/?p=1023"},"modified":"2020-10-11T16:35:50","modified_gmt":"2020-10-11T07:35:50","slug":"bottomnavigationbar","status":"publish","type":"post","link":"https:\/\/leenux.kr\/?p=1023","title":{"rendered":"Flutter BottomNavigationBar"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:blog\/Item0.dart';\nimport 'package:blog\/Item1.dart';\nimport 'package:blog\/Item2.dart';\nimport 'package:flutter\/material.dart';\n\nclass BottomNavigationBarPage extends StatefulWidget {\n  @override\n  _BottomNavigationBarPageState createState() => _BottomNavigationBarPageState();\n}\n\nclass _BottomNavigationBarPageState extends State&lt;BottomNavigationBarPage> {\n\n  int _index;\n\n  List&lt;Widget> _list = [\n    Item0Page(),\n    Item1Page(),\n    Item2Page(),\n  ];\n\n  @override\n  void initState() {\n    super.initState();\n    _index = 0;\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: _list[_index],\n      bottomNavigationBar: BottomNavigationBar(\n        currentIndex: _index,\n        onTap: (index) {\n          setState(() {\n            _index = index;\n            print(\"\uc544\uc774\ud0ec : $_index\");\n          });\n        },\n        items: &lt;BottomNavigationBarItem>[\n          BottomNavigationBarItem(icon: Icon(Icons.home), title: Text(\"\ud648\")),\n          BottomNavigationBarItem(icon: Icon(Icons.local_post_office), title: Text(\"\uba54\uc138\uc9c0\")),\n          BottomNavigationBarItem(icon: Icon(Icons.settings), title: Text(\"\uc124\uc815\")),\n        ],\n      ),\n    );\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-large-font-size has-very-dark-gray-color\"><strong>Item0Page.dart<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:flutter\/material.dart';\n\nclass Item1Page extends StatefulWidget {\n  @override\n  _Item1PageState createState() => _Item1PageState();\n}\n\nclass _Item1PageState extends State&lt;Item1Page> {\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: Center(\n        child: Text(\n          \"0\",\n          style: TextStyle(fontSize: 30),\n        ),\n      ),\n    );\n  }\n}\n<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-large-font-size has-very-dark-gray-color\"><strong>Item1Page.dart<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:flutter\/material.dart';\n\nclass Item1Page extends StatefulWidget {\n  @override\n  _Item1PageState createState() => _Item1PageState();\n}\n\nclass _Item1PageState extends State&lt;Item1Page> {\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: Center(\n        child: Text(\n          \"1\",\n          style: TextStyle(fontSize: 30),\n        ),\n      ),\n    );\n  }\n}\n<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-large-font-size has-very-dark-gray-color\"><strong>Item2Page.dart<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:flutter\/material.dart';\n\nclass Item1Page extends StatefulWidget {\n  @override\n  _Item1PageState createState() => _Item1PageState();\n}\n\nclass _Item1PageState extends State&lt;Item1Page> {\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: Center(\n        child: Text(\n          \"2\",\n          style: TextStyle(fontSize: 30),\n        ),\n      ),\n    );\n  }\n}\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/leenux.kro.kr\/wp-content\/uploads\/2020\/10\/bottomNavigationBar_Vidio.mp4\"><\/video><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Item0Page.dart Item1Page.dart Item2Page.dart<\/p>\n","protected":false},"author":1,"featured_media":1001,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts\/1023"}],"collection":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1023"}],"version-history":[{"count":3,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts\/1023\/revisions"}],"predecessor-version":[{"id":1042,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts\/1023\/revisions\/1042"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/media\/1001"}],"wp:attachment":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}