showSignMessage method
Future<bool?>
showSignMessage(
- BuildContext context, {
- required String message,
- required String address,
- required InAppWebViewController ctrl,
Implementation
Future<bool?> showSignMessage(
BuildContext context, {
required String message,
required String address,
required InAppWebViewController ctrl,
}) async {
final requestFrom = (await ctrl.getUrl())?.host ?? '';
return await _showDialog(
context: context,
builder: (context) => Container(
decoration: BoxDecoration(
color: _theme.backgroundColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(_theme.borderRadius),
topRight: Radius.circular(_theme.borderRadius),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// Handle bar
Container(
margin: const EdgeInsets.only(top: 12),
width: 40,
height: 4,
decoration: BoxDecoration(
color: _theme.borderColor,
borderRadius: BorderRadius.circular(2),
),
),
Flexible(
child: ListView(
shrinkWrap: true,
padding: _theme.contentPadding,
children: [
_buildDialogHeader('Sign Message'),
SizedBox(height: _theme.itemSpacing),
_buildInfoRow('Request from', requestFrom),
SizedBox(height: _theme.itemSpacing),
_buildInfoRow(
'Signing with', address.ellipsisMidWalletAddress()),
SizedBox(height: _theme.itemSpacing),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: _theme.surfaceColor,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: _theme.borderColor.withOpacity(0.3)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
Icons.edit_outlined,
color: _theme.primaryColor,
size: 20,
),
const SizedBox(width: 8),
Text(
'Message to sign:',
style: _theme.labelStyle.copyWith(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
],
),
const SizedBox(height: 12),
GestureDetector(
onTap: () => AppUtils.copyToClipboard(message),
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: _theme.cardColor,
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: _theme.borderColor.withOpacity(0.5)),
),
child: Row(
children: [
Expanded(
child: Text(
message,
style: _theme.valueStyle.copyWith(
fontSize: 13,
fontFamily: 'monospace',
),
),
),
const SizedBox(width: 8),
Icon(
Icons.copy_outlined,
color: _theme.primaryColor,
size: 16,
),
],
),
),
),
],
),
),
SizedBox(height: _theme.itemSpacing * 2),
_buildActionButtons(
context: context,
cancelText: 'Cancel',
confirmText: 'Sign',
),
const SizedBox(height: 16),
],
),
),
],
),
),
);
}