-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
put a small message "Copied" when message or url is copied into clipboard #8
base: master
Are you sure you want to change the base?
Conversation
Sorry I didn't write it in the card, but maybe the message "Copied" is better (when you copy a url it is not a message) and it is smaller. |
Do you think it is possible to have
|
@@ -266,7 +268,9 @@ class _MessageTileState extends State<MessageTile> { | |||
color: const Color(0x00000000), | |||
icon: Icons.content_copy, | |||
foregroundColor: Colors.grey, | |||
onTap: () => Clipboard.setData(ClipboardData(text: widget.message.text)), | |||
onTap: () { | |||
copyToClipboard(widget.message.text).show(context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better if you do a function like that copyToClipboard(context, widget.message.text);
(with context
as the first argument)
import 'package:flutter/services.dart'; | ||
import 'package:flushbar/flushbar.dart'; | ||
|
||
final flushbarCopied = Flushbar<dynamic>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm would have instanciated the Flushbar Object in the function but okay for this one
import 'package:flutter/services.dart'; | ||
import 'package:flushbar/flushbar.dart'; | ||
|
||
final flushbarCopied = Flushbar<dynamic>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to avoid dynamic
type as it doesn't give any information. So replace this with a real type (preferred option) or don't put it
flushbarStyle: FlushbarStyle.FLOATING, | ||
borderRadius: 20, | ||
isDismissible: true, | ||
duration: Duration(milliseconds: 20),); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't 20 milliseconds too short ?
isDismissible: true, | ||
duration: Duration(milliseconds: 20),); | ||
|
||
Flushbar copyToClipboard(String textToCopy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said previously, take the context in the function as a first argument and call show()
in the function
Pull Request
Description
Trello Card
https://trello.com/c/JETCwEo6
Checklist
I have:
Looks like this, will always display at the bottom of the screen (excluding keyboard if it is active).