Skip to content

Commit

Permalink
Add basic example
Browse files Browse the repository at this point in the history
  • Loading branch information
xqwzts committed Mar 17, 2018
1 parent 0ddae35 commit 1b6fe13
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## [0.0.3] - 2018-04-17

* Add basic example

## [0.0.2] - 2018-04-16

* Fix readme screenshots for pub.
Expand Down
39 changes: 39 additions & 0 deletions example/example.dart
@@ -0,0 +1,39 @@
import 'dart:math' as math;

import 'package:flutter/material.dart';
import 'package:flutter_sparkline/flutter_sparkline.dart';

math.Random random = new math.Random();

List<double> _generateRandomData(int count) {
List<double> result = <double>[];
for (int i = 0; i < count; i++) {
result.add(random.nextDouble() * 100);
}
return result;
}

void main() {
var data = _generateRandomData(100);
runApp(
new MaterialApp(
home: new Scaffold(
body: new Center(
child: new Container(
width: 300.0,
height: 100.0,
child: new Sparkline(
data: data,
lineColor: Colors.lightGreen[500],
fillMode: FillMode.below,
fillColor: Colors.lightGreen[200],
pointsMode: PointsMode.all,
pointSize: 5.0,
pointColor: Colors.amber,
),
),
),
),
),
);
}
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_sparkline
description: Beautiful sparkline charts for Flutter.
version: 0.0.2
version: 0.0.3
author: Victor Choueiri <victor.oc@gmail.com>
homepage: https://github.com/xqwzts/flutter_sparkline

Expand Down

0 comments on commit 1b6fe13

Please sign in to comment.