Skip to content

Instantly share code, notes, and snippets.

@this-is-richard
Last active March 11, 2019 03:56
Show Gist options
  • Save this-is-richard/8554da0120c127976253a279b76f81cb to your computer and use it in GitHub Desktop.
Save this-is-richard/8554da0120c127976253a279b76f81cb to your computer and use it in GitHub Desktop.
The WhatsApp tabview
// 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