Last active
June 13, 2021 16:31
-
-
Save Indy9000/60bf596c1331f887c6336b5538b6fb81 to your computer and use it in GitHub Desktop.
line-chart-widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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