Skip to content

Instantly share code, notes, and snippets.

@yshogo
Created April 13, 2019 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yshogo/bb2f55099e32b4cce7d92c0fff151f79 to your computer and use it in GitHub Desktop.
Save yshogo/bb2f55099e32b4cce7d92c0fff151f79 to your computer and use it in GitHub Desktop.
Create YouTube UI in 10 minute using Flutter!
import 'package:flutter/material.dart';
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
title: Container(
width: 120,
height: 50,
child: Image.asset("assets/youtube.png"),
),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.cast,
color: Colors.black,
),
onPressed: () {},
),
IconButton(
icon: Icon(
Icons.video_call,
color: Colors.black,
),
onPressed: () {},
),
IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
),
onPressed: () {},
),
Container(
margin: const EdgeInsets.all(10),
child: CircleAvatar(
backgroundImage: AssetImage("assets/0.png"),
),
),
],
),
body: _body(),
bottomNavigationBar: BottomNavigationBar(
onTap: (int i) {},
currentIndex: 0,
type: BottomNavigationBarType.fixed,
fixedColor: Colors.red,
items: [
BottomNavigationBarItem(
icon: Icon(
Icons.home,
),
title: Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.trending_up),
title: Text("Trending"),
),
BottomNavigationBarItem(
icon: Icon(Icons.subscriptions),
title: Text("Subscriptions"),
),
BottomNavigationBarItem(
icon: Icon(Icons.mail),
title: Text("Inbox"),
),
BottomNavigationBarItem(
icon: Icon(Icons.subscriptions),
title: Text("Subscriptions"),
),
]),
);
}
Widget _body() {
return ListView(
children: List.generate(5, (int i) {
return Column(
children: <Widget>[
Image.asset("assets/image$i.jpg"),
SizedBox(
height: 5,
),
ListTile(
leading: CircleAvatar(
backgroundImage: AssetImage("assets/$i.png"),
),
title: Text(
"This UI is YouTube. I create this ui with flutter. I Love it!!!!!!!!!!!!!!!!!!!",
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
subtitle: Text("shogo.yamada * 5.1 M Views * 1 years ago"),
),
SizedBox(
height: 20,
)
],
);
}),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment