diff --git a/app/lib/common/widgets/drug_list/builder.dart b/app/lib/common/widgets/drug_list/builder.dart index 6720f687..032ad6f8 100644 --- a/app/lib/common/widgets/drug_list/builder.dart +++ b/app/lib/common/widgets/drug_list/builder.dart @@ -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( @@ -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, ), ], diff --git a/app/lib/common/widgets/pretty_expansion_tile.dart b/app/lib/common/widgets/pretty_expansion_tile.dart index 6ad6f52d..0fdcdfef 100644 --- a/app/lib/common/widgets/pretty_expansion_tile.dart +++ b/app/lib/common/widgets/pretty_expansion_tile.dart @@ -9,6 +9,7 @@ class PrettyExpansionTile extends StatelessWidget { this.visualDensity, this.titlePadding, this.childrenPadding, + this.icon, this.initiallyExpanded = false, this.enabled = true, }); @@ -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; @@ -35,6 +37,7 @@ class PrettyExpansionTile extends StatelessWidget { initiallyExpanded: initiallyExpanded, title: title, iconColor: PharMeTheme.iconColor, + trailing: icon, collapsedIconColor: PharMeTheme.iconColor, onExpansionChanged: onExpansionChanged, visualDensity: visualDensity,