wrapWithPadding method

Widget wrapWithPadding(
  1. int position,
  2. Widget child, {
  3. double? additionalPadding,
})

Implementation

Widget wrapWithPadding(int position, Widget child, {double? additionalPadding}){
  EdgeInsets padding;
  final addPadding = additionalPadding ?? 0;
  if(orientation() == Axis.vertical){
    padding = EdgeInsets.only(
        top: position == 0 ? startDivider() + addPadding ?? addPadding : addPadding,
        bottom: position < items.length - 1 ? middleDivider() + addPadding ?? addPadding : endDivider() + addPadding ?? addPadding,
        left: addPadding,
        right: addPadding
    );
  }
  else{
    padding = EdgeInsets.only(
        left: position == 0 ? startDivider() + addPadding ?? addPadding : addPadding,
        right: position < items.length - 1 ? middleDivider() + addPadding ?? addPadding : endDivider() + addPadding ?? addPadding,
        top: addPadding,
        bottom: addPadding
    );
  }
  return Container(
    padding: padding,
    child: child,
  );
}