Skip to content

Commit

Permalink
fix: #2009 - product page will always pull down - and refresh (#2618)
Browse files Browse the repository at this point in the history
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 6a4c29f commit ca960ed
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
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 ca960ed

Please sign in to comment.