ecodesk_flutter 3.1.3

SDKflutter
Platformandroidios

Native Flutter implementation of the ecodesk.io chat widget.

logo

pub package style: effective dart License GitHub issues

likes popularity pub points

Demo Chat

Try Demo
Get Ecodesk

Compatible with all platforms: Windows, Android, Linux, MacOS, and iOS

Installing

To get started simply add ecodesk_flutter: and the latest version to your pubspec.yaml. Then run flutter pub get

🎉 Done, It's that simple.

Using the widget

Integration with your app requires just a few lines of code, add the following widget wherever you want your ecodesk chat window to be:

import 'package:ecodesk_flutter/ecodesk_flutter.dart';

EcodeskWidget(
  props: EcodeskProps(
    accountId: "xxxxxxxx-xxxxxxx-xxxx-xxxxxx", //Your account id goes here.
  ),
),
    

That should get you up and running in just a few seconds ⚡️.

Configuration

Available EcodeskWidget arguments

ParameterTypeValueDefault
propsEcodeskPropsRequired. This is where all of the config for the chat is contained.N/A
dateLocaleStringLocale for the date, use the locales from the intl package."en-US"
timeagoLocaledynamicCheck timeago messages for the available classes.N/A

Available EcodeskProps parameters

PropTypeValueDefault
accountIdStringRequired. Your Ecodesk account token.N/A
baseUrlStringThe base URL of your API if you're self-hosting Ecodesk. Ensure you do not include the protocol (https) of a trailing dash (/)."app.ecodesk.io"
customerEcodeskCustomerMetadataIdentifying information for the customer, including name, email, externalId, and otherMetadata (for any custom fields).N/A
closeIconWidgetThe close button displayed in the header section.N/A
closeActionVoidCallbackThe function to handle closing the widget. If not null, close button will be shown.N/A
scrollEnabledboolWhether or not to allow scrolling.true
floatingSendMessageboolWether to have the message box floating.false
requireEmailUpfrontboolIf you want to require unidentified customers to provide their email before they can message you. Not recommended for apps.false
sendIconWidgetMessage send icon in the chat text field.N/A
onMessageBubbleTapvoid Function(EcodeskMessage)Function to handle message bubble tap action.N/A
styleEcodeskStyleClass used to customize the widget appearance.EcodeskStyle()
translationsEcodeskIntlIf you want to override the default EN translations displayed by the widget.EcodeskIntl()

Available EcodeskCustomerMetadata parameters

ParametersTypeValueDefault
emailStringThe customer's emailN/A
externalIdStringThe customer's external IDN/A
nameStringThe customer's nameN/A
otherMetadataMap<String, dynamic>Extra metadata to pass such as OS info, app version, etc.N/A

Available EcodeskStyle parameters

