diff --git a/docusaurus/docs/Flutter/basics/choose_package.mdx b/docusaurus/docs/Flutter/basics/choose_package.mdx new file mode 100644 index 00000000..7a4961c5 --- /dev/null +++ b/docusaurus/docs/Flutter/basics/choose_package.mdx @@ -0,0 +1,54 @@ +--- +id: choose_package +sidebar_position: 2 +title: Choosing The Right Flutter Package +--- + +### Why the SDK is split into different packages + +Different applications need different levels of customization and integration with the Stream Chat SDK. +To do this, the Flutter SDK is split into three different packages which build upon the last and give +varying levels of control to the developer. The higher level packages offer better compatibility out of the +box while the lower level SDKs offer fine grained control. There is also a separate package for persistence +which allows you persist data locally which works with all packages. + +### How do I choose? + +#### The case for stream_chat_flutter + +For the quickest way to integrate Stream Chat with your app, the UI SDK (`stream_chat_flutter`) is the +way to go. `stream_chat_flutter` contains prebuilt components that manage most operations like data +fetching, pagination, sending a message, and more. This ensures you have a nearly out-of-the-box +experience adding chat to your applications. It is also possible to use this in conjunction with +lower level operations of the SDK to get the best of both worlds. + +:::note +The package allows customization of components to a large extent making it easy to tweak the theme +to match your app colors and such. If you require any additional feature or customization, feel free +to request this through our support channels. +::: + +:::summary +For the quickest and easiest way to add Chat to your app with prebuilt UI components, use stream_chat_flutter +::: + +#### The case for stream_chat_flutter_core + +If your application involves UI that does not fit in with the stream_chat_flutter components, stream_chat_flutter_core +strips away the UI associated with the components and provides the data fetching and manipulation +capabilities while supplying builders for UI. This allows you to implement your own UI and themes +completely independently while not worrying about writing functions for data and pagination. + +:::summary +For implementing your own custom UI while not having to worry about lower level API calls, use stream_chat_flutter_core. +::: + +#### The case for stream_chat + +The stream_chat package is the Low-level Client (LLC) of Stream Chat in Flutter. This package wraps +the underlying functionality of Stream Chat and allows the most customization in terms of UI, data, +and architecture. + +:::summary +For the most control over the SDK and dealing with low level calls to the API, use stream_chat. +::: \ No newline at end of file diff --git a/docusaurus/docs/Flutter/guides/_category_.json b/docusaurus/docs/Flutter/guides/_category_.json index c2af63bb..cb58ac0d 100644 --- a/docusaurus/docs/Flutter/guides/_category_.json +++ b/docusaurus/docs/Flutter/guides/_category_.json @@ -1,4 +1,4 @@ { "label": "Guides", - "position": 5 + "position": 2 } \ No newline at end of file diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/_category_.json b/docusaurus/docs/Flutter/stream_chat_flutter/_category_.json index 18f33a2b..242afb7b 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/_category_.json +++ b/docusaurus/docs/Flutter/stream_chat_flutter/_category_.json @@ -1,4 +1,4 @@ { "label": "Stream Chat Flutter", - "position": 4 + "position": 3 } \ No newline at end of file diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/message_list_view.mdx b/docusaurus/docs/Flutter/stream_chat_flutter/message_list_view.mdx index 74a3ae5f..0ac78f7d 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/message_list_view.mdx +++ b/docusaurus/docs/Flutter/stream_chat_flutter/message_list_view.mdx @@ -84,7 +84,9 @@ MessageListView( You can also supply your own implementation for displaying messages using the `messageBuilder` parameter. -Note: To customize the existing implementation, look at the `MessageWidget` documentation instead. +:::note +To customize the existing implementation, look at the `MessageWidget` documentation instead. +::: ```dart MessageListView( diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/user_list_view.mdx b/docusaurus/docs/Flutter/stream_chat_flutter/user_list_view.mdx index 5cc1ae40..61dfbeb4 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/user_list_view.mdx +++ b/docusaurus/docs/Flutter/stream_chat_flutter/user_list_view.mdx @@ -27,11 +27,7 @@ class UsersListPage extends StatelessWidget { return Scaffold( body: UsersBloc( child: UsersListView( - filter: Filter.and([ - Filter.autoComplete('name', 'search_here'), - Filter.notEqual( - 'id', StreamChat.of(context).user!.id), - ]), + filter: Filter.notEqual('id', StreamChat.of(context).user!.id), sort: [ SortOption( 'name', diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/_category_.json b/docusaurus/docs/Flutter/stream_chat_flutter_core/_category_.json index 748e3f4a..8d738e89 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/_category_.json +++ b/docusaurus/docs/Flutter/stream_chat_flutter_core/_category_.json @@ -1,4 +1,4 @@ { "label": "Stream Chat Flutter Core", - "position": 3 + "position": 4 } \ No newline at end of file diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/user_list_core.mdx b/docusaurus/docs/Flutter/stream_chat_flutter_core/user_list_core.mdx index bf1055db..622d0025 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/user_list_core.mdx +++ b/docusaurus/docs/Flutter/stream_chat_flutter_core/user_list_core.mdx @@ -18,3 +18,47 @@ exposes builders to build the UI in situations such as loading, empty data, erro ### Basic Example +`UserListCore` is a simplified class that allows fetching users while +exposing UI builders. +A `UserListController` is used to load and paginate data. + +```dart +class UsersListPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: UsersListCore( + sort: [SortOption('last_active')], + pagination: PaginationParams( + limit: 20, + ), + errorBuilder: (err) { + return Center( + child: Text('An error has occured'), + ); + }, + emptyBuilder: (context) { + return Center( + child: Text('Nothing here...'), + ); + }, + emptyBuilder: (context) { + return Center( + child: CircularProgressIndicator(), + ); + }, + listBuilder: (context, list) { + return UsersPage(list); + } + ), + ); + } +} +``` + +`UsersBloc` must be the ancestor of this widget. This is necessary since +`UserListCore` depends on functionality contained within `UsersBloc`. + +The parameters `listBuilder`, `loadingBuilder`, `emptyBuilder` and +`errorBuilder` must all be supplied and not null. +