Reputation: 21
do you have any way to open new screen without using navigation, i want when i open a new screen, the fist stop and play continuous when i go back from the second screen,
i want when i open many creen like the image below, the D creen have a button the button will go back to the A creen, not open new tab A creen
I dont't want it like this:
I want this:
Upvotes: 1
Views: 2395
Reputation: 975
There can be 2 ways to this:
Navigator.popUntil
since you have to go back to the first screen. This can only be used in case you know how many screens you want to pop.count = 0;
Navigator.popUntil(context, (route) {
return count++ == 2;
});
Navigator.pushReplacementNamed
route. Check the link for more reference https://api.flutter.dev/flutter/widgets/Navigator/pushReplacementNamed.htmlNavigator.pushReplacementNamed(context, folder/A)
Upvotes: 0
Reputation: 83
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) => A(),
),
(Route route) => false,
);
Above line help you to achieve your requirement.
Replace A() With your destination class.
Upvotes: 1