ChildExpanded constructor

ChildExpanded({
  1. Key? key,
  2. required Widget child,
  3. int flex = 1,
  4. int itemCount = 1,
})

Implementation

ChildExpanded({Key? key, required this.child, this.flex = 1, this.itemCount = 1}) : super(key: key) {
  if (itemCount != 1) {
    if (itemCount % 2 == 0) {
      mainFlex = 2;
      marginFlex = (((itemCount * 2) - 2) ~/ 2);
    } else {
      mainFlex = 1;
      marginFlex = (itemCount - 1) ~/ 2;
    }
  }else{
    mainFlex=1;
  }
}