-
Notifications
You must be signed in to change notification settings - Fork 825
various improvements #864
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
base: main
Are you sure you want to change the base?
various improvements #864
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,9 @@ class FlyerChatTextMessage extends StatelessWidget { | |
| /// The widget to display on top of the message. | ||
| final Widget? topWidget; | ||
|
|
||
| /// Widget to display as text, overriding message text. | ||
| final Widget? customWidget; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please remove this - if you don't want markdown you just don't use this lib - default is SimpleTextMessage that does not use markdown. If you need a 3rd party lib - you should just copy the code and change it, and provide your class to the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thing is, I want all the features of the FlyerChatTextMessage, and the nice UI, but I need to be able to render HTML.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, just copy the code and use HTML :) I specifically created the builders pattern to avoid all the "customXXX" stuff that was everywhere in v1 - people would throw all sorts of things in there and then complain the package didn't work. Now, when someone needs something super custom, I prefer to give them full control and responsibility.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, but thats a lot of code I need to copy, when I only want to change the display of one widget... |
||
|
|
||
| /// Creates a widget to display a text message. | ||
| const FlyerChatTextMessage({ | ||
| super.key, | ||
|
|
@@ -149,6 +152,7 @@ class FlyerChatTextMessage extends StatelessWidget { | |
| this.onLinkTap, | ||
| this.linkPreviewPosition = LinkPreviewPosition.bottom, | ||
| this.topWidget, | ||
| this.customWidget, | ||
| }); | ||
|
|
||
| bool get _isOnlyEmoji => message.metadata?['isOnlyEmoji'] == true; | ||
|
|
@@ -188,7 +192,7 @@ class FlyerChatTextMessage extends StatelessWidget { | |
| ) | ||
| : null; | ||
|
|
||
| final textContent = GptMarkdownTheme( | ||
| final textContent = customWidget ?? GptMarkdownTheme( | ||
| gptThemeData: GptMarkdownTheme.of(context), | ||
| child: GptMarkdown( | ||
| message.text, | ||
|
|
||
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.
this feels incomplete. right now
shift+enterwill also send a message and enter will make a new line. if you want to send on enter - how user makes a new line?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.
This variable makes it so that the message sends on enter, and shift+enter only adds a new line.
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 saw the change to send on enter, but did not see the code for the new line itself - is it automatic?
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 used an XOR operator for it on line 222 of composer.dart, inside your existing logic for this.
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.
It definitely works, I'm using it in my app right now.