Comments (10)
Hi, I am still having this issue. When I click in the textfield, the keyboard pops up and pops down immediately with this error thrown out.
I think managed to solve my problem... The thing is that I wrapped dash_chat under a future builder. When I tap the textfield, it seems that set_state is called and future builder would reload. Then, the scrollcontroller is not attached. The solution is to separate dash chat into another class.
from dash_chat.
Finally, I found a solution for my problem. I decide to don't use FutureBuilder
at all.
from dash_chat.
Hi @lchoua Thanks for notifying me about this issue, I have taken a look at the problem, I deploy fix it might take me a couple of days though. If you can fix this feel free to create a pull request.
from dash_chat.
@lchoua Just fixed this issue try version 1.0.9
from dash_chat.
Hi, I am still having this issue. When I click in the textfield, the keyboard pops up and pops down immediately with this error thrown out.
from dash_chat.
Hi, I just run into the same problem: I use DashChat()
inside a FutureBuilder
and get this error. Can you please explain how I can solve this issue? I don't exactly now what you mean with "separate dash chat into another class". @pricejiang
from dash_chat.
Hi, I just run into the same problem: I use
DashChat()
inside aFutureBuilder
and get this error. Can you please explain how I can solve this issue? I don't exactly now what you mean with "separate dash chat into another class". @pricejiang
Hi, what I did was wrapped DashChat
into a separate StatefulWidget
class so it will refresh its own state and will not cause the FutureBuilder
to refresh
from dash_chat.
Thank your very much for your fast answer! I'll try 👍
from dash_chat.
@pricejiang Do you have a hint for me how I can set the state of the DashChat
wrapper? I don't have any idea how to do this at the moment...
I mean, it has to look something like this:
class Chat extends StatefulWidget {
final Key _key;
final Function(ChatMessage) _onSend;
final Function(ChatUser) _onPressAvatar;
final Function(ChatUser) _onLongPressAvatar;
final Function _onLoadEarlier;
final ChatUser _chatPartner;
Chat({
@required Function(ChatMessage) onSend,
@required Function(ChatUser) onPressAvatar,
@required Function(ChatUser) onLongPressAvatar,
@required Function onLoadEarlier,
@required ChatUser chatPartner,
Key key,
}) : assert(onSend != null),
assert(chatPartner != null),
assert(onPressAvatar != null),
assert(onLongPressAvatar != null),
assert(onLoadEarlier != null),
_onSend = onSend,
_chatPartner = chatPartner,
_onPressAvatar = onPressAvatar,
_onLongPressAvatar = onLongPressAvatar,
_onLoadEarlier = onLoadEarlier,
_key = key,
super();
@override
_ChatState createState() => _ChatState();
}
class _ChatState extends State<Chat> {
List<ChatMessage> messages = [];
@override
Widget build(BuildContext context) {
return DashChat(
key: widget._key,
inverted: false,
onSend: widget._onSend,
sendOnEnter: true,
textInputAction: TextInputAction.send,
user: widget._chatPartner,
inputDecoration: InputDecoration.collapsed(
hintText: 'a hint',
),
messages: messages,
showUserAvatar: false,
showAvatarForEveryMessage: false,
scrollToBottom: true,
onPressAvatar: widget._onPressAvatar,
onLongPressAvatar: widget._onLongPressAvatar,
inputMaxLines: 5,
messageContainerPadding: EdgeInsets.only(
left: 5.0,
right: 5.0,
),
alwaysShowSend: true,
inputTextStyle: TextStyle(
fontSize: 16.0,
),
inputContainerStyle: BoxDecoration(
color: Theme.of(context).backgroundColor,
border: Border.all(
width: 0.0,
),
),
onQuickReply: (Reply reply) => {print('QuickReply: $reply')},
onLoadEarlier: widget._onLoadEarlier,
shouldShowLoadEarlier: false,
showTraillingBeforeSend: true,
);
}
}
I'm stuck here.
from dash_chat.
Not sure about the context of your implementation, but the state of the Chat
class should be managed by how your FutureBuilder
populate data to it.
from dash_chat.
Related Issues (20)
- [Bug] Old Chat messages are not aligned with sender to the right HOT 1
- [Question] Does this have null safety? HOT 5
- [Question] Why is it necessary for scrollNotificationFunc to always return true?
- 1.1.16 cannot show emojis HOT 4
- how to use flutter dash_chat with dialogflow?
- why dash_chat support 3 Quick Replies limited at 3? in flutter any idea
- how i use flutter_dialogflow with dashchat to my app flutter
- Can't open chat emoji dash_chat: ^1.1.16 HOT 5
- does the package support sending videos and files ?
- [Feature request] Your title
- [Question] about messageTextBuilder HOT 1
- does 2.0 release? HOT 5
- [Bug] default DateBuilder is wrong when scrolling HOT 1
- [Feature request] ListView.custom to prevent widgets from rebuilding
- [Question] Is it possible to send a new message programmatically?
- How to show sender name or auth anme in massage box list? and also emoji are not working in chat.
- [Feature request] Voice
- Invalid image data
- Null check operator used on a null value
- padding between messages
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dash_chat.