반응형
목적
- Container() 위젯에 있는 여러 요소들의 TextStyle을 한번에 지정하고 싶음.
- Text() 위젯 하나하나에 지정하기 너무 귀찮으니깐...
코드
- DefaultTextStyle() 위젯의 style을 사용해 한번에 적용하기
- 개꿀
- 물론 Theme 파일로 한번에 지정할 수 도 있을 듯?
Container(
margin: EdgeInsets.fromLTRB(10, 0, 0, 0),
child: DefaultTextStyle( // <--- 요고!
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.w700
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
요소()
],
),
Row(
children: [
요소()
],
)
],
),
)
)
'Flutter' 카테고리의 다른 글
[Flutter, Google 공식 문서] 리마인드 1 (1~4) (0) | 2023.09.06 |
---|---|
[Flutter, 토이 프로젝트] 위젯 사이의 간격 간편하게 주고 싶을 때 - SizedBox (0) | 2023.08.22 |
[Flutter, 토이 프로젝트] CustomScrollView 안의 패딩 위젯 - SliverPadding (0) | 2023.08.21 |
[Flutter, 토이 프로젝트] ElevatedButton Radius 변경 - styleFrom (0) | 2023.08.19 |
[Flutter, 토이 프로젝트] 가로,세로 요소 스크롤 & 스와이프 - ListView (0) | 2023.08.19 |