Last active
March 11, 2019 03:56
-
-
Save this-is-richard/8554da0120c127976253a279b76f81cb to your computer and use it in GitHub Desktop.
The WhatsApp tabview
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
// above are the imports | |
class Home extends StatelessWidget { | |
final _tabs = <Widget>[ | |
Tab(icon: Icon(Icons.camera_alt)), Tab(text: 'CHATS'), | |
Tab(text: 'STATUS'), Tab(text: 'CALLS'), | |
]; | |
@override | |
Widget build(BuildContext context) { | |
return DefaultTabController( | |
length: _tabs.length, | |
initialIndex: 1, | |
child: Scaffold( | |
// top app bar | |
appBar: AppBar( | |
title: Text('WhatsApp'), | |
actions: <Widget>[ | |
IconButton(icon: Icon(Icons.search), onPressed: () {}), | |
IconButton(icon: Icon(Icons.more_vert), onPressed: () {}), | |
], | |
bottom: TabBar(tabs: _tabs), | |
), | |
// body (tab views) | |
body: TabBarView( | |
children: <Widget>[ | |
Text('camera'), | |
ChatList(), | |
Text('status'), | |
Text('calls'), | |
], | |
// below are the closing tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment