Last active
November 10, 2019 07:45
-
-
Save ibhavikmakwana/b87730f1e7359df83ed48e14a5101d4a to your computer and use it in GitHub Desktop.
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(MyApp()); | |
class MyApp extends StatefulWidget { | |
@override | |
_MyAppState createState() => _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> { | |
Color favColor = Colors.black; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Welcome to Flutter', | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text( | |
'Instagram', | |
style: TextStyle(color: Colors.black), | |
), | |
leading: Icon( | |
Icons.camera_alt, | |
color: Colors.black, | |
), | |
backgroundColor: Colors.white, | |
actions: <Widget>[ | |
Icon( | |
Icons.tv, | |
color: Colors.black, | |
), | |
Icon( | |
Icons.send, | |
color: Colors.black, | |
), | |
], | |
), | |
body: ListView.builder( | |
physics: BouncingScrollPhysics(), | |
itemBuilder: (BuildContext context, int index) { | |
return buildInstagramTile(); | |
}, | |
itemCount: 10, | |
), | |
), | |
); | |
} | |
Widget buildInstagramTile() { | |
return Column( | |
children: <Widget>[ | |
ListTile( | |
leading: Image.network( | |
'https://avatars0.githubusercontent.com/u/22465800?s=52&v=4'), | |
title: Text('Bhavik Makwana'), | |
trailing: Icon(Icons.more_horiz), | |
), | |
Image.network( | |
'https://images.unsplash.com/photo-1558980394-4c7c9299fe96?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80', | |
height: 200, | |
width: double.infinity, | |
fit: BoxFit.cover, | |
), | |
Row( | |
mainAxisSize: MainAxisSize.max, | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
Row( | |
children: <Widget>[ | |
IconButton( | |
icon: Icon( | |
Icons.favorite, | |
color: favColor, | |
), | |
onPressed: () { | |
setState(() { | |
favColor = Colors.red; | |
}); | |
}, | |
), | |
SizedBox(width: 8), | |
Icon(Icons.mode_comment), | |
SizedBox(width: 8), | |
Icon(Icons.share), | |
], | |
), | |
Icon(Icons.bookmark_border), | |
], | |
) | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment