-
-
Notifications
You must be signed in to change notification settings - Fork 34
Support radial-gradient (1/2)
#76
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c9242cf
stash add figma gradient docs
You-J 62282cd
stash support radial gradient
You-J 9fdc8b4
fix boxshadow parameter handle to array
You-J 2aebf97
support radialGradient, linearGradient in flutter code
You-J 2e8346d
Merge branch 'main' of https://github.com/gridaco/designto-code into …
You-J 29e7215
fix not handle log
You-J 51a9432
update package
You-J b1c2a19
update pacakge
You-J 041e781
update package
You-J f8a9173
remove log and fix more safer to using switch
You-J 4195e91
fix throw error
You-J 3375788
remove log
You-J f4ef359
remove log
You-J 999e0a6
add undefined case
You-J f497dc1
update package
You-J 98428b7
update package
You-J File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Figma Gradient | ||
|
|
||
| - [figma paint - gradient paint](https://www.figma.com/plugin-docs/api/Paint/#gradientpaint) | ||
| - [css gradient](https://developer.mozilla.org/en-US/docs/Web/CSS/gradient) | ||
|
|
||
| ## gradient type | ||
|
|
||
| - linear gradient | ||
| - radial gradient | ||
| - angular gradient | ||
| - diamond gradient | ||
|
|
||
| ### linear gradient | ||
|
|
||
| **css** | ||
|
|
||
| - [linear-gradient()](<https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient()>) | ||
|
|
||
| `linear-gradient()` css function | ||
|
|
||
| ```css | ||
| background: linear-gradient(45deg, blue, red); | ||
| ``` | ||
|
|
||
| > **syntax** | ||
| > | ||
| > wip | ||
|
|
||
| **flutter** | ||
|
|
||
| - [LinearGradient()](https://api.flutter.dev/flutter/painting/LinearGradient-class.html) | ||
|
|
||
| ### radial gradient | ||
|
|
||
| **css** | ||
|
|
||
| - [radial-gradient()](<https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/radial-gradient()>) | ||
|
|
||
| ```css | ||
| background: radial-gradient(red, blue); | ||
| ``` | ||
|
|
||
| **flutter** | ||
|
|
||
| - [RadialGradient()](https://api.flutter.dev/flutter/painting/RadialGradient-class.html) | ||
|
|
||
| > **gradient paint opacity** | ||
| > | ||
| > gradient color's opacity \* fill's opacity | ||
|
|
||
| > **gradient paint degree** | ||
| > WIP |
Submodule reflect-core
updated
from dde6fc to cc76dc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { RadialGradientManifest } from "@reflect-ui/core"; | ||
| import { CSSProperty } from "@coli.codes/css"; | ||
| import { color } from "../color"; | ||
|
|
||
| /** | ||
| * https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/radial-gradient() | ||
| * | ||
| * @param g | ||
| * @returns | ||
| */ | ||
| export function radialGradient(g: RadialGradientManifest): CSSProperty.Color { | ||
| // TODO: | ||
| // 1. center support | ||
| // 2. radius support | ||
|
|
||
| const colors = g.colors.map(color).join(", "); | ||
| return `radial-gradient(${colors})`; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/designto-flutter/painting/painting-radial-gradient.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { RadialGradient } from "@reflect-ui/core"; | ||
| import * as flutter from "@flutter-builder/flutter"; | ||
| import * as dartui from "../dart-ui"; | ||
|
|
||
| export function radialGradient(g: RadialGradient): flutter.RadialGradient { | ||
| return new flutter.RadialGradient({ | ||
| // TODO: add center | ||
| // TODO: add radius | ||
| colors: g.colors.map((c) => dartui.color(c)), | ||
| stops: g.stops, | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.