-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
support letter spacing #54
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/grida/designto-codes/2GD8iK6M36r6m6ZnadzEjAokAB1y |
|
// making to fixed number since css does not support decimal px points. | ||
return `${d.toFixed()}px`; | ||
// If there is a decimal point, it is rounded up to the first place. |
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.
Explain this
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.
If there is a decimal point in css, the first digit is rounded off instead of rounding. Upload the reference written in that file.
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's round, but it's round up. I will fix it to round
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 mean what is the whole point of altering the value?
Why round at all in the first place
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.
You know that toFixed and round basically does the same thing 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.
Confirmed, I was mistaken. sorry.
@@ -66,6 +65,12 @@ export class Text extends TextChildWidget { | |||
"line-height": css.length(this.textStyle.lineHeight), | |||
}; | |||
} | |||
if (!!this.textStyle.letterSpacing) { | |||
textStyle = { | |||
...textStyle, |
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.
Invalid syntax
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.
Exception handling when default is 0, what's the problem?
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.
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 does not make sense at all.
Never do this again
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.
.
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 checked I'll fix it!
@@ -7,7 +7,7 @@ export function multiple(origin: number, target: DimensionLength) { | |||
const targetToNum = parseInt(target.match(regx)[0]); |
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.
Explain this file
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.
When the target is DimensionLength type, this function measures the multiple from the origin number.
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.
That's now what i meant by "explain".
Explain why you did this way
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.
Are you asking because of regx? We've talked about this before. I'll fix this too.
// making to fixed number since css does not support decimal px points. | ||
return `${d.toFixed()}px`; | ||
// If there is a decimal point, it is rounded up to the first place. |
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 mean what is the whole point of altering the value?
Why round at all in the first place
// making to fixed number since css does not support decimal px points. | ||
return `${d.toFixed()}px`; | ||
// If there is a decimal point, it is rounded up to the first place. |
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.
You know that toFixed and round basically does the same thing right?
@@ -66,6 +65,12 @@ export class Text extends TextChildWidget { | |||
"line-height": css.length(this.textStyle.lineHeight), | |||
}; | |||
} | |||
if (!!this.textStyle.letterSpacing) { | |||
textStyle = { | |||
...textStyle, |
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.
@@ -7,7 +7,7 @@ export function multiple(origin: number, target: DimensionLength) { | |||
const targetToNum = parseInt(target.match(regx)[0]); |
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.
That's now what i meant by "explain".
Explain why you did this way
@@ -66,6 +65,12 @@ export class Text extends TextChildWidget { | |||
"line-height": css.length(this.textStyle.lineHeight), | |||
}; | |||
} | |||
if (!!this.textStyle.letterSpacing) { | |||
textStyle = { | |||
...textStyle, |
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 does not make sense at all.
Never do this again
return new flutter.TextStyle({ | ||
fontSize: rd(style.fontSize), | ||
fontWeight: fontWeight, | ||
fontFamily: fontFamily, | ||
color: dartui.color(style.color), | ||
fontStyle: fontStyle(style.fontStyle), | ||
letterSpacing: letterSpacing, // percentage is not supported | ||
letterSpacing: rd(letterSpacing as number), // percentage is not supported |
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.
what's the as number
for
@@ -2,7 +2,10 @@ export function px(d: number): string | undefined { | |||
if (d === undefined || d === null) { | |||
return; | |||
} else { | |||
// https://stackoverflow.com/questions/4308989/are-the-decimal-places-in-a-css-width-respected | |||
// making to fixed number since css does not support decimal px points. |
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.
cleaup
@@ -66,6 +65,12 @@ export class Text extends TextChildWidget { | |||
"line-height": css.length(this.textStyle.lineHeight), | |||
}; | |||
} | |||
if (!!this.textStyle.letterSpacing) { | |||
textStyle = { | |||
...textStyle, |
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.
.
wip