vi-k / bubble

Speech bubble for Flutter
BSD 2-Clause "Simplified" License
266 stars 57 forks source link

Nip draw in wrong position #13

Closed pazhut closed 3 years ago

pazhut commented 4 years ago

i am using the following code to add bubbles to the screen:

class ChatMessageWidget extends StatelessWidget { final bool self; final String text; final AnimationController animationController;

ChatMessageWidget({this.text,this.animationController,this.self});

TextStyle _msgStyle = TextStyle( color: Palette.blackColor, fontSize: 15, fontFamily: "Lato", fontWeight: FontWeight.w500, );

@override Widget build(BuildContext context) { print("Message widget build self = $self $text"); return SizeTransition( sizeFactor: CurvedAnimation( parent: animationController, curve: Curves.easeOut ), axisAlignment: 0.0, child: Container( margin: const EdgeInsets.symmetric(vertical: 10.0), child: Row( mainAxisAlignment: self == true ? MainAxisAlignment.start : MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: [ Bubble( color: self == true ? Colors.white : Color.fromRGBO(225, 255, 199, 1.0), //margin: BubbleEdges.only(top: 5), nip: self == true ? BubbleNip.leftTop : BubbleNip.rightTop, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: const EdgeInsets.only(top: 5.0), child: Text(text,style: _msgStyle,), ), ], ), ), ], ), ), ); } }

after adding new message the nips are getting drawn in the wrong position, however the position and color are correct (please see screen shots), if i drag the bubbles out of the screen (so they need to get redrow) the nip is in the correct position

Simulator Screen Shot - iPhone 8 - 2020-04-17 at 11 06 00 Simulator Screen Shot - iPhone 8 - 2020-04-17 at 11 06 24

shinriyo commented 4 years ago

enum BubbleNip { no, leftTop, leftBottom, rightTop, rightBottom } I want other position.

pazhut commented 4 years ago

Had you looked at the screenshots? They are getting drawn on the left when they supposed to be on the right and vice versa

On Fri, Apr 17, 2020, 7:54 PM shinriyo notifications@github.com wrote:

enum BubbleNip { no, leftTop, leftBottom, rightTop, rightBottom } I want other position.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vi-k/bubble/issues/13#issuecomment-615514615, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANFZIGNSJPTKNBNRTERI7QLRNDT3JANCNFSM4MK2JPXA .

danielthomasdev commented 4 years ago

Same issue, but I have some more info. I'm using code from the example with listview.builder - I've noticed it only does it when the message is the SAME as a previous message sent from the other user, so if user 1 sends Test and then user 2 sends Test, it flips the nip for user 2. Also, if you scroll up the listview and then back down the nip now faces the correct position.

Rouvo commented 3 years ago

Same issue, but I have some more info. I'm using code from the example with listview.builder - I've noticed it only does it when the message is the SAME as a previous message sent from the other user, so if user 1 sends Test and then user 2 sends Test, it flips the nip for user 2. Also, if you scroll up the listview and then back down the nip now faces the correct position.

Thanks for pointing this out. I just hit the same bug while using a listview and made the same observation about scrolling and changing the nip position. I was testing against a simple echo bot and this was driving me crazy.....now i just add a empty space behind the received message as a little work around.

I think I observed the same weird behaviour in another speech bubble library in the flutter web environment and thought it was the librarys fault btw. Still sticking to this one, because it looks much better.

rh-id commented 3 years ago

hi @vi-k , encounter the same issue, retest using the latest master branch and it seemed to solve the issue.

vi-k commented 3 years ago

See 1.2.1. I added key. Use it.