dev
dart 65 lines 1.8 KB
Raw
1 import 'package:cake_wallet/themes/core/theme_extension.dart';
2 import 'package:flutter/material.dart';
3
4 class WarningBox extends StatelessWidget {
5 const WarningBox({
6 required this.content,
7 this.showBorder = true,
8 this.textColor,
9 this.textAlign,
10 this.iconSize,
11 this.padding,
12 this.iconSpacing,
13 this.textWeight,
14 this.showIcon = true,
15 super.key,
16 });
17
18 final String content;
19 final bool showBorder;
20 final Color? textColor;
21 final TextAlign? textAlign;
22 final double? iconSize;
23 final EdgeInsets? padding;
24 final double? iconSpacing;
25 final FontWeight? textWeight;
26 final bool showIcon;
27
28 @override
29 Widget build(BuildContext context) {
30 return Container(
31 padding: padding ?? EdgeInsets.symmetric(horizontal: 12, vertical: 8),
32 decoration: BoxDecoration(
33 color: context.customColors.warningContainerColor,
34 borderRadius: BorderRadius.all(Radius.circular(12)),
35 border: showBorder
36 ? Border.all(
37 color: context.customColors.warningOutlineColor,
38 width: 2.0,
39 )
40 : null,
41 ),
42 child: Row(
43 children: [
44 if (showIcon)
45 Icon(
46 Icons.warning_amber_rounded,
47 size: iconSize ?? 64,
48 color: textColor ?? Theme.of(context).colorScheme.onSurface,
49 ),
50 SizedBox(width: iconSpacing ?? 6),
51 Expanded(
52 child: Text(
53 content,
54 textAlign: textAlign ?? TextAlign.center,
55 style: Theme.of(context).textTheme.bodySmall?.copyWith(
56 fontWeight: textWeight ?? FontWeight.w800,
57 color: textColor ?? Theme.of(context).colorScheme.onSurface,
58 ),
59 ),
60 ),
61 ],
62 ),
63 );
64 }
65 }