Skip to content

Commit

Permalink
Documentation for v0.1.0+1
Browse files Browse the repository at this point in the history
  • Loading branch information
rwbr committed Jan 2, 2021
1 parent 0511297 commit 202029a
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## [0.0.1] - TODO: Add release date.
## [0.1.0+1] - First public release

* TODO: Describe initial release.
* The first public release
68 changes: 67 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,74 @@ final BasicChatMessage message;
final bool isMe;
final Color backgroundColor;
final Color textColor;
final Color buttonColor;
final Widget buttonWidget;
final String buttonText;
```

### message

The property **message** contains an object representing the content of the message. It's defined as:

```dart
/// The [BasicChatMessage] class represents a single message, that forms
/// the content of a [BasicChatBubble]. This object has the following properties:
/// String [peerUserName] containes the name of the peer user (sender or receiver of message)
/// String [ownUserName] contains the own user name
/// String [messageText] contains the text of the message
/// DateTime [timeStamp] is the date/time of the message was sent
class BasicChatMessage {
String peerUserName;
String messageText;
String timeStamp;
BasicChatMessage({this.peerUserName, this.messageText, this.timeStamp});
}
```

### isMe

This parameter indicates, that the user of the app is the sender of the message. It determines the position of the bubble:

* _true_: **right aligned** chat bubble
* _false_: **left aligned** chat bubble

### backgroundColor

This property defines the background color of the chat bubble.

### textColor

With this property you can set the color of the text elements of the chat bubble.

### Embedding a button in the chat bubble

In some cases it might be useful to embed a button inside the chat bubble. Imagin a messenger app with a video or phone call functionality.

![Embedded button](https://github.com/rwbr/flutter_basic_chat_bubble/blob/main/img/chat_bubble_with_button.png)

This can be done by specifying a widget for that purpose in the **buttonWidget** and the **buttonText** parameters.

### buttonWidget

Here you specify a widget, that should be used as the button. Usually you would use an InkWell widget to make it tappable.

Example:

```dart
InkWell(
child: CircleAvatar(
backgroundColor: Colors.red,
child: Icon(
Icons.video_call,
color: Colors.white,
),
),
onTap: () {
print('Button tapped $index');
}
)
```

### buttonText

This parameter defines the text placed right of the button, replacing the message body.
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.1"
version: "0.1.0+1"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
Binary file added img/chat_bubble_with_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_basic_chat_bubble
description: A new Flutter package project.
version: 0.0.1
version: 0.1.0+1
homepage: https://github.com/rwbr/flutter_basic_chat_bubble

environment:
Expand Down

0 comments on commit 202029a

Please sign in to comment.