Flutter Challenge To YouTube

Flutter Challenge To YouTube

二月 26, 2019



Flutter Challenges will attempt to receate a particular app UI or design in
Flutter.

This challenge will attempt the Home screen and the Video Detail screen (The
screen where the video actually plays) of the Youtube app including the
animation.

This challenge will be slightly more complex than my previous ones but the
result is that much better for the same.

Getting Started

The YouTube app comprises of:

a) The Home Screen which contains:

  1. The AppBar with 3 actions
  2. The User Video Feed
  3. The Bottom Navigation Bar

b) The Video Detail Screen which contains:

  1. The main video player which can shrink to let users look at their feed (PIP)
  2. Recommendations for users based on the current video

Setting up the project

Let’s make a Flutter project and remove all the default code leaving just a blank
screen with the default app bar.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Challenge YouTube',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}

class MyHomePage extends StatefulWidget {
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(''),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[],
),
));
}
}

Making the AppBar

The AppBar has the YouTube logo and name on the left and three actions,i.e.
record,search and open profile on the right.

The AppBar can be recreated as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
appBar: AppBar(
backgroundColor: Colors.white,
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
FontAwesomeIcons.youtube,
color: Colors.red,
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
'YouTube',
style: TextStyle(
color: Colors.black,
letterSpacing: -1.0,
fontWeight: FontWeight.w700,
),
),
)
],
),
actions: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Icon(
Icons.videocam,
color: Colors.black54,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Icon(Icons.search, color: Colors.black54),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Icon(Icons.account_circle, color: Colors.black54),
)
],
),

This is what the recreated AppBar looks like:

Note: For the YouTube logo,I’ve used the FontFlutterAwesome icons available as
a package on Dart pub.

Let’s move on to the Bottom Navigation Bar,

Creating the BottomNavigationBar

The bottom navigation bar has 5 items in it and is pretty straightforward to
recreate in Flutter.We use the bottomNavigationBar parameter of the Scaffold.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(
Icons.home,
color: Colors.black54,
),
title: Text("Home",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
FontAwesomeIcons.fire,
color: Colors.black54,
),
title: Text("Trending",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
Icons.subscriptions,
color: Colors.black54,
),
title: Text("Subscriptions",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
Icons.email,
color: Colors.black54,
),
title: Text("Inbox",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
Icons.folder,
color: Colors.black54,
),
title: Text("Library",
style: TextStyle(
color: Colors.black54,
)),
),
],
type: BottomNavigationBarType.fixed,
),

Note: We need to specify a fixed BottomNavigationBarType because for 4+
items,the default type is shifting to avoid overcrowding.

The result is:

The User Video Feed

The User Video Feed is a list of items consisting of recommended videos,Let’s
take a look at the list item:



The list item consists of a Column with an image and a Row of information about
the video.The Row consists of an image,a Column of the title and pubisher and a
menu button.

To create a list in Flutter,we use a ListView.builder().Recreating the list items,
we come to:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import 'package:flutter/material.dart';
import 'package:flutterchallenge/VideoItemModel.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Challenge YouTube',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}

