PaddedChildrenList.only constructor

PaddedChildrenList.only({
  1. required List<Widget> children,
  2. double left = 16.0,
  3. double right = 16.0,
  4. double top = 0.0,
  5. double bottom = 16.0,
  6. MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
  7. CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.start,
})

Factory constructor for custom padding (only specific sides).

Allows setting padding individually for the left, right, top, and bottom sides.

Example usage:

PaddedChildrenList.only(
  left: 10.0,
  right: 20.0,
  top: 5.0,
  bottom: 15.0,
  children: [
    Text('Item 1'),
    Text('Item 2'),
    Text('Item 3'),
  ],
);

Implementation

factory PaddedChildrenList.only({
  required List<Widget> children,
  double left = 16.0,
  double right = 16.0,
  double top = 0.0,
  double bottom = 16.0, // Ensure the bottom defaults to 16.0
  MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
  CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.start,
}) {
  return PaddedChildrenList(
    padding:
        EdgeInsets.only(left: left, right: right, top: top, bottom: bottom),
    mainAxisAlignment: mainAxisAlignment,
    crossAxisAlignment: crossAxisAlignment,
    children: children,
  );
}