Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Conversation

shihaohong
Copy link

@shihaohong shihaohong commented Nov 18, 2020

This introduces state restoration to:

The expansion state of the Material/Cupertino/other category lists.

Demo

  1. Go on the home page
  2. Scroll down and under "Categories", tap "MATERIAL", "CUPERTINO", or "STYLES & OTHER".
  3. Kill the Android app and reopen, notice that the scroll location and the expansion states are preserved

Restores if you're on a particular Material/Cupertino/Other page

Demo

  1. Go on the home page
  2. Scroll down and under "Categories", tap "MATERIAL", "CUPERTINO", or "STYLES & OTHER".
  3. Tap on any of the demos.
  4. Kill the app, notice that the the page is preserved.

The state of the some Material demo pages

  1. Banner
  2. Bottom app bar
  3. Bottom navigation

Demo

  1. Go on the home page
  2. Scroll down and under "Categories", tap "MATERIAL", "CUPERTINO", or "STYLES & OTHER".
  3. Tap on any of the demos.
  4. Tap any of the action icons in the AppBar (except the flutter API doc one).
  5. Kill the app, notice that the page's state is preserved (Code sample is shown, or description of the widget is shown).

@shihaohong shihaohong requested review from rami-a, JoseAlba and goderbauer and removed request for rami-a November 18, 2020 03:23
@@ -70,9 +77,7 @@ class _CategoryListItemState extends State<CategoryListItem>
end: BorderRadius.zero,
).animate(_controller);

_isExpanded = PageStorage.of(context)?.readState(context) as bool ??
Copy link
Author

@shihaohong shihaohong Nov 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rami-a @JoseAlba Any idea why PageStorage is used for this particular widget? It currently does not support state restoration, but it seems like it's unnecessarily used here. I was able to remove it and have it work without any issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't actually recall. I think it's probably safe to remove it

Copy link
Contributor

@rami-a rami-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@shihaohong shihaohong merged commit 35c6793 into flutter:master Nov 19, 2020
@shihaohong shihaohong deleted the restore-widget-samples branch November 19, 2020 13:55
@shihaohong shihaohong changed the title Restorable Material Code Samples Restorable Material Code Samples - Part 1/? Nov 20, 2020
@shihaohong shihaohong changed the title Restorable Material Code Samples - Part 1/? Restorable Material Code Samples - Part 1/3 Dec 16, 2020
@shihaohong shihaohong changed the title Restorable Material Code Samples - Part 1/3 [State Restoration] Restorable Material Code Samples - Part 1/3 Feb 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants