defaultButton static method

Widget defaultButton(
  1. BuildContext context, {
  2. String? label,
  3. SvgData? icon,
  4. Key? key,
})

Returns the proceed button, which invokes NavigatorState.pop.

Implementation

static Widget defaultButton(
  BuildContext context, {
  String? label,
  SvgData? icon,
  Key? key,
}) {
  final button = PrimaryButton(
    key: key ?? const Key('Proceed'),
    onPressed: () => Navigator.of(context).pop(true),
    title: label ?? 'btn_proceed'.l10n,
  );

  if (icon != null) {
    return Stack(
      children: [
        button,
        Positioned(
          top: 0,
          bottom: 0,
          left: 16,
          child: IgnorePointer(child: SvgIcon(icon)),
        ),
      ],
    );
  }

  return button;
}