-1

In Flutter, How do I push a screen so that it appears inside the tab, rather than full screen.

Here is my code:

Card(
  color: Colors.white,
  child: ListTile(
    title: Text("PRIVACY POLICY", style: Styles.textDark),
    trailing: Icon(Icons.arrow_forward_ios),
    onTap: () => Navigator.of(context).push(CupertinoPageRoute(builder: (context) => SinglePageTextView("PRIVACY POLICY", "/assets/privacy.txt"))),
  ),
)

PS: I have tried the fullscreenDialog setting on CupertinoPageRoute, and it does nothing!

Source screen:

When tapped Privacy Policy, this shows up:

This is what I am trying to achieve (tab bar is still showing!):

Thanks in advance for the help.

Ajay Gautam
  • 997
  • 12
  • 14

2 Answers2

1

Instead of using Navigator, use setState() to change the current page content to one you need.

0

Maybe you could use an ExpansionTile to achieve your goal?

ExpansionTile(
      title: Text("I'm expandable."),
      children: <Widget>[
        Text("Hello, here I am."),
      ],
    ),