[무작정 플러터 강의노트] 01 네비게이션 탭이 있는 앱 프로젝트 구조 설정하기

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
// lib/main.dart
import 'package:flutter/material.dart';
import 'package:netflix_clone_lecture_note/widget/bottom_bar.dart';

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

class MyApp extends StatefulWidget {
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
TabController controller;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Bbongflix',
theme: ThemeData(
brightness: Brightness.dark,
primaryColor: Colors.black,
accentColor: Colors.white,
),
home: DefaultTabController(
length: 4,
child: Scaffold(
body: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: <Widget>[
Container(
child: Center(
child: Text('home'),
),
),
Container(
child: Center(
child: Text('search'),
),
),
Container(
child: Center(
child: Text('save'),
),
),
Container(
child: Center(
child: Text('more'),
),
),
],
),
bottomNavigationBar: Bottom(),
),
),
);
}
}
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
// lib/widget/bottom_bar.dart
import 'package:flutter/material.dart';

class Bottom extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.black,
child: Container(
height: 50,
child: TabBar(
labelColor: Colors.white,
unselectedLabelColor: Colors.white60,
indicatorColor: Colors.transparent,
tabs: <Widget>[
Tab(
icon: Icon(
Icons.home,
size: 18,
),
child: Text(
'홈',
style: TextStyle(fontSize: 9),
),
),
Tab(
icon: Icon(
Icons.search,
size: 18,
),
child: Text(
'검색',
style: TextStyle(fontSize: 9),
),
),
Tab(
icon: Icon(
Icons.save_alt,
size: 18,
),
child: Text(
'저장한 콘텐츠 목록',
style: TextStyle(fontSize: 9),
),
),
Tab(
icon: Icon(
Icons.list,
size: 18,
),
child: Text(
'더보기',
style: TextStyle(fontSize: 9),
),
),
],
),
),
);
}
}

[무작정 플러터 강의노트] 01 네비게이션 탭이 있는 앱 프로젝트 구조 설정하기

https://taebbong.github.io/2020/03/21/2020-03-21-bbongflix-lec01-post/

Author

TaeBbong Kwon

Posted on

2020-03-21

Updated on

2022-08-06

Licensed under

Comments