{"id":570,"date":"2023-02-18T18:30:05","date_gmt":"2023-02-18T10:30:05","guid":{"rendered":"http:\/\/gjweb.top\/?p=570"},"modified":"2023-02-18T18:30:07","modified_gmt":"2023-02-18T10:30:07","slug":"08-%e5%ba%95%e9%83%a8%e5%af%bc%e8%88%aa%e6%a0%8f-navbar","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=570","title":{"rendered":"08. \u5e95\u90e8\u5bfc\u822a\u680f navBar"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"bottomnavigationbar-\u7ec4\u4ef6\">BottomNavigationBar \u7ec4\u4ef6<\/h2>\n\n\n\n<p>\u653e\u5728 Scaffold \u7ec4\u4ef6\u4e2d<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u5c5e\u6027<\/th><th>\u4f5c\u7528<\/th><th>\u7c7b\u578b<\/th><\/tr><\/thead><tbody><tr><td>items<\/td><td>\u5e95\u90e8\u5bfc\u822a\u680f\u96c6\u5408<\/td><td>List<\/td><\/tr><tr><td>iconSize<\/td><td>\u56fe\u6807<\/td><td>Icon<\/td><\/tr><tr><td>currentIndex<\/td><td>\u9ed8\u8ba4\u9009\u4e2d\u7b2c\u51e0\u4e2a<\/td><td>Index<\/td><\/tr><tr><td>onTap<\/td><td>\u89e6\u53d1\u7684\u56de\u8c03\u51fd\u6570<\/td><td>(index){}<\/td><\/tr><tr><td>fixedColor<\/td><td>\u9009\u4e2d\u7684\u989c\u8272<\/td><td>Color<\/td><\/tr><tr><td>type<\/td><td>\u5f53\u8d85\u8fc7\u4e09\u4e2a\u5bfc\u822a\u680f\u65f6\u9700\u8981\u914d\u7f6e\u8be5\u7c7b\u578b<\/td><td>BottomNavigationBarType.fixed<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>Scaffold(<br>    bottomNavigationBar:BottomNavigationBar(<br> &nbsp; &nbsp; &nbsp; &nbsp;type:BottomNavigationBarType.fixed,<br> &nbsp; &nbsp; &nbsp; &nbsp;currentIndex:0,<br> &nbsp; &nbsp; &nbsp; &nbsp;onTap:(index){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/ \u6253\u5370\u5f53\u524d\u70b9\u51fb\u56fe\u6807\u7684\u4e0b\u6807<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;      items:const &#91;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BottomNavigationBarItem(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;      icon:Icon(Icons.home),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;label:\"\u9996\u9875\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BottomNavigationBarItem(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;      icon:Icon(Icons.class),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;label:\"\u5206\u7c7b\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BottomNavigationBarItem(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;      icon:Icon(Icons.char),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;label:\"\u8d2d\u7269\u8f66\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BottomNavigationBarItem(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;      icon:Icon(Icons.user),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;label:\"\u6211\u7684\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ),<br> &nbsp; &nbsp; &nbsp;  ]<br> &nbsp;  )<br>)<\/code><\/pre>\n\n\n\n<p><strong>\u5207\u6362\u9875\u9762,\u53ef\u5b9a\u4e49\u591a\u4e2abody\u7684\u7ec4\u4ef6,\u901a\u8fc7taber\u7684index\u5bf9\u5e94\u597d\u6bcf\u4e2abody\u7684\u6570\u7ec4\u4e2d\u4e0b\u6807\u7684\u4f4d\u7f6e<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5168\u5c4f\u6d6e\u52a8\u7ec4\u4ef6\u5b9e\u73b0\u95f2\u9c7c\u6309\u94ae\u6548\u679c\">\u5168\u5c4f\u6d6e\u52a8\u7ec4\u4ef6\u5b9e\u73b0\u95f2\u9c7c\u6309\u94ae\u6548\u679c<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Scaffold(<br>    floatingActionButton:Container(<br> &nbsp;      height:30,<br> &nbsp; &nbsp; &nbsp; &nbsp;width:30,<br> &nbsp; &nbsp; &nbsp; &nbsp;padding:EdgeInsets.all(4),<br> &nbsp; &nbsp; &nbsp; &nbsp;margin:EdgInsets.only(top:4),<br> &nbsp; &nbsp; &nbsp; &nbsp;decoration:BoxDecoration(<br> &nbsp; &nbsp; &nbsp;      color:Colors.white,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;borderRadius:BorderRadius.circular(15)<br> &nbsp; &nbsp; &nbsp;  ),<br> &nbsp; &nbsp; &nbsp; &nbsp;child:FloatingActionButton(<br> &nbsp; &nbsp; &nbsp;      onPress(){},<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;child:Icon(Icons.add)<br> &nbsp; &nbsp; &nbsp;  )<br> &nbsp;  ),<br> &nbsp; &nbsp;floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,<br>)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>BottomNavigationBar \u7ec4\u4ef6 \u653e\u5728 Scaffold \u7ec4\u4ef6\u4e2d \u5c5e\u6027 \u4f5c\u7528 \u7c7b\u578b items \u5e95 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-570","post","type-post","status-publish","format-standard","hentry","category-flutter"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=570"}],"version-history":[{"count":1,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/570\/revisions"}],"predecessor-version":[{"id":571,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/570\/revisions\/571"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}