ParametersTypeValueDefault
primaryColorColorThe theme color of the chat widget.Ecodesk blue:
Color(0xFF1890FF)
primaryGradientGradientGradient to specify, should be used instead of primaryColor. DO NOT USE BOTH!N/A
backgroundColorColorColor used in the background of the entire widget.
Theme.of(context).canvasColor
titleStyleTextStyleThe text style of the title at the top of the chat widget.
TextStyle(
  color: textColor, // Using computeLuminance
  fontSize: 21,
  fontWeight: FontWeight.w600,
)
titleAlignTextAlignThe widget title alignment.
TextAlign.left
subtitleStyleTextStyleThe chat widget sub title text style.
TextStyle(
  color: props.style.titleStyle?.color?.withOpacity(0.8),
)
headerHeightdoubleThe chat widget header height.N/A
headerPaddingEdgeInsetsGeometryThe chat widget header padding.
EdgeInsets.only(
  top: 16,
  right: 20,
  left: 20,
  bottom: 12,
)
noConnectionIconWidgetThe widget displayed in the chat when there's no Internet connection.
Icon(
  Icons.wifi_off_rounded,
  size: 100,
  color: Colors.grey,
)
noConnectionTextStyleTextStyleThe text style of the text displayed in the chat widget when there's no Internet connection.
Theme.of(context).textTheme.headlineSmall?.copyWith(color: code.grey)
requireEmailUpfrontInputDecorationInputDecorationThe input decoration of the require email text field.
InputDecoration(
  border: UnderlineInputBorder(
    borderSide: BorderSide(
      color: Theme.of(context).dividerColor,
      width: 0.5,
      style: BorderStyle.solid,
    ),
  ),
  enabledBorder: UnderlineInputBorder(
    borderSide: BorderSide(
      color: Theme.of(context).dividerColor,
      width: 0.5,
      style: BorderStyle.solid,
    ),
  ),
  focusedBorder: UnderlineInputBorder(
    borderSide: BorderSide(
      color: Theme.of(context).dividerColor,
      width: 0.5,
      style: BorderStyle.solid,
    ),
  ),
  hintText: widget.props.translations.enterEmailPlaceholder,
  hintStyle: widget.props.style.requireEmailUpfrontInputHintStyle,
),
requireEmailUpfrontKeyboardAppearanceBrightnessThe keyboard brightness of the require email text field.
Brightness.light
requireEmailUpfrontInputHintStyleTextStyleThe text style of the require email text field hint.
TextStyle(fontSize: 14)
requireEmailUpfrontInputTextStyleTextStyleThe text style of the require email text field.N/A
floatingSendMessageBoxDecorationBoxDecorationThe box decoration of the message text field when floatingSendMessage prop is true.
BoxDecoration(
  borderRadius: BorderRadius.circular(10),
  boxShadow: [
    BoxShadow(
      blurRadius: 10,
      color: Theme.of(context).brightness == Brightness.light
          ? Colors.grey.withOpacity(0.4)
          : Colors.black.withOpacity(0.8),
    ),
  ],
)
sendMessageBoxDecorationBoxDecorationThe box decoration of the message text field.
BoxDecoration(
  color: Theme.of(context).cardColor,
  border: widget.showDivider
      ? Border(
          top: BorderSide(color: Theme.of(context).dividerColor),
        )
      : null,
  boxShadow: [
    BoxShadow(
      blurRadius: 30,
      color: Theme.of(context).shadowColor.withOpacity(0.1),
    )
  ],
)
sendMessageKeyboardAppearanceBrightnessThe keyboard brightness of the send message text field.
Brightness.light
sendMessagePlaceholderInputDecorationInputDecorationThe input decoration of the message text field.
InputDecoration(
  border: InputBorder.none,
  hintText: widget.props.translations.newMessagePlaceholder,
  hintStyle: widget.props.style.sendMessagePlaceholderTextStyle,
)
sendMessagePlaceholderTextStyleTextStyleThe text style of the message text field input hint text.
TextStyle(fontSize: 14)
sendMessageInputTextStyleTextStyleThe text style of the message text field input.N/A
botBubbleBoxDecorationBoxDecorationThe box decoration of the bot chat bubbles.
BoxDecoration(
  color: Theme.of(context).brightness == Brightness.light
    ? brighten(Theme.of(context).disabledColor, 80)
    : const Color(0xff282828,
  ),
  borderRadius: BorderRadius.circular(4),
  )
botBubbleTextStyleTextStyleThe text style of the bot chat bubbles.
TextStyle(
  color: Theme.of(context).textTheme.bodyLarge?.color,
)
botAttachmentBoxDecorationBoxDecorationThe box decoration of the bot attachment (images, files) chat bubbles.
BoxDecoration(
  borderRadius: BorderRadius.circular(5),
  color: Theme.of(context).brightness == Brightness.light
    ? brighten(Theme.of(context).disabledColor, 70)
    : Color(0xff282828,
  ),
)
botAttachmentTextStyleTextStyleThe text style of the bot attachments file name.
TextStyle(
  color: Theme.of(context).textTheme.bodyLarge?.color,
)
botBubbleUsernameTextStyleTextStyleThe text style of bot user name displayed below its chat bubbles.
TextStyle(
  color: Theme.of(context).textTheme.bodyLarge?.color?.withOpacity(0.5),
  fontSize: 14,
)
userBubbleBoxDecorationBoxDecorationThe box decoration of the user chat bubbles.
BoxDecoration(
  color: widget.props.style.primaryColor,
  gradient: widget.props.style.primaryGradient,
  borderRadius: BorderRadius.circular(4),
)
userBubbleTextStyleTextStyleThe text style of the user chat bubbles.
TextStyle(color: widget.textColor)
Depending on the luminance of the provided primaryColor, textColor can be either Colors.black or Colors.white.
userAttachmentBoxDecorationBoxDecorationThe box decoration of the user attachment (images, files) chat bubbles.
BoxDecoration(
  borderRadius: BorderRadius.circular(5),
  color: darken(widget.props.style.primaryColor!, 20),
)
userAttachmentTextStyleTextStyleThe text style of the user attachments file name.
TextStyle(color: widget.textColor)
Depending on the luminance of the provided primaryColor, textColor can be either Colors.black or Colors.white.
userBubbleSentAtTextStyleTextStyleThe text style of the "Sent x ago" (or "Sending...") text displayed below the latest user chat bubble.
TextStyle(color: Colors.grey)
chatBubbleTimeTextStyleTextStyleThe text style of the time stamp displayed (on tap) next to the any chat bubble.
TextStyle(
  color: Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(100),
  fontSize: 10,
)
chatBubbleFullDateTextStyleTextStyleThe text style of the date displayed centered in the chat before the chat bubbles of a given day.
TextStyle(color: Colors.grey)
chatUploadingAlertTextStyleTextStyleThe text style of the alert shown when an attachment is being uploaded.
Theme.of(context).textTheme.bodyMedium
chatUploadingAlertBackgroundColorColorThe background color of the alert shown when an attachment is being uploaded.
BottomAppBarTheme.of(context).color!
chatUploadErrorAlertTextStyleTextStyleThe text style of the error alert shown when an attachment failed to upload.
Theme.of(context).textTheme.bodyMedium
chatUploadErrorAlertBackgroundColorColorThe background color of the error alert shown when an attachment failed to upload.
BottomAppBarTheme.of(context).color!
chatNoConnectionAlertTextStyleTextStyleThe text style of the alert shown when the chat is displayed but no Internet connection is available.
Theme.of(context).textTheme.bodyMedium
chatNoConnectionAlertBackgroundColorColorThe background color of the alert shown when the chat is displayed but no Internet connection is available.
BottomAppBarTheme.of(context).color!
chatCopiedTextAlertTextStyleTextStyleThe text style of the alert shown when a chat bubble gets long pressed and its text copied.
Theme.of(context).textTheme.bodyMedium
chatCopiedTextAlertBackgroundColorColorThe background color of the alert shown when a chat bubble gets long pressed and its text copied.
BottomAppBarTheme.of(context).color!

Available EcodeskIntl parameters

ParametersTypeValueDefault
attachmentNamePlaceholderStringText displayed when an attachment doesn't have a file name"No Name"
attachmentUploadErrorTextStringError message displayed when an attachment could not be uploaded"Failed to upload attachment"
attachmentUploadedTextStringText displayed when an attachment has been uploaded"Attachment uploaded"
attachmentUploadingTextStringText displayed when an attachment is been uploaded"Uploading..."
companyNameStringCompany name to show on greeting"Bot"
enterEmailPlaceholderStringThis is the placeholder text in the email input section"Enter your email"
fileTextStringText displayed on the tile where the user decides to upload a file"File"
greetingStringAn optional initial message to greet your customers withN/A
historyFetchErrorTextStringError message displayed when the customer history couldn't be fetched"There was an issue retrieving your details. Please try again!"
imageTextStringText displayed on the tile where the user decides to upload an image"Image"
loadingTextStringText displayed when the chat is loading"Loading..."
newMessagePlaceholderStringThe placeholder text in the new message input"Start typing..."
noConnectionTextStringThe placeholder text in the new message input"No Connection"
retryButtonLabelStringLabel used in the retry button when the chat history couldn't be fetched"Retry"
sendingTextStringText to show while message is sending"Sending..."
sentTextStringText to show when the message is sent"Sent"
subtitleStringThe subtitle in the header of your chat widget"How can we help you?"
textCopiedTextStringText displayed when a text has been copied after long press on a chat bubble"Text copied to clipboard"
titleStringThe title in the header of your chat widget"Welcome!"
uploadedTextStringText displayed after the percentage value of an attachment being uploaded"uploaded"

Supporters

Stargazers repo roster for @ecodesk-io/ecodesk_flutter Forkers repo roster for @ecodesk-io/ecodesk_flutter