Skip to content

Commit

Permalink
fix: Fix food preferences buttons goes into two lines (#1445)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhay1821 authored Apr 2, 2022
1 parent 3b16bbe commit 721a49b
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions packages/smooth_app/lib/widgets/attribute_button.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:openfoodfacts/model/Attribute.dart';
import 'package:openfoodfacts/personalized_search/preference_importance.dart';
Expand Down Expand Up @@ -47,31 +48,24 @@ class AttributeButton extends StatelessWidget {
children: <Widget>[
SizedBox(
width: screenWidth * .45,
child: FittedBox(
alignment: Alignment.centerLeft,
fit: BoxFit.scaleDown,
child: Text(attribute.name!, style: style),
),
child: Text(attribute.name!, style: style),
),
SizedBox(
width: screenWidth * .45,
child: FittedBox(
fit: BoxFit.scaleDown,
alignment: Alignment.centerRight,
child: ElevatedButton(
child: Text(
productPreferences
.getPreferenceImportanceFromImportanceId(importanceId)!
.name!,
style: style.copyWith(color: Colors.white),
),
style: ElevatedButton.styleFrom(
primary: _colors[importanceId],
onPrimary: Colors.white,
),
onPressed: () async => productPreferences.setImportance(
attribute.id!, _nextValues[importanceId]!),
child: ElevatedButton(
child: AutoSizeText(
productPreferences
.getPreferenceImportanceFromImportanceId(importanceId)!
.name!,
style: style.copyWith(color: Colors.white),
maxLines: 1,
),
style: ElevatedButton.styleFrom(
primary: _colors[importanceId],
onPrimary: Colors.white,
),
onPressed: () async => productPreferences.setImportance(
attribute.id!, _nextValues[importanceId]!),
),
),
],
Expand Down

0 comments on commit 721a49b

Please sign in to comment.