-
Notifications
You must be signed in to change notification settings - Fork 555
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
[dartpad_ui] Add splash screen #3089
Open
cheymos
wants to merge
4
commits into
dart-lang:main
Choose a base branch
from
cheymos:feature/add-splash-screen
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
83fb40c
Move styles from index.html to separate index.css in dartpad_ui
cheymos d17bf78
Add splash screen for dartpad_ui
cheymos a75ade6
Enable service worker in dartpad_ui
cheymos d8e471a
Fix incorrect splash theme logic for the application theme
cheymos 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 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,28 @@ | ||
{{flutter_js}} | ||
{{flutter_build_config}} | ||
|
||
const serviceWorkerSettings = { | ||
serviceWorkerVersion: {{flutter_service_worker_version}} | ||
}; | ||
|
||
_flutter.loader.load({ | ||
serviceWorkerSettings, | ||
}); | ||
|
||
const splash = document.querySelector('#splash'); | ||
|
||
_initSplashTheme(); | ||
|
||
window.addEventListener('flutter-first-frame', () => { | ||
splash.classList.add('done'); | ||
|
||
setTimeout(() => splash.remove(), 500); | ||
}); | ||
|
||
async function _initSplashTheme() { | ||
const queryParams = new URLSearchParams(window.location.search); | ||
const queryTheme = queryParams.get('theme'); | ||
const theme = ['light', 'dark'].includes(queryTheme) ? queryTheme : 'dark'; | ||
|
||
splash.classList.add(theme); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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,112 @@ | ||
.CodeMirror { | ||
height: 100%; | ||
} | ||
|
||
.squiggle-info { | ||
border-bottom: 2px solid #7ea7d8; | ||
} | ||
|
||
.squiggle-warning { | ||
border-bottom: 2px solid #d9d077; | ||
} | ||
|
||
.squiggle-error { | ||
border-bottom: 2px solid #ef5350; | ||
} | ||
|
||
.squiggle-deprecation { | ||
text-decoration: line-through; | ||
text-decoration-thickness: 10%; | ||
} | ||
|
||
.CodeMirror-simplescroll-horizontal div, | ||
.CodeMirror-simplescroll-vertical div { | ||
position: absolute; | ||
-moz-box-sizing: border-box; | ||
box-sizing: border-box; | ||
border-radius: 4px; | ||
} | ||
|
||
.CodeMirror-simplescroll-horizontal, | ||
.CodeMirror-simplescroll-vertical { | ||
position: absolute; | ||
z-index: 6; | ||
} | ||
|
||
.CodeMirror-simplescroll-horizontal { | ||
bottom: 0; | ||
left: 0; | ||
height: 9px; | ||
} | ||
|
||
.CodeMirror-simplescroll-horizontal div { | ||
bottom: 0; | ||
height: 100%; | ||
} | ||
|
||
.CodeMirror-simplescroll-vertical { | ||
right: 0; | ||
top: 0; | ||
width: 9px; | ||
} | ||
|
||
.CodeMirror-simplescroll-vertical div { | ||
right: 0; | ||
width: 100%; | ||
} | ||
|
||
#splash { | ||
position: fixed; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
z-index: 999; | ||
transition: opacity 500ms; | ||
} | ||
|
||
#splash.light { | ||
background-color: #f5f5f7; | ||
} | ||
|
||
#splash.dark { | ||
background-color: #1f2833; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with this with the dark theme? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. |
||
} | ||
|
||
#splash.done { | ||
opacity: 0; | ||
} | ||
|
||
#splash img { | ||
width: 28vmin; | ||
animation: 1s ease-in-out 200ms infinite alternate breathe; | ||
transition: opacity 500ms; | ||
} | ||
|
||
#splash.done img { | ||
animation: 500ms ease-in-out 0s 1 forwards zoom; | ||
opacity: 0; | ||
} | ||
|
||
@keyframes breathe { | ||
from { | ||
transform: scale(1); | ||
} | ||
|
||
to { | ||
transform: scale(0.95); | ||
} | ||
} | ||
|
||
@keyframes zoom { | ||
from { | ||
transform: scale(1); | ||
} | ||
|
||
to { | ||
transform: scale(0.01); | ||
} | ||
} |
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.
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 assume this color is the color we'd settle into after we've started up in the light theme?
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.
Yeah, that's right.