| 1 | import 'package:cake_wallet/generated/i18n.dart'; |
| 2 | import 'package:flutter/material.dart'; |
| 3 | |
| 4 | class AlertCloseButton extends StatelessWidget { |
| 5 | AlertCloseButton({ |
| 6 | this.image, |
| 7 | this.bottom, |
| 8 | this.onTap, |
| 9 | this.isPositioned = true, |
| 10 | super.key, |
| 11 | }); |
| 12 | |
| 13 | final VoidCallback? onTap; |
| 14 | |
| 15 | final Image? image; |
| 16 | final double? bottom; |
| 17 | final bool isPositioned; |
| 18 | |
| 19 | @override |
| 20 | Widget build(BuildContext context) { |
| 21 | final button = SafeArea( |
| 22 | child: GestureDetector( |
| 23 | onTap: onTap ?? () => Navigator.of(context).pop(), |
| 24 | child: Semantics( |
| 25 | label: S.of(context).close, |
| 26 | button: true, |
| 27 | enabled: true, |
| 28 | child: Container( |
| 29 | height: 42, |
| 30 | width: 42, |
| 31 | decoration: BoxDecoration( |
| 32 | color: Theme.of(context).colorScheme.onSurface, |
| 33 | shape: BoxShape.circle, |
| 34 | ), |
| 35 | child: Center( |
| 36 | child: image ?? |
| 37 | Image.asset( |
| 38 | 'assets/images/close.png', |
| 39 | color: Theme.of(context).colorScheme.surface, |
| 40 | ), |
| 41 | ), |
| 42 | ), |
| 43 | ), |
| 44 | ), |
| 45 | ); |
| 46 | |
| 47 | return isPositioned ? Positioned(bottom: bottom ?? 60, child: button) : button; |
| 48 | } |
| 49 | } |