Skip to content

Commit

Permalink
fix: openfoodfacts#2123 onboarding preference issues (openfoodfacts#2231
Browse files Browse the repository at this point in the history
)
  • Loading branch information
cli1005 authored Jun 9, 2022
1 parent f65499f commit 70cfea0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class _HelperState extends State<_Helper> {
),
),
Container(
height: _isProductExpanded ? null : 150,
height: _isProductExpanded ? null : 180,
padding: const EdgeInsets.only(
bottom: LARGE_SPACE,
right: LARGE_SPACE,
Expand All @@ -108,6 +108,7 @@ class _HelperState extends State<_Helper> {
productPreferences,
isFullVersion: _isProductExpanded,
isRemovable: false,
isSettingClickable: false,
),
),
),
Expand Down
26 changes: 18 additions & 8 deletions packages/smooth_app/lib/pages/product/summary_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class SummaryCard extends StatefulWidget {
this.showUnansweredQuestions = false,
this.refreshProductCallback,
this.isRemovable = true,
this.isSettingClickable = true,
});

final Product _product;
Expand All @@ -69,6 +70,9 @@ class SummaryCard extends StatefulWidget {
/// If true, there will be a button to remove the product from the carousel.
final bool isRemovable;

/// If true, the icon setting will be clickable.
final bool isSettingClickable;

/// Callback to refresh the product when necessary.
final Function(BuildContext)? refreshProductCallback;

Expand Down Expand Up @@ -419,16 +423,22 @@ class _SummaryCardState extends State<SummaryCard> {
),
InkWell(
borderRadius: const BorderRadius.only(topRight: ROUNDED_RADIUS),
onTap: () async => Navigator.push<Widget>(
context,
MaterialPageRoute<Widget>(
builder: (BuildContext context) => const UserPreferencesPage(
type: PreferencePageType.FOOD,
),
),
),
onTap: widget.isSettingClickable
? () async => Navigator.push<Widget>(
context,
MaterialPageRoute<Widget>(
builder: (BuildContext context) =>
const UserPreferencesPage(
type: PreferencePageType.FOOD,
),
),
)
: null,
child: Tooltip(
message: appLocalizations.open_food_preferences_tooltip,
triggerMode: widget.isSettingClickable
? TooltipTriggerMode.longPress
: TooltipTriggerMode.tap,
child: const SizedBox.square(
dimension: kMinInteractiveDimension,
child: Icon(
Expand Down

0 comments on commit 70cfea0

Please sign in to comment.