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
| Property | Description | Type |
|---|---|---|
child | The content of the button. | Widget |
disabled | If true, the button is disabled and doesn't respond to taps. | bool |
onPressed | Callback function when the button is tapped. | void Function()? |
onLongPress | Callback function when the button is long-pressed. | void Function()? |
disabledBackgroundColor | Background color when the button is disabled. | Color? |
backgroundColor | The normal background color of the button. | Color? |
focusedBackgroundColor | Background color when the button is focused/pressed. | Color? |
padding | Padding around the button's child. | EdgeInsets? |
borderRadius | The radius of the button's corners. | BorderRadius? |
clipBehavior | What to do with visuals outside the button's bounds. | Clip |