Skip to content

Instantly share code, notes, and snippets.

@flar
flar / main.dart
Created October 17, 2024 21:12
Test of very tiny join decorations (green is path, blue is 2 lines)
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@flar
flar / hairline_test.cc
Created October 7, 2024 23:46
Test case to visualize the sub-pixel registration of hairlines against reference (round)rects.
TEST_P(AiksTest, HorizontalHairlinesPixelRegistration) {
const DlStrokeCap caps[] = {
DlStrokeCap::kButt,
DlStrokeCap::kSquare,
DlStrokeCap::kRound,
};
DlPaint stroke_paint;
stroke_paint.setDrawStyle(DlDrawStyle::kStroke);
stroke_paint.setStrokeWidth(0.0f);
@flar
flar / main.dart
Created September 30, 2024 22:05
Demonstration of tile modes used in blurring backdrop filters (doesn't work with Skia currently, only Impeller)
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(const App());
}
class App extends StatefulWidget {
@flar
flar / main.dart
Last active February 26, 2025 14:12
Example of how to fade the edges of a BackdropFilter
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@flar
flar / gist:60b95e86c0d641be1d7505d75605fe48
Last active November 29, 2023 23:29
Dart program to compute divisions of a quarter circle based on a pixel error metric.
import 'dart:math';
class Point {
Point(this.x, this.y);
double x;
double y;
operator+(Point p) { return Point(x + p.x, y + p.y); }
operator*(double v) { return Point(x * v, y * v); }
@flar
flar / main.dart
Last active January 23, 2021 00:12
Workaround for Image widget not applying the filter quality unless you force it to change size via the "fit" operation
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(ImageTestApp());
}
@flar
flar / main.dart
Created October 22, 2020 01:57
Testing 3 ways to animate a transform on a widget: Transform(), FilteredWidget(), and Transform(methd: TransformMethod.bitmapTransform)
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@flar
flar / main.dart
Created October 17, 2020 02:38
Testing 3 ways to animate a transform on a widget: Transform(), FilteredWidget(), and Transform(cacheTransform: ...)
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@flar
flar / main.dart
Created July 11, 2020 00:45
Effect of filtering an image with different BoxFit settings
import 'dart:ui';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@flar
flar / main.dart
Last active July 10, 2020 19:11
Using ImageFiltered instead of BackdropFilter to blur text
import 'dart:ui';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
builder: (_, __) => Scaffold(