class MyHomePage extends StatefulWidget {
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
var videos = [
VideoItemModel(
"Gordon Ramsay Cooked For Vladimir Putin",
"The Late Show with Stephen Colbert\n1.1M views.2 weeks ago",
"assets/images/youtube/youtube_one.jpg"),
VideoItemModel(
"Hailee Steinfeld, Alesso - Let Me Go",
"Hailee Steinfeld\n57M views.8 months ago",
"assets/images/youtube/youtube_two.jpg"),
VideoItemModel(
"Charlie Puth - Look At Me Now",
"Lyricwood\n4.7M views.4 months ago",
"assets/images/youtube/youtube_three.jpg")
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
FontAwesomeIcons.youtube,
color: Colors.red,
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
'YouTube',
style: TextStyle(
color: Colors.black,
letterSpacing: -1.0,
fontWeight: FontWeight.w700,
),
),
)
],
),
actions: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Icon(
Icons.videocam,
color: Colors.black54,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Icon(Icons.search, color: Colors.black54),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Icon(Icons.account_circle, color: Colors.black54),
)
],
),
body: ListView.builder(
itemCount: 3,
itemBuilder: (context, position) {
return Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Image.asset(
videos[position].imagePath,
fit: BoxFit.cover,
),
)
],
),
Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Icon(
Icons.account_circle,
size: 40.0,
),
flex: 2,
),
Expanded(
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Text(
videos[position].title,
style: TextStyle(fontSize: 18.0),
),
),
Text(
videos[position].publisher,
style: TextStyle(color: Colors.black54),
),
],
crossAxisAlignment: CrossAxisAlignment.start,
),
flex: 9,
),
Expanded(
flex: 1,
child: Icon(Icons.more_vert),
),
],
),
)
],
);
},
),
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(
Icons.home,
color: Colors.black54,
),
title: Text("Home",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
FontAwesomeIcons.fire,
color: Colors.black54,
),
title: Text("Trending",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
Icons.subscriptions,
color: Colors.black54,
),
title: Text("Subscriptions",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
Icons.email,
color: Colors.black54,
),
title: Text("Inbox",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
Icons.folder,
color: Colors.black54,
),
title: Text("Library",
style: TextStyle(
color: Colors.black54,
)),
),
],
type: BottomNavigationBarType.fixed,
),
);
}
}

Here videos is simply a list of the video details like titles and publishers.

This is how the recreated home screen looks like:



Now,we’ll move on to the slightly harder part,the video detail screen.

Creating the Video Detail Screen

The video detail screen is the screen which actually displays videos in the YouTube
app. The hightlight of the screen is that we can shrink the video and it keeps on
playing on the bottom right side of the screen.For this article,we’ll focus on the
shrinking animation instead of actually playing a video.

Notice,the screen is not a different page,but more of an overlay onto the existing
screen.So,we’ll use the Stack widget to overlay the screen instead.

So at the background,we’ll have our home screen and on the top will be our video page.

Building the Floating Video Player (Picture-in-picture)

To build the floating video player which can expand to fill the whole screen,we use
a LayoutBuilder to fit the screen perfectly.

Before going ahead we define a few values,namely,what size the video player will be
when shrunk and expanded.We don’t set the width for the expanded player,instead,we
take it from the Layout Builder.

1
2
3
4
5
6
7
8
9
10
var currentAlignment = Alignment.topCenter;
var minVideoHeight = 100.0;
var minVideoWidth = 150.0;
var maxVideoHeight = 200.0;

var maxVideoWidth = 250.0;
var currentVideoHeight = 200.0;
var currentVideoWidth = 200.0;

bool isInSmallMode = false;

Here,”small mode” is when the video player is shrunk.

The LayoutBuilder which builds the VideoDetail Screen can be written as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
LayoutBuilder(builder: (context, constraints) {
maxVideoWidth = constraints.biggest.width;
if (!isInSmallMode) {
currentVideoWidth = maxVideoWidth;
}
return Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Expanded(
child: Align(
child: Padding(
padding: EdgeInsets.all(isInSmallMode ? 8.0 : 0.0),
child: GestureDetector(
child: Container(
width: currentVideoWidth,
height: currentVideoHeight,
child: Image.asset(
videos[videoIndexSelected].imagePath,
fit: BoxFit.cover,
),
color: Colors.blue,
),
onVerticalDragEnd: (details) {
if (details.velocity.pixelsPerSecond.dy > 0) {
setState(() {
isInSmallMode = true;
});
} else if (details.velocity.pixelsPerSecond.dy < 0) {
setState(() {});
}
},
),
),
alignment: currentAlignment,
),
flex: 3,
),
currentAlignment == Alignment.topCenter
? Expanded(
flex: 6,
child: Container(
child: Column(
children: <Widget>[
Row(),
Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Video Recommendation'),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Video Recommendation'),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Video Recommendation'),
),
),
),
],
),
color: Colors.white,
),
)
: Container(),
Row(),
],
);
});

