Last active
August 18, 2021 09:09
-
-
Save juskek/b5026ac74765451cb564d61b8cbc73ec to your computer and use it in GitHub Desktop.
Code structure for flutter_radar_chart.
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
class MyApp extends StatelessWidget { | |
... | |
Widget build(...) { | |
return MaterialApp(..., home: MyHomePage()); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
... | |
_MyHomePageState createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin { | |
... | |
late final AnimationController _controller = AnimationController(...).forward(); | |
... | |
Widget build(...) { | |
return Scaffold(..., child: RadarChartTransition(...)); | |
} | |
} | |
class RadarChartTransition extends AnimatedWidget { | |
Widget build(...) { | |
return CustomPaint(painter: RadarChartPainter(...)); | |
} | |
} | |
class RadarChartPainter extends CustomPainter { | |
... | |
void paint(...) { | |
... // custom paint commands | |
} | |
@override | |
bool shouldRepaint(...) { | |
return true; // repaint whenever CustomPainter is rebuilt | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment