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
import 'dart:ui' as ui; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/painting.dart'; | |
// sample code | |
/* | |
class CornerDecorationTest extends StatefulWidget { | |
@override | |
_CornerDecorationTestState createState() => _CornerDecorationTestState(); | |
} |
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
class RoundedListView extends StatefulWidget { | |
@override | |
_RoundedListViewState createState() => _RoundedListViewState(); | |
} | |
class _RoundedListViewState extends State<RoundedListView> with TickerProviderStateMixin { | |
var size = 32; | |
@override | |
Widget build(BuildContext context) { |
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
/// Return a scaled and translated [Matrix4] that maps [src] to [dst] for given [fit] | |
/// aligned by [alignment] within [dst] | |
/// | |
/// For example, if you have a [CustomPainter] with size 300 x 200 logical pixels and | |
/// you want to draw an expanded, centered image with size 80 x 100 you can do the following: | |
/// | |
/// ```dart | |
/// canvas.save(); | |
/// var matrix = sizeToRect(imageSize, Offset.zero & customPainterSize); | |
/// canvas.transform(matrix.storage); |
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
import 'dart:ui' as ui; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
import 'package:path_drawing/path_drawing.dart'; | |
class WorldMap extends StatelessWidget { | |
final notifier = ValueNotifier(Offset.zero); | |
@override |
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
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; |
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
class LongPressRipple extends StatefulWidget { | |
final Widget child; | |
final VoidCallback onLongPress; | |
LongPressRipple({ | |
Key key, | |
this.child, | |
@required this.onLongPress, | |
}) : assert(onLongPress != null), super(key: key); |
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
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)))); |
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
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), |
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
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( |
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
import 'dart:math'; | |
import 'dart:ui'; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/physics.dart'; | |
import 'package:flutter/scheduler.dart'; | |
void main() { | |
// debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; |