Skip to content

Instantly share code, notes, and snippets.

/*
child: Center(
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.teal, width: 2),
borderRadius: BorderRadius.circular(32),
color: Colors.white54,
),
child: Row(
mainAxisSize: MainAxisSize.min,
import 'dart:ui' as ui;
import 'dart:math' as math;
class FooPageView extends StatelessWidget {
final PageController controller = PageController();
double get page => controller.position.haveDimensions? controller.page : 0.0;
@override
Widget build(BuildContext context) {
class RotaryDial extends StatefulWidget {
@override
_RotaryDialState createState() => _RotaryDialState();
}
class _RotaryDialState extends State<RotaryDial> with SingleTickerProviderStateMixin {
final numbers = List.generate(10, (i) => i != 0? 10 - i : i);
final turns = ProxyAnimation();
final stackKey = GlobalKey();
late AnimationController controller;
@pskink
pskink / multi_layout.dart
Created October 8, 2020 10:19
CustomMultiChildLayout test
class MultiLayoutTest extends StatefulWidget {
@override
_MultiLayoutTestState createState() => _MultiLayoutTestState();
}
var _data = [
_Data(0, Colors.orange, Alignment.topRight, Offset(0, -1)),
_Data(1, Colors.red, Alignment.bottomLeft, Offset(-1, 0)),
_Data(2, Colors.green, Alignment.bottomRight, Offset(1, 0)),
_Data(3, Colors.blue, Alignment.topLeft, Offset(0, 1)),
class CustomImageScroller extends StatefulWidget {
final String asset;
CustomImageScroller({Key key, this.asset}) : super(key: key);
@override
_CustomImageScrollerState createState() => _CustomImageScrollerState();
}
class _CustomImageScrollerState extends State<CustomImageScroller> with TickerProviderStateMixin {
AnimationController xc;
import 'dart:math';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
// debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
runApp(MaterialApp(
home: Scaffold(
class AnimatedTransform extends ImplicitlyAnimatedWidget {
const AnimatedTransform({
Key key,
@required this.transform,
this.alignment = Alignment.center,
this.child,
Curve curve = Curves.linear,
@required Duration duration,
VoidCallback onEnd,
}) : assert(transform != null), assert(alignment != null),
class FruitColorizer extends TextEditingController {
final Map<String, TextStyle> mapping;
final Pattern pattern;
FruitColorizer(this.mapping)
: pattern = RegExp(mapping.keys.map((key) => RegExp.escape(key)).join('|'));
FruitColorizer.fromColors(Map<String, Color> colorMap)
: this(colorMap.map((text, color) => MapEntry(text, TextStyle(color: color))));
class LongPressRipple extends StatefulWidget {
final Widget child;
final VoidCallback onLongPress;
LongPressRipple({
Key key,
this.child,
@required this.onLongPress,
}) : assert(onLongPress != null), super(key: key);
class BlurView extends StatefulWidget {
final String imagePath;
const BlurView(this.imagePath, {Key key}) : super(key: key);
@override
_BlurViewState createState() => _BlurViewState();
}
class _BlurViewState extends State<BlurView> {
ui.Image image;