Skip to content

Commit ee71cc7

Browse files
committed
update sample app
2 parents 001298e + c30d127 commit ee71cc7

File tree

9 files changed

+92
-57
lines changed

9 files changed

+92
-57
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This repo contains official Stream projects, guides, links to helpful resources,
3535
| <br><h3>Stream Chat Flutter Core Application</h3>**[> YouTube Tutorial Playlist](https://www.youtube.com/playlist?list=PLNBhvhkAJG6sH7dkmwt4BiCclFkMoXq4r)**<br><br>An ongoing, beginner friendly, series, demoing how to use the <a href ="https://pub.dev/packages/stream_chat_flutter_core">Stream Chat Flutter Core package</a> for lower level control and customization options.<br><br>• Custom UI components <br>• Lower level client integration<br>• Light & dark themes<br>• Multiple users accounts <br>• Firebase Authentication <br>• Firebase Cloud Functions to generate user tokens<br>• Create private chats <br><br> **[> Source Code](https://github.com/HayesGordon/chatter)**<br><br> | <img src="https://user-images.githubusercontent.com/13705472/160588541-6dc3186c-848f-47d6-a8f2-a9d2f2f5da4a.gif" width="320" alt="Chatter Application Preview"> |
3636
| <br><h3>Instagram Clone</h3>**[> YouTube Tutorial](https://youtu.be/fHRB6KGoaV0)**<br>**[> Written Tutorial](https://getstream.io/blog/instagram-clone-flutter/)**<br><br>A tutorial showing how to use <a href="https://github.com/GetStream/stream-feed-flutter">Stream Feed Flutter</a> to create an Instagram clone using activity feeds.<br><br>• Instagram-like animations and transitions <br>• Light & dark themes<br>• Add and change profile pictures<br>• Multiple users accounts <br>• State management with Provider<br>• Application architecture <br>• Add photo posts to your own user feed (activities)<br>• Follow/Unfollow other users' feeds <br>• Add comments and likes (reactions)<br><br> **[> Source Code](https://github.com/GetStream/flutter-instagram-clone)**<br><br> | <img src="https://camo.githubusercontent.com/f6125cca0164288544682eff5ccab8c100c22e0054ead2401a232d81c8be3f8e/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f4a6d5259656c53495a7a49306d696546774f2f67697068792e676966" width="320" alt="Chatter Application Preview"> |
3737
| <br><h3>iMessage Clone</h3>**[> Written Tutorial](https://getstream.io/blog/build-an-imessage-clone-with-streams-flutter-chat-sdk/)**<br><br>This tutorial shows how to use <a href="https://pub.dev/packages/stream_chat_flutter_core">Stream Chat Flutter Core</a> to create a basic chat application, styled similar to iMessage.<br><br>• Custom chat bubbles with a custom painter <br>• Core chat components<br>• Sending attachments <br>• Chat functionality<br>• List all channels<br> **[> Source Code](https://github.com/GetStream/flutter-samples/tree/main/packages/imessage)**<br><br> | <img src="https://user-images.githubusercontent.com/13705472/160639870-37fcccc5-b5ae-4260-aad6-9d87cd2c0f9c.gif" width="320" alt="Chatter Application Preview"> |
38+
| <br><h3>Chess Game in Chat</h3>**[> Written Tutorial](https://getstream.io/blog/messenger-chess-chat-app/)**<br><br>A fun tutorial showing you how customizable <a href="https://pub.dev/packages/stream_chat_flutter">Stream Chat Flutter</a> is by adding a chess game to your chat app.<br><br>• Custom Stream Chat Attachments <br>• Two player, or group match<br>• Sending attachments <br>• Base chat functionality<br>• Updating messages/attachments<br> **[> Source Code](https://github.com/deven98/stream_chess_demo)**<br><br> | <img src="https://user-images.githubusercontent.com/13705472/171142720-104d7b68-9bfe-4eee-81ca-82d5d45375e0.gif" width="320" alt="Chess Game Chat Preview"> |
3839
| ⚙️ Codelabs | |
3940
| <br><h3>Animated Stickers And Reactions With Rive</h3>**[> Codelab](https://getstream.io/codelabs/flutter/flutter-chat-and-rive-animations/)**<br><br>Add animated reactions and stickers to your chat application using <a href ="https://rive.app/">Rive</a>.<br><br>• Rive animations <br>• Custom attachments<br>• Custom reactions <br><br> **[> Source Code](https://github.com/HayesGordon/stream-chat-flutter-animated-stickers)**<br><br> | <img src="https://user-images.githubusercontent.com/13705472/164188802-a8cce134-7441-4daf-9d1d-c3fadeeb03ea.gif" width="320" alt="Animated Reactions/Stickers with Rive"> |
4041
| | |
@@ -57,6 +58,7 @@ Chat tutorials that go into greater detail on certain topics:
5758
- [Add Peer-to-Peer Payment Integration With Stream and Rapyd](https://getstream.io/blog/p2p-integration-with-flutter/)
5859
- [Send Voice Messages](https://getstream.io/blog/instantly-send-audio-messages-with-stream-chat-and-flutter/)
5960
- [Location Sharing](https://getstream.io/blog/add-location-sharing-to-a-messaging-app-using-flutter/)
61+
- [Conversational AI with HuggingFace and DialogGPT](https://getstream.io/blog/conversational-ai-flutter/)
6062

6163
## What is Stream?
6264

packages/stream_chat_v1/.metadata

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: 8962f6dc68ec8e2206ac2fa874da4a453856c7d3
7+
revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
88
channel: stable
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
17+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
18+
- platform: android
19+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
20+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
21+
- platform: ios
22+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
23+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
24+
- platform: linux
25+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
26+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
27+
- platform: macos
28+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
29+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
30+
- platform: web
31+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
32+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
33+
- platform: windows
34+
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
35+
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

packages/stream_chat_v1/android/app/src/main/kotlin/com/example/example/Application.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class Application : FlutterApplication(), PluginRegistrantCallback {
1212
super.onCreate()
1313
}
1414

15-
override fun registerWith(registry: PluginRegistry?) {
16-
PathProviderPlugin.registerWith(registry?.registrarFor(
15+
override fun registerWith(registry: PluginRegistry) {
16+
PathProviderPlugin.registerWith(registry.registrarFor(
1717
"io.flutter.plugins.pathprovider.PathProviderPlugin"))
18-
SharedPreferencesPlugin.registerWith(registry?.registrarFor(
18+
SharedPreferencesPlugin.registerWith(registry.registrarFor(
1919
"io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin"))
20-
FlutterLocalNotificationsPlugin.registerWith(registry?.registrarFor(
20+
FlutterLocalNotificationsPlugin.registerWith(registry.registrarFor(
2121
"com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin"))
2222
}
2323
}

packages/stream_chat_v1/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@
456456
);
457457
PRODUCT_BUNDLE_IDENTIFIER = io.getstream.flutter;
458458
PRODUCT_NAME = "$(TARGET_NAME)";
459-
PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter 1634304851";
459+
PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter";
460460
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
461461
SWIFT_VERSION = 5.0;
462462
VERSIONING_SYSTEM = "apple-generic";
@@ -598,7 +598,7 @@
598598
);
599599
PRODUCT_BUNDLE_IDENTIFIER = io.getstream.flutter;
600600
PRODUCT_NAME = "$(TARGET_NAME)";
601-
PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter 1634304851";
601+
PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter";
602602
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
603603
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
604604
SWIFT_VERSION = 5.0;
@@ -635,7 +635,7 @@
635635
);
636636
PRODUCT_BUNDLE_IDENTIFIER = io.getstream.flutter;
637637
PRODUCT_NAME = "$(TARGET_NAME)";
638-
PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter 1634304851";
638+
PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter";
639639
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
640640
SWIFT_VERSION = 5.0;
641641
VERSIONING_SYSTEM = "apple-generic";

packages/stream_chat_v1/lib/channel_page.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class ChannelPage extends StatefulWidget {
3535

3636
class _ChannelPageState extends State<ChannelPage> {
3737
FocusNode? _focusNode;
38-
StreamMessageInputController _messageInputController = StreamMessageInputController();
38+
StreamMessageInputController _messageInputController =
39+
StreamMessageInputController();
3940

4041
@override
4142
void initState() {
@@ -51,7 +52,7 @@ class _ChannelPageState extends State<ChannelPage> {
5152

5253
void _reply(Message message) {
5354
_messageInputController.quotedMessage = message;
54-
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
55+
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
5556
_focusNode!.requestFocus();
5657
});
5758
}

packages/stream_chat_v1/lib/group_info_screen.dart

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
4141

4242
late final channel = StreamChannel.of(context).channel;
4343

44-
late final userListController = StreamUserListController(
45-
client: StreamChat.of(context).client,
46-
limit: 25,
47-
filter: Filter.and(
48-
[
49-
if (_searchController!.text.isNotEmpty)
50-
Filter.autoComplete('name', _userNameQuery),
51-
Filter.notIn('id', [
52-
StreamChat.of(context).currentUser!.id,
53-
...channel.state!.members
54-
.map<String?>(((e) => e.userId))
55-
.whereType<String>(),
56-
]),
57-
],
58-
),
59-
sort: [
60-
SortOption(
61-
'name',
62-
direction: 1,
63-
),
64-
],
65-
);
44+
late StreamUserListController userListController;
6645

6746
void _userNameListener() {
6847
if (_searchController!.text == _userNameQuery) {
@@ -104,6 +83,33 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
10483
mutedBool = ValueNotifier(channel.isMuted);
10584
}
10685

86+
@override
87+
void didChangeDependencies() {
88+
userListController = StreamUserListController(
89+
client: StreamChat.of(context).client,
90+
limit: 25,
91+
filter: Filter.and(
92+
[
93+
if (_searchController!.text.isNotEmpty)
94+
Filter.autoComplete('name', _userNameQuery),
95+
Filter.notIn('id', [
96+
StreamChat.of(context).currentUser!.id,
97+
...channel.state!.members
98+
.map<String?>(((e) => e.userId))
99+
.whereType<String>(),
100+
]),
101+
],
102+
),
103+
sort: [
104+
SortOption(
105+
'name',
106+
direction: 1,
107+
),
108+
],
109+
);
110+
super.didChangeDependencies();
111+
}
112+
107113
@override
108114
void dispose() {
109115
userListController.dispose();
@@ -220,7 +226,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
220226
Widget _buildMembers(List<Member> members) {
221227
final groupMembers = members
222228
..sort((prev, curr) {
223-
if (curr.role == 'owner') return 1;
229+
if (curr.userId == channel.createdBy?.id) return 1;
224230
return 0;
225231
});
226232

@@ -246,7 +252,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
246252
final userMember = groupMembers.firstWhereOrNull(
247253
(e) => e.user!.id == StreamChat.of(context).currentUser!.id,
248254
);
249-
_showUserInfoModal(member.user, userMember?.role == 'owner');
255+
_showUserInfoModal(
256+
member.user, userMember?.userId == channel.createdBy?.id);
250257
},
251258
child: Container(
252259
height: 65.0,
@@ -293,7 +300,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
293300
Padding(
294301
padding: const EdgeInsets.all(8.0),
295302
child: Text(
296-
member.role == 'owner'
303+
member.userId == channel.createdBy?.id
297304
? AppLocalizations.of(context).owner
298305
: '',
299306
style: TextStyle(
@@ -920,18 +927,6 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
920927
);
921928
},
922929
),
923-
// if (!channel.isDistinct &&
924-
// StreamChat.of(context).user!.id != user.id &&
925-
// isUserAdmin)
926-
// _buildModalListTile(
927-
// context,
928-
// StreamSvgIcon.iconUserSettings(
929-
// color: StreamChatTheme.of(context).colorTheme.textLowEmphasis,
930-
// size: 24.0,
931-
// ),
932-
// 'Make Owner', () {
933-
// // TODO: Add make owner implementation (Remaining from backend)
934-
// }),
935930
if (!channel.isDistinct &&
936931
StreamChat.of(context).currentUser!.id != user.id &&
937932
isUserAdmin)

packages/stream_chat_v1/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void sampleAppLogHandler(LogRecord record) async {
3636

3737
StreamChatClient buildStreamChatClient(
3838
String apiKey, {
39-
Level logLevel = Level.SEVERE,
39+
Level logLevel = Level.INFO,
4040
}) {
4141
return StreamChatClient(
4242
apiKey,
@@ -129,7 +129,7 @@ class _MyAppState extends State<MyApp>
129129
final now = DateTime.now().millisecondsSinceEpoch;
130130

131131
if (now - timeOfStartMs > 1500) {
132-
SchedulerBinding.instance!.addPostFrameCallback((timeStamp) {
132+
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
133133
forwardAnimations();
134134
});
135135
} else {

packages/stream_chat_v1/lib/thread_page.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ class _ThreadPageState extends State<ThreadPage> {
2424
@override
2525
void initState() {
2626
super.initState();
27-
_messageInputController =
28-
StreamMessageInputController(message: widget.parent);
27+
_messageInputController = StreamMessageInputController(
28+
message: Message(
29+
parentId: widget.parent.id,
30+
));
2931
}
3032

3133
@override
@@ -36,7 +38,7 @@ class _ThreadPageState extends State<ThreadPage> {
3638

3739
void _reply(Message message) {
3840
_messageInputController.quotedMessage = message;
39-
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
41+
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
4042
_focusNode.requestFocus();
4143
});
4244
}

packages/stream_chat_v1/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: example
22
description: A new Flutter project.
33
publish_to: 'none'
4-
version: 2.1.1
4+
version: 2.2.0
55

66
environment:
77
sdk: '>=2.17.0 <3.0.0'
@@ -10,9 +10,9 @@ dependencies:
1010
flutter_app_badger: ^1.3.0
1111
flutter:
1212
sdk: flutter
13-
stream_chat_flutter: ^4.0.0
14-
stream_chat_persistence: ^4.0.0
15-
stream_chat_localizations: ^3.0.0
13+
stream_chat_flutter: ^4.2.0
14+
stream_chat_persistence: ^4.1.0
15+
stream_chat_localizations: ^3.1.0
1616
flutter_local_notifications: ^9.0.0
1717
flutter_svg: ^1.0.3
1818
flutter_secure_storage: ^5.0.2

0 commit comments

Comments
 (0)