inputWithIcon function

Widget inputWithIcon({
  1. Key? key,
  2. required Widget input,
  3. Color? color,
  4. Widget? prefix,
  5. Widget? suffix,
})

Implementation

Widget inputWithIcon(
    {Key? key,
    required Widget input,
    Color? color,
    Widget? prefix,
    Widget? suffix}) {
  prefix = prefix?.reIcon(color: color, size: 20);
  suffix = suffix?.reIcon(color: color, size: 20);

  if (prefix == null && suffix == null) {
    return input;
  } else {
    return Stack(
      key: key,
      fit: StackFit.passthrough,
      alignment: AlignmentDirectional.centerStart,
      children: [
        if (prefix != null) prefix,
        input,
        if (suffix != null) Positioned(right: 0, child: suffix)
      ],
    );
  }
}