Correct copy to clipboard

This commit is contained in:
Hillel Coren 2022-08-05 15:50:54 +03:00
parent 42c04840b8
commit 3c27d9f250
3 changed files with 17 additions and 8 deletions

View File

@ -8,12 +8,14 @@ class IconText extends StatelessWidget {
this.icon, this.icon,
this.style, this.style,
this.alignment, this.alignment,
this.copyToClipboard = false,
}); });
final String text; final String text;
final IconData icon; final IconData icon;
final TextStyle style; final TextStyle style;
final MainAxisAlignment alignment; final MainAxisAlignment alignment;
final bool copyToClipboard;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -24,14 +26,19 @@ class IconText extends StatelessWidget {
Icon(icon, color: style?.color), Icon(icon, color: style?.color),
SizedBox(width: 10), SizedBox(width: 10),
Flexible( Flexible(
child: CopyToClipboard( child: copyToClipboard
value: text, ? CopyToClipboard(
child: Text( value: text,
text ?? '', child: Text(
style: style, text ?? '',
overflow: TextOverflow.ellipsis, style: style,
), overflow: TextOverflow.ellipsis,
), ))
: Text(
text ?? '',
style: style,
overflow: TextOverflow.ellipsis,
),
), ),
], ],
); );

View File

@ -376,6 +376,7 @@ class _ClientViewFullwidthState extends State<ClientViewFullwidth>
IconText( IconText(
text: client.privateNotes, text: client.privateNotes,
icon: Icons.lock, icon: Icons.lock,
copyToClipboard: true,
) )
], ],
), ),

View File

@ -293,6 +293,7 @@ class _VendorViewFullwidthState extends State<VendorViewFullwidth>
IconText( IconText(
text: vendor.privateNotes, text: vendor.privateNotes,
icon: Icons.lock, icon: Icons.lock,
copyToClipboard: true,
) )
], ],
), ),