native static method

Widget native({
  1. Function? onPressed,
  2. String? label,
  3. Color? labelColor,
  4. Color? bgColor,
  5. double? widthFactor,
})

Native Buttons

Implementation

static Widget native({
  Function? onPressed,
  String? label,
  Color? labelColor,
  Color? bgColor,
  double? widthFactor,
}) {
  if (Platform.isIOS) {
    return FractionallySizedBox(
      widthFactor: widthFactor,
      child: CupertinoButton(
        color: bgColor,
        child: Text(
          label!,
          style: TextStyle(
            color: labelColor,
          ),
        ),
        onPressed: onPressed as void Function()?,
      ),
    );
  } else {
    return FractionallySizedBox(
      widthFactor: widthFactor,
      child: TextButton(
        child: Text(
          label!,
          style: TextStyle(
            color: labelColor ?? Colors.black,
          ),
        ),
        onPressed: onPressed as void Function()?,
        style: TextButton.styleFrom(
          backgroundColor: bgColor,
        ),
      ),
    );
  }
}