sentToRow method

Widget sentToRow({
  1. required String target,
  2. VoidCallback? onChange,
  3. bool verified = false,
})

"OTP sent to: …" chip with the "Change" link beside it, like the web widget's row under the header. onChange null hides the link (verified state). verified swaps the "OTP sent to:" prefix for the widget's green-ticked envelope / phone icon in front of the identity.

Implementation

Widget sentToRow({
  required String target,
  VoidCallback? onChange,
  bool verified = false,
}) {
  final textStyle = TextStyle(
    fontFamily: fontFamily,
    fontSize: 13,
    fontWeight: FontWeight.w600,
    color: theme.primary,
  );
  return Wrap(
    alignment: WrapAlignment.center,
    crossAxisAlignment: WrapCrossAlignment.center,
    spacing: 10,
    runSpacing: 4,
    children: [
      Container(
        padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
        decoration: BoxDecoration(
          color: theme.primary.withValues(alpha: 0.1),
          borderRadius: BorderRadius.circular(7),
        ),
        child: verified
            ? Row(
                mainAxisSize: MainAxisSize.min,
                children: [
                  verifiedIdentityIcon(email: target.contains('@')),
                  const SizedBox(width: 8),
                  Flexible(child: Text(target, style: textStyle)),
                ],
              )
            : Text('OTP sent to: $target', style: textStyle),
      ),
      if (onChange != null)
        InkWell(
          onTap: onChange,
          borderRadius: BorderRadius.circular(4),
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 2, vertical: 4),
            child: Text(
              'Change',
              style: TextStyle(
                fontFamily: fontFamily,
                fontSize: 14,
                color: theme.primary,
                decoration: TextDecoration.underline,
                decorationColor: theme.primary,
              ),
            ),
          ),
        ),
    ],
  );
}