Skip to content

Commit

Permalink
feat(#730): only show one drug list when searching, not scrolling up …
Browse files Browse the repository at this point in the history
…in either case
  • Loading branch information
tamslo committed Sep 19, 2024
1 parent 42509a6 commit fdb30f4
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions app/lib/common/widgets/drug_list/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,22 @@ class DrugList extends StatelessWidget {
if (filteredDrugs.isEmpty && noDrugsMessage != null) {
return errorIndicator(noDrugsMessage!);
}
final activeFilteredDrugs =
List<Widget>? activeDrugsList;
// Do not show repeated active drugs when searching
if (drugActivityChangeable && filteredDrugs.length != drugs.length) {
activeDrugsList = null;
} else {
final activeFilteredDrugs =
filteredDrugs.filter((drug) => drug.isActive).toList();
final activeDrugsList = activeFilteredDrugs.isNotEmpty
? buildDrugItems(
context,
activeFilteredDrugs,
showDrugInteractionIndicator: showDrugInteractionIndicator,
keyPrefix: 'active-',
)
: null;
activeDrugsList = activeFilteredDrugs.isNotEmpty
? buildDrugItems(
context,
activeFilteredDrugs,
showDrugInteractionIndicator: showDrugInteractionIndicator,
keyPrefix: 'active-',
)
: null;
}
final otherDrugs = drugActivityChangeable
? filteredDrugs
: filteredDrugs.filter((drug) => !drug.isActive).toList();
Expand Down

0 comments on commit fdb30f4

Please sign in to comment.