Skip to content

Commit

Permalink
feat(app): use same icon as for report also for expansion tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Nov 28, 2024
1 parent f2112a7 commit eb6bc09
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
20 changes: 18 additions & 2 deletions app/lib/common/widgets/drug_list/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class DrugList extends HookWidget {
useLine: false,
);
final currentlyExpanded = otherDrugsExpanded.value ?? false;
final currentlyEnabled = filter.query.isBlank;
final drugLists = [
if (activeDrugsList != null) ...[
ListTile(
Expand All @@ -100,12 +101,27 @@ class DrugList extends HookWidget {
...[
PrettyExpansionTile(
title: otherDrugsHeader,
enabled: filter.query.isBlank,
initiallyExpanded: currentlyExpanded || !filter.query.isBlank,
enabled: currentlyEnabled,
initiallyExpanded: currentlyExpanded || !currentlyEnabled,
onExpansionChanged: (value) => otherDrugsExpanded.value = value,
visualDensity: VisualDensity.compact,
titlePadding: EdgeInsets.zero,
childrenPadding: EdgeInsets.zero,
icon: drugActivityChangeable
? SizedBox.shrink()
: ResizedIconButton(
size: PharMeTheme.largeSpace,
disabledBackgroundColor: currentlyEnabled
? PharMeTheme.buttonColor
: PharMeTheme.onSurfaceColor,
iconWidgetBuilder: (size) => Icon(
currentlyExpanded
? Icons.arrow_drop_up
: Icons.arrow_drop_down,
size: size,
color: PharMeTheme.surfaceColor,
),
),
children: allDrugsList,
),
],
Expand Down
3 changes: 3 additions & 0 deletions app/lib/common/widgets/pretty_expansion_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class PrettyExpansionTile extends StatelessWidget {
this.visualDensity,
this.titlePadding,
this.childrenPadding,
this.icon,
this.initiallyExpanded = false,
this.enabled = true,
});
Expand All @@ -20,6 +21,7 @@ class PrettyExpansionTile extends StatelessWidget {
final VisualDensity? visualDensity;
final EdgeInsets? titlePadding;
final EdgeInsets? childrenPadding;
final Widget? icon;
final bool initiallyExpanded;
final bool enabled;

Expand All @@ -35,6 +37,7 @@ class PrettyExpansionTile extends StatelessWidget {
initiallyExpanded: initiallyExpanded,
title: title,
iconColor: PharMeTheme.iconColor,
trailing: icon,
collapsedIconColor: PharMeTheme.iconColor,
onExpansionChanged: onExpansionChanged,
visualDensity: visualDensity,
Expand Down

0 comments on commit eb6bc09

Please sign in to comment.