diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart index 829f357aa0f..137c7998646 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart @@ -52,6 +52,8 @@ class UserPreferencesPage extends StatefulWidget { class _UserPreferencesPageState extends State with TraceableClientMixin { + final ScrollController _controller = ScrollController(); + @override String get traceTitle => 'user_preferences_page'; @@ -120,6 +122,7 @@ class _UserPreferencesPageState extends State final ListView list; if (addDividers) { list = ListView.separated( + controller: _controller, padding: padding, itemCount: children.length, itemBuilder: (BuildContext context, int position) => children[position], @@ -128,6 +131,7 @@ class _UserPreferencesPageState extends State ); } else { list = ListView.builder( + controller: _controller, padding: padding, itemCount: children.length, itemBuilder: (BuildContext context, int position) => children[position], @@ -143,7 +147,10 @@ class _UserPreferencesPageState extends State ), leading: const SmoothBackButton(), ), - body: Scrollbar(child: list), + body: Scrollbar( + controller: _controller, + child: list, + ), ); } final bool dark = Theme.of(context).brightness == Brightness.dark; @@ -174,7 +181,10 @@ class _UserPreferencesPageState extends State maxLines: 2, ), ), - body: ListView(children: children), + body: ListView( + controller: _controller, + children: children, + ), ); } diff --git a/packages/smooth_app/lib/pages/product/edit_product_page.dart b/packages/smooth_app/lib/pages/product/edit_product_page.dart index 64f00b18ac6..4b9ca012b69 100644 --- a/packages/smooth_app/lib/pages/product/edit_product_page.dart +++ b/packages/smooth_app/lib/pages/product/edit_product_page.dart @@ -123,130 +123,127 @@ class _EditProductPageState extends State with UpToDateMixin { barcode: barcode, widget: this, ), - child: PrimaryScrollController( + child: Scrollbar( controller: _controller, - child: Scrollbar( - child: ListView( - children: [ - if (_ProductBarcode.isAValidBarcode(barcode)) - _ProductBarcode(product: upToDateProduct), - _ListTitleItem( - title: appLocalizations.edit_product_form_item_details_title, - subtitle: - appLocalizations.edit_product_form_item_details_subtitle, - onTap: () async => ProductFieldDetailsEditor().edit( - context: context, - product: upToDateProduct, - ), + child: ListView( + controller: _controller, + children: [ + if (_ProductBarcode.isAValidBarcode(barcode)) + _ProductBarcode(product: upToDateProduct), + _ListTitleItem( + title: appLocalizations.edit_product_form_item_details_title, + subtitle: + appLocalizations.edit_product_form_item_details_subtitle, + onTap: () async => ProductFieldDetailsEditor().edit( + context: context, + product: upToDateProduct, ), - _ListTitleItem( - leading: const Icon(Icons.add_a_photo_rounded), - title: appLocalizations.edit_product_form_item_photos_title, - subtitle: - appLocalizations.edit_product_form_item_photos_subtitle, - onTap: () async { - AnalyticsHelper.trackProductEdit( - AnalyticsEditEvents.photos, - barcode, - ); + ), + _ListTitleItem( + leading: const Icon(Icons.add_a_photo_rounded), + title: appLocalizations.edit_product_form_item_photos_title, + subtitle: + appLocalizations.edit_product_form_item_photos_subtitle, + onTap: () async { + AnalyticsHelper.trackProductEdit( + AnalyticsEditEvents.photos, + barcode, + ); - await Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - ProductImageGalleryView( - product: upToDateProduct, - ), - fullscreenDialog: true, + await Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + ProductImageGalleryView( + product: upToDateProduct, ), - ); - }, - ), - _getMultipleListTileItem( - [ - SimpleInputPageLabelHelper(), - SimpleInputPageStoreHelper(), - SimpleInputPageOriginHelper(), - SimpleInputPageEmbCodeHelper(), - SimpleInputPageCountryHelper(), - SimpleInputPageCategoryHelper(), - ], + fullscreenDialog: true, + ), + ); + }, + ), + _getMultipleListTileItem( + [ + SimpleInputPageLabelHelper(), + SimpleInputPageStoreHelper(), + SimpleInputPageOriginHelper(), + SimpleInputPageEmbCodeHelper(), + SimpleInputPageCountryHelper(), + SimpleInputPageCategoryHelper(), + ], + ), + _ListTitleItem( + leading: const _SvgIcon('assets/cacheTintable/ingredients.svg'), + title: + appLocalizations.edit_product_form_item_ingredients_title, + onTap: () async => ProductFieldOcrIngredientEditor().edit( + context: context, + product: upToDateProduct, ), - _ListTitleItem( + ), + _getSimpleListTileItem(SimpleInputPageCategoryHelper()), + _ListTitleItem( leading: - const _SvgIcon('assets/cacheTintable/ingredients.svg'), - title: - appLocalizations.edit_product_form_item_ingredients_title, - onTap: () async => ProductFieldOcrIngredientEditor().edit( - context: context, - product: upToDateProduct, - ), - ), - _getSimpleListTileItem(SimpleInputPageCategoryHelper()), - _ListTitleItem( - leading: const _SvgIcon( - 'assets/cacheTintable/scale-balance.svg'), - title: appLocalizations - .edit_product_form_item_nutrition_facts_title, - subtitle: appLocalizations - .edit_product_form_item_nutrition_facts_subtitle, - onTap: () async { - AnalyticsHelper.trackProductEdit( - AnalyticsEditEvents.nutrition_Facts, - barcode, - ); - await NutritionPageLoaded.showNutritionPage( - product: upToDateProduct, - isLoggedInMandatory: true, - context: context, - ); - }), - _getSimpleListTileItem(SimpleInputPageLabelHelper()), - _ListTitleItem( - leading: const _SvgIcon('assets/cacheTintable/packaging.svg'), - title: appLocalizations.edit_packagings_title, - onTap: () async => ProductFieldPackagingEditor().edit( - context: context, - product: upToDateProduct, - ), - ), - _ListTitleItem( - leading: const Icon(Icons.recycling), - title: - appLocalizations.edit_product_form_item_packaging_title, - onTap: () async => ProductFieldOcrPackagingEditor().edit( - context: context, - product: upToDateProduct, - ), - ), - _getSimpleListTileItem(SimpleInputPageStoreHelper()), - _getSimpleListTileItem(SimpleInputPageOriginHelper()), - _getSimpleListTileItem(SimpleInputPageEmbCodeHelper()), - _getSimpleListTileItem(SimpleInputPageCountryHelper()), - _ListTitleItem( + const _SvgIcon('assets/cacheTintable/scale-balance.svg'), title: appLocalizations - .edit_product_form_item_other_details_title, + .edit_product_form_item_nutrition_facts_title, subtitle: appLocalizations - .edit_product_form_item_other_details_subtitle, + .edit_product_form_item_nutrition_facts_subtitle, onTap: () async { - if (!await ProductRefresher().checkIfLoggedIn(context)) { - return; - } AnalyticsHelper.trackProductEdit( - AnalyticsEditEvents.otherDetails, + AnalyticsEditEvents.nutrition_Facts, barcode, ); - await Navigator.push( - context, - MaterialPageRoute( - builder: (_) => AddOtherDetailsPage(upToDateProduct), - fullscreenDialog: true, - ), + await NutritionPageLoaded.showNutritionPage( + product: upToDateProduct, + isLoggedInMandatory: true, + context: context, ); - }, + }), + _getSimpleListTileItem(SimpleInputPageLabelHelper()), + _ListTitleItem( + leading: const _SvgIcon('assets/cacheTintable/packaging.svg'), + title: appLocalizations.edit_packagings_title, + onTap: () async => ProductFieldPackagingEditor().edit( + context: context, + product: upToDateProduct, ), - ], - ), + ), + _ListTitleItem( + leading: const Icon(Icons.recycling), + title: appLocalizations.edit_product_form_item_packaging_title, + onTap: () async => ProductFieldOcrPackagingEditor().edit( + context: context, + product: upToDateProduct, + ), + ), + _getSimpleListTileItem(SimpleInputPageStoreHelper()), + _getSimpleListTileItem(SimpleInputPageOriginHelper()), + _getSimpleListTileItem(SimpleInputPageEmbCodeHelper()), + _getSimpleListTileItem(SimpleInputPageCountryHelper()), + _ListTitleItem( + title: + appLocalizations.edit_product_form_item_other_details_title, + subtitle: appLocalizations + .edit_product_form_item_other_details_subtitle, + onTap: () async { + if (!await ProductRefresher().checkIfLoggedIn(context)) { + return; + } + AnalyticsHelper.trackProductEdit( + AnalyticsEditEvents.otherDetails, + barcode, + ); + await Navigator.push( + context, + MaterialPageRoute( + builder: (_) => AddOtherDetailsPage(upToDateProduct), + fullscreenDialog: true, + ), + ); + }, + ), + ], ), ), ),