0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Flutter】園児でもタイトルの中央寄せできるもん📛

Posted at

まえがき

[Flutter title中央寄せ🔍]で検索して一番上にでる記事の方法で実装したときにハマっちゃった💦

だから今後はITお兄ちゃん達に悲しい思いをしてほしくないということでこの記事をかくね:relaxed:

いいやりかた⭕️

たぶんこの方法が一番いいとおもうの📛

centerTitle:trueを指定する

main.dart
appBar: AppBar(
  centerTitle: true, // 中央寄せにするパラメーター
  title: Text(
    "たいとる"
  ),
),

これのいいところは戻るボタンが左側に来ても中央寄せがくずれないことなの:point_up:

:point_down:うごきはこんな感じ:point_down:

good-title.gif

よくないやりかた❌

Centerをつかう

main.dart
appBar: AppBar(
  title: new Center(child: new Text("たいとる", textAlign: TextAlign.center))
),

これでだいじょぶなときもあるけど
戻るボタンが左側に来たときに正確な中央寄せにならなくなっちゃうんだ😢

:point_down:うごきはこんな感じ:point_down:
bad-title.gif

おしまい

Flutterべんきょうちゅう!
要望とか訂正事項があったら園児ニアのTwitterに連絡くれたらうれしいな

最後までみてくれて
ありがと。おにいちゃん📛

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?