Skip to content

Commit

Permalink
feat: 4616 - no food preferences displayed in onboarding
Browse files Browse the repository at this point in the history
Impacted files:
* `preferences_page.dart`: no food preferences displayed in onboarding
* `summary_card.dart`: minor bug fix where the fast track button was displayed on the onboarding
  • Loading branch information
monsieurtanuki committed Sep 3, 2023
1 parent 1bae5a7 commit 8693cfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
13 changes: 0 additions & 13 deletions packages/smooth_app/lib/pages/onboarding/preferences_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:provider/provider.dart';
import 'package:smooth_app/data_models/onboarding_data_product.dart';
import 'package:smooth_app/data_models/preferences/user_preferences.dart';
import 'package:smooth_app/data_models/product_preferences.dart';
import 'package:smooth_app/database/local_database.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/helpers/app_helper.dart';
import 'package:smooth_app/pages/onboarding/next_button.dart';
import 'package:smooth_app/pages/onboarding/onboarding_flow_navigator.dart';
import 'package:smooth_app/pages/preferences/user_preferences_food.dart';
import 'package:smooth_app/pages/product/summary_card.dart';

class PreferencesPage extends StatefulWidget {
Expand Down Expand Up @@ -77,7 +75,6 @@ class _HelperState extends State<_Helper> {
Widget build(BuildContext context) {
final ProductPreferences productPreferences =
context.watch<ProductPreferences>();
final UserPreferences userPreferences = context.watch<UserPreferences>();
final AppLocalizations appLocalizations = AppLocalizations.of(context);
final List<Widget> pageData = <Widget>[
SvgPicture.asset(
Expand Down Expand Up @@ -112,16 +109,6 @@ class _HelperState extends State<_Helper> {
),
),
];
pageData.addAll(
UserPreferencesFood(
productPreferences: productPreferences,
setState: setState,
context: context,
userPreferences: userPreferences,
appLocalizations: appLocalizations,
themeData: Theme.of(context),
).getOnboardingContent(),
);
return ColoredBox(
color: widget.backgroundColor,
child: SafeArea(
Expand Down
6 changes: 4 additions & 2 deletions packages/smooth_app/lib/pages/product/summary_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class _SummaryCardState extends State<SummaryCard> with UpToDateMixin {
super.initState();
initUpToDate(widget._product, context.read<LocalDatabase>());
_questionsLayout = getUserQuestionsLayout(context.read<UserPreferences>());
if (ProductIncompleteCard.isProductIncomplete(initialProduct)) {
if (widget.isProductEditable &&
ProductIncompleteCard.isProductIncomplete(initialProduct)) {
AnalyticsHelper.trackEvent(
AnalyticsEvent.showFastTrackProductEditCard,
barcode: barcode,
Expand Down Expand Up @@ -356,7 +357,8 @@ class _SummaryCardState extends State<SummaryCard> with UpToDateMixin {
});
},
),
if (ProductIncompleteCard.isProductIncomplete(upToDateProduct))
if (widget.isProductEditable &&
ProductIncompleteCard.isProductIncomplete(upToDateProduct))
ProductIncompleteCard(product: upToDateProduct),
..._getAttributes(scoreAttributes),
if (widget.isFullVersion &&
Expand Down

0 comments on commit 8693cfe

Please sign in to comment.