-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
Add support for various inline styles #526
Add support for various inline styles #526
Conversation
…f, implement em support relative to parent font size
…on-line, and text-decoration-style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. Just slightly confusing variable naming here for me.
lib/src/css_parser.dart
Outdated
} | ||
} | ||
} | ||
fontFeatures.toSet().toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't do anything right? (it creates a new list, bu you don't assign it to anything).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It removes duplicates from the list. Kind of odd, but it works nicely and is super concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that's what you wanted, but it doesn't, because the list is not modified in-place.
test("toSet_inline", () async {
final list = ["one", "two", "one"];
list.toSet().toList();
expect(list, ["one", "two"]);
});
Will fail:
Expected: ['one', 'two']
Actual: ['one', 'two', 'one']
But this works of course:
test("toSet_inline", () async {
final list = ["one", "two", "one"];
expect(list.toSet().toList(), ["one", "two"]);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was modified in place. I will fix this as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
lib/src/css_parser.dart
Outdated
} | ||
} | ||
} | ||
shadow.toSet().toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here - this has no effect right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It removes duplicates from the list here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
lib/style.dart
Outdated
|
||
const FontSize(this.size); | ||
const FontSize(this.size, this.units); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would have preferred to have the units as optional param, with ''
as default.
Alternatively, use named constructors for perc, px and rm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have made it optional... don't know what I was thinking I was probably a little tired 😅 I'll do the same for LineHeight
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Fixes #516, implements everything that was WIP in #228.
Implements direction, display, font-feature-settings, font-family, font-style, font-size, font-weight, line-height, text-decoration, text-decoration-line, text-decoration-color, text-decoration-style, and text-shadow support based on CSS guidelines.
Added
Display.NONE
to the existingDisplay
enums to allowstyle="display: none;"
Preview:
Code for above example:
This is going to need some pretty rigorous testing imo, there's a lot of different variables to consider when creating the inline style implementations so I want to make sure as many edge-cases are covered as possible.