Reputation: 147
How can I change the function of the back button in de app bar? So I want to go to the home page when you click on the back button how can I make this work?
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: const BackButton(
color: Color(0xFFFD879A),
),
),
Upvotes: 0
Views: 1549
Reputation: 96
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: const BackButton(
color: Color(0xFFFD879A),
onPressed: () {
// execute this on pressed...
},
),
),
Upvotes: 1
Reputation: 17950
Add onPressed
to your leading
:
leading: BackButton(
color: Color(0xFFFD879A),
onPressed: () {
// do your navigate here
print("back click");
},
),
Upvotes: 3