Browse Source

fix(neon): override equality operators in NeonTheme

Signed-off-by: Nikolas Rimikis <rimikis.nikolas@gmail.com>
pull/640/head
Nikolas Rimikis 1 year ago
parent
commit
bae0775253
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 4
      packages/neon/neon/lib/src/theme/branding.dart
  2. 4
      packages/neon/neon/lib/src/theme/color_scheme.dart
  3. 4
      packages/neon/neon/lib/src/theme/dialog.dart
  4. 19
      packages/neon/neon/lib/src/theme/neon.dart

4
packages/neon/neon/lib/src/theme/branding.dart

@ -58,9 +58,7 @@ class Branding {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
if (other.runtimeType != runtimeType) {
return false;
}
return other is Branding && name == other.name && logo == other.logo && legalese == other.legalese; return other is Branding && name == other.name && logo == other.logo && legalese == other.legalese;
} }
} }

4
packages/neon/neon/lib/src/theme/color_scheme.dart

@ -50,9 +50,7 @@ class NeonColorScheme {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
if (other.runtimeType != runtimeType) {
return false;
}
return other is NeonColorScheme && other.primary == primary; return other is NeonColorScheme && other.primary == primary;
} }
} }

4
packages/neon/neon/lib/src/theme/dialog.dart

@ -56,9 +56,7 @@ class NeonDialogTheme {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
if (other.runtimeType != runtimeType) {
return false;
}
return other is NeonDialogTheme && other.constraints == constraints; return other is NeonDialogTheme && other.constraints == constraints;
} }
} }

19
packages/neon/neon/lib/src/theme/neon.dart

@ -55,4 +55,23 @@ class NeonTheme extends ThemeExtension<NeonTheme> {
dialogTheme: NeonDialogTheme.lerp(dialogTheme, other.dialogTheme, t), dialogTheme: NeonDialogTheme.lerp(dialogTheme, other.dialogTheme, t),
); );
} }
@override
int get hashCode => Object.hashAll([
branding,
colorScheme,
dialogTheme,
]);
@override
bool operator ==(final Object other) {
if (identical(this, other)) {
return true;
}
return other is NeonTheme &&
other.branding == branding &&
other.colorScheme == colorScheme &&
other.dialogTheme == dialogTheme;
}
} }

Loading…
Cancel
Save