flutter tab widget code example

Example 1: tab design in flutter

DefaultTabController(      length: 3,      child: Scaffold(        appBar: AppBar(          backgroundColor: Colors.white,          elevation: 0,          bottom: TabBar(              unselectedLabelColor: Colors.redAccent,              indicatorSize: TabBarIndicatorSize.label,              indicator: BoxDecoration(                  borderRadius: BorderRadius.circular(50),                  color: Colors.redAccent),              tabs: [                Tab(                  child: Container(                    decoration: BoxDecoration(                        borderRadius: BorderRadius.circular(50),                        border: Border.all(color: Colors.redAccent, width: 1)),                    child: Align(                      alignment: Alignment.center,                      child: Text("APPS"),                    ),                  ),                ),                Tab(                  child: Container(                    decoration: BoxDecoration(                        borderRadius: BorderRadius.circular(50),                        border: Border.all(color: Colors.redAccent, width: 1)),                    child: Align(                      alignment: Alignment.center,                      child: Text("MOVIES"),                    ),                  ),                ),                Tab(                  child: Container(                    decoration: BoxDecoration(                        borderRadius: BorderRadius.circular(50),                        border: Border.all(color: Colors.redAccent, width: 1)),                    child: Align(                      alignment: Alignment.center,                      child: Text("GAMES"),                    ),                  ),                ),              ]),        ),        body: TabBarView(children: [          Icon(Icons.apps),          Icon(Icons.movie),          Icon(Icons.games),        ]),      ))

Example 2: ttk widget tab

import tkinter as tk
from tkinter import ttk

# intializing the window
window = tk.Tk()
window.title("TABS")
# configuring size of the window 
window.geometry('350x200')
#Create Tab Control
TAB_CONTROL = ttk.Notebook(window)
#Tab1
TAB1 = ttk.Frame(TAB_CONTROL)
TAB_CONTROL.add(TAB1, text='Tab 1')
#Tab2
TAB2 = ttk.Frame(TAB_CONTROL)
TAB_CONTROL.add(TAB2, text='Tab 2')
TAB_CONTROL.pack(expand=1, fill="both")
#Tab Name Labels
ttk.Label(TAB1, text="This is Tab 1").grid(column=0, row=0, padx=10, pady=10)
ttk.Label(TAB2, text="This is Tab 2").grid(column=0, row=0, padx=10, pady=10)
#Calling Main()
window.mainloop()

Example 3: tab design in flutter

DefaultTabController(        length: 3,        child: Scaffold(          appBar: AppBar(            backgroundColor: Colors.redAccent,            elevation: 0,            bottom: TabBar(                labelColor: Colors.redAccent,                unselectedLabelColor: Colors.white,                indicatorSize: TabBarIndicatorSize.label,                indicator: BoxDecoration(                    borderRadius: BorderRadius.only(                        topLeft: Radius.circular(10),                        topRight: Radius.circular(10)),                    color: Colors.white),                tabs: [                  Tab(                    child: Align(                      alignment: Alignment.center,                      child: Text("APPS"),                    ),                  ),                  Tab(                    child: Align(                      alignment: Alignment.center,                      child: Text("MOVIES"),                    ),                  ),                  Tab(                    child: Align(                      alignment: Alignment.center,                      child: Text("GAMES"),                    ),                  ),                ]            ),          ),          body: TabBarView(children: [            Icon(Icons.apps),            Icon(Icons.movie),            Icon(Icons.games),          ]),        )     )