Merge branch 'develop' into release/4.0
This commit is contained in:
@@ -1,18 +1,66 @@
|
|||||||
# Flutter samples
|
# Stream Flutter Samples
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
**Quick Links**
|
## 😎 Repo Overview
|
||||||
|
|
||||||
- [Register](https://getstream.io/chat/trial/) to get an API key for Stream Chat
|
This repo contains official Stream projects, guides, links to helpful resources, and excellent tutorials and samples developed by the Flutter community.
|
||||||
|
|
||||||
|
#### Quick Links
|
||||||
|
|
||||||
|
- [Register For a Free Account](https://getstream.io/try-for-free/)
|
||||||
|
- [Stream Flutter YouTube Playlist](https://www.youtube.com/playlist?list=PLNBhvhkAJG6t-BxkRAnSqa67lm5C1mpKk)
|
||||||
|
|
||||||
|
**Chat:**
|
||||||
- [Flutter Chat Tutorial](https://getstream.io/chat/flutter/tutorial/)
|
- [Flutter Chat Tutorial](https://getstream.io/chat/flutter/tutorial/)
|
||||||
|
- [Flutter Chat SDK Repo](https://github.com/GetStream/stream-chat-flutter)
|
||||||
|
- [Flutter Chat Client Documentation](https://getstream.io/chat/docs/flutter-dart/?language=dart)
|
||||||
|
- [Flutter Chat UI Documentation and Helpful Guides](https://getstream.io/chat/docs/sdk/flutter/)
|
||||||
- [Chat UI Kit](https://getstream.io/chat/ui-kit/)
|
- [Chat UI Kit](https://getstream.io/chat/ui-kit/)
|
||||||
- [Flutter SDK Repo](https://github.com/GetStream/stream-chat-flutter)
|
|
||||||
|
|
||||||
|
**Feeds:**
|
||||||
|
- [Flutter Feed Tutorial](https://getstream.io/activity-feeds/sdk/flutter/tutorial/)
|
||||||
|
- [Flutter Feed SDK Repo](https://github.com/GetStream/stream-feed-flutter)
|
||||||
|
- [Flutter Feed Client Documentation](https://getstream.io/activity-feeds/docs/flutter-dart/?language=dart)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
🔎 Official Samples and Tutorials
|
||||||
|
------------
|
||||||
|
|
||||||
|
| 🔮 Official Samples | |
|
||||||
|
|:-----|---------|
|
||||||
|
| <br><h3>Stream Chat Sample Application</h3>A fully fledged messaging application, demoing everything you can do with Stream Chat Flutter, using our <a href="https://pub.dev/packages/stream_chat_flutter">UI package</a>.<br><br>• Maintained to support the latest version of the SDK<br>• Combination of pre-made widgets and custom widgets<br>• Light & dark themes<br>• Localization<br>• Multiple users accounts<br>• Message search and filtering <br>• Create private and group chats <br>• View @mentions <br>• View pinned messages, files, photos and videos <br>• Base Stream Chat functionality <br><br> **[> Source Code](packages/stream_chat_v1)**<br><br> | <img src="https://user-images.githubusercontent.com/13705472/160582030-20a8c13e-a802-40c8-b744-e11f8d6df0b9.gif" width="320" alt="Stream Chat Flutter Sample App"> |
|
||||||
|
| ⚙️ Tutorials | |
|
||||||
|
| <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"> |
|
||||||
|
| <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"> |
|
||||||
|
| <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"> |
|
||||||
|
| ⚙️ Codelabs | |
|
||||||
|
| <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"> |
|
||||||
|
| | |
|
||||||
|
|
||||||
|
## Chat Guides
|
||||||
|
See [here](https://getstream.io/chat/docs/sdk/flutter/) for all our chat guides.
|
||||||
|
|
||||||
|
These guides explore our UI components in greater detail and demonstrate how to easily perform a variety of common actions using the Stream Chat Flutter SDK, such as:
|
||||||
|
- [Adding Push Notifications](https://getstream.io/chat/docs/sdk/flutter/guides/adding_push_notifications_v2/)
|
||||||
|
- [Adding Localization](https://getstream.io/chat/docs/sdk/flutter/guides/adding_localization/)
|
||||||
|
- [Adding Custom Attachments - Location Sharing](https://getstream.io/chat/docs/sdk/flutter/guides/adding_custom_attachments/)
|
||||||
|
- [Token Generation With Firebase Auth and Cloud Functions](https://getstream.io/chat/docs/sdk/flutter/guides/token_generation_with_firebase/)
|
||||||
|
- [Adding Chat To Video Livestreams](https://getstream.io/chat/docs/sdk/flutter/guides/adding_chat_to_video_livestreams/)
|
||||||
|
- [Adding Local Data Persistence](https://getstream.io/chat/docs/sdk/flutter/guides/adding_local_data_persistence/)
|
||||||
|
- [Understanding Filters](https://getstream.io/chat/docs/sdk/flutter/guides/understanding_filters/)
|
||||||
|
- [End To End Chat Encryption](https://getstream.io/chat/docs/sdk/flutter/guides/end_to_end_chat_encryption/)
|
||||||
|
|
||||||
|
## Chat Tutorials
|
||||||
|
Chat tutorials that go into greater detail on certain topics:
|
||||||
|
- [Add Peer-to-Peer Payment Integration With Stream and Rapyd](https://getstream.io/blog/p2p-integration-with-flutter/)
|
||||||
|
- [Send Voice Messages](https://getstream.io/blog/instantly-send-audio-messages-with-stream-chat-and-flutter/)
|
||||||
|
- [Location Sharing](https://getstream.io/blog/add-location-sharing-to-a-messaging-app-using-flutter/)
|
||||||
|
|
||||||
## What is Stream?
|
## What is Stream?
|
||||||
|
|
||||||
Stream allows developers to rapidly deploy scalable feeds and chat messaging with an industry leading 99.999% uptime SLA guarantee.
|
Stream allows developers to rapidly deploy scalable feeds and chat messaging with an industry-leading 99.999% uptime SLA guarantee.
|
||||||
|
|
||||||
With Stream's chat components, developers quickly add chat to their app for a variety of use-cases:
|
With Stream's chat components, developers quickly add chat to their app for a variety of use-cases:
|
||||||
|
|
||||||
@@ -22,28 +70,17 @@ With Stream's chat components, developers quickly add chat to their app for a va
|
|||||||
- Messaging style chat like Whatsapp or Facebook's messenger
|
- Messaging style chat like Whatsapp or Facebook's messenger
|
||||||
- Commerce chat like Drift or Intercom
|
- Commerce chat like Drift or Intercom
|
||||||
|
|
||||||
## Repo Overview 😎
|
## 📕 Historic Projects
|
||||||
|
|
||||||
This repo contains projects and samples developed by the team and Stream community. Projects are broke up into directories under the `packages` folder.
|
|
||||||
|
|
||||||
Each project contains a README with build and execution instructions.
|
|
||||||
|
|
||||||
## **Maintained Projects 🚀**
|
|
||||||
- [Stream Chat v1](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1): a sample app implemented using Stream Chat and Flutter. It is a fully fledged messaging app built using a combination of our pre-made widgets and custom Flutter widgets.
|
|
||||||
- [Chatter YouTube Series](https://github.com/HayesGordon/chatter): an ongoing, beginner friendly, YouTube video series showing how to use Stream's Flutter packages.
|
|
||||||
- [iMessage clone](https://github.com/GetStream/flutter-samples/tree/main/packages/imessage): an iMessage clone implemented using Flutter and the `stream_chat_flutter_core` package.
|
|
||||||
|
|
||||||
## **Historic Projects 📕**
|
|
||||||
*These projects are not actively maintained. They were developed using older versions of our packages and Flutter.*
|
*These projects are not actively maintained. They were developed using older versions of our packages and Flutter.*
|
||||||
- [Stream Chatty](https://github.com/GetStream/flutter-samples/tree/main/packages/chatty) Stream Chatty is a sample chat app made in Flutter using Stream Chat, Firebase, and flutter_bloc. It has full light and dark mode support, real-time chat, and full authentication using Firebase auth.
|
- [Stream Chatty](https://github.com/GetStream/flutter-samples/tree/main/packages/chatty) Stream Chatty is a sample chat app made in Flutter using Stream Chat, Firebase, and flutter_bloc. It has full light and dark mode support, real-time chat, and full authentication using Firebase auth.
|
||||||
|
|
||||||
## Requirements 🛠
|
## 🛠 Requirements
|
||||||
|
|
||||||
Before running this project please ensure Flutter is installed and configured on your machine. If you're new to Flutter, please checkout the [official guide](https://flutter.dev/docs/get-started/install) with installation instructions for your OS.
|
Before running this project, please ensure Flutter is installed and configured on your machine. If you're new to Flutter, please check out the [official guide](https://flutter.dev/docs/get-started/install) with installation instructions for your OS.
|
||||||
|
|
||||||
## Contributing
|
## 📈 Contributing
|
||||||
|
|
||||||
- How can I submit a sample app?
|
- How can I submit a sample app?
|
||||||
- Apps submissions are always welcomed! 🥳 Open a pr with a proper description and we'll review it as soon as possible
|
- Apps submissions are always welcomed! 🥳 Open a pr with a proper description, and we'll review it as soon as possible
|
||||||
- Spot a bug 🕷?
|
- Spot a bug 🕷?
|
||||||
- We welcome code changes that improve the apps or fix a problem. Please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github.
|
- We welcome code changes that improve the apps or fix a problem. Please follow all best practices and add tests if applicable before submitting a Pull Request on Github.
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.example.example"
|
applicationId "com.example.example"
|
||||||
minSdkVersion 21
|
minSdkVersion 22
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
|||||||
@@ -293,10 +293,7 @@ class _AdvancedOptionsPageState extends State<AdvancedOptionsPage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final client = StreamChatClient(
|
final client = buildStreamChatClient(apiKey);
|
||||||
apiKey,
|
|
||||||
logLevel: Level.INFO,
|
|
||||||
)..chatPersistenceClient = chatPersistentClient;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await client.connectUser(
|
await client.connectUser(
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
|
|||||||
Navigator.pushNamedAndRemoveUntil(
|
Navigator.pushNamedAndRemoveUntil(
|
||||||
context,
|
context,
|
||||||
Routes.CHANNEL_PAGE,
|
Routes.CHANNEL_PAGE,
|
||||||
ModalRoute.withName(Routes.HOME),
|
ModalRoute.withName(Routes.CHANNEL_LIST_PAGE),
|
||||||
arguments: ChannelPageArgs(channel: channel),
|
arguments: ChannelPageArgs(channel: channel),
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
import 'package:stream_chat_localizations/stream_chat_localizations.dart';
|
import 'package:stream_chat_localizations/stream_chat_localizations.dart';
|
||||||
import 'package:stream_chat_persistence/stream_chat_persistence.dart';
|
import 'package:stream_chat_persistence/stream_chat_persistence.dart';
|
||||||
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
|
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
|
||||||
|
|
||||||
import 'app_config.dart';
|
|
||||||
import 'routes/app_routes.dart';
|
import 'routes/app_routes.dart';
|
||||||
import 'routes/routes.dart';
|
import 'routes/routes.dart';
|
||||||
|
|
||||||
@@ -22,8 +22,65 @@ final chatPersistentClient = StreamChatPersistenceClient(
|
|||||||
connectionMode: ConnectionMode.regular,
|
connectionMode: ConnectionMode.regular,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void sampleAppLogHandler(LogRecord record) async {
|
||||||
|
if (kDebugMode) StreamChatClient.defaultLogHandler(record);
|
||||||
|
|
||||||
|
// report errors to sentry
|
||||||
|
if (record.error != null || record.stackTrace != null) {
|
||||||
|
await Sentry.captureException(
|
||||||
|
record.error,
|
||||||
|
stackTrace: record.stackTrace,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamChatClient buildStreamChatClient(
|
||||||
|
String apiKey, {
|
||||||
|
Level logLevel = Level.SEVERE,
|
||||||
|
}) {
|
||||||
|
return StreamChatClient(
|
||||||
|
apiKey,
|
||||||
|
logLevel: logLevel,
|
||||||
|
logHandlerFunction: sampleAppLogHandler,
|
||||||
|
)..chatPersistenceClient = chatPersistentClient;
|
||||||
|
}
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
|
const sentryDsn =
|
||||||
|
'https://6381ef88de4140db8f5e25ab37e0f08c@o1213503.ingest.sentry.io/6352870';
|
||||||
|
|
||||||
|
/// Captures errors reported by the Flutter framework.
|
||||||
|
FlutterError.onError = (FlutterErrorDetails details) {
|
||||||
|
if (kDebugMode) {
|
||||||
|
// In development mode, simply print to console.
|
||||||
|
FlutterError.dumpErrorToConsole(details);
|
||||||
|
} else {
|
||||||
|
// In production mode, report to the application zone to report to sentry.
|
||||||
|
Zone.current.handleUncaughtError(details.exception, details.stack!);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Future<void> _reportError(dynamic error, StackTrace stackTrace) async {
|
||||||
|
// Print the exception to the console.
|
||||||
|
if (kDebugMode) {
|
||||||
|
// Print the full stacktrace in debug mode.
|
||||||
|
print(stackTrace);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// Send the Exception and Stacktrace to sentry in Production mode.
|
||||||
|
await Sentry.captureException(error, stackTrace: stackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
runZonedGuarded(
|
||||||
|
() async {
|
||||||
|
await SentryFlutter.init(
|
||||||
|
(options) => options.dsn = sentryDsn,
|
||||||
|
);
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
|
},
|
||||||
|
_reportError,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
@@ -45,10 +102,7 @@ class _MyAppState extends State<MyApp>
|
|||||||
token = await secureStorage.read(key: kStreamToken);
|
token = await secureStorage.read(key: kStreamToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
final client = StreamChatClient(
|
final client = buildStreamChatClient(apiKey ?? kStreamApiKey);
|
||||||
apiKey ?? kDefaultStreamApiKey,
|
|
||||||
logLevel: Level.SEVERE,
|
|
||||||
)..chatPersistenceClient = chatPersistentClient;
|
|
||||||
|
|
||||||
if (userId != null && token != null) {
|
if (userId != null && token != null) {
|
||||||
await client.connectUser(
|
await client.connectUser(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: example
|
name: example
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 1.7.1
|
version: 1.8.1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
@@ -26,13 +26,14 @@ dependencies:
|
|||||||
ref: v4
|
ref: v4
|
||||||
path: packages/stream_chat_localizations
|
path: packages/stream_chat_localizations
|
||||||
flutter_local_notifications: ^9.0.0
|
flutter_local_notifications: ^9.0.0
|
||||||
flutter_svg: ^1.0.1
|
flutter_svg: ^1.0.3
|
||||||
flutter_secure_storage: ^4.2.1
|
flutter_secure_storage: ^5.0.2
|
||||||
yaml: ^3.1.0
|
yaml: ^3.1.0
|
||||||
uuid: ^3.0.5
|
uuid: ^3.0.5
|
||||||
streaming_shared_preferences: ^2.0.0
|
streaming_shared_preferences: ^2.0.0
|
||||||
lottie: ^1.2.1
|
lottie: ^1.2.1
|
||||||
collection: ^1.15.0
|
collection: ^1.15.0
|
||||||
|
sentry_flutter: ^6.5.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_launcher_icons: ^0.9.2
|
flutter_launcher_icons: ^0.9.2
|
||||||
|
|||||||
Reference in New Issue
Block a user