Skip to content

Commit

Permalink
State restorable fortnightly (flutter#390)
Browse files Browse the repository at this point in the history
* State restorable fortnightly
  • Loading branch information
Shi-Hao Hong authored Dec 17, 2020
1 parent a950e14 commit c8734e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/layout/image_placeholder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ class FadeInImagePlaceholder extends StatelessWidget {
height: height,
fit: fit,
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
// We only need to animate the loading of images on the web. We can
// also return early if the images are already in the cache.
if (wasSynchronouslyLoaded || !kIsWeb) {
if (wasSynchronouslyLoaded) {
return this.child ?? child;
} else {
return AnimatedSwitcher(
Expand Down
2 changes: 2 additions & 0 deletions lib/studies/fortnightly/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class FortnightlyApp extends StatelessWidget {
? const _FortnightlyHomeDesktop()
: const _FortnightlyHomeMobile();
return MaterialApp(
restorationScopeId: 'fortnightly_app',
title: _fortnightlyTitle,
debugShowCheckedModeBanner: false,
theme: buildTheme(context).copyWith(
Expand Down Expand Up @@ -76,6 +77,7 @@ class _FortnightlyHomeMobile extends StatelessWidget {
),
body: SafeArea(
child: ListView(
restorationId: 'list_view',
children: [
HashtagBar(),
for (final item in buildArticlePreviewItems(context))
Expand Down
1 change: 1 addition & 0 deletions lib/studies/fortnightly/shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ class HashtagBar extends StatelessWidget {
return SizedBox(
height: height,
child: ListView(
restorationId: 'hashtag_bar_list_view',
scrollDirection: Axis.horizontal,
children: [
const SizedBox(width: 16),
Expand Down

0 comments on commit c8734e9

Please sign in to comment.