Notice how we’re getting the maximum screen width and then using that instead of
using our first arbitrary value for maximum screen width.

We have attached a GestureDetector to detect swips on the screen so that we can
shrink and expand it accordingly.Let’s create the animations.

Animating the Video Detail Screen

When we animate,we need to take care of two things:

  1. Bringing the video from top to the bottom right.
  2. Changing the size of the video and making it smaller.

For these things,we use two Tweens,an AlignmentTween and a Tween and construct
two separate animations which will run concurrently.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
AnimationController alignmentAnimationController;
Animation alignmentAnimation;

AnimationController videoViewController;
Animation videoViewAnimation;

@override
void initState() {
super.initState();
alignmentAnimationController =
AnimationController(vsync: this, duration: Duration(seconds: 1))
..addListener(() {
setState(() {
currentAlignment = alignmentAnimation.value;
});
});
alignmentAnimation =
AlignmentTween(begin: Alignment.topCenter, end: Alignment.bottomRight)
.animate(CurvedAnimation(
parent: alignmentAnimationController,
curve: Curves.fastOutSlowIn));
videoViewController =
AnimationController(vsync: this, duration: Duration(seconds: 1))
..addListener(() {
setState(() {
currentVideoWidth = (maxVideoWidth * videoViewAnimation.value) +
(minVideoHeight * (1.0 - videoViewAnimation.value));
currentVideoHeight = (maxVideoHeight * videoViewAnimation.value) +
(minVideoHeight * (1.0 - videoViewAnimation.value));
});
});

videoViewAnimation =
Tween<double>(begin: 1.0, end: 0.0).animate(videoViewController);
}

We trigger these animations when our video player is swiped up or down.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
onVerticalDragEnd: (details) {
if (details.velocity.pixelsPerSecond.dy > 0) {
setState(() {
isInSmallMode = true;
alignmentAnimationController.forward();
videoViewController.forward();
});
} else if (details.velocity.pixelsPerSecond.dy < 0) {
setState(() {
alignmentAnimationController.reverse();
videoViewController.reverse().then((value) {
setState(() {
isInSmallMode = false;
});
});
});
}
},

This is the final result of the code:



This is the final code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
import 'package:flutter/material.dart';
import 'package:flutterchallenge/VideoItemModel.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Challenge YouTube',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}

