LoginSignup
2
3

More than 3 years have passed since last update.

[Flutter] App bar の X ボタンを非表示にしたい

Last updated at Posted at 2019-12-04

Modal 表示(fullscreenDialog: true)した時のScaffold の AppBar(Navigationbar みたいなの)の左側に出てくるCloseボタンを押せないように(非表示に)したかったので調べたメモです。

AppBar の leading プロパティをいじる

leading プロパティがタイトル前に表示する widget だとドキュメントに書いてあったのでこれをセットします。

非表示にしたいので Container をセットすればOKです。

class PopupScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('title'),
        leading: Container(),
      ),
    ..

Before

image.png

After

image.png

参考

2
3
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
2
3