CW-1174: Add warning for sending to contract addresses (#2463)

* feat: add warning for sending to contract addresses

* feat: Add wallet type icon to full screen qr page
This commit is contained in:
David Adegoke
2025-08-19 18:30:07 +03:00
committed by GitHub
parent cb53840332
commit 09d10fce27
53 changed files with 616 additions and 240 deletions
+3 -1
View File
@@ -36,6 +36,7 @@ class AddressTextField<T extends Currency> extends StatelessWidget {
this.hasUnderlineBorder = false,
this.borderWidth = 1.0,
this.contentPadding,
this.copyImagePath,
});
static const prefixIconWidth = 34.0;
@@ -60,6 +61,7 @@ class AddressTextField<T extends Currency> extends StatelessWidget {
final FocusNode? focusNode;
final T? selectedCurrency;
final Key? addressKey;
final String? copyImagePath;
final Function(BuildContext context)? onPushPasteButton;
final Function(BuildContext context)? onPushAddressBookButton;
@@ -125,7 +127,7 @@ class AddressTextField<T extends Currency> extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(6)),
),
child: Image.asset(
'assets/images/paste_ios.png',
copyImagePath ?? 'assets/images/paste_ios.png',
color: iconColor ?? Theme.of(context).colorScheme.onSurfaceVariant,
),
),
+39 -16
View File
@@ -3,42 +3,65 @@ import 'package:cake_wallet/themes/utils/custom_theme_colors.dart';
import 'package:flutter/material.dart';
class WarningBox extends StatelessWidget {
const WarningBox({required this.content, required this.currentTheme, Key? key}) : super(key: key);
const WarningBox({
required this.content,
required this.currentTheme,
this.showBorder = true,
this.textColor,
this.textAlign,
this.iconSize,
this.padding,
this.iconSpacing,
this.textWeight,
this.showIcon = true,
super.key,
});
final String content;
final MaterialThemeBase currentTheme;
final bool showBorder;
final Color? textColor;
final TextAlign? textAlign;
final double? iconSize;
final EdgeInsets? padding;
final double? iconSpacing;
final FontWeight? textWeight;
final bool showIcon;
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
padding: padding ?? EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: currentTheme.isDark
? CustomThemeColors.warningContainerColorDark
: CustomThemeColors.warningContainerColorLight,
borderRadius: BorderRadius.all(Radius.circular(12)),
border: Border.all(
color: currentTheme.isDark
? CustomThemeColors.warningOutlineColorDark
: CustomThemeColors.warningOutlineColorLight,
width: 2.0,
),
border: showBorder
? Border.all(
color: currentTheme.isDark
? CustomThemeColors.warningOutlineColorDark
: CustomThemeColors.warningOutlineColorLight,
width: 2.0,
)
: null,
),
child: Row(
children: [
Icon(
Icons.warning_amber_rounded,
size: 64,
color: Theme.of(context).colorScheme.onSurface,
if (showIcon)
Icon(
Icons.warning_amber_rounded,
size: iconSize ?? 64,
color: textColor ?? Theme.of(context).colorScheme.onSurface,
),
SizedBox(width: 6),
SizedBox(width:iconSpacing ?? 6),
Expanded(
child: Text(
content,
textAlign: TextAlign.center,
textAlign: textAlign ?? TextAlign.center,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontWeight: FontWeight.w800,
color: Theme.of(context).colorScheme.onSurface,
fontWeight: textWeight ?? FontWeight.w800,
color: textColor ?? Theme.of(context).colorScheme.onSurface,
),
),
),