Skip to main content

Touchable Highlight

C2CTouchableHighlight is a custom Flutter widget that functions as an interactive button with a highlight effect. It's designed to change its background color upon user interactions like tap and long press. This widget is useful for creating visually responsive UI elements in your Flutter application, enhancing the overall user experience.

Example Usage

C2CTouchableHighlight(
onPressed: () {
// Action to perform on tap
},
backgroundColor: Colors.blue,
focusedBackgroundColor: Colors.blue[300],
disabledBackgroundColor: Colors.grey,
padding: EdgeInsets.all(12),
borderRadius: BorderRadius.circular(8),
child: Text('Press Me'),
)

Properties

PropertyDescriptionType
childThe content of the button.Widget
disabledIf true, the button is disabled and doesn't respond to taps.bool
onPressedCallback function when the button is tapped.void Function()?
onLongPressCallback function when the button is long-pressed.void Function()?
disabledBackgroundColorBackground color when the button is disabled.Color?
backgroundColorThe normal background color of the button.Color?
focusedBackgroundColorBackground color when the button is focused/pressed.Color?
paddingPadding around the button's child.EdgeInsets?
borderRadiusThe radius of the button's corners.BorderRadius?
clipBehaviorWhat to do with visuals outside the button's bounds.Clip