Flutter - make computing time from reload/computing beautiful - not with black screen

41 views Asked by At

I am running flutter on windows. I made a Gantt Chart with the flutter rendering library. The refresh for the Gantt Chart is happening via Timer and then Flutter is fetching Data from a Redis Server, when there is a change. The ugly thing about my program is: Due to high computing for rendering the Gantt chart, I get when a refresh happens, a black screen for approx. 0,5 sec. Is there any solution to freeze the screen instead of showing the user a black screen?

Here is a short overview from my code:

class Gantt extends MultiChildRenderObjectWidget {
  Gantt({
    Key? key,
    //rest of var
    required List<AppointmentItemWrapper> items,
  }), super(key: key, children: items);

class RenderGantt extends RenderBox
    with
        ContainerRenderObjectMixin<RenderBox, DynamicTimelineParentData>,
        RenderBoxContainerDefaultsMixin<RenderBox, DynamicTimelineParentData> {
  RenderGantt({
  //rest of var
  })

class TimelineItem extends SingleChildRenderObjectWidget {
  TimelineItem({
    Key? key,
   //rest of var
  })  :
        super(
        key: key,
        child: child,
      );

class RenderTimelineItem extends RenderProxyBox
    implements MouseTrackerAnnotation {
  RenderTimelineItem({
  //rest of var
  }) 

class AppointmentItemWrapper extends StatefulWidget {}

Gantt is placed in a stateful widget, with setState((){}) I am changing the items list in the Gantt widget. Due to that, the repaint is triggered and the necessary recalculation of positions, sizes is started and then with .markNeedsLayout() and .markNeedsPaint() the view is updated.

0

There are 0 answers