flutter-expandable
flutter-expandable copied to clipboard
Theme `isEmpty()` function returns true for zero padding
When using the following code, the noPaddingTheme.isEmpty() functions returns true, despite having set a proper zero padding.
This causes the default padding to be used in combinedTheme.
The issue is in the == operator of ExpandableThemeData, which does not take into account iconPadding.
final emptyTheme = ExpandableThemeData(); // isEmpty == true
final noPaddingTheme = ExpandableThemeData( // isEmpty == true
iconPadding: EdgeInsets.zero,
);
final combinedTheme = ExpandableThemeData.combine(
noPaddingTheme,
ExpandableThemeData.defaults,
);
My temporary fix is:
ExpandableThemeData(
iconPadding: EdgeInsets.zero,
// This is used in the `==` operator, and does not really affect the result
crossFadePoint: ExpandableThemeData.defaults.crossFadePoint + 0.001,
),