Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add validation against passing both color and foreground to InlineTextStyle #3427

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

luanpotter
Copy link
Member

@luanpotter luanpotter commented Dec 30, 2024

Description

Add validation against passing both color and foreground to InlineTextStyle.

Note: I plan on working on standardizing asserts, exceptions and tests thereof on a followup, so I am not focusing on this particular issue here.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

@@ -84,10 +87,15 @@ class InlineTextStyle extends FlameTextStyle {
}

TextStyle asTextStyle() {
final fontSize = this.fontSize;
if (fontSize == null) {
throw Exception('fontSize must be set');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't an assertion enough here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan on working on standardizing asserts, exceptions and tests thereof on a followup, so I am not making any particular choice in this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you did make the choice of casting an unspecified exception, it didn't have that before right? Which is like the worst of both worlds 😅
Or are you doing the refactoring like today? Then I guess it is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants