| 1 | import 'package:cake_wallet/generated/i18n.dart'; |
| 2 | import 'package:cake_wallet/utils/share_util.dart'; |
| 3 | import 'package:cake_wallet/utils/show_bar.dart'; |
| 4 | import 'package:flutter/material.dart'; |
| 5 | import 'package:flutter/services.dart'; |
| 6 | |
| 7 | class CopyLinkItem extends StatelessWidget { |
| 8 | const CopyLinkItem({super.key, required this.url, required this.title}); |
| 9 | final String url; |
| 10 | final String title; |
| 11 | |
| 12 | @override |
| 13 | Widget build(BuildContext context) { |
| 14 | final copyImage = Image.asset('assets/images/copy_address.png', |
| 15 | color: Theme.of(context).colorScheme.onSurface); |
| 16 | |
| 17 | return Row( |
| 18 | mainAxisAlignment: MainAxisAlignment.center, |
| 19 | children: [ |
| 20 | Text( |
| 21 | title, |
| 22 | style: Theme.of(context).textTheme.bodyLarge?.copyWith( |
| 23 | color: Theme.of(context).colorScheme.onSurface, |
| 24 | ), |
| 25 | ), |
| 26 | SizedBox(width: 50), |
| 27 | Row( |
| 28 | children: [ |
| 29 | InkWell( |
| 30 | onTap: () { |
| 31 | Clipboard.setData(ClipboardData(text: url)); |
| 32 | showBar<void>(context, S.of(context).copied_to_clipboard); |
| 33 | }, |
| 34 | child: copyImage, |
| 35 | ), |
| 36 | SizedBox(width: 20), |
| 37 | IconButton( |
| 38 | padding: EdgeInsets.zero, |
| 39 | constraints: BoxConstraints(), |
| 40 | highlightColor: Colors.transparent, |
| 41 | splashColor: Colors.transparent, |
| 42 | iconSize: 25, |
| 43 | onPressed: () => ShareUtil.share(text: url, context: context), |
| 44 | icon: Icon( |
| 45 | Icons.share, |
| 46 | color: Theme.of(context).colorScheme.primary, |
| 47 | ), |
| 48 | ) |
| 49 | ], |
| 50 | ) |
| 51 | ], |
| 52 | ); |
| 53 | } |
| 54 | } |