こんにちは。
今回は、テキストのスタイルを設定する方法を紹介します。
方法
Textのテキストを設定するには、引数「style」を使います。
まず、Textの引数「style」にTextStyleを指定します。
そして、
太字にするには、TextStyleの引数「fontWeight」に「FontWeight.bold」を指定します。
文字色を変えるには、TextStyleの引数「color」に「Colors.文字色」を指定します。
使用例
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.pink, //背景の色を選択
title: const Text("Flutter!!!!"), //タイトルを表示
),
body: const Column(
children: [
Text(
"太文字",
style: TextStyle(fontWeight: FontWeight.bold),//太文字
),
Text(
"文字色ピンク",
style: TextStyle(color: Colors.pink),//文字色ピンク
),
],
));
}
}