| 1 | import 'package:cake_wallet/src/widgets/cake_image_widget.dart'; |
| 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter_svg/svg.dart'; |
| 4 | |
| 5 | class FloatingIconButton extends StatelessWidget { |
| 6 | const FloatingIconButton({ |
| 7 | super.key, |
| 8 | required this.iconPath, |
| 9 | required this.onPressed, |
| 10 | required this.semanticLabel, |
| 11 | }); |
| 12 | |
| 13 | final String iconPath; |
| 14 | final VoidCallback onPressed; |
| 15 | |
| 16 | /// Localized accessible name for this icon-only button. The icon itself stays |
| 17 | /// decorative, so this is the only name a screen reader can announce. |
| 18 | final String semanticLabel; |
| 19 | |
| 20 | @override |
| 21 | Widget build(BuildContext context) { |
| 22 | return MergeSemantics( |
| 23 | child: Semantics( |
| 24 | label: semanticLabel, |
| 25 | button: true, |
| 26 | enabled: true, |
| 27 | child: Material( |
| 28 | color: Colors.transparent, |
| 29 | borderRadius: const BorderRadius.all(Radius.circular(6)), |
| 30 | child: InkWell( |
| 31 | borderRadius: const BorderRadius.all(Radius.circular(6)), |
| 32 | onTap: onPressed, |
| 33 | child: Padding( |
| 34 | padding: const EdgeInsets.all(4.0), |
| 35 | child: CakeImageWidget( |
| 36 | imageUrl: iconPath, |
| 37 | width: 22, |
| 38 | height: 22, |
| 39 | colorFilter: |
| 40 | ColorFilter.mode(Theme.of(context).colorScheme.primary, BlendMode.srcIn), |
| 41 | ), |
| 42 | )), |
| 43 | ), |
| 44 | ), |
| 45 | ); |
| 46 | } |
| 47 | } |