Is it ok to stack multiple CustomPainter in a Stack widget?
For example:
Stack(
children: [
RepaintBoundary(
child: CustomPaint(
size: Size(imgSource.width.toDouble(), imgSource.height.toDouble()),
painter: BackgroundImagePainter(imgSource),
)),
RepaintBoundary(
child: CustomPaint(
isComplex: true,
willChange: true,
size: Size(imgSource.width.toDouble(), imgSource.height.toDouble()),
painter: GpsMarkerPainter(lMarkerDisplay, scale: _currentScale),
)),
],
),
In this example i use one painter (BackgroundImagePainter) to draw the background image one time and another CustomPainter (GpsMarkerPainter) to draw updated marker positions.
What is the best practice if i would like to display a compass that redraws every second. Can i just add a CustomPainter for that as well or would it be better to put them together in one CustomPainter even they would have different triggers for redraw?