Skip to content

Commit c61e314

Browse files
committed
doc: separate out readme content
1 parent 2c70e16 commit c61e314

8 files changed

+1444
-0
lines changed

doc/advance_usage.md

Lines changed: 695 additions & 0 deletions
Large diffs are not rendered by default.

doc/basic_usage.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
1. Adding a chat controller.
2+
```dart
3+
final chatController = ChatController(
4+
initialMessageList: messageList,
5+
scrollController: ScrollController(),
6+
currentUser: ChatUser(id: '1', name: 'Flutter'),
7+
otherUsers: [ChatUser(id: '2', name: 'Simform')],
8+
);
9+
```
10+
11+
2. Adding a `ChatView` widget.
12+
```dart
13+
ChatView(
14+
chatController: chatController,
15+
onSendTap: onSendTap,
16+
chatViewState: ChatViewState.hasMessages, // Add this state once data is available.
17+
)
18+
```
19+
20+
3. Adding a messageList with `Message` class.
21+
```dart
22+
List<Message> messageList = [
23+
Message(
24+
id: '1',
25+
message: "Hi",
26+
createdAt: createdAt,
27+
sentBy: userId,
28+
),
29+
Message(
30+
id: '2',
31+
message: "Hello",
32+
createdAt: createdAt,
33+
sentBy: userId,
34+
),
35+
];
36+
```
37+
38+
4. Adding a `onSendTap`.
39+
```dart
40+
void onSendTap(String message, ReplyMessage replyMessage, MessageType messageType){
41+
final message = Message(
42+
id: '3',
43+
message: "How are you",
44+
createdAt: DateTime.now(),
45+
senBy: currentUser.id,
46+
replyMessage: replyMessage,
47+
messageType: messageType,
48+
);
49+
chatController.addMessage(message);
50+
}
51+
```

doc/contributor.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Main Contributors
2+
3+
| ![img](https://avatars.githubusercontent.com/u/25323183?v=4) | ![img](https://avatars.githubusercontent.com/u/64645989?v=4) | ![img](https://avatars.githubusercontent.com/u/56400956?v=4) | ![img](https://avatars.githubusercontent.com/u/65003381?v=4) | ![img](https://avatars.githubusercontent.com/u/41247722?v=4) |
4+
|:------------------------------------------------------------:|:----------------------------------------------------------:|:----------------------------------------------------------:|:----------------------------------------------------------:|:----------------------------------------------------------:|
5+
| [Vatsal Tanna](https://github.com/vatsaltanna) | [Dhvanit Vaghani](https://github.com/DhvanitVaghani) | [Ujas Majithiya](https://github.com/Ujas-Majithiya)| [Apurva Kanthraviya](https://github.com/apurva780) | [Aditya Chavda](https://github.com/aditya-chavda) |

doc/installation.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
1. Add dependencies to `pubspec.yaml`
2+
3+
Get the latest version in the 'Installing' tab
4+
on [pub.dev](https://pub.dev/packages/chatview/install)
5+
6+
```yaml
7+
dependencies:
8+
chatview: <latest-version>
9+
```
10+
11+
2. Run pub get.
12+
13+
```shell
14+
flutter pub get
15+
```
16+
17+
3. Import package.
18+
19+
```dart
20+
import 'package:chatview/chatview.dart';
21+
```
22+
23+
## Messages types compability
24+
25+
|Message Types | Android | iOS | MacOS | Web | Linux | Windows |
26+
| :-----: | :-----: | :-: | :---: | :-: | :---: | :-----: |
27+
|Text messages | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
28+
|Image messages | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
29+
|Voice messages | ✔️ | ✔️ | ❌ | ❌ | ❌ | ❌ |
30+
|Custom messages | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
31+
32+
## Platform specific configuration
33+
34+
### For image Picker
35+
#### iOS
36+
* Add the following keys to your _Info.plist_ file, located in `<project root>/ios/Runner/Info.plist`:
37+
38+
```
39+
<key>NSCameraUsageDescription</key>
40+
<string>Used to demonstrate image picker plugin</string>
41+
<key>NSMicrophoneUsageDescription</key>
42+
<string>Used to capture audio for image picker plugin</string>
43+
<key>NSPhotoLibraryUsageDescription</key>
44+
<string>Used to demonstrate image picker plugin</string>
45+
```
46+
47+
### For voice messages
48+
#### iOS
49+
* Add this two rows in `ios/Runner/Info.plist`
50+
```
51+
<key>NSMicrophoneUsageDescription</key>
52+
<string>This app requires Mic permission.</string>
53+
```
54+
* This plugin requires ios 10.0 or higher. So add this line in `Podfile`
55+
```
56+
platform :ios, '10.0'
57+
```
58+
59+
#### Android
60+
* Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.
61+
```
62+
minSdkVersion 21
63+
```
64+
65+
* Add RECORD_AUDIO permission in `AndroidManifest.xml`
66+
```
67+
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
68+
```

doc/migration_guide.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
## Migration guide for release 2.0.0
2+
3+
- Renamed `sendBy` field to `sentBy` in `Message` class.
4+
5+
- Renamed `chatUsers` field to `otherUsers` in `ChatController` class.
6+
7+
- Moved `currentUser` field from `ChatView` widget to `ChatController` class
8+
9+
- Updated `id` value in `copyWith` method of `Message` to have correct value.
10+
11+
- Removed `showTypingIndicator` field from `ChatView` and replaced it with `ChatController.showTypingIndicator`.
12+
13+
Before:
14+
```dart
15+
ChatView(
16+
showTypingIndicator:false,
17+
),
18+
```
19+
20+
After:
21+
```dart
22+
/// use it with your [ChatController] instance.
23+
_chatContoller.setTypingIndicator = true; // for showing indicator
24+
_chatContoller.setTypingIndicator = false; // for hiding indicator
25+
```
26+
27+
- Updated `ChatUser`, `Message` and `ReplyMessage` Data Model's `fromJson` and `toJson` methods:
28+
29+
##### in `ChatUser.fromJson`:
30+
31+
Before:
32+
```dart
33+
ChatUser.fromJson(
34+
{
35+
...
36+
'imageType': ImageType.asset,
37+
...
38+
},
39+
),
40+
```
41+
42+
After:
43+
```dart
44+
ChatUser.fromJson(
45+
{
46+
...
47+
'imageType': 'asset',
48+
...
49+
},
50+
),
51+
```
52+
53+
##### in `ChatUser.toJson`:
54+
55+
Before:
56+
```dart
57+
{
58+
...
59+
imageType: ImageType.asset,
60+
...
61+
}
62+
```
63+
64+
After:
65+
```dart
66+
{
67+
...
68+
imageType: asset,
69+
...
70+
}
71+
```
72+
73+
##### in `Message.fromJson`:
74+
75+
Before:
76+
```dart
77+
Message.fromJson(
78+
{
79+
...
80+
'createdAt': DateTime.now(),
81+
'message_type': MessageType.text,
82+
'voice_message_duration': Duration(seconds: 5),
83+
...
84+
}
85+
)
86+
```
87+
88+
After:
89+
```dart
90+
Message.fromJson(
91+
{
92+
...
93+
'createdAt': '2024-06-13T17:32:19.586412',
94+
'message_type': 'text',
95+
'voice_message_duration': '5000000',
96+
...
97+
}
98+
)
99+
```
100+
101+
##### in `Message.toJson`:
102+
103+
Before:
104+
```dart
105+
{
106+
...
107+
createdAt: 2024-06-13 17:23:19.454789,
108+
message_type: MessageType.text,
109+
voice_message_duration: 0:00:05.000000,
110+
...
111+
}
112+
```
113+
114+
After:
115+
```dart
116+
{
117+
...
118+
createdAt: 2024-06-13T17:32:19.586412,
119+
message_type: text,
120+
voice_message_duration: 5000000,
121+
...
122+
}
123+
```
124+
125+
##### in `ReplyMessage.fromJson`:
126+
127+
Before:
128+
```dart
129+
ReplyMessage.fromJson(
130+
{
131+
...
132+
'message_type': MessageType.text,
133+
'voiceMessageDuration': Duration(seconds: 5),
134+
...
135+
}
136+
)
137+
```
138+
139+
After:
140+
```dart
141+
ReplyMessage.fromJson(
142+
{
143+
...
144+
'message_type': 'text',
145+
'voiceMessageDuration': '5000000',
146+
...
147+
}
148+
)
149+
```
150+
151+
in `ReplyMessage.toJson`:
152+
153+
Before:
154+
```dart
155+
{
156+
...
157+
message_type: MessageType.text,
158+
voiceMessageDuration: 0:00:05.000000,
159+
...
160+
}
161+
```
162+
163+
After:
164+
```dart
165+
{
166+
...
167+
message_type: text,
168+
voiceMessageDuration: 5000000,
169+
...
170+
}
171+
```

doc/overview.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
![Banner](https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_chatview/main/preview/banner.png)
2+
3+
# ChatView
4+
5+
A Flutter package that allows you to integrate Chat View with highly customization options such as one on one
6+
chat, group chat, message reactions, reply messages, link preview and configurations for overall view.
7+
8+
For web demo visit [Chat View Example](https://simformsolutionspvtltd.github.io/flutter_chatview/).
9+
10+
## Preview
11+
12+
![The example app running in iOS](https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_chatview/main/preview/chatview.gif)

doc/reference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
Check out [blog](https://medium.com/simform-engineering/chatview-a-cutting-edge-chat-ui-solution-7367b1f9d772) for better understanding and basic implementation.
3+
4+
Also, for whole example, check out the **example** app in the [example](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/tree/main/example) directory or the 'Example' tab on pub.dartlang.org for a more complete example.

0 commit comments

Comments
 (0)