Skip to content

Commit

Permalink
feat(app): add filter label
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Sep 7, 2024
1 parent be3404f commit fdf353d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
46 changes: 28 additions & 18 deletions app/lib/common/widgets/drug_search/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class DrugSearch extends HookWidget {
),
color: value && enabled ? warningLevel.color : Colors.transparent,
borderColor: value && enabled
? warningLevel.color
? darkenColor(warningLevel.color, 0.05)
: PharMeTheme.onSurfaceColor,
);
}
Expand All @@ -176,26 +176,36 @@ class DrugSearch extends HookWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: _buildSearchBarItems(context, searchController),
),
if (showFilter) state.whenOrNull(
loaded: (allDrugs, filter) => Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SizedBox(height: PharMeTheme.smallSpace),
Wrap(
spacing: PharMeTheme.smallSpace,
runSpacing: PharMeTheme.smallSpace,
runAlignment: WrapAlignment.center,
alignment: WrapAlignment.start,
children: [
..._buildWarningLevelFilters(context, allDrugs, filter),
],
),
],
)
) ?? SizedBox.shrink(),
],
),
),
if (showFilter) state.whenOrNull(
loaded: (allDrugs, filter) => Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SubheaderDivider(
text: context.l10n.search_page_filter_label,
useLine: false,
),
Padding(
padding: EdgeInsets.only(
left: PharMeTheme.smallSpace,
right: PharMeTheme.smallSpace,
bottom: PharMeTheme.smallSpace,
),
child: Wrap(
spacing: PharMeTheme.smallSpace,
runSpacing: PharMeTheme.smallSpace,
runAlignment: WrapAlignment.center,
alignment: WrapAlignment.start,
children: [
..._buildWarningLevelFilters(context, allDrugs, filter),
],
),
),
],
)
) ?? SizedBox.shrink(),
DrugList(
state: state,
activeDrugs: activeDrugs,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

"search_page_tooltip_search": "Search for medications by their name, brand name or class.",
"search_page_tooltip_search_no_class": "Search for medications by their name or brand name.",
"search_page_filter_label": "Filter",
"search_page_filter_label": "Filter by guideline result",
"search_page_indicator_explanation": "Taking medications with an {indicatorName} ({indicator}) can interact with your results for other medications",
"@search_page_indicator_explanation": {
"placeholders": {
Expand Down

0 comments on commit fdf353d

Please sign in to comment.