drawLoadingScreen method
drawLoadingScreen
Psuedo Build String "Loading ${PercentComplete}" Draw String at the center of the screen
Implementation
void drawLoadingScreen(Canvas canvas, Size size) {
// Fill the screen Black
canvas.drawRect(
Rect.fromLTWH(0, 0, size.width, size.height), standardPaint);
// Set up the TextSpan (Specifies Text, Font, Etc)
final percentLoaded =
(_imageMap.length / images.length.toDouble() * 100).toInt();
final span = TextSpan(
style: TextStyle(color: Colors.white, fontSize: 24).withNovaMono(),
text: "Loading ($percentLoaded%)....");
// Set up the TextPainter, which decides how to draw the span
final textPainter = TextPainter(
text: span,
textAlign: TextAlign.left,
textDirection: TextDirection.ltr);
// Layouter the Text (Measure it, etc)
textPainter
..layout()
..paint(
canvas,
Offset(size.width / 2 - textPainter.width / 2,
size.height / 2 - textPainter.height / 2));
}