class MyHomePage extends StatefulWidget {
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
var videos = [
VideoItemModel(
"Gordon Ramsay Cooked For Vladimir Putin",
"The Late Show with Stephen Colbert\n1.1M views.2 weeks ago",
"assets/images/youtube/youtube_one.jpg"),
VideoItemModel(
"Hailee Steinfeld, Alesso - Let Me Go",
"Hailee Steinfeld\n57M views.8 months ago",
"assets/images/youtube/youtube_two.jpg"),
VideoItemModel(
"Charlie Puth - Look At Me Now",
"Lyricwood\n4.7M views.4 months ago",
"assets/images/youtube/youtube_three.jpg")
];

var currentAlignment = Alignment.topCenter;
var minVideoHeight = 100.0;
var minVideoWidth = 150.0;
var maxVideoHeight = 200.0;

var maxVideoWidth = 250.0;
var currentVideoHeight = 200.0;
var currentVideoWidth = 200.0;

bool isInSmallMode = false;
var videoIndexSelected = -1;

AnimationController alignmentAnimationController;
Animation alignmentAnimation;

AnimationController videoViewController;
Animation videoViewAnimation;

@override
void initState() {
super.initState();
alignmentAnimationController =
AnimationController(vsync: this, duration: Duration(seconds: 1))
..addListener(() {
setState(() {
currentAlignment = alignmentAnimation.value;
});
});
alignmentAnimation =
AlignmentTween(begin: Alignment.topCenter, end: Alignment.bottomRight)
.animate(CurvedAnimation(
parent: alignmentAnimationController,
curve: Curves.fastOutSlowIn));
videoViewController =
AnimationController(vsync: this, duration: Duration(seconds: 1))
..addListener(() {
setState(() {
currentVideoWidth = (maxVideoWidth * videoViewAnimation.value) +
(minVideoHeight * (1.0 - videoViewAnimation.value));
currentVideoHeight = (maxVideoHeight * videoViewAnimation.value) +
(minVideoHeight * (1.0 - videoViewAnimation.value));
});
});

videoViewAnimation =
Tween<double>(begin: 1.0, end: 0.0).animate(videoViewController);
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
FontAwesomeIcons.youtube,
color: Colors.red,
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
'YouTube',
style: TextStyle(
color: Colors.black,
letterSpacing: -1.0,
fontWeight: FontWeight.w700,
),
),
)
],
),
actions: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Icon(
Icons.videocam,
color: Colors.black54,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Icon(Icons.search, color: Colors.black54),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Icon(Icons.account_circle, color: Colors.black54),
)
],
),
body: Stack(children: <Widget>[
Center(
child: ListView.builder(
itemCount: 3,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
setState(() {
videoIndexSelected = position;
});
},
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Image.asset(
videos[position].imagePath,
fit: BoxFit.cover,
),
)
],
),
Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Icon(
Icons.account_circle,
size: 40.0,
),
flex: 2,
),
Expanded(
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Text(
videos[position].title,
style: TextStyle(fontSize: 18.0),
),
),
Text(
videos[position].publisher,
style: TextStyle(color: Colors.black54),
),
],
crossAxisAlignment: CrossAxisAlignment.start,
),
flex: 9,
),
Expanded(
flex: 1,
child: Icon(Icons.more_vert),
),
],
),
)
],
),
);
},
),
),
videoIndexSelected > -1
? LayoutBuilder(builder: (context, constraints) {
maxVideoWidth = constraints.biggest.width;
if (!isInSmallMode) {
currentVideoWidth = maxVideoWidth;
}
return Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Expanded(
child: Align(
child: Padding(
padding: EdgeInsets.all(isInSmallMode ? 8.0 : 0.0),
child: GestureDetector(
child: Container(
width: currentVideoWidth,
height: currentVideoHeight,
child: Image.asset(
videos[videoIndexSelected].imagePath,
fit: BoxFit.cover,
),
color: Colors.blue,
),
onVerticalDragEnd: (details) {
if (details.velocity.pixelsPerSecond.dy > 0) {
setState(() {
isInSmallMode = true;
alignmentAnimationController.forward();
videoViewController.forward();
});
} else if (details.velocity.pixelsPerSecond.dy <
0) {
setState(() {
alignmentAnimationController.reverse();
videoViewController.reverse().then((value) {
setState(() {
isInSmallMode = false;
});
});
});
}
},
),
),
alignment: currentAlignment,
),
flex: 3,
),
currentAlignment == Alignment.topCenter
? Expanded(
flex: 6,
child: Container(
child: Column(
children: <Widget>[
Row(),
Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Video Recommendation'),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Video Recommendation'),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Video Recommendation'),
),
),
),
],
),
color: Colors.white,
),
)
: Container(),
Row(),
],
);
})
: Container()
]),
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(
Icons.home,
color: Colors.black54,
),
title: Text("Home",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
FontAwesomeIcons.fire,
color: Colors.black54,
),
title: Text("Trending",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
Icons.subscriptions,
color: Colors.black54,
),
title: Text("Subscriptions",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
Icons.email,
color: Colors.black54,
),
title: Text("Inbox",
style: TextStyle(
color: Colors.black54,
)),
),
BottomNavigationBarItem(
icon: Icon(
Icons.folder,
color: Colors.black54,
),
title: Text("Library",
style: TextStyle(
color: Colors.black54,
)),
),
],
type: BottomNavigationBarType.fixed,
),
);
}
}