Skip to content

Instantly share code, notes, and snippets.

abstract class Annotation {
ui.TextStyle? get style;
void build(...);
}
class Range {
// ...
}
@immutable
@Hixie
Hixie / main.dart
Created November 10, 2023 18:57
DecorationImage lerp demo
import 'package:flutter/material.dart';
// Tap or click the image to transition between owls.
// The owls are DecorationImages with different settings (e.g. repeating,
// or a nine-patch center slice configuration). The AnimatedContainer
// lerps the DecorationImages so that they transition smoothly.
void main() {
runApp(MyApp());
}
@Hixie
Hixie / main.dart
Created October 6, 2022 00:33
Playing with animations
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart' show TestVSync;
void main() {
runApp(const Placeholder()); // to trigger the scheduler
AnimationController test = AnimationController(
duration: const Duration(milliseconds: 200),
vsync: const TestVSync(),
);
@Hixie
Hixie / main.dart
Created October 5, 2022 18:53
tropical-spray-2618 variant
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@Hixie
Hixie / main.dart
Created October 5, 2022 18:53
tropical-spray-2618 variant
Flexible(
child: Padding(
padding: const EdgeInsets.all(100),
child: FloatingActionButton(
onPressed: () {
setState(() {
_position = Alignment.topRight;
});
},
child: const Icon(
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
}
}
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
}
}
@Hixie
Hixie / dashboard.pl
Created February 5, 2020 06:55
Script to track a GQ Geiger Counter and report how long until a radioactive cat is safe to release
#!/usr/bin/perl -wT
use strict;
use Device::SerialPort;
if ($< != 0) {
print("Must be run as root.\n");
exit(1);
}
my $port = Device::SerialPort->new("/dev/ttyUSB0");
STARTING TEST
Spawning flutter [run, --machine, -d, flutter-tester, --start-paused] in /tmp/flutter_expression_test.ITINEI
Expecting daemon.connected event...
<=stdout= [{"event":"daemon.connected","params":{"version":"0.4.2","pid":258867}}]
OK (daemon.connected event)
Expecting app.started event...
Expecting app.debugPort event...
<=stdout= [{"event":"app.start","params":{"appId":"255f4a36-3bb0-4314-a5a7-0c21bad6fd7e","deviceId":"flutter-tester","directory":"/tmp/flutter_expression_test.ITINEI","supportsRestart":true}}]
<=stdout= Launching lib/main.dart on Flutter test device in debug mode...
<=stdout= [{"event":"app.debugPort","params":{"appId":"255f4a36-3bb0-4314-a5a7-0c21bad6fd7e","port":42159,"wsUri":"ws://127.0.0.1:42159/ws","baseUri":"file:///tmp/flutter_expression_test.ITINEIQJXLRQ/flutter_expression_test.ITINEI/"}}]
import 'dart:async';
import 'package:flutter/material.dart';
final Identifier time = new Identifier();
final Identifier counter = new Identifier();
void main() {
Model model = new Model();
runApp(new ModelProvider(