mirror of
https://github.com/flutter/samples.git
synced 2025-11-09 14:28:51 +00:00
Beta (#1234)
This commit is contained in:
@@ -17,12 +17,12 @@ class LayeredChart extends StatefulWidget {
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return LayeredChartState();
|
||||
State<LayeredChart> createState() {
|
||||
return _LayeredChartState();
|
||||
}
|
||||
}
|
||||
|
||||
class LayeredChartState extends State<LayeredChart> {
|
||||
class _LayeredChartState extends State<LayeredChart> {
|
||||
late List<Path> paths;
|
||||
late List<Path> capPaths;
|
||||
late List<double> maxValues;
|
||||
@@ -167,13 +167,13 @@ class LayeredChartState extends State<LayeredChart> {
|
||||
return Container(
|
||||
color: Constants.backgroundColor,
|
||||
child: CustomPaint(
|
||||
foregroundPainter: ChartPainter(this, widget.dataToPlot,
|
||||
foregroundPainter: _ChartPainter(this, widget.dataToPlot,
|
||||
widget.milestones, 80, 50, 50, 12, 500, widget.animationValue),
|
||||
child: Container()));
|
||||
}
|
||||
}
|
||||
|
||||
class ChartPainter extends CustomPainter {
|
||||
class _ChartPainter extends CustomPainter {
|
||||
static List<Color?> colors = [
|
||||
Colors.red[900],
|
||||
const Color(0xffc4721a),
|
||||
@@ -208,9 +208,9 @@ class ChartPainter extends CustomPainter {
|
||||
late Paint linePaint;
|
||||
late Paint fillPaint;
|
||||
|
||||
LayeredChartState state;
|
||||
_LayeredChartState state;
|
||||
|
||||
ChartPainter(
|
||||
_ChartPainter(
|
||||
this.state,
|
||||
this.dataToPlot,
|
||||
this.milestones,
|
||||
|
||||
@@ -22,7 +22,7 @@ class MainLayout extends StatefulWidget {
|
||||
const MainLayout({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MainLayoutState createState() => _MainLayoutState();
|
||||
State<MainLayout> createState() => _MainLayoutState();
|
||||
}
|
||||
|
||||
class _MainLayoutState extends State<MainLayout> with TickerProviderStateMixin {
|
||||
|
||||
@@ -29,12 +29,12 @@ class Timeline extends StatefulWidget {
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return TimelineState();
|
||||
State<Timeline> createState() {
|
||||
return _TimelineState();
|
||||
}
|
||||
}
|
||||
|
||||
class TimelineState extends State<Timeline> {
|
||||
class _TimelineState extends State<Timeline> {
|
||||
HashMap<String, TextPainter> labelPainters = HashMap();
|
||||
|
||||
@override
|
||||
@@ -49,7 +49,7 @@ class TimelineState extends State<Timeline> {
|
||||
for (var weekLabel in widget.weekLabels) {
|
||||
labelPainters[weekLabel.label] =
|
||||
_makeTextPainter(Constants.milestoneTimelineColor, weekLabel.label);
|
||||
labelPainters[weekLabel.label + '_red'] =
|
||||
labelPainters['${weekLabel.label}_red'] =
|
||||
_makeTextPainter(Colors.redAccent, weekLabel.label);
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class TimelineState extends State<Timeline> {
|
||||
}
|
||||
},
|
||||
child: CustomPaint(
|
||||
foregroundPainter: TimelinePainter(
|
||||
foregroundPainter: _TimelinePainter(
|
||||
this, widget.numWeeks, widget.animationValue, widget.weekLabels),
|
||||
child: Container(
|
||||
height: 200,
|
||||
@@ -106,8 +106,8 @@ class TimelineState extends State<Timeline> {
|
||||
}
|
||||
}
|
||||
|
||||
class TimelinePainter extends CustomPainter {
|
||||
TimelineState state;
|
||||
class _TimelinePainter extends CustomPainter {
|
||||
_TimelineState state;
|
||||
|
||||
late Paint mainLinePaint;
|
||||
late Paint milestoneLinePaint;
|
||||
@@ -123,7 +123,7 @@ class TimelinePainter extends CustomPainter {
|
||||
|
||||
int yearNumber = 2015;
|
||||
|
||||
TimelinePainter(
|
||||
_TimelinePainter(
|
||||
this.state, this.numWeeks, this.animationValue, this.weekLabels) {
|
||||
mainLinePaint = Paint();
|
||||
mainLinePaint.style = PaintingStyle.stroke;
|
||||
|
||||
Reference in New Issue
Block a user