### Installation Bundle Setup Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/linux/CMakeLists.txt Configures the installation prefix to create a relocatable bundle and sets up directories for data and libraries within the bundle. ```cmake # === Installation === # By default, "installing" just makes a relocatable bundle in the build # directory. set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() # Start with a clean build bundle directory every time. install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Install Application Bundle Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_flutter/example/linux/CMakeLists.txt Sets up installation rules for the application bundle, including the executable, data files, libraries, and assets. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Configure Installation Directory Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/windows/CMakeLists.txt Sets up the installation directory for the application bundle, ensuring that support files are placed next to the executable. This is important for running the application in place, especially within IDEs like Visual Studio. ```cmake # === Installation === # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Configure Installation Rules Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_flutter/example/windows/CMakeLists.txt Defines how the application and its assets are installed. It ensures that runtime files, data, libraries, and assets are placed in the correct directories relative to the executable. ```cmake # === Installation === # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) # Install the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Install Executable and Data Files Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/linux/CMakeLists.txt Installs the main executable, ICU data file, Flutter library, and bundled plugin libraries to the specified bundle destinations. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Bootstrap Project Dependencies Source: https://github.com/getstream/stream-chat-flutter/blob/master/README.md Run this command after cloning the project to install all necessary dependencies. ```shell melos bootstrap ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/linux/CMakeLists.txt Installs the Flutter assets directory, ensuring it's re-copied on each build to avoid stale files. ```cmake # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install AOT Library Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/linux/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library on non-Debug builds. ```cmake # Install the AOT library on non-Debug builds only. if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install AOT Library Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library for Profile and Release builds. This is not installed for Debug builds to potentially speed up development cycles. ```cmake # Install the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Set Installation RPATH Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/windows/CMakeLists.txt Configures the runtime search path for libraries relative to the executable. This is useful for ensuring dynamic libraries can be found after installation. ```cmake set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### StreamReactionListView Usage Example Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/reaction_list.md A basic example of how to instantiate and use StreamReactionListView. It provides a custom itemBuilder to display reaction type and user name. ```dart StreamReactionListView( controller: controller, itemBuilder: (context, reactions, index) { final reaction = reactions[index]; return ListTile( leading: Text(reaction.type), title: Text(reaction.user?.name ?? ''), ); }, ) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/linux/CMakeLists.txt Sets up the minimum CMake version, project name, and binary name. Configures the application ID and RPATH for libraries. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "example") set(APPLICATION_ID "com.example.example") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Run Flutter Pub Get Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_flutter_core/README.md After adding the dependency, run this command in your terminal to fetch the package and its dependencies. ```shell flutter pub get ``` -------------------------------- ### Migrate from StreamFullScreenMedia to StreamMediaGalleryPreview Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/media_viewer.md Example demonstrating the migration from the old StreamFullScreenMedia widget to the new StreamMediaGalleryPreview widget. It shows the changes in constructor parameters and how to map attachments. ```dart Navigator.of(context).push( MaterialPageRoute( builder: (_) => StreamChannel( channel: channel, child: StreamFullScreenMedia( mediaAttachmentPackages: [ for (final a in message.attachments) StreamAttachmentPackage(attachment: a, message: message), ], startIndex: 3, userName: message.user!.name, autoplayVideos: false, onReplyMessage: handleReply, onShowMessage: handleShowInChat, attachmentActionsModalBuilder: buildActions, ), ), ), ); // After: Navigator.of(context).push( MaterialPageRoute( builder: (_) => StreamChannel( channel: channel, child: StreamMediaGalleryPreview( attachments: message.toMediaGalleryAttachments( filter: (a) => a.type == AttachmentType.image || a.type == AttachmentType.video || a.type == AttachmentType.giphy, ), initialIndex: 3, autoplayVideos: false, ), ), ), ); ``` -------------------------------- ### Using showStreamDialog for Stream Modals Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_actions.md Example of replacing `showDialog` with `showStreamDialog` to present Stream modals, ensuring proper theming and transitions. ```dart final action = await showStreamDialog( context: context, builder: (_) => StreamMessageActionsModal(/* … */), ); ``` -------------------------------- ### StreamChannelListHeader After Redesign Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/headers_and_icons.md Example of StreamChannelListHeader usage after the redesign, demonstrating new parameters like title and trailing. ```dart StreamChannelListHeader( title: Text('Chats', style: context.streamTextTheme.headingSm), trailing: StreamButton.icon( icon: Icon(context.streamIcons.plus), onPressed: () => GoRouter.of(context).pushNamed('new-chat'), ), ) ``` -------------------------------- ### StreamChannelHeader Before Migration Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/headers_and_icons.md Example of StreamChannelHeader usage before the redesign. Note the use of parameters like showBackButton, onBackPressed, onImageTap, showTypingIndicator, and elevation. ```dart StreamChannelHeader( showBackButton: true, onBackPressed: () => GoRouter.of(context).pop(), onImageTap: () => openChannelInfo(channel), showTypingIndicator: true, elevation: 1, ) ``` -------------------------------- ### StreamMediaGalleryPreviewHeader Usage Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/headers_and_icons.md Example of StreamMediaGalleryPreviewHeader, which wraps StreamAppBar and exposes title and subtitle slots. ```dart StreamMediaGalleryPreviewHeader( title: Text(message.user?.name ?? ''), subtitle: Text( context.translations.sentAtText( date: message.createdAt, time: message.createdAt, ), ), ) ``` -------------------------------- ### Custom Message Composer Input (Before) Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_composer.md Example of how to customize the message composer input using the old 'messageComposerInput' factory builder key. ```dart streamChatComponentBuilders( messageComposerInput: (context, props) => MyCustomTextField(props: props), ) ``` -------------------------------- ### Reorder Default Attachment Picker Options Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/v10-migration.md Example demonstrating how to reorder default attachment picker options using `attachmentPickerOptionsBuilder`. ```dart StreamMessageComposer( attachmentPickerOptionsBuilder: (context, defaultOptions) { // Reverse the order return defaultOptions.reversed.toList(); }, ) ``` -------------------------------- ### Clone and Bootstrap Monorepo Source: https://github.com/getstream/stream-chat-flutter/blob/master/sample_app/README.md Clone the Stream Chat Flutter repository and bootstrap the monorepo using Melos. This command installs all necessary dependencies. ```bash git clone https://github.com/GetStream/stream-chat-flutter.git cd stream-chat-flutter melos bootstrap ``` -------------------------------- ### StreamContextMenu with Partitioned Actions Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_actions.md A themed container that wraps a list of StreamContextMenuAction and StreamContextMenuSeparator widgets. This example shows how to use the 'partitioned' helper to build the children. ```dart StreamContextMenu( children: StreamContextMenuAction.partitioned(items: actions), ) ``` -------------------------------- ### Migrating StreamUnreadIndicator Styling Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/unread_indicator.md This example shows the migration from the old way of styling StreamUnreadIndicator to the new method using StreamTheme. Direct styling parameters like backgroundColor, textColor, and textStyle have been removed. ```dart StreamUnreadIndicator( backgroundColor: Colors.red, textColor: Colors.white, textStyle: TextStyle(fontSize: 12), ) ``` ```dart // Styling via StreamTheme — see README.md for theming setup. StreamUnreadIndicator() ``` -------------------------------- ### StreamChannelListHeader Before Redesign Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/headers_and_icons.md Example of StreamChannelListHeader usage before the redesign, showcasing old parameters like titleBuilder and onNewChatButtonTap. ```dart StreamChannelListHeader( titleBuilder: (context, user) => Text(user?.name ?? 'Stream Chat'), onUserAvatarTap: (_) => Scaffold.of(context).openDrawer(), onNewChatButtonTap: () => GoRouter.of(context).pushNamed('new-chat'), elevation: 1, ) ``` -------------------------------- ### Set Minimum CMake Version and Project Name Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/windows/CMakeLists.txt Specifies the minimum required CMake version and the project name. This is a standard starting point for any CMake project. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) ``` -------------------------------- ### Run the Sample App Source: https://github.com/getstream/stream-chat-flutter/blob/master/sample_app/README.md Navigate to the sample_app directory and run the Flutter application. The app connects to a demo Stream environment by default. ```bash cd sample_app flutter run ``` -------------------------------- ### System Dependencies and Application Build Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/linux/CMakeLists.txt Finds PkgConfig and GTK, defines the application ID, and adds the main executable with its source files and Flutter plugin registration. ```cmake # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") # Application build add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Application Build Configuration Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_flutter/example/linux/CMakeLists.txt Configures the main application executable, linking necessary libraries and setting runtime output directory. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Before: StreamMessageAction Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_actions.md Example of using the deprecated StreamMessageAction. ```dart StreamMessageAction( action: QuotedReply(message: message), leading: const StreamSvgIcon(icon: StreamSvgIcons.reply), title: Text(context.translations.replyLabel), ) ``` -------------------------------- ### Before: StreamMessageActionItem Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_actions.md Example of using the deprecated StreamMessageActionItem with StreamMessageAction. ```dart StreamMessageActionItem( action: StreamMessageAction( action: CopyMessage(message: message), leading: const StreamSvgIcon(icon: StreamSvgIcons.copy), title: Text('Copy'), ), onTap: (action) => _handle(action), ) ``` -------------------------------- ### Set Up Flutter Library and Headers Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_flutter/example/windows/flutter/CMakeLists.txt Configures the Flutter library and its associated headers. This includes setting the path to the Flutter library DLL and ICU data file, and defining include directories for the Flutter library interface. ```cmake cmake_minimum_required(VERSION 3.14) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) # TODO: Move the rest of this into files in ephemeral. See # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Old StreamDraftListView Usage Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_list.md Example of using the removed StreamDraftListView. ```dart StreamDraftListView( controller: draftListController, onDraftTap: (draft) => openDraft(draft), ) ``` -------------------------------- ### Run Specific Test File in a Package Source: https://github.com/getstream/stream-chat-flutter/blob/master/CLAUDE.md Navigates to a specific package directory and runs a particular test file. ```bash cd packages/stream_chat_flutter && flutter test test/src/path/to/test_file.dart ``` -------------------------------- ### Global Theme Migration: After Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/channel_list_item.md Illustrates the new approach using StreamChannelListItemThemeData for channel list item theming. ```dart StreamChatTheme( data: StreamChatThemeData( channelListItemTheme: StreamChannelListItemThemeData( titleStyle: TextStyle(fontWeight: FontWeight.bold), subtitleStyle: TextStyle(color: Colors.grey), timestampStyle: TextStyle(fontSize: 12), // unreadCounterColor → customize via StreamBadgeNotificationThemeData ), ), child: ..., ) ``` -------------------------------- ### After: StreamContextMenuAction (Copy Message Example) Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_actions.md Replacement for StreamMessageActionItem, directly using StreamContextMenuAction for copy functionality. ```dart StreamContextMenuAction( value: CopyMessage(message: message), leading: Icon(context.streamIcons.copy), label: Text('Copy'), onTap: () => _handle(message), ) ``` -------------------------------- ### Removing a Default Action using actionsBuilder Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_widget.md Example of how to remove a default action, such as 'DeleteMessage', using the `actionsBuilder`. ```dart actionsBuilder: (context, defaultActions) { return StreamContextMenuAction.partitioned( items: defaultActions.where( (a) => a.props.value is! DeleteMessage, ).toList(), ); }, ``` -------------------------------- ### Background and Selected Color: Before Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/channel_list_item.md Illustrates setting tile and selected tile colors directly on StreamChannelListTile. ```dart StreamChannelListTile( channel: channel, tileColor: Colors.white, selectedTileColor: Colors.blue.shade50, selected: isSelected, ) ``` -------------------------------- ### StreamMessageItem Before Custom Actions Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_actions.md Example of how custom actions were appended using the `customActions` parameter before the `actionsBuilder` was introduced. ```dart StreamMessageItem( message: message, messageTheme: messageTheme, customActions: [ StreamMessageAction( action: CustomMessageAction( message: message, extraData: const {'type': 'favourite'}, ), leading: const Icon(Icons.star), title: Text('Favourite'), ), ], onCustomActionTap: (CustomMessageAction action) { _favourite(action.message); }, ) ``` -------------------------------- ### Basic StreamReactionListController Usage Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/reaction_list.md Shows the basic initialization and initial load of StreamReactionListController for a given message. ```dart final controller = StreamReactionListController( client: StreamChat.of(context).client, messageId: message.id, sort: const [SortOption.desc(ReactionSortKey.createdAt)], ); await controller.doInitialLoad(); ``` -------------------------------- ### Before: Audio Waveform Theming with StreamChatThemeData Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/audio_theme.md Illustrates the previous method of configuring audio waveform themes directly within StreamChatThemeData. ```dart StreamChat( client: client, themeData: StreamChatThemeData( audioWaveformTheme: StreamAudioWaveformThemeData( waveColor: Colors.blue, playedWaveColor: Colors.blueAccent, ), ), child: ..., ) ``` -------------------------------- ### Migrating StreamChatConfigurationData: Before Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/reaction_picker.md Illustrates the old way of configuring reaction icons before the migration. ```dart StreamChat( client: client, configData: StreamChatConfigurationData( reactionIcons: [ /* type + builder per reaction */ ], ), child: MyApp(), ) ``` -------------------------------- ### Migrating to StreamChat componentBuilders (After) Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/headers_and_icons.md After the update, component builders can be passed directly to the StreamChat widget, simplifying the setup. ```dart StreamChat( client: client, componentBuilders: StreamComponentBuilders( extensions: streamChatComponentBuilders( messageItem: (context, props) => MyMessage(props: props), ), ), child: MyApp(), ) ``` -------------------------------- ### Cross-Building Configuration Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/linux/CMakeLists.txt Configures sysroot and find root paths for cross-compilation, setting modes for program, package, library, and include paths. ```cmake # Root filesystem for cross-building. if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() ``` -------------------------------- ### StreamMessageInput with old attachment validation parameters Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_composer.md Example of using the deprecated `maxAttachmentSize` and `onAttachmentLimitExceed` parameters in `StreamMessageInput` before the redesign. ```dart StreamMessageInput( maxAttachmentSize: 5 * 1024 * 1024, // 5 MB UI-side cap onAttachmentLimitExceed: (limit, error) { showSnackBar('Too many attachments ($limit max)'); }, ) ``` -------------------------------- ### Global Theme Migration: Before Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/channel_list_item.md Shows the old way of defining channel preview theme properties within StreamChatTheme. ```dart StreamChatTheme( data: StreamChatThemeData( channelPreviewTheme: StreamChannelPreviewThemeData( titleStyle: TextStyle(fontWeight: FontWeight.bold), subtitleStyle: TextStyle(color: Colors.grey), lastMessageAtStyle: TextStyle(fontSize: 12), unreadCounterColor: Colors.red, ), ), child: ..., ) ``` -------------------------------- ### Filter Default Attachment Picker Options Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/v10-migration.md Example demonstrating how to filter out default attachment picker options using `attachmentPickerOptionsBuilder`. ```dart StreamMessageComposer( attachmentPickerOptionsBuilder: (context, defaultOptions) { // Remove poll option return defaultOptions.where((option) => option.key != 'poll').toList(); }, ) ``` -------------------------------- ### Old Message List View Builder Usage Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_list.md Example of how message and parent message builders were used with the old signature. ```dart StreamMessageListView( messageBuilder: (context, details, messages, defaultWidget) { return defaultWidget.copyWith(showReactions: false); }, parentMessageBuilder: (context, parent, defaultWidget) { return defaultWidget.copyWith(showReactions: false); }, ) ``` -------------------------------- ### Showing ReactionDetailSheet Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/reaction_list.md Demonstrates how to display the ReactionDetailSheet using its static 'show' method. This method is used to present a bottom sheet for viewing and interacting with message reactions. An optional initialReactionType can be provided. ```dart final action = await ReactionDetailSheet.show( context: context, message: message, initialReactionType: 'like', // optional: pre-select a reaction type ); ``` -------------------------------- ### Migrating StreamFileAttachment: Before and After Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/attachments_and_polls.md Illustrates the migration of StreamFileAttachment, removing 'shape' and 'backgroundColor' parameters and making 'constraints' optional. ```dart StreamFileAttachment( message: message, file: attachment, shape: const RoundedRectangleBorder(...), backgroundColor: Colors.grey, constraints: BoxConstraints(...), ) ``` ```dart StreamFileAttachment( message: message, file: attachment, ) ``` -------------------------------- ### Activate Melos Package Manager Source: https://github.com/getstream/stream-chat-flutter/blob/master/CONTRIBUTING.md Activate the Melos package manager globally to manage the mono-repository. This is a prerequisite for bootstrapping the local clone. ```bash pub global activate melos ``` -------------------------------- ### Accessing Message Alignment in New Builder Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_list.md Demonstrates how to get message alignment using StreamMessageLayout within the new message builder. ```dart final currentUser = StreamChat.of(context).currentUser; final alignment = StreamMessageLayout.alignmentDirectionalOf(context); final isMyMessage = message.user?.id == currentUser?.id; ``` -------------------------------- ### After: Audio Waveform Theming with StreamTheme Extension Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/audio_theme.md Demonstrates the new approach to audio waveform theming by adding StreamTheme as a theme extension to MaterialApp. ```dart MaterialApp( theme: ThemeData( extensions: [ StreamTheme( brightness: Brightness.light, // Audio waveform theming is now part of StreamTheme's component themes. // Refer to StreamThemeData for available audio waveform properties. ), ], ), home: StreamChat(client: client, child: ...), ) ``` -------------------------------- ### Migrate StreamGroupAvatar to StreamUserAvatarGroup Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/stream_avatar.md Migrate from StreamGroupAvatar to StreamUserAvatarGroup, updating the 'members' parameter to 'users' and using StreamAvatarGroupSize for sizing. This example shows the 'After' state. ```dart GestureDetector( onTap: () => print('Tapped group'), child: StreamUserAvatarGroup( size: StreamAvatarGroupSize.lg, users: otherMembers.map((m) => m.user!), ), ) ``` -------------------------------- ### Find System-Level Dependencies with PkgConfig Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/linux/flutter/CMakeLists.txt Uses PkgConfig to find and import targets for GTK, GLIB, and GIO libraries, which are essential system-level dependencies for the Flutter Linux GTK application. ```cmake # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) ``` -------------------------------- ### Migrate StreamUserAvatar Tap and Constraints Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/stream_avatar.md Use GestureDetector for tap events and StreamAvatarSize enum for sizing. This example shows the 'After' state for StreamUserAvatar migration. ```dart GestureDetector( onTap: () => print('Tapped ${user.name}'), child: StreamUserAvatar( size: StreamAvatarSize.lg, user: user, showOnlineIndicator: false, ), ) ``` -------------------------------- ### Run Static Analysis with Melos Source: https://github.com/getstream/stream-chat-flutter/blob/master/CLAUDE.md Performs static analysis using 'dart analyze --fatal-infos' on all packages. ```bash melos run analyze ``` -------------------------------- ### Configure Profile Build Settings Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/windows/CMakeLists.txt Sets linker flags and compiler flags for the 'Profile' build type to match the 'Release' build type. This ensures performance characteristics are consistent between profile and release builds. ```cmake set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") ``` -------------------------------- ### Add Stream Chat Dependency Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat/README.md Add the stream_chat package to your pubspec.yaml file to include it in your project. Run 'dart pub get' to fetch the dependency. ```yaml dependencies: stream_chat: ^10.0.0 ``` -------------------------------- ### StreamContextMenu with Separators Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_actions.md Demonstrates the use of StreamContextMenuSeparator to visually divide actions within a StreamContextMenu. This example includes a reply action, a separator, and a destructive delete action. ```dart StreamContextMenu( children: [ StreamContextMenuAction(value: reply, label: Text('Reply')), const StreamContextMenuSeparator(), StreamContextMenuAction.destructive(value: delete, label: Text('Delete')), ], ) ``` -------------------------------- ### StreamMessageItem After Removing Action and Adding Custom Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_actions.md Example showing how to remove an existing default action (like delete) and add a custom action using `actionsBuilder`. ```dart StreamMessageItem( message: message, messageTheme: messageTheme, actionsBuilder: (context, defaultActions) => [ ...defaultActions.where((a) => a.props.value is! DeleteMessage), StreamContextMenuSeparator(), StreamContextMenuAction( leading: const Icon(Icons.star), label: Text('Favourite'), onTap: () => _favourite(message), ), ], ) ``` -------------------------------- ### Migrating StreamChatConfigurationData: After Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/reaction_picker.md Shows the new approach using reactionIconResolver for configuring reaction icons. ```dart StreamChat( client: client, configData: StreamChatConfigurationData( reactionIconResolver: const MyReactionIconResolver(), ), child: MyApp(), ) ``` -------------------------------- ### StreamMessageItem After Adding Custom Action with actionsBuilder Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_actions.md Example demonstrating how to add a custom action using `actionsBuilder` by spreading the default actions and appending a new `StreamContextMenuAction`. ```dart StreamMessageItem( message: message, messageTheme: messageTheme, actionsBuilder: (context, defaultActions) => [ ...defaultActions, StreamContextMenuAction( leading: const Icon(Icons.star), label: Text('Favourite'), onTap: () => _favourite(message), ), ], ) ``` -------------------------------- ### Set Up Flutter Tool Backend Custom Command Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_flutter/example/windows/flutter/CMakeLists.txt Configures a custom command to run the Flutter tool backend. This command is responsible for generating necessary build artifacts like the Flutter library and headers. It uses a phony output file to ensure the command runs every time. ```cmake # === Flutter tool backend === # _phony_ is a non-existent file to force this command to run every time, # since currently there's no way to get a full input/output list from the # flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" windows-x64 $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### StreamChannelHeader After Migration Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/headers_and_icons.md Example of StreamChannelHeader usage after the redesign. Parameters like leading and onChannelAvatarPressed are now used. The default leading is StreamBackButton and the default trailing is the channel avatar. ```dart StreamChannelHeader( leading: StreamBackButton(onPressed: () => GoRouter.of(context).pop()), onChannelAvatarPressed: (channel) => openChannelInfo(channel), ) ``` -------------------------------- ### Enable Unicode Support Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/windows/CMakeLists.txt Adds preprocessor definitions to enable Unicode support for all projects. This is crucial for handling international characters correctly. ```cmake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Custom Message Composer Input (After) Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/message_composer.md Example of how to customize the message composer input's text field center using the new 'messageComposerInputCenter' factory builder key. ```dart streamChatComponentBuilders( messageComposerInputCenter: (context, props) => MyCustomTextField(props: props), ) ``` -------------------------------- ### Migrate StreamChannelAvatar Tap and Constraints Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/stream_avatar.md Wrap StreamChannelAvatar with GestureDetector for tap events and use StreamAvatarGroupSize enum for sizing. This example shows the 'After' state for StreamChannelAvatar migration. ```dart GestureDetector( onTap: () => print('Tapped channel'), child: StreamChannelAvatar( size: StreamAvatarGroupSize.lg, channel: channel, ), ) ``` -------------------------------- ### Activate Melos Source: https://github.com/getstream/stream-chat-flutter/blob/master/sample_app/README.md Activate the Melos package globally. This is a prerequisite for bootstrapping the monorepo. ```bash dart pub global activate melos ``` -------------------------------- ### Subtree Theme Override: Before Source: https://github.com/getstream/stream-chat-flutter/blob/master/migrations/redesign/channel_list_item.md Demonstrates the previous method of overriding channel preview themes for a specific subtree. ```dart StreamChannelPreviewTheme( data: StreamChannelPreviewThemeData( titleStyle: TextStyle(color: Colors.blue), ), child: StreamChannelListView(...), ) ``` -------------------------------- ### Define Flutter Library and Paths Source: https://github.com/getstream/stream-chat-flutter/blob/master/packages/stream_chat_persistence/example/linux/flutter/CMakeLists.txt Defines the path to the Flutter Linux GTK shared library and the ICU data file. These paths are published to the parent scope for use in installation steps. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) ```