Overview.
RichText에 대해 알아보자
- RichText
0. 문서
https://api.flutter.dev/flutter/widgets/RichText-class.html
1. RichText
뭐 밑과 같이 알 수 있듯이 텍스트를 좀 더 꾸미거나 할때 쓰인다. 그리고 아무리 글을 써도 창을 넘지 않을 수 있다!!!(오류가 나지 않는다.)
함께 쓰이는 위젯은 TextSpan 으로 계속 쓰이는 것 같다.
RichText(
text: TextSpan(
text: 'Hello ',
style: DefaultTextStyle.of(context).style,
children: const <TextSpan>[
TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: ' world!'),
],
),
)
RichText(
text: const TextSpan(text: 'Hello'),
selectionRegistrar: SelectionContainer.maybeOf(context),
selectionColor: const Color(0xAF6694e8),
)
'flutter & dart' 카테고리의 다른 글
flutter & dart - 도형을 만드는 ClipRRect , ClipOval , ClipPath (0) | 2024.04.01 |
---|---|
flutter & dart - ListTile 위젯 (0) | 2024.04.01 |
flutter & dart - ListView.builder (0) | 2024.03.21 |
flutter & dart - TextEditingController (0) | 2024.03.21 |
flutter & dart - Flutter MVVM 패턴 (0) | 2024.03.19 |