Skip to main content

Button

CometChatButton is a widget representing a button with optional icon and text. It provides customisable button styles through the buttonStyle object and handles tap events with onTap callback.

Usage

CometChatButton(
text: "Button",
buttonStyle: CometChatButtonStyle(
background: Colors.red,
),
onTap: (context) {
// Action on button tap goes here
},
);

Properties

PropertiesTypeDescription
textstringused to set the text for the button
hoverTextstringused to set the hover text for the button
iconUrlstringused to set the url for the icon
iconPackagestringused to set the package name for the icon
buttonStyleButtonStyleused to set the style for the button
onTapFunction(BuildContext)is a callback which gets called when button is clicked

Button Style

PropertiesTypeDescription
textStyleTextStylesets TextStyle for text
iconTintColorsets color for icon
iconBackgroundColorsets background color for icon
iconBorderBoxBordersets border for icon
iconBorderRadiusdoublesets border radius for icon
iconHeightdoublesets height for icon
iconWidthdoublesets width for icon
widthdoublesets width
heightdoublesets height
backgroundColorsets backGround color
borderBoxBordersets border
borderRadiusdoublesets border radius
gradientGradientsets backGround gradient
Example
ButtonStyle(
textStyle: TextStyle(),
iconTint: Colors.white,
iconBackground: Colors.white,
iconBorder: Border.all(),
iconBorderRadius: 50,
width: 100,
height: 100,
background: Colors.white,
border: Border.all(),
borderRadius: BorderRadius.circular(20),
gradient: LinearGradient(),
);