[Flutter_study] Section 6 review
Flutter

[Flutter_study] Section 6 review

728x90

● font 사용하기

- 폰드 다운로드

https://fonts.google.com/

 

Google Fonts

Making the web more beautiful, fast, and open through great typography

fonts.google.com

- 다운 받은 폰트 pubspec.yaml에 추가

https://flutter.dev/docs/cookbook/design/fonts#from-packages

 

Use a custom font

How to use custom fonts.

flutter.dev

- pubspec.yaml

1
2
3
4
  fonts:
    - family: Pacifico
      fonts:
        - asset: fonts/Pacifico-Regular.ttf
cs

- main.dart에서 사용

1
2
3
4
5
6
7
8
9
Text(
                'Kim Soo Bin',
                style: TextStyle(
                  fontSize: 40.0,
                  fontFamily: 'Pacifico',
                  color: Colors.white,
                  fontWeight: FontWeight.bold,
                ),
              ),
cs

 

● icon 사용하기

- 사용할 수 있는 아이콘 검색 -> 이름 알아내기

https://materialdesignicons.com/

 

Material Design Icons

Material Design Icons' growing icon collection allows designers and developers targeting various platforms to download icons in the format, color and size they need for any project. Loading... Sponsored by Icons8 Material Icon Sets

materialdesignicons.com

- main.dart에서 사용

1
2
3
4
Icon(
                      Icons.email,
                      color: Colors.teal,
                    ),
cs

 

● Card, ListTile 사용하기

- Card

https://flutter.dev/docs/development/ui/layout#card

 

Layouts in Flutter

Learn how Flutter's layout mechanism works and how to build a layout.

flutter.dev

- ListTile

https://flutter.dev/docs/development/ui/layout#listtile

 

Layouts in Flutter

Learn how Flutter's layout mechanism works and how to build a layout.

flutter.dev

 

● 소스코드

-main.dart

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
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
 
void main() {
  runApp(
    MyApp()
  );
}
 
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.teal,
        body: SafeArea(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              CircleAvatar(
                radius: 50.0,
                backgroundImage: AssetImage('images/soobin.jpg'),
              ),
              Text(
                'Kim Soo Bin',
                style: TextStyle(
                  fontSize: 40.0,
                  fontFamily: 'Pacifico',
                  color: Colors.white,
                  fontWeight: FontWeight.bold,
                ),
              ),
              Text(
                'FLUTTER DEVELOPER',
                style: TextStyle(
                  color: Colors.teal.shade100,
                  fontSize: 20.0,
                  letterSpacing:  2.5,
                  fontWeight: FontWeight.bold,
 
                )
              ),
              SizedBox(
                height: 20.0,
                width: 150.0,
                child: Divider(
                  color: Colors.teal.shade100,
                ),
              ),
              Card(
                  margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 25.0),
                  child: ListTile(
                    leading: Icon(
                      Icons.phone,
                      color: Colors.teal,
                    ),
                    title: Text(
                      '+44 123 456 789',
                      style: TextStyle(
                        color: Colors.teal.shade900,
                        fontFamily: 'Source Sans Pro',
                        fontSize: 20.0,
                      ),
                    ),
                  )),
              Card(
                  margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 25.0),
                  child: ListTile(
                    leading: Icon(
                      Icons.email,
                      color: Colors.teal,
                    ),
                    title: Text(
                      'tnqlsqks27@gmail.com',
                      style: TextStyle(
                          fontSize: 20.0,
                          color: Colors.teal.shade900,
                          fontFamily: 'Source Sans Pro'),
                    ),
                  ))
            ],
          )
        )
      )
    );
  }
}
cs

 

-pubspec.yaml

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
name: mi_card
description: A new Flutter application.
 
version: 1.0.0+1
 
environment:
  sdk: ">=2.1.0 <3.0.0"
 
dependencies:
  flutter:
    sdk: flutter
 
  cupertino_icons: ^0.1.2
 
dev_dependencies:
  flutter_test:
    sdk: flutter
 
flutter:
 
  uses-material-design: true
  assets:
    - images/
 
  fonts:
    - family: Pacifico
      fonts:
        - asset: fonts/Pacifico-Regular.ttf
 
 
 
cs

 

실행 결과

 

728x90

'Flutter' 카테고리의 다른 글

[Flutter] 구글맵 API 사용하기-2  (0) 2021.05.25
[Flutter] 구글맵 API 사용하기  (0) 2021.05.24
[Flutter_study] Section 7 review  (0) 2021.05.23
[Flutter_study] Section 5~6 review  (0) 2021.05.18
[Flutter_study] Section 1~4 review  (0) 2021.05.15