Flutter
Text widget 사용법(flutter)
마느아
2021. 8. 16. 09:10
반응형
Text widget은 앱에서 Text를 보이고 싶을때 주로 사용한다.
Text widget 내부에서 Text의 폰트나 크기등을 조정 가능하다.
Text위젯을 이런식으로 사용헀을 경우 다음과 같은 결과가 나온다.
1
2
3
4
5
6
7
8
|
Text('hello world',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.green,
),
),
|
cs |

이 부분은 아래 링크의 title에서 Text 내부만 수정한 것으로,
플러터 AppBar 총정리
AppBar는 이미지에서도 볼 수 있듯이, 앱 상단에 위치하는 부분을 AppBar라고 한다. AppBar는 주로 메뉴버튼을 만들거나, 제목을 다는 등 다양한 용도로 사용할 수 있다. 우선 다음과 같이 AppBar에 관한
learncom1234.tistory.com
TextAlign은 center, left, right등을 통해 왼쪽정렬, 가운데 정렬, 오른쪽 정렬이 가능하다.
(하지만 바깥에 그 text의 위치를 fix할경우 적용되지 않을 수 있다. ex) appBar의 centertitle)
Textstyle 내부:
fontSize: 폰트 크기 조절
fontWeight: 폰트 변경(bold가 가장 많이 쓰임)
color: 색상 변경
반응형