-
-
Save rodydavis/c8badc708e5ae4438b7478b547daaaca to your computer and use it in GitHub Desktop.
Customized Tab Bar for Login,Sign Up and Forgot Password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,), | |
),) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment