Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing the default back arrow on certain pages

Tags:

flutter

From my understanding that a back arrow appears after navigating to any page by default. is there a way not to include the back arrow on a certain page of my choice ?

like image 957
Shady Aziza Avatar asked Oct 15 '25 08:10

Shady Aziza


2 Answers

Duplicate of https://stackoverflow.com/a/44978595/3013538

I believe the solutions are the following

You actually either:

  • Don't want to display that ugly back button ( :] ), and thus go for : AppBar(...,automaticallyImplyLeading: false,...);

  • Don't want the user to go back - replacing current view - and thus go for: Navigator.pushReplacementNamed(## your routename here ##);

  • Don't want the user to go back - replacing a certain view back in the stack - and thus use: Navigator.pushNamedAndRemoveUntil(## your routename here ##, f(Route<dynamic>)→bool); where f is a function returning truewhen meeting the last view you want to keep in the stack (right before the new one);

  • Don't want the user to go back - EVER - emptying completely the navigator stack with: Navigator.pushNamedAndRemoveUntil(## your routename here ##, (_) => false);

Cheers

like image 140
Fabio Veronese Avatar answered Oct 17 '25 01:10

Fabio Veronese


To hide the back button, set the automaticallyImplyLeading property of the Appbar as false

new Scaffold(
            appBar: new AppBar(
              automaticallyImplyLeading: false,
            )
)
like image 32
Shyju M Avatar answered Oct 17 '25 00:10

Shyju M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!