Skip to content
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

This is not a bug, I just do not understand how to replace the default sendButtonBuilder #11

Closed
SushiRoll53 opened this issue Dec 5, 2019 · 6 comments

Comments

@SushiRoll53
Copy link

I was using the example and everything is working flawlessly, but then I try to change the default icon send but it ask for a specific time and I am not sure on how to create a type Widget Function(Function)
Could someone illustrate me. I do not need to modify the functionality, just the icon colors.

@PolymathWhiz
Copy link

One way i'll suggest is to change it from the core code to fit what you want

@fayeed
Copy link
Owner

fayeed commented Dec 8, 2019

@SushiRoll53 Its really simple you create a function that returns a widget and the function you see a parameter is actually the onSend function you passed to the Dashchat.

Here's an example:

Function sendButtonBuilder(Function onSend) {
  return IconButton(
     icon: Icon(
       Icons.send,
       color: Colors.white  
     ),
     onPress: onSend
  );
}

// Your dashchat code
Dashchat(
  sendButtonBuilder: sendButtonBuilder(),
)

@PolymathWhiz
Copy link

@SushiRoll53 Its really simple you create a function that returns a widget and the function you see a parameter is actually the onSend function you passed to the Dashchat.

Here's an example:

Function sendButtonBuilder(Function onSend) {
  return IconButton(
     icon: Icon(
       Icons.send,
       color: Colors.white  
     ),
     onPress: onSend
  );
}

// Your dashchat code
Dashchat(
  sendButtonBuilder: sendButtonBuilder(),
)

Much better

@SushiRoll53
Copy link
Author

Cool it seems easy, I tried as the following, I had to make some modifications so I was able to run a test

sendButtonBuilder(Function onSend) {
  return IconButton(
     icon: Icon(
       Icons.send,
       color: Colors.white  
     ),
     onPress: onSend
  );
}

Dashchat(
  sendButtonBuilder: sendButtonBuilder(onSend),
)

and the icon does not get replace it.
Do you have another way I can try to solve this?

@SushiRoll53
Copy link
Author

It's me again, for the record I managed to solve with some help, here it is how I could fix it

sendButtonBuilder(Function onSend) {
  return IconButton(
     icon: Icon(
       Icons.send,
       color: Colors.white  
     ),
     onPressed: onSend
  );
}

Dashchat(
  sendButtonBuilder: (function) {
    sendButtonBuilder(function)
  },
)

I'm gonna close it, thank you for your responses.

@kornha
Copy link

kornha commented Jun 5, 2020

Reopening. This does not work, the onSend method does not get triggered. As this is not expected behavior, this is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants