Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add state restoration to LicensePage #145886

Open
triallax opened this issue Mar 28, 2024 · 3 comments
Open

Add state restoration to LicensePage #145886

triallax opened this issue Mar 28, 2024 · 3 comments
Labels
a: state restoration RestorationManager and related APIs c: proposal A detailed proposal for a change to Flutter f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-design Owned by Design Languages team triaged-design Triaged by Design Languages team

Comments

@triallax
Copy link

triallax commented Mar 28, 2024

Use case

I'm setting up state restoration for my app, but LicensePage doesn't have support for it. For instance, if I scroll down in the LicensePage and then leave the app while "Don't keep activities" is enabled, the scroll position is lost. And if I press on one of the list tiles, opening a new page with the licenses of a specific package, then I leave the app and open it again, I'm thrown back to the main LicensePage.

To be clear, I'm not using showLicensePage here, because I'm aware that it uses Navigator.push to push the LicensePage route, where Navigator.push doesn't support state restoration. So I used Navigator.restorablePush manually to push the page route:

class FooWidget extends StatelessWidget {
  @pragma('vm:entry-point')
  static Route<void> _buildLicensePageRoute(
      BuildContext context, Object? arguments) {
    return MaterialPageRoute(
      builder: (context) => LicensePage(
        applicationName: 'foo',
        applicationVersion: 'v1.0.0',
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    // ...
    return TextButton(child: Text('foo'), onPressed: () => Navigator.restorablePush(context, _buildLicensePageRoute));
  }
}

Which is why the main LicensePage route itself is still restored.

Proposal

Add state restoration support in LicensePage and its subpages.

@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Mar 28, 2024
@danagbemava-nc danagbemava-nc changed the title LicensePage does not support state restoration Add state restoration to LicensePage Mar 28, 2024
@danagbemava-nc danagbemava-nc added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. c: proposal A detailed proposal for a change to Flutter a: state restoration RestorationManager and related APIs team-design Owned by Design Languages team and removed in triage Presently being triaged by the triage team labels Mar 28, 2024
@HansMuller HansMuller added the P2 Important issues not at the top of the work list label Mar 28, 2024
@triallax
Copy link
Author

@HansMuller is there a reason why I was assigned?

@HansMuller
Copy link
Contributor

Sorry about that, I thought you had a PR open.

@triallax
Copy link
Author

No worries. :)

@HansMuller HansMuller added the triaged-design Triaged by Design Languages team label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: state restoration RestorationManager and related APIs c: proposal A detailed proposal for a change to Flutter f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-design Owned by Design Languages team triaged-design Triaged by Design Languages team
Projects
None yet
Development

No branches or pull requests

3 participants