Format with dartfmt

This commit is contained in:
Victor Choueiri 2018-03-21 02:38:05 +02:00 committed by Victor Choueiri
parent 1c846b4e21
commit ae85badc74
3 changed files with 20 additions and 12 deletions

View File

@ -26,7 +26,8 @@ class AnimatedCircularChart extends StatefulWidget {
this.startAngle = _kStartAngle, this.startAngle = _kStartAngle,
this.holeLabel, this.holeLabel,
this.labelStyle, this.labelStyle,
}) : assert(size != null), })
: assert(size != null),
super(key: key); super(key: key);
/// The size of the bounding box this chart will be constrained to. /// The size of the bounding box this chart will be constrained to.
@ -201,10 +202,10 @@ class AnimatedCircularChartState extends State<AnimatedCircularChart>
void _updateLabelPainter() { void _updateLabelPainter() {
if (widget.holeLabel != null) { if (widget.holeLabel != null) {
TextStyle _labelStyle = widget.labelStyle ?? Theme.of(context).textTheme.body2; TextStyle _labelStyle =
widget.labelStyle ?? Theme.of(context).textTheme.body2;
_labelPainter _labelPainter
..text = new TextSpan( ..text = new TextSpan(style: _labelStyle, text: widget.holeLabel)
style: _labelStyle, text: widget.holeLabel)
..textDirection = Directionality.of(context) ..textDirection = Directionality.of(context)
..textScaleFactor = MediaQuery.of(context).textScaleFactor ..textScaleFactor = MediaQuery.of(context).textScaleFactor
..layout(); ..layout();

View File

@ -11,13 +11,13 @@ class CircularChart {
CircularChart(this.stacks, this.chartType); CircularChart(this.stacks, this.chartType);
final List<CircularChartStack> stacks;
final CircularChartType chartType;
factory CircularChart.empty({@required CircularChartType chartType}) { factory CircularChart.empty({@required CircularChartType chartType}) {
return new CircularChart(<CircularChartStack>[], chartType); return new CircularChart(<CircularChartStack>[], chartType);
} }
final List<CircularChartStack> stacks;
final CircularChartType chartType;
factory CircularChart.fromData({ factory CircularChart.fromData({
@required Size size, @required Size size,
@required List<CircularStackEntry> data, @required List<CircularStackEntry> data,
@ -60,6 +60,8 @@ class CircularChartTween extends Tween<CircularChart> {
final MergeTween<CircularChartStack> _stacksTween; final MergeTween<CircularChartStack> _stacksTween;
@override @override
CircularChart lerp(double t) => CircularChart lerp(double t) => new CircularChart(
new CircularChart(_stacksTween.lerp(t), begin.chartType); _stacksTween.lerp(t),
begin.chartType,
);
} }

View File

@ -9,7 +9,12 @@ const double _kMaxAngle = 360.0;
class CircularChartStack implements MergeTweenable<CircularChartStack> { class CircularChartStack implements MergeTweenable<CircularChartStack> {
CircularChartStack( CircularChartStack(
this.rank, this.radius, this.width, this.startAngle, this.segments); this.rank,
this.radius,
this.width,
this.startAngle,
this.segments,
);
final int rank; final int rank;
final double radius; final double radius;
@ -30,8 +35,8 @@ class CircularChartStack implements MergeTweenable<CircularChartStack> {
? 100.0 ? 100.0
: entries.fold( : entries.fold(
0.0, 0.0,
(double prev, CircularSegmentEntry element) => (double prev, CircularSegmentEntry element) => prev + element.value,
prev + element.value); );
double previousSweepAngle = 0.0; double previousSweepAngle = 0.0;
List<CircularChartSegment> segments = List<CircularChartSegment> segments =