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
name: canvas_clock | |
description: creativecreatorormaybenot's entry to the Flutter clock challenge. | |
version: 1.0.0+1 | |
environment: | |
sdk: ">=2.7.0 <3.0.0" | |
dependencies: | |
flutter: | |
sdk: flutter |
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
@override | |
void visitChildrenForSemantics(visitor) { | |
final toBeVisited = <ClockComponent, RenderBox>{}; | |
... | |
for (final component in paintOrder) { | |
if (toBeVisited.containsKey(component)) visitor(toBeVisited[component]); | |
} | |
} |
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
@override | |
void describeSemanticsConfiguration(SemanticsConfiguration config) { | |
super.describeSemanticsConfiguration(config); | |
config | |
..label = | |
'Analog clock showing hour $hour${_use24HourFormat ? ' (and ${hour + 12})' : ''}, ' | |
'minute $minute, and second $second' | |
..isReadOnly = true | |
..textDirection = TextDirection.ltr; |
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
final paint = Paint() | |
..color = _sunColor | |
..strokeWidth = radius / 124; | |
canvas.drawOval(Rect.fromCircle(center: Offset.zero, radius: radius / 9), paint); | |
for (var i = 0; i < _sunRays; i++) { | |
final direction = pi * 2 / _sunRays * i; | |
canvas.drawLine( | |
Offset.fromDirection(direction, radius / 8), |
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
final analogTime = layoutChildren[ClockComponent.analogTime], | |
analogTimeData = | |
layoutParentData[ClockComponent.analogTime] as AnalogTimeParentData, | |
analogTimeSize = | |
Size.fromRadius(size.height / 2.9 + 55) * spinUpAnimation.value; |
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
void main() { | |
print(-7 % 6); // 5 | |
} |
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 is my first Project Euler problem I attempt to solve in Dart. | |
/// It has been quite a few years since I solved the last problem and | |
/// I did not even know about Dart when I did it. | |
/// I think that Dart is not best suited for these kinds of problems because it is not performant | |
/// and also object-oriented instead of functional (which I would suppose works better for math problems) | |
/// or maybe Python because the syntax is better to solve math problems, but I have solved these problems in | |
/// Go, Kotlin, JavaScript, and other similar languages in the past and thus I see this as an opportunity to learn even more about Dart :) | |
import 'dart:math' as math; | |
void main() { |
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
errors.dart:147 Uncaught (in promise) Error: EncodingError: The source image cannot be decoded. | |
at Object.throw_ [as throw] (errors.dart:196) | |
at async._AsyncCallbackEntry.new.callback (zone.dart:1114) | |
at Object._microtaskLoop (schedule_microtask.dart:43) | |
at _startMicrotaskLoop (schedule_microtask.dart:52) | |
at async_patch.dart:168 | |
DartError @ errors.dart:147 | |
throw_ @ errors.dart:196 | |
(anonymous) @ zone.dart:1114 | |
_microtaskLoop @ schedule_microtask.dart:43 |
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 ms] Compiling lib\main.dart for the Web... (completed in 6.7s) | |
[ +11 ms] Building application for the web... (completed in 7.0s) | |
[ +281 ms] Warning: Flutter's support for web development is not stable yet and hasn't | |
[ +1 ms] been thoroughly tested in production environments. | |
[ ] For more information see https://flutter.dev/web | |
[ +1 ms] 🔥 To hot restart changes while running, press "r". To hot restart (and refresh the browser), press "R". | |
[ +15 ms] For a more detailed help message, press "h". To quit, press "q". |
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
[ +325 ms] Failed to load asset at path: packages/build_web_compilers/src/dev_compiler/dart_sdk.js. | |
Status code: 404 | |
Headers: | |
{ | |
"date": "Tue, 19 Nov 2019 17:25:39 GMT", | |
"content-length": "9", | |
"x-frame-options": "SAMEORIGIN", |