outlined static method

Widget outlined({
  1. UIButtonDefaults? as,
  2. String? label,
  3. Color? labelColor,
  4. required Function onPressed,
  5. Color? borderColor,
  6. Color? bgColor,
  7. double? borderRadius,
  8. double? borderWidth,
  9. double? elevation,
  10. double? widthFactor,
  11. Widget? icon,
})

Outlined Button

Implementation

static Widget outlined({
  UIButtonDefaults? as,
  String? label,
  Color? labelColor,
  required Function onPressed,
  Color? borderColor,
  Color? bgColor,
  double? borderRadius,
  double? borderWidth,
  double? elevation,
  double? widthFactor,
  Widget? icon,
}) {
  return FractionallySizedBox(
    widthFactor: UIUtils.getDouble(as, as?.widthFactor, widthFactor, 1.0),
    child: OutlinedButton(
      onPressed: onPressed as void Function(),
      style: ButtonStyle(
        padding: MaterialStateProperty.all<EdgeInsets>(
          as?.padding ?? EdgeInsets.all(15.0),
        ),
        overlayColor: MaterialStateProperty.resolveWith<Color?>(
          (Set<MaterialState> states) {
            if (states.contains(MaterialState.focused)) return Colors.black12;
            if (states.contains(MaterialState.hovered)) return Colors.black12;
            if (states.contains(MaterialState.pressed)) return Colors.black12;
            return null; // Defer to the widget's default.
          },
        ),
        backgroundColor: MaterialStateProperty.resolveWith<Color>(
          (Set<MaterialState> states) {
            return UIUtils.getColor(as, as?.bgColor, bgColor, Colors.blue);
          },
        ),
        shape: MaterialStateProperty.all<OutlinedBorder>(
          RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(
              UIUtils.getDouble(as, as?.borderRadius, borderRadius, 0.0),
            ),
          ),
        ),
        side: MaterialStateProperty.resolveWith<BorderSide>(
          (Set<MaterialState> states) {
            return BorderSide(
              width: UIUtils.getDouble(as, as?.borderWidth, borderWidth, 2.0),
              color: UIUtils.getColor(as, as?.borderColor, borderColor, Colors.transparent),
            );
          },
        ),
      ),
      child: FractionallySizedBox(
        child: UIButtonContent(as, label, labelColor, icon),
      ),
    ),
  );
}