Skip to content

Instantly share code, notes, and snippets.

@yshogo
Created April 14, 2019 00:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yshogo/e286b7bde9f6bd3114949b64c7456cdd to your computer and use it in GitHub Desktop.
Save yshogo/e286b7bde9f6bd3114949b64c7456cdd to your computer and use it in GitHub Desktop.
Create Gmail app UI in 10 minute using Flutter!
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