Created
August 29, 2018 13:29
-
-
Save xProgrammer-007/28de1fbdf3dc03af6dc0cf2416642e2f to your computer and use it in GitHub Desktop.
Basic whatsapp layout using flutter
This file contains hidden or 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( new WhatsApp()); | |
} | |
class WhatsApp extends StatefulWidget { | |
@override | |
_WhatsAppState createState() => _WhatsAppState(); | |
} | |
class _WhatsAppState extends State<WhatsApp> with TickerProviderStateMixin{ | |
TabController tabController; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
floatingActionButton: FloatingActionButton( | |
onPressed: null, | |
backgroundColor: Colors.green, | |
child: Icon(Icons.message,color: Colors.white,), | |
), | |
appBar: AppBar( | |
bottom: new TabBar( | |
controller: tabController, | |
indicatorColor: Colors.white, | |
tabs:[ | |
new Tab( | |
icon: Icon(Icons.camera), | |
), | |
new Tab( | |
text: 'CHATS', | |
), | |
new Tab( | |
text:'STATUS' | |
), | |
new Tab( | |
text:'CAllS' | |
) | |
]), | |
backgroundColor: Colors.green, | |
elevation: 0.0, | |
title: Text( | |
'WhatsApp', | |
style: TextStyle( | |
color: Colors.white | |
), | |
), | |
actions: <Widget>[ | |
IconButton( | |
icon: Icon(Icons.search, color: Colors.white), | |
onPressed: null, | |
), | |
IconButton( | |
icon: Icon( Icons.more_vert,color: Colors.white), | |
onPressed: null, | |
) | |
], | |
), | |
body: new TabBarView( | |
controller: tabController, | |
children:[ | |
new ListView.builder( | |
itemBuilder: (BuildContext context, int i){ | |
return ListTile( | |
leading:CircleAvatar( | |
backgroundImage: NetworkImage('https://via.placeholder.com/350x150'), | |
), | |
title: Text( | |
'reshma' | |
), | |
subtitle: Text( | |
'i love u' | |
), | |
trailing:Text( | |
'08/26/18' | |
) , | |
); | |
}, | |
itemCount: 90, | |
), | |
]), | |
) | |
); | |
} | |
@override | |
void initState() { | |
tabController = new TabController(length: 4, vsync: this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment