AiChatWidget constructor

const AiChatWidget({
  1. Key? key,
  2. required ChatUser currentUser,
  3. required ChatUser aiUser,
  4. required ChatMessagesController controller,
  5. required void onSendMessage(
    1. ChatMessage
    ),
  6. List<ChatMessage>? messages,
  7. InputOptions? inputOptions,
  8. MessageOptions? messageOptions,
  9. MessageListOptions? messageListOptions,
  10. List<ChatUser>? typingUsers,
  11. bool readOnly = false,
  12. QuickReplyOptions? quickReplyOptions,
  13. ScrollToBottomOptions? scrollToBottomOptions,
  14. ScrollController? scrollController,
  15. WelcomeMessageConfig? welcomeMessageConfig,
  16. List<ExampleQuestion> exampleQuestions = const [],
  17. bool persistentExampleQuestions = false,
  18. bool enableAnimation = true,
  19. double? maxWidth,
  20. LoadingConfig? loadingConfig,
  21. PaginationConfig? paginationConfig,
  22. EdgeInsets? padding,
  23. bool enableMarkdownStreaming = true,
  24. Duration streamingDuration = const Duration(milliseconds: 30),
  25. String aiName = 'AI',
  26. ScrollBehaviorConfig? scrollBehaviorConfig,
  27. VoiceOptions? voiceOptions,
})

Implementation

const AiChatWidget({
  super.key,
  // Required parameters similar to Dila
  required this.currentUser,
  required this.aiUser,
  required this.controller,
  required this.onSendMessage,

  // Optional parameters, similar to Dila's approach
  this.messages,
  this.inputOptions,
  this.messageOptions,
  this.messageListOptions,
  this.typingUsers,
  this.readOnly = false,
  this.quickReplyOptions,
  this.scrollToBottomOptions,
  this.scrollController,

  // Optional specific to AI functionality
  this.welcomeMessageConfig,
  this.exampleQuestions = const [],
  this.persistentExampleQuestions = false,
  this.enableAnimation = true,
  this.maxWidth,
  this.loadingConfig,
  this.paginationConfig,
  this.padding,
  this.enableMarkdownStreaming = true,
  this.streamingDuration = const Duration(milliseconds: 30),
  this.aiName = 'AI',

  // Scroll behavior configuration
  this.scrollBehaviorConfig,

  // New parameters
  this.voiceOptions,
});