Skip to content

Commit

Permalink
fix: openfoodfacts#2009 - product page will always pull down - and re…
Browse files Browse the repository at this point in the history
…fresh

For the record, tested on `3489940014075` on server `world.openbeautyfacts.org`.

I've also written the explanation behind the trick - perhaps that would make sense to create a wiki about nice tricks:
```dart
// /!\ Smart Dart
// `physics: const AlwaysScrollableScrollPhysics()`
// means that we will always scroll, even if it's pointless.
// Why do we need to? For the RefreshIndicator, that wouldn't be
// triggered on a ListView smaller than the screen
// (as there will be no scroll).
```

Impacted file:
 `new_product_page.dart`: forced the page content to scroll even when not necessary
  • Loading branch information
monsieurtanuki committed Jul 18, 2022
1 parent 6b52473 commit a09b8f6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/smooth_app/lib/pages/product/new_product_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,13 @@ class _ProductPageState extends State<ProductPage> with TraceableClientMixin {
return RefreshIndicator(
onRefresh: () => _refreshProduct(context),
child: ListView(
controller: _scrollController,
// /!\ Smart Dart
// `physics: const AlwaysScrollableScrollPhysics()`
// means that we will always scroll, even if it's pointless.
// Why do we need to? For the RefreshIndicator, that wouldn't be
// triggered on a ListView smaller than the screen
// (as there will be no scroll).
physics: const AlwaysScrollableScrollPhysics(),
children: <Widget>[
Align(
heightFactor: 0.7,
Expand Down

0 comments on commit a09b8f6

Please sign in to comment.