Skip to content

Instantly share code, notes, and snippets.

@trey-rosius
Created March 12, 2019 11:06
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save trey-rosius/f9f526135c774c6668080454faea224c to your computer and use it in GitHub Desktop.
Save trey-rosius/f9f526135c774c6668080454faea224c to your computer and use it in GitHub Desktop.
Customized Tab Bar for Login,Sign Up and Forgot Password
import 'package:flutter/material.dart';
void main() {
runApp(HomePage());
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin{
TabController _tabController;
@override
void initState() {
_tabController = new TabController(length: 3, vsync: this);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home:DefaultTabController(length: 3, child: Scaffold(
appBar: PreferredSize(child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child:SafeArea(child: Column(
children: <Widget>[
Expanded(child: Container(),
),
TabBar(
controller: _tabController,
indicatorColor: Colors.transparent,
isScrollable: true,
unselectedLabelColor: Colors.grey.withOpacity(0.3),
labelColor: Colors.grey.shade800,
labelStyle: TextStyle(fontSize: 35.0,fontFamily: 'Montserrat',fontWeight: FontWeight.w700),
tabs: [
new Tab(text:"Log In",),
new Tab(text:"Sign Up",),
new Tab(text:"Forgot password",),
],
),
],
)) ,
),
),
preferredSize: Size.fromHeight(100.0)),
body: TabBarView(
children: [
new Text("Log in"),
new Text("Sign Up"),
new Text("Forgot Password"),
],
controller: _tabController,),
),)
);
}
}
@trey-rosius
Copy link
Author

WhatsApp Image 2019-03-12 at 12 07 24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment