buttonUrl function

Widget? buttonUrl(
  1. BuildContext context, {
  2. String? text,
  3. String? url,
})

Create a button that will open URL on click

Implementation

Widget? buttonUrl(
  BuildContext context, {
  String? text,
  String? url,
}) {
  if (text == null && url == null) return null;
  if (url == null) {
    return lazy.textField(context, text: text!);
  } else {
    String label = text ?? url;
    return OutlinedButton(
      onPressed: () => lazy.openUrl(url),
      style: lazy.buttonStyleRound(),
      child: Text(
        label,
        style: lazy.textStyleBodyS(context),
      ),
    );
  }
}