Skip to content

Instantly share code, notes, and snippets.

@Indy9000
Last active June 13, 2021 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Indy9000/60bf596c1331f887c6336b5538b6fb81 to your computer and use it in GitHub Desktop.
Save Indy9000/60bf596c1331f887c6336b5538b6fb81 to your computer and use it in GitHub Desktop.
line-chart-widget
import 'dart:math';
void main() {
runApp(MyApp());
}
final rng = Random();
const dayCount = 7;
class MyApp extends StatelessWidget {
final scores = List<Score>.generate(dayCount, (index) {
final y = rng.nextDouble() * 30.0;
final d = DateTime.now().add(Duration(days: -dayCount + index));
return Score(y, d);
});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter LineChart Demo',
home: LineChartWidget(scores),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment