initData method

void initData()

Implementation

void initData(){
  screenWidth = MediaQuery.of(context).size.width;
  screenHeight= MediaQuery.of(context).size.height;

  double startX=(screenWidth-widget.childView.length*widget.childWidth)/2;
  double startY=(screenHeight-widget.childHeight)/2;

  int i=0;
  bx.clear();
  by.clear();
  lx.clear();
  ly.clear();
  dx.clear();
  dy.clear();
  widget.childView.forEach((element) {

    bx.add(randomx.nextInt(screenWidth.toInt()).toDouble());
    by.add(randomy.nextInt(screenHeight.toInt()).toDouble());

    if(i==0){
      lx.add(startX);
      ly.add(startY);
    }else{
      lx.add(startX+widget.childWidth*i);
      ly.add(startY);
    }

    dx.add(0);
    dy.add(0);
    i++;
  });
}