Learn how to create tab bar on your android application using flutter.
This Application will give a basic idea like how you can create tab bar with icons, text and controller.
Code
import 'package:flutter/material.dart';
class TabBarWidget extends StatelessWidget {
const TabBarWidget({super.key});
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 3,
initialIndex: 1,
child: Scaffold(
appBar: AppBar(
title: const Text('Contact Us'),
bottom: const TabBar(tabs: [
Tab(
icon: Icon(Icons.email),
child: Text('Email'),
),
Tab(
icon: Icon(Icons.sms),
child: Text('SMS'),
),
Tab(
icon: Icon(Icons.web),
child: Text('Web'),
)
]),
),
body: const TabBarView(
children: [Text('1st Tab'), Text('2nd Tab'), Text('3rd Tab')]),
));
}
Tutorial Video
Comments
Post a Comment