<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sarthak Verma on Medium]]></title>
        <description><![CDATA[Stories by Sarthak Verma on Medium]]></description>
        <link>https://medium.com/@IAmSarthakVerma?source=rss-39df853ffd59------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*msaCGS4-PdTd7cktwQu5Tw.jpeg</url>
            <title>Stories by Sarthak Verma on Medium</title>
            <link>https://medium.com/@IAmSarthakVerma?source=rss-39df853ffd59------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:44:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@IAmSarthakVerma/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Making Antigravity Your Own: Extending Google Antigravity for Engineering Teams]]></title>
            <link>https://medium.com/@IAmSarthakVerma/making-antigravity-your-own-extending-google-antigravity-for-engineering-teams-363e43df941b?source=rss-39df853ffd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/363e43df941b</guid>
            <category><![CDATA[google-antigravity]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[google-antigravity-skills]]></category>
            <category><![CDATA[antigravity]]></category>
            <dc:creator><![CDATA[Sarthak Verma]]></dc:creator>
            <pubDate>Wed, 03 Jun 2026 16:21:42 GMT</pubDate>
            <atom:updated>2026-06-03T17:44:45.210Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABXdfZI5zGiP9f13q5z3qw.jpeg" /></figure><h3>Introduction</h3><p>The era of generic AI developer assistants is rapidly evolving. While standard off the shelf agents provide massive productivity boosts, they often stumble when faced with the unique conventions, internal databases, and strict security requirements of a specific engineering team. They lack the bespoke context that makes a senior developer truly effective in a complex corporate environment.</p><p><a href="https://antigravity.google/"><strong>Google Antigravity</strong></a> addresses this gap directly through a robust suite of customization layers. By moving beyond basic chat interfaces, Antigravity allows engineering organizations to mold the AI into a deeply integrated team member. You are no longer just prompting an AI; you are architecting a custom intelligence tailored to your precise workspace.</p><p>In this comprehensive guide, you will learn how to transform Antigravity from a generalized tool into a specialized asset. We will explore how to connect live external data, teach the agent your internal best practices, enforce strict operational boundaries, and automate background operations. Whether you are a startup founder looking to multiply your engineering output or a technical leader aiming to standardize code quality, mastering these tools will redefine how your team builds software.</p><h3>Integrating External Context with MCP</h3><p>Understanding the architecture of your product requires more than just reading local source files. Developers constantly reference external databases, issue trackers, and build pipelines. Antigravity bridges this divide using the Model Context Protocol, commonly referred to as MCP.</p><h4>What it is</h4><p>The Model Context Protocol is an open standard integration layer that allows the editor to securely query local tools, external services, and databases. Instead of forcing developers to manually copy and paste schema definitions or error logs into the chat, MCP provides the AI with a direct lifeline to your broader ecosystem.</p><h4>Basic Configuration and Placement</h4><p>Custom MCP servers are defined in a single configuration file located globally on your machine.</p><p><strong>File Location:</strong> ~/.gemini/config/mcp_config.json</p><p><strong>Basic Configuration:</strong></p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;my-stdio-server&quot;: {<br>      &quot;command&quot;: &quot;path/to/executable&quot;,<br>      &quot;args&quot;: [&quot;--arg1&quot;, &quot;value1&quot;],<br>      &quot;env&quot;: { &quot;API_KEY&quot;: &quot;your-api-key&quot; },<br>      &quot;cwd&quot;: &quot;/working/directory&quot;,<br>      &quot;disabled&quot;: false,<br>      &quot;disabledTools&quot;: [&quot;tool-name-to-exclude&quot;]<br>    },<br>    &quot;my-remote-server&quot;: {<br>      &quot;serverUrl&quot;: &quot;https://api.example.com/mcp/&quot;,<br>      &quot;headers&quot;: { &quot;Authorization&quot;: &quot;Bearer YOUR_API_TOKEN&quot; },<br>      &quot;authProviderType&quot;: &quot;google_credentials&quot;,<br>      &quot;oauth&quot;: {<br>        &quot;clientId&quot;: &quot;your-client-id&quot;,<br>        &quot;clientSecret&quot;: &quot;your-client-secret&quot;<br>      },<br>      &quot;disabled&quot;: false,<br>      &quot;disabledTools&quot;: [&quot;tool-name-to-exclude&quot;]<br>    }<br>  }<br>}</pre><h4>How it works</h4><p>Connections are managed through the built-in MCP Store. To connect a <strong>custom</strong> MCP server: open the ... dropdown at the top of the editor&#39;s agent panel → click <strong>Manage MCP Servers</strong> → click <strong>View raw config</strong> → edit the mcp_config.json that opens. Once a server is authenticated using Application Default Credentials or standard OAuth, the agent gains access to predefined context resources and custom tools. For example, the agent could use a custom tool to search your internal documentation or read data streams from active deployments.</p><h4>Why it matters</h4><p>Context switching is the enemy of deep work. By granting the agent direct access to peripheral systems, you eliminate the friction of data gathering. The AI can base its code suggestions on the actual live schema of your Supabase project or read the latest failing test logs from Heroku, ensuring its outputs are grounded in current reality rather than outdated assumptions.</p><h4>Practical Examples</h4><p>Imagine writing a complex SQL migration. With a connected database server, Antigravity inspects your live tables and suggests the exact column names needed. Alternatively, if a bug is identified, you can ask the agent to create a new ticket in your tracking software directly from the editor environment, completely bypassing the browser.</p><h3>Teaching Reusable Knowledge with Agent Skills</h3><p>A tool is only as good as the knowledge operating it. Agent Skills provide a structured method for teaching Antigravity the specific patterns and practices your team relies on.</p><h4>What it is</h4><p>Skills are reusable packages of knowledge stored as directories within your workspace or global configuration folders. Each skill requires a primary markdown file containing YAML frontmatter and detailed instructions. These files can also be accompanied by helper scripts, reference examples, and templates.</p><h4>Basic Configuration and Placement</h4><p>Skills can be scoped globally across all your projects or specifically to a single workspace.</p><p><strong>File Locations:</strong></p><ul><li><strong>Workspace specific:</strong> &lt;workspace-root&gt;/.agents/skills/&lt;skill-folder&gt;/</li><li><strong>Global:</strong> ~/.gemini/config/skills/&lt;skill-folder&gt;/</li></ul><p><strong>Directory Structure:</strong></p><pre>.agents/skills/my-skill/<br>├─── SKILL.md        # Main instructions (required)<br>├─── scripts/        # Helper scripts (optional)<br>├─── examples/       # Reference implementations (optional)<br>└─── resources/      # Templates and other assets (optional)</pre><p><strong>Basic Configuration (SKILL.md Frontmatter):</strong></p><pre>---<br>name: my-skill<br>description: Helps with a specific task. Use when you need to do X or Y.<br>---<br># My Skill<br>Detailed instructions for the agent go here.</pre><h4>How it works</h4><p>Skills operate on a principle of progressive disclosure. When a conversation begins, the agent surveys a list of available skills, reading only their names and brief descriptions. If the agent determines that a particular skill aligns with your current task, it activates that skill and reads the full instructions. You do not always need to explicitly call a skill; the agent intelligently decides when to apply it based on the context of the conversation.</p><h4>Why it matters</h4><p>Without skills, developers must constantly remind the AI of project specific constraints. By encoding these constraints into dedicated skill files, you ensure consistent behavior. This is especially powerful for onboarding new team members, as the agent acts as an automated enforcer of team conventions.</p><h4>Practical Examples</h4><p>A team might create a dedicated code review skill. The description tells the agent to activate this skill whenever a pull request is being evaluated. The full instructions guide the agent to check for edge case handling, adherence to local style guides, and potential performance bottlenecks. The agent then follows these exact steps, providing methodical and consistent feedback.</p><h3>Setting Boundaries with Rules and Workflows</h3><p>While skills teach the agent how to perform tasks, Rules and Workflows provide the overarching governance and procedural tracks the agent must follow.</p><h4>What it is</h4><p>Rules are manually defined constraints that dictate behavior. They are markdown files capped at twelve thousand characters and can be applied globally across all projects or strictly within a single repository. Workflows, on the other hand, define a structured sequence of interconnected steps for repetitive tasks at the trajectory level.</p><h4>Basic Configuration and Placement</h4><p>Like skills, rules can be applied globally or tied to a specific repository.</p><p><strong>File Locations:</strong></p><ul><li><strong>Global Rules:</strong> ~/.gemini/GEMINI.md</li><li><strong>Workspace Rules:</strong> .agents/rules/&lt;rule-name&gt;.md</li></ul><h4>How it works</h4><p>Rules offer incredible flexibility in their activation. They can be invoked manually via an at mention, left always on, left to the discretion of the model, or triggered by specific file glob patterns. For instance, a rule automatically applies to any file matching the glob pattern (e.g. **/*.ts), regardless of the action being taken. Workflows are invoked in the chat using a slash command and can even trigger other workflows, chaining actions together to complete complex processes. Agent can even generate workflows for you based on your conversation history.<br>Rules files support @filename references to pull in other files. Relative paths resolve from the rules file&#39;s location; absolute paths resolve as true filesystem paths, falling back to workspace/path if not found.</p><p>You can also ask the agent to generate a workflow for you directly. This works especially well after walking through a task manually. The agent can use the conversation history to write the workflow steps automatically.</p><h4>Why it matters</h4><p>Rules guarantee that hard constraints are never ignored. If your security policy forbids using certain libraries, a rule ensures the agent never suggests them. Workflows save massive amounts of time by automating repetitive boilerplate sequences, such as scaffolding a new microservice or executing a multi step deployment checklist.</p><h3>Bundling Features into Plugins</h3><p>Managing individual skills, rules, and server configurations across a large organization can become unwieldy. Plugins solve this deployment challenge.</p><h4>What it is</h4><p>Plugins are namespaced directories that allow you to extend the capabilities of the agent by grouping Skills, Rules, MCP servers, and Hooks into a single shareable package.</p><h3>Basic Configuration and Placement</h3><p>Antigravity automatically scans designated plugin directories to discover and load your custom bundles.</p><p><strong>File Locations:</strong></p><ul><li><strong>Workspace Level:</strong> .agents/plugins/</li><li><strong>Global Level:</strong> ~/.gemini/config/plugins/</li></ul><p><strong>Directory Structure:</strong></p><pre>plugins/&lt;plugin-name&gt;/<br>├── plugin.json         # Required marker file<br>├── mcp_config.json     # Optional MCP server definitions<br>├── hooks.json          # Optional hooks definition<br>├── skills/             # Optional skills<br>│   └── &lt;skill-name&gt;/<br>│       └── SKILL.md<br>└── rules/              # Optional rules<br>    └── &lt;rule-name&gt;.md</pre><p><strong>Basic Configuration (plugin.json):</strong></p><pre>{<br>  &quot;name&quot;: &quot;my-custom-plugin&quot;<br>}</pre><h4>How it works</h4><p>A plugin directory must contain a manifest file simply defining the package name. Inside this directory, you can place your server configurations, hook definitions, and folders for rules and skills. Antigravity automatically scans designated plugin locations at both the global and workspace levels, loading all contained customizations simultaneously. You can also browse Google-built plugins by navigating to the <strong>Customizations</strong> page and selecting the Build with Google section. See the <a href="https://antigravity.google/docs/build-with-google">Build with Google page</a> for the full list.</p><h4>Why it matters</h4><p>Plugins are the ultimate distribution mechanism for engineering teams. A platform team can create a single centralized plugin containing all the preferred linter rules, custom build scripts, and deployment workflows, and distribute it to every developer in the company. This guarantees a unified development environment across the entire organization.</p><h3>Hooking into the Execution Loop</h3><p>For absolute control over the actions of the agent, developers can tap directly into the execution lifecycle using Hooks.</p><h4>What it is</h4><p>Hooks allow you to run custom scripts or shell commands at specific points during the execution loop of the agent. They are defined in a configuration file within your settings directory.</p><h4>Basic Configuration and Placement</h4><p>Hooks are configured in a single JSON file that maps events to your custom scripts.</p><p><strong>File Location:</strong></p><ul><li>.agents/hooks.json (Workspace)</li><li>~/.gemini/config/hooks.json (Global)</li></ul><p><strong>Basic Configuration:</strong></p><pre>{<br>  &quot;my-linter-hook&quot;: {<br>    &quot;PostToolUse&quot;: [<br>      {<br>        &quot;matcher&quot;: &quot;run_command&quot;,<br>        &quot;hooks&quot;: [<br>          {<br>            &quot;type&quot;: &quot;command&quot;,<br>            &quot;command&quot;: &quot;./scripts/lint.sh&quot;,<br>            &quot;timeout&quot;: 10<br>          }<br>        ]<br>      }<br>    ]<br>  }<br>}</pre><h4>How it works</h4><p>The configuration maps specific events to your shell scripts. Antigravity supports several key lifecycle events: before a tool is used, after a tool completes, before the model is invoked, after the model is invoked, and when the execution loop terminates. Hooks communicate with the agent via standard input and standard output using JSON payloads. They can utilize regex matchers to target specific tools, such as intercepting any command line execution or file modification. Note that only PreToolUse hooks can gate execution, returning allow, deny, ask, or force_ask. PostToolUse hooks fire after the tool has already completed and their output is simply an empty JSON object {}; they observe but cannot control what happened.</p><h4>Why it matters</h4><p>Hooks provide an uncompromising safety net. By intercepting a tool before it runs, a hook returns a decision field with one of four values: allow (proceed automatically), deny (hard block), ask (prompt the user, respects cached permissions), or force_ask (always prompts, ignoring cached permissions). An optional permissionOverrides array can also be returned to override specific resource permissions. PreInvocation hooks can inject steps directly into the conversation trajectory before the model is called, via an injectSteps array in their stdout output. Each injected step is one of three types: a toolCall (executes a tool), a userMessage (appears as if the user typed it), or an ephemeralMessage (a transient system message). PostInvocation supports the same injectSteps output, and adds a terminationBehavior field — set to force_continue to keep the execution loop running, or terminate to end it immediately.</p><h3>Automating Background Tasks with Sidecars</h3><p>Antigravity is not limited to reacting to your immediate prompts. Sidecars allow the AI to operate proactively in the background.</p><h4>What it is</h4><p>Sidecars are background processes managed entirely by Antigravity. The system automatically launches these processes and ensures they remain running, restarting them upon failure according to your defined policies.</p><h3>Basic Configuration and Placement</h3><p>Each sidecar requires its own directory containing a specific configuration file. Furthermore, sidecars must be explicitly enabled in your global user settings.</p><p><strong>File Locations:</strong></p><ul><li><strong>Global Sidecars:</strong> ~/.gemini/config/sidecars/&lt;sidecarId&gt;/sidecar.json</li><li><strong>Plugin Sidecars:</strong> ~/.gemini/config/plugins/&lt;pluginName&gt;/sidecars/&lt;sidecarId&gt;/sidecar.json</li><li><strong>User Configuration (to enable):</strong> ~/.gemini/config/config.json</li></ul><p><strong>Basic Configuration (sidecar.json):</strong></p><pre>{<br>  &quot;description&quot;: &quot;Background worker&quot;,<br>  &quot;command&quot;: &quot;python3&quot;,<br>  &quot;args&quot;: [<br>    &quot;worker.py&quot;<br>  ],<br>  &quot;restart_policy&quot;: &quot;on-failure&quot;<br>}</pre><p><strong>Enabling the Sidecar (config.json):</strong></p><pre>{<br>  &quot;sidecars&quot;: {<br>    &quot;sidecar1&quot;: {<br>      &quot;enabled&quot;: true<br>    }<br>  }<br>}</pre><h4>How it works</h4><p>Sidecars are defined by configuration files placed in a dedicated directory. These files specify either a custom command to execute, such as a Python script, or a built in function like the cron based schedule runner. For security, sidecars must be explicitly enabled by the user in the core configuration file. Once running, they can utilize a dedicated command line interface to start new conversations or send messages directly to the active agent.</p><h4>Why it matters</h4><p>Sidecars transform the agent from a passive tool into an active collaborator. Instead of waiting for you to ask for a code review, a scheduled sidecar can periodically check your repository for new requests and prompt the agent to generate a summary automatically.</p><h3>Architecture and Mechanisms</h3><p>The Antigravity customization engine operates on a cascading resolution architecture. When determining which rules or skills to apply, the system <strong>first evaluates the workspace level</strong> directories before <strong>falling back</strong> to the <strong>global configurations</strong> stored in the user home directory. This allows for broad baseline behaviors that can be tightly overridden on a per project basis.</p><p>The execution loop of the agent is a highly orchestrated state machine. When the AI proposes a tool use, the system halts and fires the corresponding pre execution hooks. The hook receives a JSON payload containing the conversation ID, workspace paths, and tool arguments. The shell script evaluates this data and returns a decision payload via standard output. If the script returns an allow directive, the state machine resumes. If it returns a deny directive, the agent is hard blocked from executing the command, preserving system integrity.</p><p>Authentication for MCP is handled securely and robustly. You can utilize Application Default Credentials for seamless integration with Google Cloud services, or rely on dynamic client registration for OAuth enabled servers. Access tokens are managed entirely by the Antigravity engine, stored securely in a local JSON file at ~/.gemini/antigravity/mcp_oauth_tokens.json, and refreshed automatically to maintain uninterrupted service.</p><p>Sidecars generate their own runtime data footprint, storing persistent information, timestamped logs, and recorded events in a dedicated local directory. This ensures that background tasks are fully observable and can be debugged easily if a scheduled cron job fails to execute as expected.</p><h3>Trade Offs and Limitations</h3><p>While the customization system is remarkably powerful, it requires thoughtful architecture to prevent context bloat. The progressive disclosure model used by Agent Skills is a direct response to this challenge. If all skills were loaded into the model context simultaneously, the AI would lose focus and hallucinate. By only reading the descriptions first, the agent preserves its attention for the active task.</p><p>A key limitation is the twelve thousand character limit on rule and workflow files. This forces developers to be concise and modular. Rather than writing a single monolithic workflow, the best practice is to compose smaller, focused workflows that call each other.</p><h3>Best Practices</h3><ul><li><strong>Keep Skills Focused:</strong> A skill should do exactly one thing well. Instead of a massive skill covering all testing, create separate skills for unit testing, integration testing, and end to end testing.</li><li><strong>Use Scripts as Black Boxes:</strong> If your skill involves complex logic, wrap that logic in a shell script. Instruct the agent to run the script with a help flag rather than asking it to read the entire source code. This minimizes context pollution.</li><li><strong>Optimize Skill Descriptions:</strong> Because the agent decides whether to use a skill based entirely on its description, you must write descriptions in the third person using highly specific keywords.</li></ul><h3>Example Use Cases</h3><p>An enterprise security team could deploy a global plugin to all developers. This plugin might include an MCP server connected to their internal vulnerability database. A hook could intercept every attempt by the agent to add a new package dependency, pausing execution to run a background scan against the database. If the package is flagged, the hook denies the tool execution and injects an automated message explaining the security violation, preventing vulnerable code from ever reaching the editor.</p><h3>Key Takeaways</h3><ul><li><strong>Connect Your World:</strong> The Model Context Protocol brings live external data directly into the editor, eliminating context switching.</li><li><strong>Standardize Execution:</strong> Skills and Rules provide a robust framework for teaching the agent your proprietary coding standards and operational constraints.</li><li><strong>Bundle and Distribute:</strong> Plugins make it trivial to package complex configurations and share them across an entire engineering organization.</li><li><strong>Secure and Automate:</strong> Hooks and Sidecars provide the ultimate technical control, allowing you to gate dangerous actions and automate recurring background tasks.</li></ul><h3>Conclusion</h3><p>Google Antigravity represents a fundamental shift in how developers interact with artificial intelligence. By exposing a deep, programmable customization layer, it moves beyond the paradigm of one size fits all assistance.</p><p>Through the strategic application of external connections, reusable knowledge packages, execution hooks, and background processes, you can forge an AI companion that intrinsically understands the nuances of your engineering organization. <strong>The true power of Antigravity is not in what it can do out of the box, but in what you can teach it to become</strong>. The tools are now in your hands to build the perfect digital teammate.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F6HOkD1pSCne4E%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F6HOkD1pSCne4E%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F6HOkD1pSCne4E%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="290" frameborder="0" scrolling="no"><a href="https://medium.com/media/667d294936b9c2764e730980323850c2/href">https://medium.com/media/667d294936b9c2764e730980323850c2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=363e43df941b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Nested TabBar in Flutter]]></title>
            <link>https://medium.com/flutterarsenal/build-a-nested-tabbar-in-flutter-7e0cae5cfc7?source=rss-39df853ffd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e0cae5cfc7</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Sarthak Verma]]></dc:creator>
            <pubDate>Tue, 25 Jun 2019 22:00:35 GMT</pubDate>
            <atom:updated>2019-06-25T22:00:35.269Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_WNcY3BRHMmBFnHhcurxWA.png" /></figure><p>TabBars can prove to be a very useful component in any mobile application. Generally, a TabBar appears on the bottom of the screen or sometimes at the top. If you’re not familiar with what a <strong>TabBar</strong> is then you can think of it as a UI element which consists of a number of <strong>options(tabs)</strong> and each tab has a different <strong>Tab View</strong> when active.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*o9xB8YUjIjxE-xSWP8KY_g.gif" /><figcaption><strong>TabBar</strong></figcaption></figure><p>But what if you want the more than one TabBars on a single screen of your application? In this case, you will need to implement a <strong>Nested TabBar </strong>and we are going to learn how to do that right away.</p><h3>Getting Started</h3><p>Let’s take a look at the result beforehand so that you know what are we building.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0njV8qlBWVdmHqEMZ7qa9A.gif" /><figcaption><strong>Nested TabBar Flutter Demo</strong></figcaption></figure><p>First, you have to create a blank Flutter Project. You <strong>main.dart</strong> file should look something similar to the code below.</p><h3>main.dart (Blank Flutter App)</h3><pre><strong>import </strong>&#39;package:flutter/material.dart&#39;;<br><br><strong>void </strong>main() =&gt; runApp(MyApp());<br><br><strong>class </strong>MyApp <strong>extends </strong>StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    <strong>return </strong>MaterialApp(<br>      title: &#39;Nested Tab Bar Demo&#39;,<br>      theme: ThemeData(<br>        primarySwatch: Colors.<em>teal</em>,<br>      ),<br>      home: MyHomePage(title: &#39;Nested Tab Bar Demo Page&#39;),<br>    );<br>  }<br>}<br><br><strong>class </strong>MyHomePage <strong>extends </strong>StatefulWidget {<br>  MyHomePage({Key key, <strong>this</strong>.title}) : <strong>super</strong>(key: key);<br><br>  <strong>final </strong>String title;<br><br>  @override<br>  _MyHomePageState createState() =&gt; _MyHomePageState();<br>}<br><br><strong>class </strong>_MyHomePageState <strong>extends </strong>State&lt;MyHomePage&gt; {<br><br>  @override<br>  Widget build(BuildContext context) {<br><br>    <strong>return </strong>Scaffold(<br>      appBar: AppBar(<br>        title: Text(widget.title),<br>      ),<br>      body: Container(<br><br>      ),<br>    );<br>  }<br>}</pre><p>Now let’s add our <strong>First TabBar</strong> to the application.</p><p>First of all, we have to add a <a href="https://api.flutter.dev/flutter/widgets/TickerProviderStateMixin-mixin.html">TickerProviderStateMixin</a> to the class that defines the state.</p><pre><strong>class </strong>_MyHomePageState <strong>extends </strong>State&lt;MyHomePage&gt; <strong>with </strong>TickerProviderStateMixin</pre><p>Then we have to add a controller for our first TabBar.</p><pre>TabController _tabController;</pre><p>Now we should initialize this controller in the <strong>initState()</strong> method. We have to specify the length of the TabBar while initializing this controller. Let’s set this to 3 for now.</p><pre>@override<br><strong>void </strong>initState() {<br>  <strong>super</strong>.initState();<br>  _tabController = <strong>new </strong>TabController(length: 3, vsync: <strong>this</strong>);<br>}</pre><p>Now, its time that we should give a location to our first TabBar. For this, we can use the <strong>bottomNavigationBar </strong>option provided by default when we use <strong>Scaffold</strong>.</p><pre>bottomNavigationBar: Material(<br>  color: Colors.<em>white</em>,<br>  child: TabBar(<br>      controller: _tabController,<br>      indicatorColor: Colors.<em>teal</em>,<br>      labelColor: Colors.<em>teal</em>,<br>      unselectedLabelColor: Colors.<em>black54</em>,<br>      tabs: &lt;Widget&gt;[<br>        Tab(<br>          icon: Icon(Icons.<em>home</em>),<br>        ),<br>        Tab(<br>          icon: Icon(Icons.<em>email</em>),<br>        ),<br>        Tab(<br>          icon: Icon(Icons.<em>settings</em>),<br>        ),<br>      ]),<br>),</pre><p>Now let’s add <strong>Views</strong> for the tabs in this TabBar. For this, inside the <strong>body </strong>we have to place a TabBarView widget.</p><pre>body: TabBarView(<br>  children: &lt;Widget&gt;[<br>    Center(<br>      child: Text(&quot;Home&quot;),<br>    ),<br>    Center(<br>      child: Text(&quot;Email&quot;),<br>    ),<br>    Center(<br>      child: Text(&quot;Settings&quot;),<br>    )<br>  ],<br>  controller: _tabController,<br>),</pre><p>Now that we have added a view for all the three tabs in our tab bar, we just have to do one last this i.e. to <strong>dispose</strong> the Tab Controller by overriding the dispose() method.</p><pre>@override<br><strong>void </strong>dispose() {<br>  <strong>super</strong>.dispose();<br>  _tabController.dispose();<br>}</pre><p>We have now successfully added our first Tab Bar and our <strong>main.dart</strong> should now look like the code below.</p><h3>main.dart (After adding First TabBar)</h3><pre><strong>import </strong>&#39;package:flutter/material.dart&#39;;<br><br><strong>void </strong>main() =&gt; runApp(MyApp());<br><br><strong>class </strong>MyApp <strong>extends </strong>StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    <strong>return </strong>MaterialApp(<br>      title: &#39;Nested Tab Bar Demo&#39;,<br>      theme: ThemeData(<br>        primarySwatch: Colors.<em>teal</em>,<br>      ),<br>      home: MyHomePage(title: &#39;Nested Tab Bar Demo Page&#39;),<br>    );<br>  }<br>}<br><br><strong>class </strong>MyHomePage <strong>extends </strong>StatefulWidget {<br>  MyHomePage({Key key, <strong>this</strong>.title}) : <strong>super</strong>(key: key);<br><br>  <strong>final </strong>String title;<br><br>  @override<br>  _MyHomePageState createState() =&gt; _MyHomePageState();<br>}<br><br><strong>class </strong>_MyHomePageState <strong>extends </strong>State&lt;MyHomePage&gt; <strong>with </strong>TickerProviderStateMixin {<br>  TabController _tabController;<br><br>  @override<br>  <strong>void </strong>initState() {<br>    <strong>super</strong>.initState();<br><br>    _tabController = <strong>new </strong>TabController(length: 3, vsync: <strong>this</strong>);<br>  }<br><br>  @override<br>  <strong>void </strong>dispose() {<br>    <strong>super</strong>.dispose();<br>    _tabController.dispose();<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    <strong>return </strong>Scaffold(<br>      appBar: AppBar(<br>        title: Text(widget.title),<br>      ),<br>      bottomNavigationBar: Material(<br>        color: Colors.<em>white</em>,<br>        child: TabBar(<br>            controller: _tabController,<br>            indicatorColor: Colors.<em>teal</em>,<br>            labelColor: Colors.<em>teal</em>,<br>            unselectedLabelColor: Colors.<em>black54</em>,<br>            tabs: &lt;Widget&gt;[<br>              Tab(<br>                icon: Icon(Icons.<em>home</em>),<br>              ),<br>              Tab(<br>                icon: Icon(Icons.<em>email</em>),<br>              ),<br>              Tab(<br>                icon: Icon(Icons.<em>settings</em>),<br>              ),<br>            ]),<br>      ),<br>      body: TabBarView(<br>        children: &lt;Widget&gt;[<br>          Center(<br>            child: Text(&quot;Home&quot;),<br>          ),<br>          Center(<br>            child: Text(&quot;Email&quot;),<br>          ),<br>          Center(<br>            child: Text(&quot;Settings&quot;),<br>          )<br>        ],<br>        controller: _tabController,<br>      ),<br>    );<br>  }<br>}</pre><p>Now it’s time for implementing the Second TabBar in the TabBar View of any Tab.</p><p>For more understanding and code simplicity we will create a separate class for the TabBarView which will consist of our secondTabBar.</p><p>Let’s create a file named as <strong>nestedTabBarView.dart</strong>. We can now add TabBar and TabBarView in this class just like we did it for the first TabBar in <strong>main.dart</strong>. The only difference here will be that in the build function we will return a Column instead of a Scaffold. The children of this Column will be TabBar and a Container wrapping the TabBarView.</p><h3>nestedTabBarView.dart</h3><pre><strong>import </strong>&#39;package:flutter/material.dart&#39;;<br><br><strong>class </strong>NestedTabBar <strong>extends </strong>StatefulWidget {<br><br>  @override<br>  _NestedTabBarState createState() =&gt; _NestedTabBarState();<br>}<br><br><strong>class </strong>_NestedTabBarState <strong>extends </strong>State&lt;NestedTabBar&gt;<br>    <strong>with </strong>TickerProviderStateMixin {<br>  TabController _nestedTabController;<br><br>  @override<br>  <strong>void </strong>initState() {<br>    <strong>super</strong>.initState();<br><br>    _nestedTabController = <strong>new </strong>TabController(length: 5, vsync: <strong>this</strong>);<br>  }<br><br>  @override<br>  <strong>void </strong>dispose() {<br>    <strong>super</strong>.dispose();<br>    _nestedTabController.dispose();<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    double screenHeight = MediaQuery.<em>of</em>(context).size.height;<br>    <strong>return </strong>Column(<br>      mainAxisAlignment: MainAxisAlignment.spaceAround,<br>      children: &lt;Widget&gt;[<br>        TabBar(<br>          controller: _nestedTabController,<br>          indicatorColor: Colors.<em>teal</em>,<br>          labelColor: Colors.<em>teal</em>,<br>          unselectedLabelColor: Colors.<em>black54</em>,<br>          isScrollable: <strong>true</strong>,<br>          tabs: &lt;Widget&gt;[<br>            Tab(<br>              text: &quot;One&quot;,<br>            ),<br>            Tab(<br>              text: &quot;Two&quot;,<br>            ),<br>            Tab(<br>              text: &quot;Three&quot;,<br>            ),<br>            Tab(<br>              text: &quot;Four&quot;,<br>            ),<br>            Tab(<br>              text: &quot;Five&quot;,<br>            ),<br>          ],<br>        ),<br>        Container(<br>          height: screenHeight * 0.70,<br>          margin: EdgeInsets.only(left: 16.0, right: 16.0),<br>          child: TabBarView(<br>            controller: _nestedTabController,<br>            children: &lt;Widget&gt;[<br>              Container(<br>                decoration: BoxDecoration(<br>                  borderRadius: BorderRadius.circular(8.0),<br>                  color: Colors.<em>blueAccent</em>,<br>                ),<br>              ),<br>              Container(<br>                decoration: BoxDecoration(<br>                  borderRadius: BorderRadius.circular(8.0),<br>                  color: Colors.<em>orangeAccent</em>,<br>                ),<br>              ),<br>              Container(<br>                decoration: BoxDecoration(<br>                  borderRadius: BorderRadius.circular(8.0),<br>                  color: Colors.<em>greenAccent</em>,<br>                ),<br>              ),<br>              Container(<br>                decoration: BoxDecoration(<br>                  borderRadius: BorderRadius.circular(8.0),<br>                  color: Colors.<em>indigoAccent</em>,<br>                ),<br>              ),<br>              Container(<br>                decoration: BoxDecoration(<br>                  borderRadius: BorderRadius.circular(8.0),<br>                  color: Colors.<em>redAccent</em>,<br>                ),<br>              ),<br>            ],<br>          ),<br>        )<br>      ],<br>    );<br>  }<br>}</pre><p>Lastly, in the <strong>main.dart </strong>import the NestedTabBar class and any child of the TabBarView with the class name.</p><h3>main.dart (Final)</h3><pre><strong>import </strong>&#39;package:flutter/material.dart&#39;;<br><strong>import </strong>&#39;package:nested_tabbar_flutter/nestedTabBarView.dart&#39;;<br><br><strong>void </strong>main() =&gt; runApp(MyApp());<br><br><strong>class </strong>MyApp <strong>extends </strong>StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    <strong>return </strong>MaterialApp(<br>      title: &#39;Nested Tab Bar Demo&#39;,<br>      theme: ThemeData(<br>        primarySwatch: Colors.<em>teal</em>,<br>      ),<br>      home: MyHomePage(title: &#39;Nested Tab Bar Demo Page&#39;),<br>    );<br>  }<br>}<br><br><strong>class </strong>MyHomePage <strong>extends </strong>StatefulWidget {<br>  MyHomePage({Key key, <strong>this</strong>.title}) : <strong>super</strong>(key: key);<br><br>  <strong>final </strong>String title;<br><br>  @override<br>  _MyHomePageState createState() =&gt; _MyHomePageState();<br>}<br><br><strong>class </strong>_MyHomePageState <strong>extends </strong>State&lt;MyHomePage&gt; <strong>with </strong>TickerProviderStateMixin {<br>  TabController _tabController;<br><br>  @override<br>  <strong>void </strong>initState() {<br>    <strong>super</strong>.initState();<br><br>    _tabController = <strong>new </strong>TabController(length: 3, vsync: <strong>this</strong>);<br>  }<br><br>  @override<br>  <strong>void </strong>dispose() {<br>    <strong>super</strong>.dispose();<br>    _tabController.dispose();<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    <strong>return </strong>Scaffold(<br>      appBar: AppBar(<br>        title: Text(widget.title),<br>      ),<br>      bottomNavigationBar: Material(<br>        color: Colors.<em>white</em>,<br>        child: TabBar(<br>          controller: _tabController,<br>          indicatorColor: Colors.<em>teal</em>,<br>          labelColor: Colors.<em>teal</em>,<br>          unselectedLabelColor: Colors.<em>black54</em>,<br>          tabs: &lt;Widget&gt;[<br>            Tab(<br>              icon: Icon(Icons.<em>home</em>),<br>            ),<br>            Tab(<br>              icon: Icon(Icons.<em>email</em>),<br>            ),<br>            Tab(<br>              icon: Icon(Icons.<em>settings</em>),<br>            ),<br>          ],<br>        ),<br>      ),<br>      body: TabBarView(<br>        children: &lt;Widget&gt;[<br>          NestedTabBar(),<br>          Center(<br>            child: Text(&quot;Email&quot;),<br>          ),<br>          Center(<br>            child: Text(&quot;Settings&quot;),<br>          )<br>        ],<br>        controller: _tabController,<br>      ),<br>    );<br>  }<br>}</pre><p>If you will run the app now, you will find that you have successfully implemented a Nested TabBar in your Flutter Application.</p><h3>Important Points</h3><p>You might have noticed the below line of code in the <strong>build function</strong> in the <strong>nestedTabBarView.dart</strong>.</p><pre>double screenHeight = MediaQuery.<em>of</em>(context).size.height;</pre><p>The need for this line of code is that it helps to <strong>find the screen height</strong> of the device in which the application is running and <strong>store it</strong> in a <strong>double</strong> type variable with the name <strong>screenHeight</strong>. This variable can be later used to give <strong>heights</strong> to different <strong>widgets</strong> corresponding to the <strong>screen height</strong>.</p><h3>Github Link</h3><p>The code for this build is available on Github. You can view it at:</p><p><a href="https://github.com/IAmSarthakVerma/NestedTabBar-Flutter">Nested TabBar - Flutter</a></p><h3>Done</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F6HOkD1pSCne4E%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F6HOkD1pSCne4E%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F6HOkD1pSCne4E%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="290" frameborder="0" scrolling="no"><a href="https://medium.com/media/667d294936b9c2764e730980323850c2/href">https://medium.com/media/667d294936b9c2764e730980323850c2/href</a></iframe><p>In case you have any doubts or question, I’ll be happy to help. Also, if you like this post you can follow me on <a href="https://github.com/IAmSarthakVerma">GITHUB</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e0cae5cfc7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutterarsenal/build-a-nested-tabbar-in-flutter-7e0cae5cfc7">Build a Nested TabBar in Flutter</a> was originally published in <a href="https://medium.com/flutterarsenal">FlutterArsenal</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>