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
void main() { | |
const a1 = ''; | |
// Correct prefer_adjacent_string_concatenation lint. | |
print(a1 + ''); | |
const a2 = Custom(); | |
// Incorrect prefer_adjacent_string_concatenation lint. |
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 Foo { | |
const Foo({required this.bar}); | |
final void Function()? bar; | |
void doSomething() { | |
if (bar != null) { | |
// Analyzer still complains that bar can be null. | |
bar(); | |
} |
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 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Perception is Everything', | |
home: MyHomePage(), |
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
final path = Path() | |
..moveTo(0, 0) | |
..lineTo(-w / 2, 0) | |
..lineTo(-w / 2, sh) | |
// And a bunch more operations.. | |
; | |
canvas.drawShadow(path, _shadowColor, _radius / 64, false); | |
canvas.drawPath(path, paint); |
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
// In RenderCompositedClock (parent layout) | |
location.layout(constraints, parentUsesSize: true); | |
// In RenderLocation | |
_textPainter = TextPainter(...); | |
_textPainter.layout(maxWidth: constraints.biggest.width); // constraints here are what was given in location.layout | |
size = _textPainter.size; // size here is the size of the RenderLocation render object | |
// Back in RenderCompositedClock after laying out the location | |
locationData.offset = Offset( // Setting the offset positions the child |
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
@override | |
double transformInternal(double t) { | |
return troughTransform(elasticTransform(t)); | |
} | |
double elasticTransform(double t) { | |
final b = 12 / 27; | |
return 1 + pow(2, -10 * t) * sin(((t - b / 4) * pi * 2) / b); | |
} |
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
final path = Path() | |
..moveTo(mf * (1 - l1), -hd) | |
..lineTo(2 * mf, -hd) | |
..quadraticBezierTo( | |
2.6 * mf, | |
-hd, | |
2.6 * mf, | |
-hd * 3, | |
) | |
..cubicTo( |
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
void paintIcon(PaintingContext context, Offset offset) { | |
final canvas = context.canvas; | |
canvas.save(); | |
canvas.translate(0, radius * -indentationFactor / 2); | |
drawCondition(canvas); | |
canvas.restore(); | |
} |
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
@override | |
void attach(PipelineOwner owner) { | |
super.attach(owner); | |
animation.addListener(markNeedsPaint); | |
} |
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
/// Declares that a [RenderWeatherIcon] is a repaint boundary. | |
/// | |
/// This makes sure that other weather icons and the background | |
/// do not have to repaint when only this icon changes. | |
@override | |
bool get isRepaintBoundary => true; |