flutter-expandable icon indicating copy to clipboard operation
flutter-expandable copied to clipboard

Theme `isEmpty()` function returns true for zero padding

Open cmaster11 opened this issue 5 years ago • 0 comments

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,
  ),

cmaster11 avatar Aug 01 '20 17:08 cmaster11