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

support letter spacing #54

Merged
merged 10 commits into from
Oct 19, 2021
Merged

support letter spacing #54

merged 10 commits into from
Oct 19, 2021

Conversation

You-J
Copy link
Collaborator

@You-J You-J commented Oct 14, 2021

wip

@vercel
Copy link

vercel bot commented Oct 14, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/grida/designto-codes/2GD8iK6M36r6m6ZnadzEjAokAB1y
✅ Preview: https://designto-codes-git-support-letter-spacing-grida.vercel.app

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

// 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.
Copy link
Member

Choose a reason for hiding this comment

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

Explain this

Copy link
Collaborator Author

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.

https://stackoverflow.com/a/4309051

Copy link
Collaborator Author

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

Copy link
Member

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

Copy link
Member

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?

Copy link
Collaborator Author

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,
Copy link
Member

Choose a reason for hiding this comment

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

Invalid syntax

Copy link
Collaborator Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

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

.

Copy link
Collaborator Author

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]);
Copy link
Member

Choose a reason for hiding this comment

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

Explain this file

Copy link
Collaborator Author

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.

Copy link
Member

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

Copy link
Collaborator Author

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.
Copy link
Member

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.
Copy link
Member

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,
Copy link
Member

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]);
Copy link
Member

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,
Copy link
Member

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
Copy link
Member

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.
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

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

.

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.

None yet

3 participants