{"id":19824,"date":"2022-05-27T05:42:43","date_gmt":"2022-05-27T05:42:43","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=3885"},"modified":"2022-05-27T05:42:43","modified_gmt":"2022-05-27T05:42:43","slug":"tabbar-step-3-4-and-5","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/05\/27\/tabbar-step-3-4-and-5\/","title":{"rendered":"Tabbar Step 3, 4 and 5:"},"content":{"rendered":"\n<p><strong>Step 3:<\/strong>&nbsp;Next, we need to create a&nbsp;<strong>DefaultTabController.<\/strong>&nbsp;The DefaultTabController creates a&nbsp;<strong>TabController<\/strong>&nbsp;and makes it available to all widgets.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.javatpoint.com\/flutter-tabbar#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-tabbar#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-tabbar#\"><\/a><span style=\"font-family: var(--list--font-family); background-color: var(--global--color-background); color: var(--global--color-primary); font-size: var(--global--font-size-base);\">\u00a0<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DefaultTabController(  \n  \/\/ The number of tabs to display.  \n  length: 2,  \n  child: \/\/ Complete this code in the next step.  \n); <\/code><\/pre>\n\n\n\n<p>In the above code, the&nbsp;<strong>length<\/strong>&nbsp;property tells about the number of tabs used in the app.<\/p>\n\n\n\n<p><strong>Step 4:<\/strong>&nbsp;Create the tab. We can create tabs by using the&nbsp;<strong>TabBar<\/strong>&nbsp;widget as below code.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.javatpoint.com\/flutter-tabbar#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-tabbar#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-tabbar#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DefaultTabController(  \n  length: 2,  \n  child: Scaffold(  \n    appBar: AppBar(  \n      bottom: TabBar(  \n        tabs: &#91;  \n          Tab(icon: Icon(Icons.directions_car)),  \n          Tab(icon: Icon(Icons.directions_bike)),  \n        ],  \n      ),  \n    ),  \n  ),  \n);  <\/code><\/pre>\n\n\n\n<p><strong>Step 5:<\/strong>\u00a0Create content for each tab so that when a tab is selected, it displays the content. For this purpose, we have to use the\u00a0<strong>TabBarView<\/strong>\u00a0widget as:<a href=\"https:\/\/www.javatpoint.com\/flutter-tabbar#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-tabbar#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-tabbar#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TabBarView(  \n  children: &#91;  \n  ],  \n);  <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Step 3:&nbsp;Next, we need to create a&nbsp;DefaultTabController.&nbsp;The DefaultTabController creates a&nbsp;TabController&nbsp;and makes it available to all widgets. \u00a0 In the above code, the&nbsp;length&nbsp;property tells about the number of tabs used in the app. Step 4:&nbsp;Create the tab. We can create tabs by using the&nbsp;TabBar&nbsp;widget as below code. Step 5:\u00a0Create content for each tab so that when [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[575],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/19824"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=19824"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/19824\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=19824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=19824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=19824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}