{"id":10383,"date":"2021-08-25T10:00:00","date_gmt":"2021-08-25T01:00:00","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=10383"},"modified":"2021-08-24T19:11:20","modified_gmt":"2021-08-24T10:11:20","slug":"flutter-bottomnavigationbar-%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%9f%e3%83%8a%e3%83%93%e3%82%b2%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%83%a1%e3%83%8b%e3%83%a5%e3%83%bc%e3%81%ae%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/10383","title":{"rendered":"[Flutter] BottomNavigationBar \u3092\u4f7f\u7528\u3057\u305f\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u30e1\u30cb\u30e5\u30fc\u306e\u4f5c\u6210"},"content":{"rendered":"\n<p>Flutter\u306eUI\u306e\u52c9\u5f37\u306e\u305f\u3081\u306b\u3001<br>Amazon\u306e\u30a2\u30d7\u30ea\u306e\u3088\u3046\u306a\u753b\u9762\u4e0b\u90e8\u306e\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u30e1\u30cb\u30e5\u30fc\u3067<br>\u753b\u9762\u3092\u5207\u308a\u66ff\u3048\u308b\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"534\" height=\"1024\" src=\"\/appnews\/wp-content\/uploads\/sites\/4\/2021\/08\/Screenshot_20210824-182409-2-534x1024.png\" alt=\"\" class=\"wp-image-10395\" srcset=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/08\/Screenshot_20210824-182409-2-534x1024.png 534w, https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/08\/Screenshot_20210824-182409-2.png 1079w\" sizes=\"(max-width: 534px) 100vw, 534px\" \/><\/figure>\n\n\n\n<p>ContentPage \u30af\u30e9\u30b9\u306f<br>\u30e1\u30cb\u30e5\u30fc\u306e\u64cd\u4f5c\u306b\u3088\u3063\u3066\u5207\u308a\u66ff\u3048\u3089\u308c\u308bWidget\u3067\u3059\u3002<br>\u5f15\u6570\u306b\u3088\u3063\u3066\u6e21\u3055\u308c\u305f\u30a2\u30a4\u30b3\u30f3\u3068\u6587\u5b57\u5217\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class ContentPage extends StatelessWidget\n{\n  final IconData icon;\n  final String title;\n\n  ContentPage({required this.icon, required this.title});\n\n  @override\n  Widget build(BuildContext context) {\n    return Container(\n      child: Center(\n        child: Container(\n          width: 250,\n          height: 250,\n          child: Center(\n              child: Column(\n                children: &lt;Widget>[\n                  Icon(icon, size: 60.0,),\n                  Text(\n                      title\n                  ),\n                ],\n              )\n            ),\n          ),\n        ),\n      );\n  }\n}<\/code><\/pre>\n\n\n\n<p>_MyHomePageState \u3000\u304c\u30e1\u30a4\u30f3\u306e\u4eca\u56de\u306e\u30e1\u30a4\u30f3\u3067\u3059\u3002<br>BottomNavigationBar\u306b\u8a2d\u5b9a\u3057\u305f\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3059\u308b\u3053\u3068\u3067<br>\u753b\u9762\u306e\u8868\u793a\u304c\u5207\u308a\u66ff\u308f\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class _MyHomePageState extends State&lt;MyHomePage> {\n  \/\/ \u9078\u629e\u3057\u305f\u30da\u30fc\u30b8\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\n  int _selectedIndex = 0;\n\n  \/\/ \u5404\u30dc\u30bf\u30f3\u306b\u5bfe\u5fdc\u3059\u308b\u30da\u30fc\u30b8\u306e\u30ea\u30b9\u30c8\n  List&lt;Widget> _pageList = [\n\n    ContentPage(icon: Icons.home, title: 'Home'),\n    ContentPage(icon: Icons.person, title: 'MyPage'),\n    ContentPage(icon: Icons.shopping_cart, title: 'Cart'),\n    ContentPage(icon: Icons.menu, title: 'Setting')\n  ];\n\n  @override\n  Widget build(BuildContext context) {\n\n    return Scaffold(\n      appBar: AppBar(\n        title: Text(widget.title),\n      ),\n      body: _pageList[_selectedIndex], \n\/\/ \u30dc\u30c7\u30a3\u306f\u3001\u30ea\u30b9\u30c8\u304b\u3089\u9078\u629e\u3055\u308c\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u30da\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\n      bottomNavigationBar: BottomNavigationBar(\n        type: BottomNavigationBarType.fixed, \n\/\/ type\u304c\u672a\u6307\u5b9a\u3060\u3068\u3001\u30dc\u30bf\u30f3\u30924\u3064\u4ee5\u4e0a\u8a2d\u5b9a\u3059\u308b\u3068\u81ea\u52d5\u7684\u306bshifting\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3057\u307e\u3046\n        items : const &lt;BottomNavigationBarItem>[ \n\/\/ \u753b\u9762\u4e0b\u306b\u8868\u793a\u3059\u308b\u30dc\u30bf\u30f3\u30a2\u30a4\u30c6\u30e0\u306e\u8a2d\u5b9a\n          BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('Home')),\n          BottomNavigationBarItem(icon: Icon(Icons.person), title: Text('MyPage')),\n          BottomNavigationBarItem(icon: Icon(Icons.shopping_cart), title: Text('Cart')),\n          BottomNavigationBarItem(icon: Icon(Icons.menu), title: Text('Setting')),\n        ],\n        currentIndex: _selectedIndex, \/\/ \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u521d\u671f\u5024\n        onTap: _onTapped, \/\/ \u30bf\u30c3\u30d7\u6642\u306e\u51e6\u7406\n      ),\n    );\n  }\n\n  \/\/ \u30bf\u30c3\u30d7\u6642\u306e\u51e6\u7406\n  void _onTapped(int index) {\n    setState(() {\n      _selectedIndex = index;\n    });\n  }\n\n}<\/code><\/pre>\n\n\n\n<p>\u30b3\u30fc\u30c9\u4e0a\u306e\u30b3\u30e1\u30f3\u30c8\u306b\u3082\u66f8\u3044\u3066\u3044\u307e\u3059\u304c\u3001<br>&#8220;type&#8221;\u306e\u6307\u5b9a\u3092\u884c\u308f\u306a\u3044\u3068\u3001BottomNavigationBar \u306b4\u3064\u4ee5\u4e0a\u306e\u30a2\u30a4\u30c6\u30e0\u3092\u8a2d\u5b9a\u3059\u308b\u3068\u81ea\u52d5\u7684\u306b&#8221;type&#8221;\u304c&#8221;shifting&#8221;\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u304c\u8e93\u3044\u305f\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002 <\/p>\n\n\n\n<p style=\"text-align:center\">\u30fb\u30fb\u30fb\u30fb&#8221;type&#8221; \u306b\u8a2d\u5b9a\u3059\u308b&#8221; fixed &#8220;\u3068&#8221;shifting &#8220;\u306e\u9055\u3044\u30fb\u30fb\u30fb\u30fb<\/p>\n\n\n\n<p>\u30fbBottomNavigationBarType.fixed \uff1a<br>\u3000\u3000\u3000\u3000\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u306e\u5404\u30a2\u30a4\u30c6\u30e0\u306e\u6a2a\u5e45\u304c\u56fa\u5b9a<br>\u30fbBottomNavigationBarType.shifting \uff1a<br>\u3000\u3000\u3000\u3000\u9078\u629e\u72b6\u614b\u306e\u30a2\u30a4\u30c6\u30e0\u306e\u5e45\u304c\u5e83\u304c\u308a\u3001\u975e\u9078\u629e\u72b6\u614b\u306e\u30a2\u30a4\u30c6\u30e0\u306e\u30e9\u30d9\u30eb\u304c\u975e\u8868\u793a<\/p>\n\n\n\n<p>\u6c34\u66dc\u62c5\u5f53:Tanaka<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/10383\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/10383\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"[Flutter] BottomNavigationBar \u3092\u4f7f\u7528\u3057\u305f\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u30e1\u30cb\u30e5\u30fc\u306e\u4f5c\u6210\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/10383\" data-text=\"[Flutter] BottomNavigationBar \u3092\u4f7f\u7528\u3057\u305f\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u30e1\u30cb\u30e5\u30fc\u306e\u4f5c\u6210\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/10383\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/10383\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>Flutter\u306eUI\u306e\u52c9\u5f37\u306e\u305f\u3081\u306b\u3001Amazon\u306e\u30a2\u30d7\u30ea\u306e\u3088\u3046\u306a\u753b\u9762\u4e0b\u90e8\u306e\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u30e1\u30cb\u30e5\u30fc\u3067\u753b\u9762\u3092\u5207\u308a\u66ff\u3048\u308b\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,11],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/10383"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=10383"}],"version-history":[{"count":17,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/10383\/revisions"}],"predecessor-version":[{"id":10404,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/10383\/revisions\/10404"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=10383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=10383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=10383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}