Created
April 14, 2019 00:41
-
-
Save yshogo/e286b7bde9f6bd3114949b64c7456cdd to your computer and use it in GitHub Desktop.
Create Gmail app UI in 10 minute using Flutter!
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'; | |
class Home extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: CustomScrollView( | |
slivers: <Widget>[ | |
SliverAppBar( | |
backgroundColor: Colors.white, | |
title: Material( | |
elevation: 8, | |
child: TextFormField( | |
decoration: InputDecoration( | |
hintText: "Search Mail", | |
border: InputBorder.none, | |
icon: Container( | |
margin: EdgeInsets.only(left: 10), | |
child: Icon(Icons.dehaze), | |
), | |
suffixIcon: Container( | |
margin: EdgeInsets.all(5), | |
child: CircleAvatar( | |
backgroundImage: AssetImage("assets/profile.jpg"), | |
), | |
), | |
), | |
), | |
), | |
), | |
SliverList( | |
delegate: SliverChildListDelegate( | |
List.generate( | |
100, | |
(int i) { | |
return _listItem(i); | |
}, | |
), | |
), | |
) | |
], | |
), | |
floatingActionButton: FloatingActionButton( | |
onPressed: () {}, | |
child: Icon( | |
Icons.add, | |
color: Colors.red, | |
), | |
backgroundColor: Colors.white, | |
), | |
); | |
} | |
Widget _listItem(int i) { | |
return ListTile( | |
leading: CircleAvatar( | |
child: Text(i.toString()), | |
backgroundColor: Colors.green, | |
), | |
title: Column( | |
children: <Widget>[ | |
Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
Text( | |
"shogo.yamada", | |
style: TextStyle(fontWeight: FontWeight.bold), | |
), | |
Text( | |
"8:59", | |
style: TextStyle(fontWeight: FontWeight.bold), | |
), | |
], | |
), | |
Text( | |
"Please Subscribe this channel!!!!! Please!!!!!", | |
overflow: TextOverflow.ellipsis, | |
style: TextStyle(fontWeight: FontWeight.bold), | |
), | |
], | |
), | |
subtitle: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
Text("this is gmail app using flutter !!!!!"), | |
Icon(Icons.star_border) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment