如何根据计数器绘制如下图所示的图形? 我尝试过this教程,但听不懂。
是否有任何程序包可以绘制这样的图形?
我的代码:
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("CHECK-INS", style: TextStyle(color: Colors.grey),),
Text("72",style:TextStyle(fontSize: 25))
],
),
),
Container(
width: MediaQuery.of(context).size.width/2,
color: Colors.blue,
child: //Here want to draw graph
)
],
),
答案 0 :(得分:0)
您可以尝试flutter_sparkline,
首先声明具有所有坐标的data
,然后将其传递给Sparkline
import 'package:flutter/material.dart';
import 'package:flutter_sparkline/flutter_sparkline.dart';
void main() {
var data = [0.0, 1.0, 1.5, 2.0, 0.0, 0.0, -0.5, -1.0, -0.5, 0.0, 0.0];
runApp(
new MaterialApp(
home: new Scaffold(
body: new Center(
child: new Container(
width: 300.0,
height: 100.0,
child: new Sparkline(
data: data,
),
),
),
),
),
);
}
输出