기본 텍스트 입력
class Home extends StatelessWidget {
// const Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Text('안녕 나는 한별'),
);
}
}

텍스트 스타일 지정
class Home extends StatelessWidget {
// const Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Text('안녕 나는 한별',
style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),
),
);
}
}

여러개의 다른 스타일을 가진 문자를 화면에 그린다.
RichText는 DefaultTextStyle을 기본적으로 적용하지 않아 기본 스타일을 명시해야한다. (이게 대체 먼소리당가 ㅡㅡ)
class Home extends StatelessWidget {
// const Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: RichText(
text: TextSpan(
text:'안녕하세요',
style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(text: '텍스트',style: TextStyle(fontWeight: FontWeight.bold, color: Colors.red)),
TextSpan(text:'한별이예요')
]
),
),
);
}
}
